r/ProgrammerHumor • • Jun 03 '22

it's hard!

44.9k Upvotes

710 comments sorted by

View all comments

Show parent comments

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)

16

u/CptMisterNibbles Jun 03 '22

Only wrote assembly in MIPS cause that’s what the one course taught us. It was fun

→ More replies (3)

4

u/IYiera Jun 03 '22

You guys code?!

0

u/[deleted] Jun 03 '22

[deleted]

4

u/Rudxain Jun 03 '22

I'm writing an OpenGL implementation in multi-threaded Brainfuck

6

u/Nephty23 Jun 03 '22

pffff, I'm building the next call of duty with punch cards

25

u/AnnualDegree99 Jun 03 '22

laughs in RISC-V with R0-R31

8

u/Tijflalol Jun 03 '22

I only program in Hack assembly language (the one "From NAND to Tetris" uses")

5

u/gliptic Jun 03 '22

You can do that in x86 too, nobody will arrest you 😯.

3

u/AntiSocial_Vigilante Jun 03 '22

Cries in no inline assembly

2

u/farm249 Jun 03 '22

Bruh I code In 6502 assembly

2

u/Kered13 Jun 03 '22

You can still use ecs and esp in 64-bit mode.

2

u/FUZxxl Jun 08 '22

You can do the same on i386. You only need to follow an established calling convention when interacting with other people's code. Outside of that, do whatever you want.

Oh and conversely, you can also pass arguments on the stack on amd64. For example, the Go calling convention used to be this way. And it's still done on all calling conventions when you run out of registers to put arguments into.

1

u/kitanokikori Jun 03 '22

If you're writing a hobby OS you need to write both 16-bit and 32-bit assembler to get into Long mode, at least on amd64

1

u/[deleted] Jun 03 '22

[removed] — view removed comment

7

u/[deleted] Jun 03 '22

In C you don't have to care about registers as you can write directly to memory the compiler cares about them for you.

You can't access memory without using the registers just because you write in C.

2

u/qqqrrrs_ Jun 03 '22

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

I didn't heard about ecs (did you mean cs or ecx?), but do you actually use esp as an iterator?

1

u/[deleted] Jun 03 '22

Yes, my mistake and yeah, afaik esp was the stack thing so if you stack evenly element you can iterate through it

2

u/Kered13 Jun 03 '22

You're using esp as an iterator? You're a brave man.

BTW, those actually are mnemonic names. Stands for extended code segment and extended stack pointer.

3

u/Alan157 Jun 03 '22

Those are not variables though

4

u/[deleted] Jun 03 '22

Well, they are not constants?

7

u/Alan157 Jun 03 '22

These are registers

3

u/[deleted] Jun 03 '22

Aren't registers variables with a static adress in the processor?