Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I do not know. I learned it when I was 12, but it was quite challenging for me. Pros: It is very ortagonal, has no memory-to-memory instructions

Zero page is like a having 256 generic RISC registers (a bit faster than accessing to other memory areas).

Very easy to understand how the assembly is micro-coded

Cons:

It is impossible to create a "generic" memory pointer with an index >255 without auto-modifying code.

It is a true 8bit only system and cannot manipulate 16bit word easily Steve Wozniac created a small VM just to manage 16 bit Integers (see the his Byte magazine articles).

Too much addressing mode.

So I like 6502, but I disagree a bit.



>Steve Wozniac created a small VM just to manage 16 bit Integers (see the his Byte magazine articles).

It was called SWEET16: https://en.m.wikipedia.org/wiki/SWEET16

A BYTE Magazine article by Wozniak: http://amigan.1emu.net/kolsen/programming/sweet16.html

Porting Sweet 16 by Carsten Strotmann (with source code) http://www.6502.org/source/interpreters/sweet16.htm


> It is impossible to create a "generic" memory pointer with an index >255 without auto-modifying code.

Sure it is. Just store your pointer in zero page, set Y to 0 and use the (ZP),Y addressing mode.


Also, compare the "zeropage indirect" address mode of the WDC 65C02, which does exactly this w/o involving any of the index registers.


Oh, nice. I wished for a similar addressing mode in the 1980s. I see they also added instructions to increment and decrement the accumulator as well.

(Actually, what I wished for was slightly different: only the high byte of the effective address would be fetched from zero page, the low byte being the Y register. In this way, one could keep both bytes of the pointer in zero page, LDY the low byte and use my zp indirect mode. The first use of a pointer would cost an extra instruction / 2 cycles, but further uses of the same pointer would be cheaper.)


Notably, the Motorola 6800 has decrement and increment for the accumulator, both of them. It also features an indexed address mode that is somewhat reverse to how the 6502 does it: there's only one index register (X), but this is of 16-bit length and a single-byte operand is added to this. So, while not exactly a zeropage address, with a bit of courage for self-modification we get there…

The 6502 did intentionally away with quite a number of features, but, as it had since become evident that it was a computer CPU, WDC added (back) for the CMOS version some of what was kind of missing for this application.

(The thing I'm probably missing most on the 6502 is a sequential-shift or barrel-shifter, shifting/rotating by multiple bit positions at once. This would be so great for games, graphics, encoding and decoding… Sophie Wilson had the wisdom to opt this into the ARM architecture.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: