From 2b650148f1991ba9e4e477efde06a02b143f8c72 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 14 Dec 2020 17:55:06 +0100 Subject: [PATCH] added some basic proxies for monitor --- src/kernal/board_m65/mega65_proxies_monitor.s | 24 +++++++++++++++++ .../{,aliases_glue.s => ,aliases_monitor.s} | 0 src/mon_m65/,imports_monitor.s | 8 ++++++ src/mon_m65/4000.mon_vectable.s | 1 - src/mon_m65/bsmon.s | 3 --- src/mon_m65/bsmon_glue.s | 26 +++++++++++++++++++ 6 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 src/kernal/board_m65/mega65_proxies_monitor.s rename src/mon_m65/{,aliases_glue.s => ,aliases_monitor.s} (100%) create mode 100644 src/mon_m65/,imports_monitor.s create mode 100644 src/mon_m65/bsmon_glue.s diff --git a/src/kernal/board_m65/mega65_proxies_monitor.s b/src/kernal/board_m65/mega65_proxies_monitor.s new file mode 100644 index 00000000..6cb1869c --- /dev/null +++ b/src/kernal/board_m65/mega65_proxies_monitor.s @@ -0,0 +1,24 @@ +;; #LAYOUT# M65 KERNAL_0 #TAKE +;; #LAYOUT# * * #IGNORE + +; +; Proxies for calling MEGA65 segment KERNAL_0 routines from KERNAL_1 +; + + +proxy_M1_CHRIN: + + jsr map_NORMAL + jsr CHRIN + bra proxy_M1_end + +proxy_M1_CHROUT: + + jsr map_NORMAL + jsr CHROUT + + ; FALLTROUGH + +proxy_M1_end: + + jmp map_MON_1 diff --git a/src/mon_m65/,aliases_glue.s b/src/mon_m65/,aliases_monitor.s similarity index 100% rename from src/mon_m65/,aliases_glue.s rename to src/mon_m65/,aliases_monitor.s diff --git a/src/mon_m65/,imports_monitor.s b/src/mon_m65/,imports_monitor.s new file mode 100644 index 00000000..b348b7a6 --- /dev/null +++ b/src/mon_m65/,imports_monitor.s @@ -0,0 +1,8 @@ +;; #IMPORT# KERNAL_0 = KERNAL_0_combined.sym + +; +; Definitions for calling MEGA65 segment KERNAL_0 routines from MON_1 +; + +;; #ALIAS# CHRIN = KERNAL_0.proxy_M1_CHRIN +;; #ALIAS# CHROUT = KERNAL_0.proxy_M1_CHROUT diff --git a/src/mon_m65/4000.mon_vectable.s b/src/mon_m65/4000.mon_vectable.s index 97c2796d..0b07704f 100644 --- a/src/mon_m65/4000.mon_vectable.s +++ b/src/mon_m65/4000.mon_vectable.s @@ -3,7 +3,6 @@ !ifdef CONFIG_DEV_BSMON { -!word xtest !word Mon_Call !word Mon_Break !word Mon_Switch diff --git a/src/mon_m65/bsmon.s b/src/mon_m65/bsmon.s index 8d54a106..f9096b63 100644 --- a/src/mon_m65/bsmon.s +++ b/src/mon_m65/bsmon.s @@ -83,7 +83,6 @@ !addr EXIT_OLD = $cf2e ; exit address for ROM 910110 !addr EXIT = $cfa4 ; exit address for ROM 911001 -!addr PRIMM = $ff7d !addr CINT = $ff81 !addr SETMSG = $ff90 !addr SECOND = $ff93 @@ -96,8 +95,6 @@ !addr TALK = $ffb4 !addr OPEN = $ffc0 !addr CLOSE = $ffc3 -!addr CHRIN = $ffcf -!addr CHROUT = $ffd2 !addr STOP = $ffe1 diff --git a/src/mon_m65/bsmon_glue.s b/src/mon_m65/bsmon_glue.s new file mode 100644 index 00000000..f35929ad --- /dev/null +++ b/src/mon_m65/bsmon_glue.s @@ -0,0 +1,26 @@ +; 'Print immediate', original implementation by Mike Barry, adapted to 65CE02 +; see http://www.6502.org/source/io/primm.htm + +PRIMM: + + pla ; get low part of (string address-1) + sta PTR1 + pla ; get high part of (string address-1) + sta PTR2 + +bra @2 +@1: + jsr CHROUT ; output a string char +@2: + inc PTR1 ; advance the string pointer + bne @3 + inc PTR2 +@3: + ldy #$00 + lda (PTR1), y ; get string char + bne @1 ; output and continue if not NUL + lda PTR2 + pha + lda PTR1 + pha + + rts