179 points

To be fair, assembly lines of code are fairly short.

/ducks

permalink
report
reply
43 points

Back in the day we wrote everything in asm

permalink
report
parent
reply
51 points

Writing in ASM is not too bad provided that there’s no operating system getting in the way. If you’re on some old 8-bit microcomputer where you’re free to read directly from the input buffers and write directly to the screen framebuffer, or if you’re doing embedded where it’s all memory-mapped IO anyway, then great. Very easy, makes a lot of sense. For games, that era basically ended with DOS, and VGA-compatible cards that you could just write bits to and have them appear on screen.

Now, you have to display things on the screen by telling the graphics driver to do it, and so a lot of your assembly is just going to be arranging all of your data according to your platform’s C calling convention and then making syscalls, plus other tedious-but-essential requirements like making sure the stack is aligned whenever you make a jump. You might as well write macros to do that since you’ll be doing it a lot, and if you’ve written macros to do it then you might as well be using C instead, since most of C’s keywords and syntax map very closely to the ASM that would be generated by macros.

A shame - you do learn a lot by having to tell the computer exactly what you want it to do - but I couldn’t recommend it for any non-trivial task any more. Maybe a wee bit of assembly here-and-there when you’ve some very specific data alignment or timing-sensitive requirement.

permalink
report
parent
reply
20 points

I like ASM because it can be delightfully simple, but it’s just not very productive especially in light of today’s tooling. In practice, I use it only when nothing else will do, such as for operating system task schedulers or hardware control. It’s nice to have the opportunity every once in a while to work on an embedded system with no OS but not something I get the chance to do very often.

On one large ASM project I worked (an RTOS) it’s exactly as you described. You end up developing your own version of everything a C compiler could have done for you for free.

permalink
report
parent
reply
10 points

Pssh, if you haven’t coded on punch cards, you aren’t a real coder

permalink
report
parent
reply
169 points

Roller coaster Tycoon is one of a lifetime game.

Now everything is electron or react shit. Gone are the times of downloading fully featured software under 10mb.

permalink
report
reply
64 points

Fun quote from an interview with Chris Sawyer:

Latterly the machine code came back to haunt us when the decision was made to re-launch the original game on mobile platforms as RollerCoaster Tycoon Classic a few years ago, and it took several years and a small team of programmers to re-write the entire game in C++. It actually took a lot longer to re-write the game in C++ than it took me to write the original machine code version 20 years earlier.

permalink
report
parent
reply
16 points

Further proof C++ is a pita

permalink
report
parent
reply
16 points

It’s probably not because it’s sucks. It’s because they’re trying to perfectly replicate an existing target. They have to read the assembly, digest it, then create the identical solution in C++. If they were just creating a new game, it likely would be much faster.

permalink
report
parent
reply
7 points
*

#include <iostream> // because writing to the console is not included by default.
int main()
{
std::cout << "C++ is simple and fun ... you cretin\n";
return 0;
}

I had a machine language course in uni, parallel with a C++ course. Not a fun semester to be my wife, or a relative of any of my classmates. Best case our brains were in C++ mode, worst case you needed an assembler to understand us.

And yes I know my code format will piss people off, I don’t care, it’s the way I write when other less informed people don’t force me to conform to their BS “Teh oPeNiNg bracket shouwd bwee on teh sam line ass teh declawation

Edit: added a \n for the sake of pedantry :)

permalink
report
parent
reply
7 points

Well worth it. The mobile version is amazing, that is to say, almost exactly the same as the original.

permalink
report
parent
reply
8 points

I guess i just found out there’s a mobile version.

permalink
report
parent
reply
6 points
*

Is there not a way to take assembly and automatically translate it to some higher level language?

Edit: Post-post thought: I guess that would basically be one step removed from decompilation which, as I understand it, is a tedious and still fairly manual process.

permalink
report
parent
reply
7 points

Your thought is correct. The basic problem is that higher level languages contain a lot of additional information that is lost in the compilation process.

permalink
report
parent
reply
29 points
*

I don’t think old=good is a good mentality though, lot of people seem to have it

All the old software I know and use is exceptionally good, however I’ve heard about and chosen to use it because it’s survived the test of time (also because it’s still actively maintained and has had thousands of bug fixes over the years)

Vscode and obsidian are pretty good and they’re electron, discord’s alright, pretty sure steam uses some kind of web wrapper as well.

Real issue is electron is very accessible to inexperienced developers and easy to do badly, but I imagine people back in the old Unix days got an equal amount of shit bloated software

permalink
report
parent
reply
20 points

Survivor bias is a thing and part of the reason people are nostalgic for old media.

permalink
report
parent
reply
8 points
*

For every There Will Be Blood, there exists an Alien vs Predator: Requiem

permalink
report
parent
reply
15 points

People only remember the good stuff. They don’t usually think about all the software that sucked.

permalink
report
parent
reply
12 points

Discord is garbage software lmao. Has been from the beginning. I can’t stand using it.

permalink
report
parent
reply
6 points

And I had to stop using vscode because of its ridiculous resource usage. I got tired of it filling up my home dir and just went back to vim.

An intern was using it, but I saw that he had set it up to run locally and connect to the ETX we were using and figured he had found a way to avoid that. Nope, turns out it runs a server on the ETX that also likes to fill up the home dir and he also just uses vim now.

permalink
report
parent
reply
3 points

Seconded. The only reason I have it installed is because my buddy refuses to answer his cell while we play games.

permalink
report
parent
reply
2 points

I’m not saying it’s phenomenal but it’s generally pretty well featured, running in a browser it’s not that heavy resource wise and the API/developer features are very good

permalink
report
parent
reply
6 points

A fucking calculator needs megabytes to run? And I’m not talking about a full fledged graphic scientific calculator. I’m talking about a basic one.

permalink
report
parent
reply
4 points
*

Gnome calculator uses 103m, it’s loading style sheets for themes, UI libraries that make it look nice and modern, scientific calculator features, keyboard shortcuts, nice graphical settings menu, touch screen and screen reader support etc

I don’t think in this day and age for all the niceties people are used to that’s unreasonable.

Also other calculators are available, some are bloated but I’m sure there’s a rust or C one out there somewhere that uses a fraction of that with the bare minimum feature set

permalink
report
parent
reply
3 points
*

Old=good is a great mentality specifically when standing the test of time is an important factor. For the most part, the old code that’s still used today is only still used because it’s proven good, whereas it’s a grab bag with newer code. And that’s the cause of the unwarranted nostalgia thay you’re rightfully criticising.

It’s like with music. “Oh, the X’s were the best decade for music, today’s music is garbage”. No, 90% of everything is crud but unless you’re an enthusiast, once enough time has passed, you’ll only ever be exposed to the 10% that isn’t. 50 years from now nobody is going to be listening to Cardi B.

permalink
report
parent
reply
1 point

I listen to music on a new music radio station - the good new music really stands out

Most people just like the (better bits of) stuff they listened to when they were young

permalink
report
parent
reply
1 point

If you want to get a glimpse of the hate against Unix in the early 90’s, give “Unix hater’s handbook” a read. It’s a funny piece

permalink
report
parent
reply
26 points

But the modern OpenRCT, written in an actual language, is better in every way.

permalink
report
parent
reply
43 points

Probably not as optimized though.

RCT could run on a toaster from the 90’s (ok, maybe early 2000’s) and looked amazing for the time.

OpenRCT can run on a toaster from the 2010’s and looks great because of the timeless art style of the original.

It’s still an incredible feat, though!

permalink
report
parent
reply
22 points

You are very unlikely to write assembly that is more optimized than what a modern compiler could produce for anything longer than a trivial program. I don’t know if it made sense at the time of the original RCT, but OpenRCT would definitely not benefit from being written in assembly.

permalink
report
parent
reply
3 points

or even opening a website that uses less than 10mb on initial load

permalink
report
parent
reply
155 points

I don’t know if everyone gets the reference: RollerCoaster Tycoon is in fact writing mostly in assembly to use the hardware more efficiently

permalink
report
reply
59 points
*
Deleted by creator
permalink
report
parent
reply
53 points
*

Writing it in assembly would make it pretty much the opposite of portable (not accounting for emulation), since you are directly giving instructions to a specific hardware and OS.

permalink
report
parent
reply
-8 points
Deleted by creator
permalink
report
parent
reply
19 points

Started playing openrct2 multiplayer with a friend yesterday. Some of the best fun I’ve had.

permalink
report
parent
reply
13 points

Damn this post. This is really going to f up my weekend plans.

permalink
report
parent
reply
6 points

My friend and I created MONORAIL LAND

permalink
report
parent
reply
8 points
*

OpenRCT2 ditched assembly tho. They wrote it entirely in C++.

permalink
report
parent
reply
1 point

Sorry, two separate thoughts. Wasn’t saying open RCT used assembly just wanting to shout out the project.

