changeset 16:a8f7ce03f08b

Remove SWI2 ROM call vector With the removal of the tape code, there is no more point in having the SWI2 ROM call handler. With only a single call through the Color Basic jump table, it is simpler to just replace the SWI2 call sequence with a sequence to set and restore DP for Basic and just call the indirect vector directly. This also removes the unreachable remnant of the same code from among the SWI calls.
author William Astle <lost@l-w.ca>
date Thu, 01 Jan 2015 11:36:38 -0700
parents 64a40f06d375
children 4cb7785c9827
files dod.s
diffstat 1 files changed, 5 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Thu Jan 01 11:09:17 2015 -0700
+++ b/dod.s	Thu Jan 01 11:36:38 2015 -0700
@@ -65,13 +65,6 @@
 		fcb $8c
 		endm
 
-
-; macros for color basic ROM calls
-romcall		macro noexpand
-		swi2
-		fcb \1
-		endm
-
 ; set lighting for render
 setlighting	macro noexpand
 		dod S00
@@ -190,15 +183,6 @@
 		dod S1C
 		endm
 
-; ROM call numbers
-POLCAT		equ 0
-CSRDON		equ 4
-BLKIN		equ 6
-BLKOUT		equ 8
-WRTLDR		equ 12
-
-ROMTAB		equ $A000
-
 BLKTYP		equ $7c
 BLKLEN		equ $7d
 CBUFAD		equ $7e
@@ -776,7 +760,9 @@
 		beq LC320			; brif not
 		ldx #LC005			; pointer to game start routine
 		stx 10,s			; set return to game start routine
-LC318		romcall POLCAT			; poll the keyboard
+LC318		jsr set_basdp			; set up DP for ROM call
+		jsr [$A000]			; go scan the keyboard
+		jsr restore_dp			; reset to DoD DP
 		tsta				; was a key down?
 		beq LC320			; brif not
 		bsr writekeybuf			; go process keyboard input
@@ -833,17 +819,6 @@
 		ldu 10,s			; restore U register
 		jsr [,s++]			; call the routine
 		rti				; return to caller
-; SWI2 handler
-swi2svc		clrb				;* restore direct page for ROM call
-		tfr b,dp			;*
-		ldu 10,s			; get return address
-		ldb ,u+				; get ROM routine offset
-		stu 10,s			; save new return address
-		ldu #ROMTAB			; point to ROM vector table
-		jsr [b,u]			; call the ROM routine
-		sta 1,s				;* save return values
-		stx 4,s				;*
-		rti				; return to caller
 ; SWI 0 routine
 ; Calculate base light level in dungeon. Note that "magic lighting" is also used for simulating
 ; the fadeout and fade in during fainting.
@@ -1325,19 +1300,6 @@
 		cmpx 10,s			; are we done yet?
 		bne LC68A			; brif not
 		rts				; return to caller
-; This looks like a leftover from earlier development which had the
-; rom calls as a SWI call instead of using SWI2. This routine cannot
-; be reached through the SWI mechanism and it cannot be called directly
-LC691		clrb				;* reset direct page for ROM call
-		tfr b,dp			;*
-		ldu 12,s			; fetch return address
-		ldb ,u+				; fetch rom call wanted
-		stu 12,s			; save new return address
-		ldu #ROMTAB			; point to ROM vector table
-		jsr [b,u]			; call the routine
-		sta 3,s				;* save return values
-		stx 6,s				;*
-		rts
 ; swi 19 routine
 ; fade in the image specified by (X) with sound effects, clear status line and command area
 LC6A4		clr enableheart			; disable heartbeat
@@ -3777,9 +3739,8 @@
 		fdb LD027			; add the "revenge" monsters for the current level
 		fdb 0				; end of routine list
 ; cold start variable initializers
-LD7E8		fcb 6
-		fdb $103
-		jmp swi2svc			; SWI2 handler
+LD7E8		fcb 3
+		fdb $106
 		jmp swisvc			; SWI handler
 		fcb 3
 		fdb $10c