QNICE-FPGA icon indicating copy to clipboard operation
QNICE-FPGA copied to clipboard

gbc4mega65: Make it easy to embed the Monitor

Open sy2002 opened this issue 3 years ago • 0 comments

This issue is about making the Monitor embeddable as kind of an "operating system" in other projects that are using QNICE such as MiSTer2MEGA65.

Currently, the gbc4mega65 project needs to do very un-(q)nice code duplications to embed the Monitor. Some simple changes of the Monitor, such as outsourcing the list of operating-system functions to two include files (one containing only the !reset jump and one containing all the rest) and outsourcing the hard coded .ORG of the monitor's variables into another include file would help. Something like this in qmon.asm:

#include "qmon_reset.asm"
#include "qmon_os.asm"

instead of

reset!          RBRA    QMON$COLDSTART, 1       ; Skip the dispatch table on reset
getc!           RBRA    IO$GETCHAR, 1
putc!           RBRA    IO$PUTCHAR, 1
gets!           RBRA    IO$GETS, 1
puts!           RBRA    IO$PUTS, 1
crlf!           RBRA    IO$PUT_CRLF, 1
[ ... and so on ...]

qmon_reset.asm would contain a #define where reset! shall jump to, so just replacing qmon_reset.asm would already lead to clean code without duplication.

Nice to have: Super helpful would be some enhancements of the assembler to be able to calculate .ORG addresses relative to labels and to .EQUs because then at certain places such as variables.asm in the QNICE project and also in the variables part inside the gbc4mega65 project, one would not need to hardcode the stack address any more.

Maybe there are better ways to do all of this, so this is just a braindump to trigger the appropriate actions when time is ripe.

sy2002 avatar Mar 13 '21 14:03 sy2002