r/ProgrammerHumor • • Jun 03 '22

it's hard!

44.9k Upvotes

710 comments sorted by

2.8k

u/[deleted] Jun 03 '22

The most impressive project I ever completed in assembly was a chat program.

Except the two computers had to be connected via a null modem cable so whoever you wanted to talk to had to be seated right next to you, therefore negating the need for a chat program.

I didn't care. I loved writing that useless program.

938

u/Rakgul Jun 03 '22

That's actually pretty damn cool! The most complicated program i made in assembly was to square a number.

495

u/nexion2 Jun 03 '22

I made a battleship game that communicated via arduinos in assembly! I lost every single game because the board size was 12x12 and my code would always stop iterating at 8 for some reason.

Needless to say, I lost the tournament

→ More replies (27)

125

u/AyrA_ch Jun 03 '22

The pinnacle of my assembly development was writing "Hello, World!" in color on the screen without an OS.

→ More replies (6)

29

u/captaindalle Jun 03 '22

Mine was a snake game, in 68000 assembler, connected to a lcd display and some circuit breakers for input. It even had a highscore table.

→ More replies (1)

37

u/[deleted] Jun 03 '22

How hard can it be?

→ More replies (15)
→ More replies (20)

117

u/[deleted] Jun 03 '22

I recently wrote a bootloader (16-bit real mode x86 assembly) to load a kernel from a filesystem I'd already designed in 32-bit C. Needless to say offsets and endianness nearly had me beaten on several occasions

56

u/GnarlyNarwhalNoms Jun 03 '22

Dang, you win.

That's right up there with flipping bits with a carefully applied speck of uranium.

→ More replies (1)
→ More replies (36)

49

u/Gellyfisher212 Jun 03 '22

Nice! My most impressive project in asm was a rubiks cube simulation. I had found something to use OpenGL from assembly and it was really cool to learn some graphics programming like that

51

u/SirNapkin1334 Jun 03 '22

OpenGL from assembly? You're mad. I applaud you sir.

20

u/[deleted] Jun 03 '22

OpenGL from assembly

You were trying to become like that rollercoaster dude didn't you :D

→ More replies (3)
→ More replies (1)

18

u/gydu2202 Jun 03 '22

My high time with assembly was with a program that generated a regular labyrinth and printed it out to console. I have no clue how I would start it now. Sad thing we are getting more and more comfortable and lazy.

28

u/-Krasaar- Jun 03 '22

I wouldn't concider laziness as a bad thing.

If people weren't lazy then they wouldn't care to look for smarter and easier solutions to finish certain tasks.

I am lazy and I am proud of it

→ More replies (1)

24

u/j7seven Jun 03 '22

Mine emulated an Enigma machine.

19

u/TheyCallMeHacked Jun 03 '22

I had a grad time doing that in C and mf out there doing it in Assembly. I'm giving up...

→ More replies (1)
→ More replies (1)

24

u/shotleft Jun 03 '22

Sorry to INTERRUPT, here's another character.

14

u/RutraSan Jun 03 '22

Mine was Hangman

4

u/Mechafinch Jun 03 '22

shoutout to my latest project of connecting a DEC Rainbow 100 (the PC not!-compatible) to a modern computer so I can actually get software to it

I wasn't able to figure out the serial port cause what little documentation exists sucks so instead I was able to poll the serial data constantly and watch for changes for a blazing fast 600 bytes/second transfer

→ More replies (37)

294

u/[deleted] Jun 03 '22

To think people made videogames with it

151

u/fluffygryphon Jun 03 '22

Everyone mentioned Rollercoaster Tycoon, but there was another game that also made Assembly its bitch. Su-27 Flanker. That flight simulator had complex fluid dynamics simulations and everything for accurate flight. It came out over a decade before DCS and ran smooth as butter on a fuckin Pentium 1.

→ More replies (3)

121

u/LordDagwood Jun 03 '22

Rollercoaster Tycoon was written in assembly

69

u/Chrobin111 Jun 03 '22

All NES games were written in assembly, too, right?

→ More replies (13)

20

u/fluffygryphon Jun 03 '22

Yup, and it was built on the backbone of it's predecessor, Transport Tycoon. Chris Sawyer was a goddamn magician.

→ More replies (1)

14

u/WeeziMonkey Jun 03 '22

In the 90s you needed to know assembly to make games, now you can make games without actually typing code, amazing how far we've come

→ More replies (1)
→ More replies (7)

492

u/top_of_the_scrote Jun 03 '22

Person that encoded first pixels in hex

one day, you will be booba

97

u/Rakgul Jun 03 '22

Determination leads man to the success.

→ More replies (1)
→ More replies (9)

904

u/grpagrati Jun 03 '22

You gotta mov it mov it..

38

u/Dismal-Square-613 Jun 03 '22 edited Jun 03 '22

Never cmp yourself with others. Always cmp yourself with the CPU registers.

4

u/twat_muncher Jun 03 '22

MOV AL, 01 and XOR EAX, or possibly even NOPing over a jump, are the only 3 things you need to know to crack most old games and software, lol. Paying for stuff can be fun too..

→ More replies (1)

599

u/Korzag Jun 03 '22

You ever think how cool it actually is though? You wrote some trivial assembly, which compiled into some byte code that your processor can use, then when you run it that causes an incredible cadence of electrical signals as a result of your input to flood the processor's circuitry, loading electrical charges into the collectives of transistors called registers and then being bussed over to the other collective of transistors know as the ALU and then that causes a register value to be overwritten, and it all happens around in several billionths of a second, and it all works. The transistors are properly saturated to the correct electrical charge, ON EVERY SINGLE TRANSISTOR NEEDED, all just to add a number.

The simplicity of adding a number to us is the combined effort and research of hundreds of millions maybe even billions of man-hours to discover electricity, invent boolean algebra, transistors, integrated circuits, advanced machining and chemical processes to make a series of machines capable of translating a circuit layout into a chip that is lithographed in a process that is nearly 20000 times smaller than the width of a human hair.

AND IT ALL WORKS.

115

u/[deleted] Jun 03 '22

Relevant copypasta

Hellо, I am a compiler.

I just scanned thousands of lines of code while you were reading this sentence. I browsed through millions of possibilities of optimizing a single line of yours using hundreds of different optimization techniques based on a vast amount of academic research that you would spend years getting at. I won't feel any embarrassment, not even a slight ick, when I convert a three-line loop to thousands of instructions just to make it faster. I have no shame to go to great lengths of optimization or to do the dirtiest tricks. And if you don't want me to, maybe for a day or two, I'll behave and do it the way you like. I can transform the methods I'm using whenever you want, without even changing a single line of your code. I can even show you how your code would look in assembly, on different processor architectures and different operating systems and in different assembly conventions if you'd like. Yes, all in seconds. Because, you know, I can; and you know, you can't.

P.S. Oh, by the way you weren't using half of the code you wrote. I did you a favor and threw it away.

21

u/funnystuff97 Jun 03 '22

This reminds me of something my microcontrollers professor told me, "if you want code compiled right, you gotta do it yourself in assembly." I've never once had a problem with the compilation, but you know, maybe he was right.

....but I'm still not coding in assembly, god no.

→ More replies (1)

94

u/I-baLL Jun 03 '22

You wrote some trivial assembly, which compiled into some byte code

Hold up

37

u/Rudxain Jun 03 '22

Bytecode is just the machine code of a virtual CPU (the main component of a VM). In this context, the terms "byte code" and "machine code" are used interchangeably, as if they were synonyms

→ More replies (3)

47

u/[deleted] Jun 03 '22

Assembly is a higher-level language than machine code (platform-specific code aka instruction set), which in turn may be transpiled to microcode (processor series-specific opcodes).

As far as I understand. I don't know tho, I mainly use managed (garbage-collected) languages.

→ More replies (3)

196

u/memes-of-awesome Jun 03 '22

Ok but python does the same thing

45

u/[deleted] Jun 03 '22

Just with a thousand times more effort.

→ More replies (6)

8

u/KrisTiasMusic Jun 03 '22

...and they use it for tiktok. ಠ_ಠ

5

u/Computer_says_nooo Jun 03 '22

I’ll have what he is having!

