2
« on: March 29, 2013, 07:38:39 am »
I really like writing assembly for my hobby Z80 (actually, currently Z180) and have done that for a while; I have something like 40000 lines of ASM code in my system. And yes, I also have wondered what kind of added instructions would be most benficial, for ASM-coding and for compiler (another language I'm using is BASIC, and of course I have implemented a compiler for it).
So, here some of the instructions, which are appearing all the time in my existing code, or which I would consider usefull implemented as single byte opcodes (there are something like 7 to 11 single byte opcodes, which no-one or at least I am not using)
LD rr,(HL) where rr=BC, DE, HL
LD (HL),ss where ss=BC or DE
INC2 HL same as INC HL two times
DEC2 HL
These are appearing so often, that in my assembler I have created pseudo-opcodes like LD DE,(HL)++ or LD HL,(HL).
For the compiler I would like to have following two single byte opcodes:
LD DE,(nn) where nn is 16 bit memory address
LD HL,SP+s i.e. HL gets the sum of SP and an 8-bit signed constanst; usefull not only for allocating/deallocating space from stack, but also building a reference to a variable in stack.
And what Z80 is really missing, is couple of indexing registers besides the IX and IY; so I would allocate two of the available single byte opcodes to prefixes for handling these new registers.
Another area where Z80 is lacking, is 16-bit operations. I really would like to have instructions like LD DE,(IX+n) implemented with just 3 bytes, instead of the current 6 bytes (I have also these pseudo-opcodes in my assembler, however, the saving in memory usage would really be wellcome). And yeah, there are a few other opcodes, which would be rather useful...