diff --git a/CONFIG.md b/CONFIG.md index 35e6570a..199220f2 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -93,3 +93,9 @@ Feature needs about 330 bytes in BASIC segment. On the most widespread CPUs the D flag is not cleared upon entering interrupts. Since the original Kernal does not clear it either, it's not safe to use BCD processor mode without disabling the interrupts first. This option makes sure the D flag is disabled at the start of the interrupt - this allows some optimizations in the code. Feature needs 2 bytes in KERNAL segmment (for CPUs needing the patch), but at the same time allows optimizations allowing to gain some more bytes. If unsure - enable. + +### `CONFIG_STUBS_BRK` + +Option just for debugging purposes - replaces `RTS` stubbed routines implementation with one causing a break. + +If unsure - disable. diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 74d3ac34..d9cfb900 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -22,3 +22,5 @@ #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS + +// #define CONFIG_STUBS_BRK diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 33cf79eb..4a54f292 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -22,3 +22,5 @@ #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS + +// #define CONFIG_STUBS_BRK diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index e5e4372c..2351e37a 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -22,3 +22,5 @@ #define CONFIG_DOS_WEDGE #define CONFIG_BCD_SAFE_INTERRUPTS + +// #define CONFIG_STUBS_BRK diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 58738507..f7a70eda 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -58,4 +58,26 @@ #if CONFIG_BCD_SAFE_INTERRUPTS #define HAS_BCD_SAFE_INTERRUPTS -#endif \ No newline at end of file +#endif + + // Stub configuration + +.macro STUB_IMPLEMENTATION_RTS() { + rts +} + +.macro STUB_IMPLEMENTATION_BRK() { + .break + brk + brk + jmp *-2 +} + +.macro STUB_IMPLEMENTATION() +{ +#if CONFIG_STUBS_BRK + STUB_IMPLEMENTATION_BRK() +#else + STUB_IMPLEMENTATION_RTS() +#endif +} diff --git a/c64/basic/a483.main.s b/c64/basic/a483.main.s index 680e34f8..40415b24 100644 --- a/c64/basic/a483.main.s +++ b/c64/basic/a483.main.s @@ -10,4 +10,4 @@ MAIN: - rts // XXX implement this + STUB_IMPLEMENTATION() diff --git a/c64/basic/a57c.chrnch.s b/c64/basic/a57c.chrnch.s index bc797250..4f462ff6 100644 --- a/c64/basic/a57c.chrnch.s +++ b/c64/basic/a57c.chrnch.s @@ -10,4 +10,4 @@ CHRNCH: - rts // XXX implement this + STUB_IMPLEMENTATION() diff --git a/c64/basic/a68e.runc.s b/c64/basic/a68e.runc.s index e94d6a94..dfec0e32 100644 --- a/c64/basic/a68e.runc.s +++ b/c64/basic/a68e.runc.s @@ -2,4 +2,4 @@ // XXX provide documentation and implementation RUNC: - rts + STUB_IMPLEMENTATION() diff --git a/c64/basic/a71a.qplop.s b/c64/basic/a71a.qplop.s index a6a8572e..efa99f31 100644 --- a/c64/basic/a71a.qplop.s +++ b/c64/basic/a71a.qplop.s @@ -10,4 +10,4 @@ QPLOP: - rts // XXX implement this + STUB_IMPLEMENTATION() diff --git a/c64/basic/a7ae.newstt.s b/c64/basic/a7ae.newstt.s index 0d01b930..55b97764 100644 --- a/c64/basic/a7ae.newstt.s +++ b/c64/basic/a7ae.newstt.s @@ -2,4 +2,4 @@ // XXX provide documentation and implementation NEWSTT: - rts + STUB_IMPLEMENTATION() diff --git a/c64/basic/a7e4.gone.s b/c64/basic/a7e4.gone.s index 00cc0d6e..547f648a 100644 --- a/c64/basic/a7e4.gone.s +++ b/c64/basic/a7e4.gone.s @@ -10,4 +10,4 @@ GONE: - rts // XXX implement this + STUB_IMPLEMENTATION() diff --git a/c64/basic/ae86.eval.s b/c64/basic/ae86.eval.s index 3d8b0116..423eb01a 100644 --- a/c64/basic/ae86.eval.s +++ b/c64/basic/ae86.eval.s @@ -10,4 +10,4 @@ EVAL: - rts // XXX implement this + STUB_IMPLEMENTATION() diff --git a/c64/basic/bdcd.linprt.s b/c64/basic/bdcd.linprt.s index 11e0c756..32afbf1b 100644 --- a/c64/basic/bdcd.linprt.s +++ b/c64/basic/bdcd.linprt.s @@ -7,4 +7,4 @@ LINPRT: - rts // XXX implement this + STUB_IMPLEMENTATION() diff --git a/c64/basic/e38b.error.s b/c64/basic/e38b.error.s index eb0fe611..43954f1d 100644 --- a/c64/basic/e38b.error.s +++ b/c64/basic/e38b.error.s @@ -10,4 +10,4 @@ ERROR: - rts // XXX implement this + STUB_IMPLEMENTATION() diff --git a/c64/basic/e3bf.init.s b/c64/basic/e3bf.init.s index efb07b70..884154f6 100644 --- a/c64/basic/e3bf.init.s +++ b/c64/basic/e3bf.init.s @@ -2,4 +2,4 @@ // XXX provide documentation and implementation INIT: - rts + STUB_IMPLEMENTATION() diff --git a/c64/basic/e422.initmsg.s b/c64/basic/e422.initmsg.s index 15f60407..a3e07d4a 100644 --- a/c64/basic/e422.initmsg.s +++ b/c64/basic/e422.initmsg.s @@ -2,4 +2,4 @@ // XXX provide documentation and implementation INITMSG: - rts \ No newline at end of file + STUB_IMPLEMENTATION() diff --git a/c64/basic/e453.rvect.s b/c64/basic/e453.rvect.s index 5fe5ea3f..916e26fd 100644 --- a/c64/basic/e453.rvect.s +++ b/c64/basic/e453.rvect.s @@ -2,4 +2,4 @@ // XXX provide documentation and implementation RVECT: - rts + STUB_IMPLEMENTATION() diff --git a/c64/kernal/f5ed.save.s b/c64/kernal/f5ed.save.s index 44c6eb15..79ea33d6 100644 --- a/c64/kernal/f5ed.save.s +++ b/c64/kernal/f5ed.save.s @@ -10,4 +10,4 @@ // SAVE: - rts + STUB_IMPLEMENTATION()