permalink
report
parent
reply
145 points
  • Programming was never meant to be abstract so far from the hardware.
  • 640k is enough ram for everybody.
  • The come with names like rust, typescript, go, and python. Names thought up by imbeciles.
  • Dev environments, environmental variables, build and make scripts, and macros, from the minds of the utter deranged.

They have played us for fools

permalink
report
reply
16 points

I dabbled with making a fairly complex program for a microcontroller the other day and quickly hit the stack limit for a simple object.

It wasn’t so much that it was a large object, but to provide flexibility I was amazed how fast I filled the memory.

I’ve done heaps with memory managed languages in the past but shit as soon as I had to think about what I was doing under the hood everything got hard af.

So serious question - does anyone have any good resources for a competent programmer, but with no clue whatsoever how to manage memory in a microcontroller space and avoid fragmentation etc?

I got it to work but I’m sure I did shit job and want to be better at it.

permalink
report
parent
reply
8 points

The best book I’ve ever bought on programming, and the second best book I bought for a class in uni, was https://dl.acm.org/doi/book/10.5555/1824214 it may be worth checking out on libgen and buy if it suits your needs.

Whenever I do low-level programming on the AVR architecture, I’ll make a memory map. As in I’ll map out where I’ll put what. It may not be suitable for more complex programs, but it does the job for me. And it has enabled teamwork in assembly in the past.

If you want to work in a language that doesn’t offer memory management, but manually mapping memory isn’t feasible either, how about building your own memory management? Or perhaps use an RTOS? I’ve used freeRTOS before on various arm-based micros, and it does take a bit to get started, but after that it’s easy sailing.

Sorry for the following tangent, all semi intelligent content in this comment is found above this line.
BTW I tried CoOS once, I wouldn’t recommend it… OK it was 12 years ago, I can’t remember exactly what was wrong other than the documentation was crap, but I don’t need to remember why to hold a grudge.

permalink
report
parent
reply
1 point

Bought the book! Thanks

permalink
report
parent
reply
1 point

Adobe promised that Lingo was the future of ‘PC and internet gaming’

Luckily by the time I had to learn to write that garbage I already coded in several other languages. Made it easier, but somehow more painful. I’m pretty sure that shit was designed so that executives could look at the code and pretend they understood what was going on. At least with ‘common terms’ it eliminated the need for commenting out most of the time. One line of code would take a paragraph of text lol.

permalink
report
parent
reply
136 points

Your game will actually likely be more efficient if written in C. The gcc compiler has become ridiculously optimized and probably knows more tricks than you do.

permalink
report
reply
46 points

Especially these days. Current-gen x86 architecture has all kinds of insane optimizations and special instruction sets that the Pentium I never had (e.g. SSE). You really do need a higher-level compiler at your back to make the most of it these days. And even then, there are cases where you have to resort to inline ASM or processor-specific intrinsics to optimize to the level that Roller Coaster Tycoon is/was. (original system specs)

permalink
report
parent
reply
2 points

I might be wrong, but doesn’t SSE require you to explicitly use it in C/C++? Laying out your data as arrays and specifically calling the SIMD operations on them?

permalink
report
parent
reply
5 points

There’s absolutely nothing you can do in C that you can’t also do in assembly. Because assembly is just the bunch of bits that the compiler generates.

That said, you’d have to be insane to write a game featuring SIMD instructions these days in assembly.

permalink
report
parent
reply
1 point

Honestly, I’m not 100% sure. I would bet that a modern compiler would just “do the right thing” but I’ve never written code in such a high performance fashion before.

permalink
report
parent
reply
21 points

Yep but not if you write sloppy C code. Gotta keep those nuts and bolts tight!

permalink
report
parent
reply
30 points

If you’re writing sloppy C code your assembly code probably won’t work either

permalink
report
parent
reply

Except everyone writing C is writing sloppy C. It’s like driving a car, there’s always a non-zero chance of an accident.

Even worse, in C the compiler is just waiting for you to trip up so it can do something weird. Think the risk of UB is overblown? I found this article from Raymond Chen enlightening: https://devblogs.microsoft.com/oldnewthing/20140627-00/?p=633

permalink
report
parent
reply
-4 points
Deleted by creator
permalink
report
parent
reply

RetroGaming

!retrogaming@lemmy.world

Create post

Vintage gaming community.

Rules:

  1. Be kind.
  2. No spam or soliciting for money.
  3. No racism or other bigotry allowed.
  4. Obviously nothing illegal.

If you see these please report them.

Community stats

  • 3.4K

    Monthly active users

  • 1.1K

    Posts

  • 8.8K

    Comments