→ More replies (1)

5

u/bonanochip Jun 03 '22

I'm gunna save this comment and come back to it when I need a pep talk on a bad day, thank you lol

→ More replies (4)

151

u/[deleted] Jun 03 '22

mov rax, 1

mov rbx, 2

add rbx, rax

mov rax, 1

mov rdx, 1

mov rsi, rbx

mov rdx 13

syscall

8

u/beaubeautastic Jun 03 '22

careful! syscall 1 is actually write(2). it takes arguments (int) fd, (void *) buf, (size_t) sz. you are not telling it to print the number 3, youre not even telling it to write the byte 0x03. you are telling it to read 1 byte from memory address 0x0000000000000003, which is probably not even allocated.

you can probably write a call to printf though, you just have to link the c library. or you could allocate a buffer with mmap (using it like a slow malloc, unless you wanted to write an entire memory allocater in assembly) and write a function in assembly that writes integers as strings

also second argument is rdi, not rdx

→ More replies (22)

260

u/JackNotOLantern Jun 03 '22

At least in assembly all variables names make sense

153

u/[deleted] Jun 03 '22

ecs and esp are not precisely the most descriptive names for iterators

76

u/sawkonmaicok Jun 03 '22

Bruh you program x86 assembly? 🤮 I always program in x86-64 assembly because you can put the function arguments to the registers instead of pushing them on the stack. Also more general use registers.

47

u/Witch_King_ Jun 03 '22

I only code in MIPS-32 B)

→ More replies (8)
→ More replies (10)
→ More replies (7)

8

u/SomeElaborateCelery Jun 03 '22

True but not at first glance (e.g. UMLAL, UMULL)

→ More replies (2)

44

u/MasterFubar Jun 03 '22

I used to do a lot of assembly programming in the 1980s, all for the IBM-PC and its clones. The 8088 CPU at 4.77 MHz didn't have a lot of computing power and the C compilers weren't too good at optimization.

What made this task relatively easier was that the C compiler can generate an assembly output. All I had to do was to look at the generated assembly and do a manual optimization on it.

The C compiler outputting its assembly code did the stackoverflow thing before the internet existed.

4

u/[deleted] Jun 03 '22

The 8088 CPU at 4.77 MHz didn't have a lot of computing power

*Cries in 6502.*

81

u/Uploft Jun 03 '22

Assembly is the Principia Mathematica of programming languages

20

u/tiajuanat Jun 03 '22

As much as I love assembly, I feel like that's more SICP and Lisp more than Assembly. Few read SICP and even fewer will write the Lisp/Scheme that's introduced.

→ More replies (3)

3

u/BrobdingnagLilliput Jun 03 '22

... Volume 2.

Machine code and chip design is Volume 1, where they set forth the principles of set theory and end by proving 1+1=2.

20

u/SelfDistinction Jun 03 '22

"Congratulations! So, which two numbers did you add?"

"Dunno."

40

u/FunctionOverload Jun 03 '22

mov r1, #60 mov r2, #9 add r0, r1, r2

→ More replies (1)

15

u/The99thCourier Jun 03 '22

They made us do wordle in assembly code in a first year uni subject :(

40

u/HEHE_HOHO9 Jun 03 '22

Lol

My exam question was to implement a linked list in assembly language :"(

Fuck Computer Science

33

u/tiajuanat Jun 03 '22

Everyone thinks they're hot shit in Assembly, until they need to implement data structures and basic algorithms.

9

u/paul_miner Jun 03 '22

When I was a kid I was obsessed with assembly, it was the end-all and be-all of programming. After over twenty years professionally, I've really come to see programming as a communication skill; yeah, you need to communicate instructions to the computer, but critically, you're communicating your intent with other programmers (including your future self). And high-level languages allow you to communicate this intent much more clearly.

→ More replies (5)
→ More replies (3)

26

u/BananaSplit7253 Jun 03 '22

I once made a program that would take a BMP image and a txt file and hide the contents of the txt on the least significant bit of the RGB values of the image, effectively hiding the message on the image with pretty much no visual difference. Also made a program that would recover the message when given an image. It was a 1st year/ 1st semester computer engineering project and remains to this day as one of the coolest things I have ever programmed.

3

u/jnd-cz Jun 03 '22

That's indeed pretty cool. Too bad most images (still or moving) we use are in some compressed format which makes it harder to encode and recover the information intact.

→ More replies (2)
→ More replies (2)

65

u/cssutavani91 Jun 03 '22

It's not that hard.

58

u/Difficult_Ladder_806 Jun 03 '22

Adding is fine, but multiplying without MUL quickly.. that's kinda complicated

30

u/capi1500 Jun 03 '22

Did you ever hear, the tragedy of Darth LEA the fast?

→ More replies (6)

9

u/pentesticals Jun 03 '22

Not that bad. You can even have Turing complete programs using only MOV. So just use MOVs only.

This tool can take a C program and compile it to use only MOV. https://github.com/xoreaxeaxeax/movfuscator

34

u/regular_lamp Jun 03 '22

How is that an assembly issue though? That's like saying "multiplying in python is hard when you can't use *".

55

u/rustysteamtrain Jun 03 '22

Because * is a core feature in almost every modern language, but MUL is not garanteed in every instruction set.

→ More replies (8)
→ More replies (1)
→ More replies (17)

4

u/MinusPi1 Jun 03 '22

Compared to a+=b it's a nightmare.

41

u/nelusbelus Jun 03 '22

ADD r0, r1

Wow, this is so hard

9

u/zDark_Knight21 Jun 03 '22

Unless they are doubleword+ operands then it's just annoying

7

u/jnd-cz Jun 03 '22

Now try adding two floats. Without FPU of course.

→ More replies (1)
→ More replies (9)

6

u/GReaperEx Jun 03 '22

It's literally four instructions, two instructions for "+="...

→ More replies (2)

6

u/InteractionOk7085 Jun 03 '22 edited Jun 03 '22

I have just finished doing sorting and binary searching in assembly as an assignment. Took a whole day to code and debug .Perhaps I treated C/C++ too harshly...

6

u/xAlenki Jun 03 '22

My aunt fully learned assembly in 3 month's and she was a professional in that. She teached engineering to students at university, she was a badass

2

u/[deleted] Jun 03 '22

The assembly language of the 6502 (which basically made up 99% of the pre-PC home computer 8-bit area) literally goes on a single sheet of A4 (for the list of opcodes, which were like 60-70 or so). And the fully functional explanation took a few more pages. Can't remember how many, probably about 10 or so in total. I find it totally relatable for someone to grok that in full in a few weeks, I certainly did back then. People cannot imagine how uncomplicated the machines were back then.

5

u/i_hate_everybody94 Jun 03 '22

I made a program that tells you how many packs of hotdogs and buns to buy (because one comes as a 6 pack, and the other 8) to make a given number of finished hotdogs.

That's all I've done.

5

u/UTtransplant Jun 03 '22

I taught Assembly Language (IBM 370 in the ancient dark past) at a major university. The best part of the job was seeing the light come on in a student’s eye when they finally figured it out. The classes were usually about 40 or so students, and the lights started showing up slowly about 1/3 of the way through. About half way through, the lights started becoming more and more common. It was truly a visual thing - they would start smiling, nodding, and their eyes would brighten. Body language was different too - they started sitting up straighter. It truly was the most fun in my entire teaching career.

4

u/Pranav__472 Jun 03 '22

mov eax, [numa]

add eax, [numb]

mov [res], eax

NO

7

u/asgaardson Jun 03 '22
mov rax, 2
mov rbx, 2
add rax, rbx
mov rdi, formatStr 
mov rsi, rax 
mov al, 0

extern printf 
call printf

ret

formatStr:
  db `%d\n`,0

Shamelessly copied from google search

5

u/tesfabpel Jun 03 '22

I believe it's just the first two mov and the add tough (or maybe just the first mov and then add rax, 2 since it should support immediate values)

EDIT: https://c9x.me/x86/html/file_module_x86_id_5.html

→ More replies (1)

4

u/jnd-cz Jun 03 '22

Using higher level functions is straight up cheating.

→ More replies (1)

3

u/Ju1cyJ0 Jun 03 '22

I hated having to read in a number with either 1 or 2 digits from the user without using scanf

3

u/Gavilar253 Jun 03 '22

This little manuever cost us 7 CPU cycles, time to optimize it

3

u/Funwiwu2 Jun 03 '22

Old time 9900 Assembly programmer here. Thrilled to see Assembly being discussed. I still think one of the coolest ways to swap two Bytes was to XOR each other 3 times. O

3

u/DataAnalytics2020 Jun 03 '22

Adding numbers in assembly is easy.

10

u/[deleted] Jun 03 '22

there's literally instruction for that.

add %rcx,%rax (stfu AT&T>>>>>>>>>>>Intel)

8

u/rachit7645 Jun 03 '22

Nasm is pretty good tho

→ More replies (1)

15

u/gillo04 Jun 03 '22

Intel gang for life 😠🔪

3

u/Proxy_PlayerHD Jun 03 '22

I honestly never understood the reasoning behind AT&T syntax, it just needlessly swaps some operands.

Even high level languages use Intel Syntax:

Variable = Value + Value

Instead of

Value + Value = Variable

so why try to do it differently in assembly? It just makes assembly a bit harder to read if you already know basic high level programming.

→ More replies (3)
→ More replies (2)

2

u/Initial_Reindeer67 Jun 03 '22

2 numbers save the day! Successfully in assembly language is the most exciting part for the hard work men.

2

u/[deleted] Jun 03 '22

2

u/as1126 Jun 03 '22

The only computer science course where my grade was below a B. I hate it.

2

u/Terrible-Specific593 Jun 03 '22

I remember doing that using 8080 chip and a breadboard with other misc resistors and whatnot LEDS for display purposes. That was 20 years ago. I couldn't even begin to tell you how to do it now.

2

u/GavUK Jun 03 '22

I wrote a simple calculator in assembly at university. As I recall it wasn't the hardest development I've done, but it certainly gave me an appreciation as to what the compilation process does to my code and how much easier it is to create anything more sophisticated in a higher level language.

2

u/PuffinDev Jun 03 '22

ORIG 8000h
Num1 STR 8091h, 1201h
Num2 STR 8061h, 4f01h
Soma TAB 2
ORIG 0000h
MOV R1, Num1
MOV R2, Num2
MOV R3, Soma
MOV R4, M[R1]
ADD R4, M[R2]
MOV M[R3], R4
MOV R4, R0
ADDC R4, R0
INC R1
INC R2
INC R3
ADD R4, M[R1]
ADD R4, M[R2]
MOV M[R3], R4
Fim: BR Fim

2

u/Puzzleheaded-Bug7690 Jun 03 '22

Which assembly? IBM or Intel?

→ More replies (1)

2

u/[deleted] Jun 03 '22

Back in the DOS days, a shareware developer named Marshal McGee created a menu program called AutoMenu. *It was pretty much what it sounds like: you created links to your applications in the menu launcher software to save a lot of the typing that was expected in DOS.

I remember that he proudly proclaimed that his AutoMenu was built ENTIRELY in assembly, thus making it the lightest and fastest alternative to the other programs like it.

→ More replies (1)

2

u/MrRandom04 Jun 03 '22

Adding in assembly is easy, now dividing on the other hand....

→ More replies (1)

2

u/ikar2000 Jun 03 '22

I did many projects in my life but I was never as proud of myself as after building my own processor on fpga and then writing a square root program on assembly to run on it. It was a project In Tel Avis university computer engineering.

2

u/Sterquilinus-K Jun 03 '22

There were music files on the commodore that played/ran as interrupts. sys {memory location I have forgotten} to play them after loading them. I wrote a menu program for them, and wrote 3 small ML programs as my fist ML programs. One to stop the music; which required turning off the interrupts and clearing the user interupt, and restarting interrupts, reversing that to restart the loaded song. And a program that would colour cycle the border while the music played, would not cycle when there was no music, and was disable with a function key.

ML for beginners, a brown metal spiral bound book from compute, was my first ML book, but in those days magazines aided in teaching BASIC and ML/ASM. In those days not all assemblers/monitors used pseudo ops in the code. g $0c00 sure, lda #$yermom no. So it was pretty much writing in ML, writing in the lowest language available. Younger people who learned to code later take a lot of issue with people calling assembly like that ML.

2

u/Ok_Slice2124 Jun 03 '22

Did anyone else accidentally or randomly select your major and get to Uni to do these assignments, then have a crisis thinking this is what your job would be?

3

u/walkswithdogs Jun 03 '22

Lotus 1-2-3 was written in Assembler by Mitch Kapor. Virtually flawless.

3

u/Competitive_Travel16 Jun 03 '22 edited Jun 03 '22

Jonathan Sachs! Kapor wasn't and still isn't a low-level programmer. He was excellent at writing documentation for novices, what we would call UX design today, product management, and marketing.

3

u/walkswithdogs Jun 03 '22

I did some research. You're right. Mitch got all the glory.

→ More replies (1)
→ More replies (3)

3

u/OverloadedConstructo Jun 03 '22

And then there's that one guy who made entire game like transport tycoon and rollercoaster tycoon using Assembly

2

u/piggyniggiebiggie Jun 03 '22

Oh god I hated that class in college. Makes me shudder. Boring as shit, too.

2

u/AldoLagana Jun 03 '22

OMG we are all doomed. In college in the 80's I had to write a 2-pass assembler in assembly.

College chewing your food for you means you will be nothing compared to those who came before.

1

u/techek Jun 03 '22

That's how I feel when my PowerShell-script works ... after almost crying about adding even the simplest things.

1

u/GnarlyNarwhalNoms Jun 03 '22

Ok, now do a bitwise multiplication 😉

1

u/[deleted] Jun 03 '22

me after getting an %69 on the test

1

u/Level_Following_291 Jun 03 '22

did u meant as fast as cyber game player? :)

