changeset 1:8ac2bb155049

Modify memory map to be compatible with Disk Basic Change memory map so the game code is loaded at $E00 and the data area starts at $4200 and runs to $7FFF. This allows the usual Disk Basic stuff in low memory to operate without interference. It also allows the code to grow upward to about 13K in size without having to relocate the data, which is painful since the graphic screens MUST be on 512 byte boundaries. Also added some symbolic definitions to make changing the graphic screen locations less problematic.
author William Astle <lost@l-w.ca>
date Sun, 28 Dec 2014 00:57:35 -0700
parents ba080039b23c
children 893efe2a0fd9
files dod.s
diffstat 1 files changed, 31 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Sat Dec 27 22:27:25 2014 -0700
+++ b/dod.s	Sun Dec 28 00:57:35 2014 -0700
@@ -137,12 +137,10 @@
 showprompt	macro noexpand
 		dod S0F
 		endm
-
 ; do a delay for about 1.33 seconds
 delay		macro noexpand
 		dod S10
 		endm
-
 ; set a block of memory (from X to U-1) to $00
 clearblock	macro noexpand
 		dod S11
@@ -241,11 +239,20 @@
 PIA0		equ $ff00
 PIA1		equ $ff20
 SAMREG		equ $ffc0
-TOPRAM		equ $4000
-STACK		equ $1000
+
+PROGLOAD	equ $e00
+; These items must be in this order by address.
+VARSTART	equ $4200			; start of variable space
+SCREEN0		equ $5000			; start of first graphic screen
+SCREEN1		equ $6800			; start of second grpahic screen
+TOPRAM		equ SCREEN1+$1800		; top of memory
+; Several utility equates
+STACK		equ SCREEN0
+SAMSCR0		equ (SCREEN0/64)|6		; SAM register for screen 0, pmode 4
+SAMSCR1		equ (SCREEN1/64)|6		; SAM register for screen 1, pmode 4
 
 ; the direct page
-		org $200
+		org VARSTART
 zero		rmb 2				; initialized to $0000
 V202		rmb 1				; apparently unused
 allones		rmb 2				; initialized to $ffff
@@ -429,7 +436,7 @@
 datatop		equ *
 
 
-		org $4000
+		org PROGLOAD
 START		ldu #dodemo			; point to the demo setup routine
 		bra LC008			; go handle the game
 LC005		ldu #dogame			; point to the real game setup routine
@@ -444,7 +451,7 @@
 		stb 2,x				; set VDG and single bit sound to output
 		lda #$3c			; flags for data mode, no interrupts, sound enabled
 		sta 3,x				; set side B for data mode
-		ldd #$2046			; SAM value for "pmode 4" graphics, screen at $1000
+		ldd #SAMSCR0			; SAM value for "pmode 4" graphics, screen at $1000
 		jsr setSAM			; go set the SAM register
 		lda #$f8			; value for "pmode 4", color set 1
 		sta 2,x				; set VDG mode
@@ -3774,17 +3781,17 @@
 		fdb $17a0			; powerlevel - player power level
 		fcb $54	
 		fdb infoarea
-		fdb $1000			; infoarea - text area starts at top of screen
+		fdb SCREEN0			; infoarea - text area starts at top of screen
 		fdb $0260			; infoarea+2 - text area ends after 19 lines
 		fdb 0				; infoarea+4 - text cursor position at top of screen
 		fcb 0				; infoarea+6 - black background
 		fcb $ff				; infoarea+7 - do not render on secondary screen
-		fdb $2300			; statusarea - text area starts at row 19 on screen
+		fdb SCREEN0+$1300		; statusarea - text area starts at row 19 on screen
 		fdb $40				; statusarea+2 - text area goes for two lines
 		fdb 0				; statusarea+4 - text cursor is at top of area
 		fcb $ff				; statusarea+6 - background is white
 		fcb 0				; statusarea+7 - do render on secondary screen
-		fdb $2400			; commandarea - text area starts at row 20 on screen
+		fdb SCREEN0+$1400		; commandarea - text area starts at row 20 on screen
 		fdb $80				; commandarea+2 - text area goes for four lines
 		fdb 0				; commandarea+4 - text cursor is at top of area
 		fcb 0				; commandarea+6 - background is black
@@ -3800,23 +3807,23 @@
 		fcb 0
 
 ; these tables are used for clearing and otherwise setting up the graphics screens
-LD870		fdb $1000			; primary screen start address
-		fdb $2300			; primary screen gfx area end address
-		fdb $2046			; primary screen SAM register value
-LD876		fdb $2800			; secondary screen start address
-		fdb $3b00			; secondary screen gfx area end address
-		fdb $20a6			; secondary screen SAM register value
-LD87C		fdb $2300			; start address of status line on first screen
-		fdb $2400			; end address of status line on first screen
+LD870		fdb SCREEN0			; primary screen start address
+		fdb SCREEN0+$1300		; primary screen gfx area end address
+		fdb SAMSCR0			; primary screen SAM register value
+LD876		fdb SCREEN1			; secondary screen start address
+		fdb SCREEN1+$1300		; secondary screen gfx area end address
+		fdb SAMSCR1			; secondary screen SAM register value
+LD87C		fdb SCREEN0+$1300		; start address of status line on first screen
+		fdb SCREEN0+$1400		; end address of status line on first screen
 		fdb 0				; dummy (SAM regster setting)
-		fdb $3b00			; start address of status line on second screen
-		fdb $3c00			; end address of status line on second screen
+		fdb SCREEN1+$1300		; start address of status line on second screen
+		fdb SCREEN1+$1400		; end address of status line on second screen
 		fdb 0				; dummy (SAM register setting)
-LD888		fdb $2400			; start address of command area on first screen
-		fdb $2800			; end address of command area on first screen
+LD888		fdb SCREEN0+$1400		; start address of command area on first screen
+		fdb SCREEN0+$1800		; end address of command area on first screen
 		fdb 0				; dummy (SAM register setting)
-		fdb $3c00			; start address of command area on second screen
-		fdb $4000			; end address of command area on second screen
+		fdb SCREEN1+$1400		; start address of command area on second screen
+		fdb SCREEN1+$1800		; end address of command area on second screen
 		fdb 0				; dummy (SAM register setting)
 
 ; This is the keyword table used for command parsing. Each keyword is stored in packed format.