Table of Contents
SuperCPU KickAssembler Library
ToDo: Consolidated hardware info / revisions etc.
Over the years after the SuperCPU became emulated in Vice, I've developed a series of pseudocommands and macros for KickAssembler to take advantage of the SuperCPU merely out of curiosity. It is now somewhat complete and I will start to port the library into Codebase. This will happen gradually as it's extensive.
NB! Opcode descriptions are ripped from the “Programming the 65816” by WDC, there may be errors. Feel free to rectify or adjust as neccessary (in the routines as well as they are not fully tested and may contain bugs.
Regular opcodes
The following opcodes does not need any special pseudocommands as they use the exact same opcode values as the 6510/6502 (NB! Some opcodes behaves differently as briefly indicated (and may also use a different amount of cycles)):
asl - 16 bit accumulator mode shifts 16 bits bcc bcs beq bmi bne bpl brk - Resets Decimal Flag in native mode bvc bvs clc cld cli clv dex - 16 bit index register mode decreases 16 bit X with 1 (dex16 pseudo available) dey - 16 bit index register mode decreases 16 bit Y with 1 (dey16 pseudo available) inx - 16 bit index register mode increases 16 bit X with 1 (inx16 pseudo available) iny - 16 bit index register mode increases 16 bit Y with 1 (iny16 pseudo available) lsr - 16 bit accumulator mote shifts 16 bits nop php - Does not push the e-flag plp - Does not pull the e-flag rol - 16 bit accumulator mode shifts 16 bits ror - 16 bit accumulator mode shifts 16 bits rti - Pulls 4 bytes in native mode (+PB) rts sec sed sei stx - Stores 16 bits in 16 bit index register mode sty - Stores 16 bits in 16 bit index register mode tax - 16 bit index register mode copies 16 bits tay - 16 bit index register mode copies 16 bits tsx - 16 bit index register mode copies 16 bits txa - 16 bit accumulator register mode copies 16 bits txs - 16 bit index register mode copies 16 bits tya - 16 bit accumulator register mode copies 16 bits
Pseudocommands
- BRA / BRL - Merged
- DEC - Decreases A or M with 1
- DEX - Decreases X with passed parameter
- DEY - Decreases Y with passed parameter
- INC - Increases A or M with 1
- INX - Increases X with passed parameter
- INY - Increases Y with passed parameter
ToDo: Merge pei/pea?
The following opcodes are not implemented:
- cop - Coprocessor, Not usefull.
- wdm - Future Expansion, does not do anything.
Macros
This section contains some usefull macros which will simplify coding the SuperCPU.
Issues
There are some hurdles which currently presents some of challenges;
- The VICE monitor (as far as I know), as of now, cannot handle 16 bit immediate values. So when stepping through code or listing code in the monitor all immediate values are treated as 8 bits (it's emulated as 16 but listed as 8!). This makes following code in the monitor a bit harder.
- KickAssembler does not allow you to do conditional trickery (.if) to an unresolved label. This is an issue for example when implementing a branch pseudo as it will not accept unresolved lables when calculating the relative branch distance in the pseudo when branching forwards (backwards works as the previous label is already resolved).
- Zero (Direct) Page addressing modes is also suffering from the unresolved label issue as the size of the absolute value is determined by a .if. If I remeber correctly, KickAssembler has a hard time passing ZP,x as KA automatically treats all as 16 bit but does some trickery later to shave down to 8 bits which does not pass well to pseudos. This may have been fixed though / I may recall wrong, so should be verified.