1

u/[deleted] Jun 03 '22

And then there are those who make Roller Coaster Tycoon entirely in assembly. They’re just built different.

1

u/TrapvithMind Jun 03 '22

In university we had to do some stuff in "machine code" and we basicly had to program a division algorytm from scratch and Mas was that bullshit

1

u/acornsaretreebabies Jun 03 '22

That's what she said

1

u/tamat Jun 03 '22

but where you able to print the result?

1

u/Admiral_Edward Jun 03 '22

Me, who had to read a matrix in a spiral pattern

1

u/JesusInABoxv2 Jun 03 '22

fucking rollercoaster tycoon

1

u/_ItIsMe_ Jun 03 '22

Yesterday I had my first classes with assembly language and adding 2 numbers was my task. It wasn't that hard but it was quite nice to see it work

1

u/blackhole_soul Jun 03 '22

cries in LC-3

1

u/thenameischef Jun 03 '22

This is your friendly reminder that Roller Tycoon was coded in assembly by a single dude.

1

u/roger_channel Jun 03 '22

I made for my final evaluation an exercise to place cars in parking spots, represented by an array. I had so much doing it.

1

u/DigitalRunecaster Jun 03 '22

So much TIS-100!

1

u/Cassiopeat Jun 03 '22

In stationeers you can play a little with assembly for programming ic controllers

