From a958087c595a4cd115946b88ef689024de6f826a Mon Sep 17 00:00:00 2001 From: mgcaret Date: Sat, 13 Jul 2019 01:15:12 -0700 Subject: [PATCH] SXB: support rom loader as system fcode --- platforms/W65C816SXB/platform-config.inc | 4 ++++ platforms/W65C816SXB/platform-lib.s | 18 +++++++++++++++++- platforms/W65C816SXB/platform-words.s | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/platforms/W65C816SXB/platform-config.inc b/platforms/W65C816SXB/platform-config.inc index 8b13789..12f6bdf 100644 --- a/platforms/W65C816SXB/platform-config.inc +++ b/platforms/W65C816SXB/platform-config.inc @@ -1 +1,5 @@ +; Should we inclide the romloader in $SXB-ROMLDR +.define romloader_as_word 0 +; Should we instead put it in the FCode to install at startup? +.define romloader_at_init 1 diff --git a/platforms/W65C816SXB/platform-lib.s b/platforms/W65C816SXB/platform-lib.s index fcb53ac..19e100f 100644 --- a/platforms/W65C816SXB/platform-lib.s +++ b/platforms/W65C816SXB/platform-lib.s @@ -260,12 +260,28 @@ wait: phx ; note 8-bit mode! jmp _sf_success .endproc -.proc _sf_fcode ; none for now +.proc _sf_fcode +.if include_fcode + ldy #.loword(list) + lda #.hiword(list) +.else lda #$0000 tay +.endif plx jsr _pushay jmp _sf_success +.if include_fcode +list: + .if romloader_at_init + .dword romldr + .endif + .dword 0 + .if romloader_at_init +romldr: PLATFORM_INCBIN "fcode/romloader.fc" + .endif +.endif + .endproc ; SXB really can't do this when ROM is banked out. Maybe restart Forth instead? diff --git a/platforms/W65C816SXB/platform-words.s b/platforms/W65C816SXB/platform-words.s index fe22c1b..3969a93 100644 --- a/platforms/W65C816SXB/platform-words.s +++ b/platforms/W65C816SXB/platform-words.s @@ -44,7 +44,7 @@ dword dCPU_HZ,"$CPU_HZ" FCONSTANT cpu_clk eword -.if include_fcode ; SXB stuff, should do different +.if include_fcode && romloader_as_word ; SXB stuff, should do different dword SXB_ROMLDR,"$SXB-ROMLDR" ENTER ONLIT :+