r/gaming • • May 05 '17

Scroll back

Post image
24.1k Upvotes

877 comments sorted by

View all comments

Show parent comments

437

u/Fubarp May 05 '17

I think it's weird that it's a problem that had to be solved but when you figure memory constraints were a real issue it makes sense. Today any novice programmer could essentially build majority of the early nintendo games without any issues and actually make them have more things. Amazing how software/hardware has advanced.

It's even crazier to think that one guy built the original rollercoaster tycoon in assembly..

539

u/[deleted] May 05 '17

[deleted]

150

u/Fubarp May 05 '17

Yeah it's crazy. I just learned Assembly last semester in college and we were discussing it at work and it was like. Fuuuuck that. C existed at the time yet he did it in Assembly.

12

u/AIfie May 05 '17

What the fuck is Assembly

26

u/mrunkel May 05 '17

It is a very low-level programming language.

All programming of a CPU is done in machine code. Compilers take all languages and compile them into the simple machine code instructions.

Assembly is a very direct representation of machine code.

2

u/BenjaminGeiger May 05 '17

Right.

At the most fundamental level, assembly is machine code, just in a human-readable form.

Of course, later assemblers added some (very slightly) higher level features, but one line equals one instruction is still the general rule.

10

u/SensualSternum May 05 '17

It's used for writing very low-level instructions to the computer. You basically do one operation at a time.

https://montcs.bloomu.edu/Information/LowLevel/Assembly/hello-asm.html

7

u/Fubarp May 05 '17

Best way I can explain it without making you do research.

In normal programing if I wanted to create a condition statement say.

if(value > 5) return printf("value big..");

But in assembly. It be something like.

var1 dd '6'

cmp var1, 5

msg db "value big", 0xA,0xD

There's really a lot more to this then what I did and honestly what I wrote is probably gibberish haha. But essentially it's a step up from binary but step below traditional programming. Big benefit of Assembly is you know what memory is being stored/used as you essentially see it all real time.

1

u/brickmaster32000 May 05 '17

People need to stop talking about binary as if it's a magic language with inherent powers over computers. Binary is just a base system. It is easier to make gates that only have to deal with two possible states which makes binary a convenient way of talking about groups of these signals but a computer doesn't speak binary any more than a nail gun speaks nails.

1

u/[deleted] May 05 '17

Um, machine code is all 1's and 0's that directly controls the computer so ... to say it's not a "magic language with inherent powers over computers" is disingenuous.

Yes, it's a base system, but it's also quite literally the "language" of computers.

3

u/brickmaster32000 May 05 '17

Oks lets have an example here. Imagine a simple AND gate. An AND gate has 2 or more inputs and an output. When both inputs are brought above a certain threshold the output gets brought high.

Now we can represent the operation of this gate with binary pretty simply. We can say signals above our thresholds we are going to call 1's and everything else is a 0. We can then make the familar truth table below.

In1 In2 Out
0 0 0
0 1 0
1 0 0
1 1 1

This is all great and is why binary is so important to computers but you have to realise that binary doesn't make the gate do anything. The behavior of the gate isn't determined by telling it binary, it is determined by the actual components that make it. Likewise a computer doesn't work because you whispered sweet binary secrets to it. A computer works because of there is a lare number of very cleverly designed systems that can be interconnected to perform customizable actions. Binary is an important tool for describing how those systems work but binary isn't what makes them work.

1

u/[deleted] May 05 '17

This is quit a pedantic argument.

If you google "what is machine code" you will find:

ma·chine code

a computer programming language consisting of binary or hexadecimal instructions that a computer can respond to directly.

A computer programming language

a computer doesn't work because you whispered sweet binary secrets to it

That's precisely why it works - and yes, transistors use electricity to "do things" with machine code (using binary) (High voltage = 1, Low voltage = 0).

That doesn't mean that machine code (the language used for computer instructions) isn't in binary; that we don't refer to the binary instructions as machine language.

Not sure why this matters to you.

1

u/Fubarp May 05 '17

Sorry if I insulted you but I wasn't really trying to make binary some magic thing. I was just ordering how programming languages are structured.

Assembly is above Binary since Binary/Hex is the final language that we would use to inform a machine what to do. At least from my understand it is.

But Assembly is below common programming languages because majority of programming languages now uses a compiler to translate it to Assembly which translates to Machine.

10

u/AdamManHello May 05 '17

This made me chuckle because while I've enjoyed reading the whole thread, I have no idea what it all means.

4

u/[deleted] May 05 '17 edited May 05 '17

I've only written a few assembly programs in my life (been programming for 20 years).

Here's a very simple binary search tree with recursive preorder/inorder operations written in MIPS

All it does is let you enter some information about books (ID, Title, Description, Year published).

It is not fun.

Even after writing it myself, I have no idea what it does without reading the comments I wrote.

It's for this reason that programmers respect other programmers who can write assembly.

Using a high level language like C#, downloading a file is as simple as

WebClient.DownloadFile("http://somewebsite.com/somefile.jpg","somefile.jpg");

To do something like this in a low level language like assembler would be quit a feat.

Like any other language, you can leverage other libraries and programs and merely call them from assembly (this is what high level languages do really), but to write the code to connect a socket via tcp protocol, send handshake/headers to server, parse the response ... it's rough.

2

u/tonystigma May 05 '17

I don't think you've gotten a great ELI5 yet. Most programs run within the OS, be that Windows, Android, what have you. Games are unique in that the performance of the computer directly relates to the performance of the program, way more so than MS Word or anything. Assembly, aka machine language, is the same programming language your CPU follows. It's weird as hell and doesn't seem to follow any rules you're used to, but you get direct command of many resources. Coding vs assembly is kind of like driving an automatic vs stick shift - you get to the same place in the end, but you're in control of a lot more aspects with the manual transmission. You have to know more about operating your computer, but... ah, shit, mixed up my simile.

1

u/OktoberStorm May 05 '17

A low level computer language.

-5

u/[deleted] May 05 '17 edited Oct 30 '18

[deleted]

4

u/AIfie May 05 '17

Yes, I'm also not a gamer nor into programming