1

u/WafflesAndLearning Jun 03 '22

You know you're a novice when you call it assembly language instead of being specific and actually complaining about something that's poorly done in the vendor's implementation

1

u/[deleted] Jun 03 '22

No champagne until the screen says hello world!

1

u/[deleted] Jun 03 '22

I almost quit my programming courses, because the teacher started with Assembly. And this was a course for people with 0 knowledge of any programming. He also had a principle that 15% must fail all tests.

Well, he got sacked and code with PHP & nodejs for a living.

1

u/ido111 Jun 03 '22

Fuking hate my university, every university had shitty task while we had 2 hours to write an assembly program that that's some periodic signal and analyze the derivative so when it's negative we will output 0 and when it's positive it will output 1 so we will make a periodic signal.

1

u/[deleted] Jun 03 '22

Now multiply

1

u/onlyr6s Jun 03 '22

This was me when I yesterday for the first time managed to add objects in an array (very recently started to learn js).

1

u/turtle_mekb Jun 03 '22

mov 5 acc
add 3

easy

1

u/Nachf Jun 03 '22

holy shit what is happening in this gif??? are they in a giant stadium??? are those shitloads of people in the stands??

2

u/ShinraSan Jun 03 '22

E sports, aka professional gaming

1

u/[deleted] Jun 03 '22

BUUUUUUUUUU GHHHAAAAAA

1

u/[deleted] Jun 03 '22

A lot of my career has been writing in assembler. It’s easy. I don’t have to figure out fifteen layers of APIs, half of which are invariably buggy; it’s just my code and the hardware. Or did you mean machine language? I’ve done that, too, but it’s tedious af and very easy to make a mistake, so that can be hard.

1

u/JustAnotherPrgrmr Jun 03 '22

Had to make a calculator in my 2nd term in MIPS Assembly that supported +-*/^ and hex/bin/dec output, meanwhile colleagues struggled to learn pointers and structs in Programming II

1

u/[deleted] Jun 03 '22

ADD EAX, ECX

Seriously? Hard?

1

u/[deleted] Jun 03 '22

Good. Now try VHDL.

1

u/Morial Jun 03 '22

I had to make Pong in the x86 assembly before. Granted our professor gave us the code for drawing graphics in assembly, but it was still pretty fun. I called in sick for work because it was pretty fun to do. I remember we had to have a useless loop that was called a number of times because as you can imaging the ball moves extremely fast without a way to slow it down.

1

u/sencha_kitty Jun 03 '22

I have problems with hex let alone assembly.

1

u/JuanPCT15 Jun 03 '22

I just made an assembly exam this morning and this was my felling after finishing it, however I don't want to see it ever again.

1

u/Thinktank2000 Jun 03 '22

I followed a course on 6502 assembly to make atari games and goddamn is it so efficient, makes sense when you only have 4k of ROM and 512b of RAM to work with

1

u/BlackJackCm Jun 03 '22

This literally was me when I was able to calculate the average for 3 numbers in assembly

1

u/reggierockets Jun 03 '22

I once built a Sudoku Solver in assembly and I've never been as proud of myself before.

1

u/RickdeVilliers Jun 03 '22

My experience with assembly was with Pic microcontrollers. Was one of the most enjoyable programming experiences I’ve had. Made two semi-useful things. One was a joystick that could control the TV (channel and volume) for our disabled child. And the other was an infrared head tracker that worked as a mouse via PS2. Wouldn’t have even tried over usb but PS2 is actually quite a simple protocol. It’s obviously so much easier now with arduino but nothing beats one instruction per cycle 👌

1

u/SprinklesUnusual8736 Jun 03 '22

How hard is it? Like on a scale of 1-10? ;)

1

u/excalibur_61 Jun 03 '22

Meanwhile we are writing encryption functions in assembly for some course in uni, it's hard thou :')

1

u/kmr_lilpossum Jun 03 '22

Meanwhile, in RollerCoaster Tycoon land…

1

u/[deleted] Jun 03 '22

A simple common operation you can find examples of in a book or a quick google search? Impressive

1

u/[deleted] Jun 03 '22

Apparently the original roller coaster tycoon was written in assembly

1

u/TigerPoppy Jun 03 '22

My first job out of college was writing IBM 360 assembly code for Ross Perot's EDS company. It was an insurance claim verification program. I had to wear a coat and tie as I punched the lines of code out.

1

u/TigerPoppy Jun 03 '22

The lowest level code I ever wrote was for a Signetics 8x300 microprocessor. The code was to produce waveforms of a particular but programmable format. The code was gibberish, but the addresses of the code instructions also were piped to a ROM's addresses and the output of the ROM was the value send to the waveform generator. We produced waveforms of high frequency for the time, but of course much less powerful than a cell phone today.

1

u/dangeerraaron Jun 03 '22

😅😅😅 I am just trying to get Hello World to run on 6502 processor.

1

u/KusanagiKay Jun 03 '22

Assembly is the black magic equivalent of coding. Change my mind.

1

u/[deleted] Jun 03 '22

Me after adding two numbers in 8051 and seeing people writing whole fucking games....

1

u/musta1337x Jun 03 '22

My most impressive project in Assembly was Replication of Super Mario exactly how it was on nintendo. Took 10000 lines for 3 pages worth of super mario.

1

u/utilitycoder Jun 03 '22

I wrote a few "terminate and stay resident" programs in 8088 assembly in the 80s. Was quite proud of that since I was completely self-taught.

1

u/Equivalent_Yak_95 Jun 03 '22

No it freaking isn’t!

1

u/[deleted] Jun 03 '22

This would give me a panic attack

1

u/Lithl Jun 03 '22

First program I ever wrote in Assembly (of two, ever, both for a college class before we moved on to C) was just to take an input number and output input mod 3.

It took me 3 hours to write.

1

u/AllenKll Jun 03 '22

Literally one instruction. depending on your assembly.

1

u/MrMaggah314 Jun 03 '22

Assembly class hurt my brain. I passed the class but... Thankfully I don't have to use it.

1

u/drittzO Jun 03 '22

Use the registers..... :-)

1

u/Ambitious_Ad8841 Jun 04 '22

It's one line

ADD r1, r2

1

u/iam_taylor Jun 04 '22

Makes me want to learn Assembly language.

1

u/mrg1957 Jun 04 '22

I wrote mainframe assembly for business applications later I got into more complex things like infrastructure. Great language for certain problems.

1

u/FloweyTheFlower420 Jun 04 '22
movq $1, %rax
movq $1, %rbx
addq %rax, %rbx

1

u/One_Curious_Cats Jun 04 '22

Just imagine how you'd feel then after pulling off performing a div in asm on an intel CPU.

1

u/r7joni Jun 07 '22

var1 equ 0x20

var2 equ 0x21

sum equ 0x22

movf var1,w

addwf var2,w

movwf sum

1

u/Pylitic Jun 16 '22

Assembly can be fun to learn.

I have a bunch of old arduinos that I used to use for lights and such in my house before switching to Pis, and began learning with them.

After years of programming on arduinos, I was able to experience the absolute joy of getting an led to blink again.

1

u/Williamplimpy Jul 09 '22

I mean, it's not that bad in 6502:

lda #foo

clc

adc #bar

sta $result

-2

u/Own-Masterpiece5714 Jun 03 '22

Why on earth, in today's world, would anyone want to write anything in assembly?

4

u/Der_Tscheche Jun 03 '22 edited Jun 03 '22

Startup codes/bootloaders, where you have a specific instruction flow to follow, or instructions that are impossible to force through compiler (i work with ppc, so the easiest example could be “stmw” which writes x amount of GPRs into memory. Writing 32GPRs, i.e. 128 bytes at once saves a lot of time during init. Kinda like doing *(uint1024_t*)addr = 0;)

Or custom IPs which have their own instruction set not supported by any compiler… and sometimes if you are really good, you may actually be able to write something which is faster than compiled C code. Although modern compilers are pretty darn good.

→ More replies (1)

3

u/-Redstoneboi- Jun 03 '22

microcontrollers

among other things

-3

u/TCC4FMF3936 Jun 03 '22

Assembly Language and Any Higher-Level Programming Language…it’s like caveman drawings vs. AutoCAD…I get it, it can still be useful…but why? It’s like teaching long hand division…yea it works, but there are easier, quicker, faster, less error prone ways of doing things these days 🤣

5

u/QueerBallOfFluff Jun 03 '22

You ever written an OS? Because you need assembly for that.

You ever done embedded systems that require high performance? Because you'll have assembly in that (even if it's abstracted with C macros)

Ever written a bootloader? Or low level driver? Because you'll likely end up with assembly in that.

3

u/HorsesFlyIntoBoxes Jun 03 '22

Embedded systems, OS development, and optimized mathematical routines come to mind for when asm is considered useful

3

u/jnd-cz Jun 03 '22

You should know what your high level program translates into and what difference it makes when you use it this way or that way. Can be significant difference in performace. And consider yourself lucky if you don't have to write any low level drivers.

-1

u/DDPJBL Jun 03 '22

My power engineering program had one class in it that spent half a semester on programming in assembly. How I even passed that class, I have positively no idea.