Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gbc4mega65: Make it easy to embed the Monitor #198

Open
sy2002 opened this issue Mar 13, 2021 · 0 comments
Open

gbc4mega65: Make it easy to embed the Monitor #198

sy2002 opened this issue Mar 13, 2021 · 0 comments
Assignees
Labels

Comments

@sy2002
Copy link
Owner

sy2002 commented Mar 13, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant