4 ms·
I wrote a lot of 6502 assembly once, and you spend a lot of time dealing with the 8-bittedness of the architecture. Multiplying two 16 bit numbers is a whole bl
by tlb 2y ago
I wrote a lot of 6502 assembly once, and you spend a lot of time dealing with the 8-bittedness of the architecture. Multiplying two 16 bit numbers is a whole blob of code. That doesn't seem useful for new programmers to struggle with.
The early ARM ISAs are good, as you say.
- 6510 2y agoI believe you should be able to sort~of simulate higher level languages on the editor level. Writing c = a * b could just be a representation for the large blob of code or subroutine.* What is particularly funny about your example is that 40 years later you still cant do multiplication or addition in js. You have to install packages (that are multiple computers in size!) after you make up your mind which of the 20+ different modules (read: "dependencies") has the right kind of multiplication for you! I'm not bitter, it's objectively ridiculous :) * it should actually be c = a × b Without the asterix, we did actually have arithmetic reasonably standardized before IT de-standardized it.
- wvenable 2y agoMultiplying (or even adding) two 16bit numbers is a good learning experience for assembler. I think it really depends on your goal. I learned x86 assembly way back when it was relevant but now I do 6502 assembly for fun. The simplicity and the limitations are what make it interesting.
- astrobe_ 2y agoI think this is true for any bus/register size. Various high-level language "bignum" libraries generalize to any size. But it's true that with only 8 bits, the problem happens very soon. However, if one doesn't want to solve basic problems "the hard way", one probably won't be interested in assembly programming anyway.
- Lerc 2y agoIt depends on what you are trying to teach I guess. If you want to impress upon students that everything is made of bytes, that could be useful. I don't think the 6502 would be a good fit because zero-page doesn't really translate to any useful modern concept. Quite a lot of 6502 coding is Zero-page management. I went with 8 bit AVR as an instruction set for my silly fantasy console project. It has an in-browser editor and assembler to let people write 8 bit code. The AVR has the best 8-bit instruction set I have found, it's still not perfect (only loading constants to some registers) but definitely built with the hindsight provided by it's predecessors. If you wanted to avoid the management of data types, I would suggest an instruction set with floating point registers. The same management of bytes into words and dwords, signed and unsigned etc. has to happen on a CPU without floating point support. It's an added complication, which you may or may not want to expose students to. If the intent is to use Asm to teach from the point of view of "every instruction is a clearly defined action" I would use something with 32-bit ints and 32-bit floats. If you wanted people to feel our pain, go with 6502, Z80, or PIC depending how sadistic you are.