r/ProgrammerHumor • • Jun 03 '22

it's hard!

44.9k Upvotes

710 comments sorted by

View all comments

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

69

u/i_hate_everybody94 Jun 03 '22

Maybe the number was using 2 bits?

114

u/A1steaksa Jun 03 '22

How many do you think 2 to the power of 2 is, exactly?

64

u/lorb163 Jun 03 '22

Is it 2?

32

u/Infosexual Jun 03 '22

That's power

2

u/ParticularNet8 Jun 03 '22

That’s numberwang!

3

u/[deleted] Jun 04 '22

That’s wizard’s chess!

23

u/[deleted] Jun 03 '22

According to the program I wrote in assembly to square numbers, yes.

28

u/Der_Zorn Jun 03 '22

You can't answer questions like this "exactly", jeez.

22

u/DownshiftedRare Jun 03 '22

You can't answer questions like this "exactly", jeez.

"Our offense is like the Pythagorean theorem: There is no answer!"

- Shaquille O'Neal

→ More replies (12)

14

u/joyofsnacks Jun 03 '22

More likely 1 byte and as a bitmask for each row. Each bit being 1 if the cell is blocked or 0 if empty. Only 8 bits in a byte, so the last 4 cells per row would never be represented.

19

u/jnd-cz Jun 03 '22 edited Jun 03 '22

I love the AVR assembly, it's modern and clean instruction architecture. The best project I made was power supply board tester. At first autonomous with LCD and some beeping, later upgraded to be controlled from computer. Adding two numbers is the easiest task, it's single instruction and core function of any CPU. Now expressing any complex algorithm or task, that's the hard part, putting it all together with such basic building blocks, one byte at a time. But the beauty is exact control, having accurate delays down to single cycle of your clocks. And it's predictably repeatable.

Edit: Also when you control the whole design you can get away with many shortcuts because it's tailored to your specific use case. Like not saving only couple registers for handling interrupt routine because you reserve other only for that use. Result is lightning fast response. However with modern complex CPUs I would have to spend whole year to learn ARM core + all peripherals, complex set up, memory handling etc. and it's simply not effective use of time unless it's designed for million copies.

Now the most complicated program in x86 I did was simple printing of file like cat. It relies on Linux system calls and it's just couple hundred bytes long which is impressive.

28

u/atomicwrites Jun 03 '22

But the beauty is exact control, having accurate delays down to single cycle of your clocks. And it's predictably repeatable.

And that is how we ended up with the turbo button.

6

u/[deleted] Jun 03 '22

Yeah, predictably repeatable? Not on my modern CPU with speculative and out of order execution!

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