Saw this post by Gregory Nacu and thought it might be of interest:
Object Orientation in 6502 (Take 2)(For those already familiar with 6502, skipping to the section "Structuring Object Oriented Code on the 6502" might be worthwhile.)
This in the context of the work-in-progress C64 OS. There are difficulties of very constrained storage, and difficulties of not being able to chase pointers or use jump tables without some zero page use:
Quote:
The pointer for indirect indexed addressing must be in zero page. So, C64 OS reserves 4 bytes in ZP for 2 pointers, which the toolkit header defines as THIS and CLASS. The first step is to copy a pointer to an object from main memory into the THIS pointer. Via that pointer the ISA property can be read. The next step is to copy the ISA property into the CLASS pointer. From the CLASS pointer, then, we can use a label for the offset into its jump table for the desired method, and JSR to it. Wait, not so fast, remember, the 6502 does not support indirect indexed with the JSR instruction. Instead, C64 OS reserves 3 more bytes of workspace memory for a JMP instruction plus its two byte address. The next step then is to use indirect indexed LDAs to read the address of the routine and write it into this method redirect vector.
It's his second take on the subject - and he suggests one should not read the earlier take, from a couple of years ago:
Object Orientation in 6502