6502: Fix ZP = 0 assumptions and note further fixes needed
authorAlan Cox <alan@linux.intel.com>
Tue, 3 Oct 2017 22:30:33 +0000 (23:30 +0100)
committerAlan Cox <alan@linux.intel.com>
Tue, 3 Oct 2017 22:30:33 +0000 (23:30 +0100)
commit761894dcb5771d9256d60675e6b96a90a69de403
tree0ed87ad667d709050ae5ae7e4212439bbebe70a4
parentfbd09fb50c652b3ba0cf4d3785d5ee02265c86fe
6502: Fix ZP = 0 assumptions and note further fixes needed

The runtime for cc65 assumes it can save to ZP and jump to the same address
via a 16bit index. That fails on our 65C816 build and also on things like the
HuC. Also fix the same offence in ct0.s

Note that we need to save jmpvec+1/2 for re-entry (CC65 forgets to mention this)
and also that we can't just swap zp because unlike a kernel/IRQ switch where
this is valid in Fuzix it's possible to take one signal in another, thus
we must stack the ZP state somewhere (at 20 odd bytes probably the C stack)
Library/libs/crt0_6502.s
Library/libs/crt0nostdio_6502.s