bobbimanners / EightBall

The Eight Bit Algorithmic Language for Apple II, Commodore 64 and VIC20
GNU General Public License v3.0
19 stars 3 forks source link

Storing bytecode to extended memory does not work #31

Closed bobbimanners closed 6 years ago

bobbimanners commented 6 years ago

There is code in eightball.c (enabled by setting EXTMEMCODE) to store generated bytecode in extended memory. However it is currently disabled because emit_fixup() ends up corrupting the bytecode. This seems to be caused by an underlying bug in the cc65 extended memory driver for Apple //e aux memory (a2e.auxmem.emd). I will investigate further ... first step is a stand-alone demonstration of the problem.

bobbimanners commented 6 years ago

I have working inline assembly code for copybytetoaux(). However there is still a bug lurking in the if/else/endif handling somewhere.

bobbimanners commented 6 years ago

I have fixed the issue that was causing bad code generation in some cases when storing bytecode to extended memory on Apple //e enhanced. The problem seemed to be caused by failure to advance rtPC when writing the final null of the string argument to a PRMSG VM instruction. However I can't see what is different in the extended memory vs the normal memory case. Even though this seems to be fixed, the fix remains a bit mysterious and is commented in the code as a TODO.

This fix, plus the inline assembly version of copybytetoaux() is enough to get this feature working well enough so I can compile both unittest.8b and tetris.8b.

bobbimanners commented 6 years ago

v0.77 pushed.