logoalt Hacker News

UltraSanelast Wednesday at 12:50 PM1 replyview on HN

x86 ASM absolutely is NOT a good first language due to it being a complete mess.


Replies

rep_lodsblast Wednesday at 3:58 PM

16 bit x86 isn't that complicated and (IMO) still helpful in learning some of the more modern stuff. But I'd recommend starting with either 6502, or the 8080, which is like the 8 bit "grandparent" of x86.

Avoid:

- Z80: at least as a first language. Extended 8080 with completely different syntax, even more messy and unorthogonal than x86!

    LD A,(HL)    ;load A from address in HL register pair
    LD A,(DE)    ;load A from address in DE
    LD B,(HL)    ;load B from address in HL
    LD B,(DE)    ;invalid!

    JP (HL)      ;load program counter with contents of HL (*not* memory)

    ADD A,B      ;add B to A
    ADC A,B      ;add B to A with carry
    SBC A,B      ;subtract B from A with borrow
    SUB B        ;subtract B from A
    OR B         ;logical-or B into A
    etc.
- RISC-V: an architecture designed by C programmers, pretty much exclusively as a target for compiling C to & omitting anything not necessary for that goal