From 09b967e82be71e3813e51cb922e89cd469ac96bd Mon Sep 17 00:00:00 2001 From: b1ackmai1er Date: Mon, 10 Feb 2020 22:44:35 +0800 Subject: [PATCH] Add a user rom pack template to romldr --- Source/HBIOS/Build.ps1 | 4 +- Source/HBIOS/imgpad0.asm | 2 +- Source/HBIOS/romldr.asm | 1 + Source/HBIOS/std.asm | 4 ++ Source/HBIOS/usrrom.asm | 80 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 Source/HBIOS/usrrom.asm diff --git a/Source/HBIOS/Build.ps1 b/Source/HBIOS/Build.ps1 index 1e653395..cb898af7 100644 --- a/Source/HBIOS/Build.ps1 +++ b/Source/HBIOS/Build.ps1 @@ -163,7 +163,7 @@ Copy-Item '..\Fonts\font*.asm' '.' # Assemble individual components. Note in the case of UNA, there is less to build. # -$RomComponentList = "dbgmon", "prefix", "romldr", "eastaegg", "nascom", "tastybasic", "game", "imgpad", "imgpad0" +$RomComponentList = "dbgmon", "prefix", "romldr", "eastaegg", "nascom", "tastybasic", "game", "usrrom", "imgpad", "imgpad0" ForEach ($RomComponentName in $RomComponentList) {Asm $RomComponentName} if ($Platform -ne "UNA") @@ -181,7 +181,7 @@ if ($Platform -ne "UNA") # Build 32K OS chunk containing the loader, debug monitor, and OS images Concat 'romldr.bin', 'eastaegg.bin','dbgmon.bin', "..\cpm22\cpm_${Bios}.bin", "..\zsdos\zsys_${Bios}.bin" osimg.bin -Concat 'camel80.bin', 'nascom.bin', 'tastybasic.bin', 'game.bin', 'imgpad0.bin' osimg1.bin +Concat 'camel80.bin', 'nascom.bin', 'tastybasic.bin', 'game.bin', 'imgpad0.bin', 'usrrom.bin' osimg1.bin # # Now the ROM disk image is created. This is done by starting with a diff --git a/Source/HBIOS/imgpad0.asm b/Source/HBIOS/imgpad0.asm index 74a2a125..2aa54841 100644 --- a/Source/HBIOS/imgpad0.asm +++ b/Source/HBIOS/imgpad0.asm @@ -1,6 +1,6 @@ #INCLUDE "std.asm" ; -SLACK .EQU ($8000-BAS_SIZ-TBC_SIZ-FTH_SIZ-GAM_SIZ) +SLACK .EQU ($8000-BAS_SIZ-TBC_SIZ-FTH_SIZ-GAM_SIZ-USR_SIZ) .FILL SLACK,00H ; MON_STACK .EQU $ diff --git a/Source/HBIOS/romldr.asm b/Source/HBIOS/romldr.asm index 8a44fec4..4fce8151 100644 --- a/Source/HBIOS/romldr.asm +++ b/Source/HBIOS/romldr.asm @@ -423,6 +423,7 @@ MENU_1: MENU_L("~CP/M$ ", "C", KY_BK, CPM_ENT, 2000h, CPM_LOC, CPM_SIZ MENU_L("~BASIC$ ", "B", KY_DE, BAS_LOC, 1700h, BAS_LOC, BAS_SIZ, BID_IMG1, BID_USR, "Nascom BASIC$") MENU_L("~T-BASIC$ ", "T", KY_EN, TBC_LOC, 3700h, TBC_LOC, TBC_SIZ, BID_IMG1, BID_USR, "Tasty BASIC$ ") MENU_L("~PLAY$ ", "P", $FF, GAM_LOC, 4000h, GAM_LOC, GAM_SIZ, BID_IMG1, BID_USR, "Game$ ") + MENU_L("~USER ROM$", "U", $FF, USR_LOC, 7000h, USR_LOC, USR_SIZ, BID_IMG1, BID_USR, "User ROM$ ") #ENDIF #IF (DSKYENABLE) MENU_L("~DSKY$ ", "D", KY_GO, MON_DSKY, 1000h, MON_LOC, MON_SIZ, BID_CUR, BID_USR, "DSKY Monitor$") diff --git a/Source/HBIOS/std.asm b/Source/HBIOS/std.asm index 1d7c96e6..e8ecf3a6 100644 --- a/Source/HBIOS/std.asm +++ b/Source/HBIOS/std.asm @@ -425,6 +425,10 @@ GAM_LOC .EQU $0200 ; GAME 2048 GAM_SIZ .EQU $0900 GAM_END .EQU GAM_LOC + GAM_SIZ +USR_LOC .EQU $0200 ; USER +USR_SIZ .EQU $1000 +USR_END .EQU USR_LOC + USR_SIZ + MON_DSKY .EQU MON_LOC + (0 * 3) ; MONITOR ENTRY (DSKY) MON_SERIAL .EQU MON_LOC + (1 * 3) ; MONITOR ENTRY (SERIAL PORT) ; diff --git a/Source/HBIOS/usrrom.asm b/Source/HBIOS/usrrom.asm new file mode 100644 index 00000000..5d4ff8e7 --- /dev/null +++ b/Source/HBIOS/usrrom.asm @@ -0,0 +1,80 @@ +; +; USRROM TEMPLATE FOR A CUSTOM USER ROM +; +#INCLUDE "std.asm" +; +CR .EQU 0DH +LF .EQU 0AH +; + .ORG USR_LOC +; + LD HL,BOOTMSG ; INTRODUCTION + CALL PRTSTR + + CALL CIN ; DO STUFF +; + LD A,00H ; RETURN TO ROM LOADER + LD HL,0000H + JP 0FFF9H +; RET +; +; +; +; PRINT A STRING AT ADDRESS SPECIFIED IN HL +; STRING MUST BE TERMINATED BY '$' +; USAGE: +; LD HL,MYSTR +; CALL PRTSTR +; ... +; MYSTR: .DB "HELLO$" +; +PRTSTR: LD A,(HL) + INC HL + CP '$' + RET Z + CALL COUT + JR PRTSTR +; +; OUTPUT CHARACTER IN A TO CONSOLE DEVICE +; +COUT: PUSH AF + PUSH BC + PUSH DE + LD B,01H + LD C,0 + LD E,A + RST 08 + POP DE + POP BC + POP AF + RET +; +; OUTPUT CHARACTER IN A TO CONSOLE DEVICE +; +COUTE: PUSH AF + LD A,E + CALL COUT + POP AF + RET +; +; WAIT FOR A CHARACTER FROM THE CONSOLE DEVICE AND RETURN IT IN A +; +CIN: PUSH BC + LD B,00H + LD C,00H + RST 08 + LD A,E + POP BC + RET +; +BOOTMSG:.DB "No User ROM Installed." + .DB CR,LF + .DB "Press a key to return to Boot Loader.$" +; +SLACK .EQU (USR_END - $) + .FILL SLACK,00 + .ECHO "User ROM space remaining: " + .ECHO SLACK + .ECHO " bytes.\n" + .END +