changeset 6:2011ab76f008

More data identified and several SWI routines too Identified SWI routines 08h through 0Bh, 0Fh, 10h, 1Bh, and 1Ch with friendly mneumonic macros. Also added some comments to several of them. Identified the data at D87C as screen parameter data blocks used for clearing the status line and command entry area. Identified the code that processes commands for the demo game. Identified the jump table for the command interpretation handler.
author William Astle <lost@l-w.ca>
date Sat, 25 May 2013 22:04:50 -0600
parents ff6eaa09bb56
children c7e6b6318fea
files dod.s
diffstat 1 files changed, 188 insertions(+), 121 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Sat May 25 14:51:37 2013 -0600
+++ b/dod.s	Sat May 25 22:04:50 2013 -0600
@@ -93,6 +93,42 @@
 		dod S06
 		endm
 
+; clear graphics screen one; return parameter pointer in U
+cleargfx1	macro noexpand
+		dod S08
+		endm
+; clear graphics screen two; return parameter pointer in U
+cleargfx2	macro noexpand
+		dod S09
+		endm
+; clear the status line
+clearstatus	macro noexpand
+		dod S0A
+		endm
+; clear the command entry area
+clearcommand	macro noexpand
+		dod S0B
+		endm
+
+; do a newline, show prompt, and cursor
+showprompt	macro noexpand
+		dod S0F
+		endm
+
+; do a delay for about 1.33 seconds
+delay		macro noexpand
+		dod S10
+		endm
+
+; play a sound number from immediate data at full volume
+playsoundimm	macro noexpand
+		dod S1B,\1
+		endm
+; play sound specified in A, volume in B
+playsound	macro noexpand
+		dod S1C
+		endm
+
 ; ROM call numbers
 POLCAT		equ 0
 CSRDON		equ 4
@@ -157,7 +193,7 @@
 V208		rmb 1
 V209		rmb 2				pointer to primary screen parameter block
 V20B		rmb 2				pointer to secondary screen parameter block
-V20D		rmb 2				
+V20D		rmb 2				pointer to demo game command sequence
 V20F		rmb 2
 V211		rmb 2
 V213		rmb 1
@@ -177,7 +213,7 @@
 V228		rmb 1
 V229		rmb 2
 V22B		rmb 1
-V22C		rmb 1
+V22C		rmb 1				the current level background colour mask
 V22D		rmb 1
 V22E		rmb 1
 V22F		rmb 2
@@ -396,7 +432,7 @@
 		blo LC08C
 		ldu #V388
 		dec V2B7				indicate nonstandard text area
-		dod S0A
+		clearstatus
 		renderstrimmp				display copyright message
 		fcb $f8,$df,$0c,$c9			packed string "COPYRIGHT  DYNA MICRO  MCMLXXXII"
 		fcb $27,$45,$00,$02
@@ -422,10 +458,10 @@
 		fcb $bd,$d3,$03,$cc
 		fcb $02,$04,$e7,$7c
 		fcb $83,$44,$6f,$7b
-		dod S10
-		dod S10
+		delay
+		delay
 		dod S15
-		dod S09
+		cleargfx2
 		dec V2B4
 		sync
 		lda #2
@@ -465,13 +501,13 @@
 		stx V2B2
 		dec V294
 		dod S0E
-		dod S10
-		dod S10
+		delay
+		delay
 		clr V29B
 		sync
 		sync
 LC166		dod S19
-		dod S0F
+		showprompt
 		jmp LC1F5
 LC16D		stx CBUFAD
 		romcall BLKIN
@@ -529,7 +565,7 @@
 LC1EC		jsr LC114
 		clr V2B8
 		dod S19
-		dod S0F
+		showprompt
 LC1F5		ldu #V2AB
 		clr V2BB
 LC1FA		tfr u,y
@@ -947,36 +983,36 @@
 		lda V26B
 		sta 3,s
 		rts
-; swi 8 routine
-LC4F3		ldu V209
-		skip2
-; swi 9 routine
-LC4F6		ldu V20B
-		ldb V22C
-		bsr LC517
-		stu 10,s
-		rts
-; swi 10 routine
-LC4FF		ldx #V388
-		ldu #LD87C
-		bra LC50D
-; swi 11 routine
-LC507		ldx #V390
-		ldu #LD888
-LC50D		clr 4,x
-		clr 5,x
-		ldb 6,x
-		bsr LC517
-		leau 6,u
-LC517		pshs a,b,x,y,u
-		sex
-		tfr d,y
-		leax ,u
-		ldu 2,u
-LC520		pshu a,b,y
-		cmpu ,x
-		bne LC520
-		puls a,b,x,y,u,pc
+; swi 8 routine - clear first graphics screen
+LC4F3		ldu V209			point to first screen parameter block
+		skip2				skip next instruction
+; swi 9 routine - clear second graphics screen
+LC4F6		ldu V20B			point to second screen parameter block
+		ldb V22C			get current level background colour
+		bsr LC517			go clear the graphics area of the screen
+		stu 10,s			save pointer to parameter block for the caller
+		rts				return to caller
+; swi 10 routine - clear the status line
+LC4FF		ldx #V388			point to text area parameters for the status line
+		ldu #LD87C			point to screen address table for the status line
+		bra LC50D			go clear the status line
+; swi 11 routine - clear the command entry area
+LC507		ldx #V390			point to text area parameters for the command area
+		ldu #LD888			point to screen address table for the command area
+LC50D		clr 4,x				; set current cursor to start of text area
+		clr 5,x				;
+		ldb 6,x				get background colour of text area
+		bsr LC517			go clear text area
+		leau 6,u			and repeat the process for the other graphics screen
+LC517		pshs a,b,x,y,u			save regsiters
+		sex				get background colour to A
+		tfr d,y				move it into Y too (4 bytes of background colour)
+		leax ,u				point to start of parameter area
+		ldu 2,u				get address of end of text area (+1)
+LC520		pshu a,b,y			blast 4 background bytes to area
+		cmpu ,x				are we at the start of the area?
+		bne LC520			brif not
+		puls a,b,x,y,u,pc		restore registers and return
 ; swi 12 routine
 LC529		clr V2C1
 		ldd V217
@@ -1015,7 +1051,7 @@
 		bne LC595
 		cmpa #3
 		bgt LC5AE
-		dod S0B
+		clearcommand
 		lda V26E
 		sta V270
 LC578		dec V26F
@@ -1026,7 +1062,7 @@
 		lda V26E
 		cmpa #$f8
 		bgt LC578
-		dod S09
+		cleargfx2
 		dec V2B4
 		dec V228
 		clr V2BC			; reset keyboard buffer
@@ -1043,7 +1079,7 @@
 		cmpa V270
 		ble LC599
 		clr V228
-		dod S0F
+		showprompt
 LC5AE		ldx V217
 		cmpx V221
 		blo LC5B5
@@ -1142,9 +1178,8 @@
 LC674		ldx #LC67A
 		renderstr
 		rts
-LC67A		fcb $1f,$1e,$1c,$24		unpacked string...
-		fcb $ff
-LC67C		equ LC67A+2			????
+LC67A		fcb $1f,$1e			unpacked string CR PERIOD UNDERSCORE BS (including following)
+LC67C		fcb $1c,$24,$ff			unpacked string UNDERSCORE BS
 
 ; swi 16 routine
 ; delay for 81 ticks (1.3 seconds)
@@ -1177,9 +1212,9 @@
 		rts
 ; swi 19 routine
 LC6A4		clr V2B1
-		dod S0A
+		clearstatus
 ; swi 20 routine
-LC6A8		dod S0B
+LC6A8		clearcommand
 		ldd #$8080
 		std V24F
 		ldb V29E
@@ -1192,10 +1227,10 @@
 		bpl LC6B7
 		clr V29C
 		clr V29E
-LC6C1		dod S1B,$16
+LC6C1		playsoundimm $16
 		rts
 ; swi 21 routine
-LC6C5		dod S0B
+LC6C5		clearcommand
 		bsr LC6C1
 		clrb
 		dec V29C
@@ -1209,7 +1244,7 @@
 LC6D7		pshs x,u
 		stb V22D
 		stb V29D
-		dod S09
+		cleargfx2
 		dod S01
 		dec V2B4
 		sync
@@ -1262,14 +1297,14 @@
 		sta 8,u
 LC742		rts
 ; swi 25 routine
-LC743		dod S0A
-		dod S0B
+LC743		clearstatus
+		clearcommand
 		dod S0C
 		inc V2AE
 		dec V2AD
 		dec V2B1
 		dod S0D
-		ldx #LCE66
+LC751		ldx #LCE66
 		stx V2B2
 		dod S0E
 		rts
@@ -2229,7 +2264,7 @@
 		sta V24F
 		sta V250
 		puls a,x,pc
-LCE66		dod S09
+LCE66		cleargfx2
 		clr V28B
 		ldd V213
 		std V27C
@@ -2469,7 +2504,7 @@
 		bne LD0B2
 		lda 13,y
 		ldb #$ff
-		dod S1C
+		playsound
 		ldd #$8080
 		ldx V21D
 		bsr LD09E
@@ -2481,7 +2516,7 @@
 		ldu #V217
 		jsr LD3D7
 		bmi LD099
-		dod S1B,$13
+		playsoundimm $13
 		jsr LD40C
 LD099		dod S0C
 		jmp LD10F
@@ -2609,7 +2644,7 @@
 		mul
 		comb
 		lda 13,y
-		dod S1C
+		playsound
 LD196		dec V2B5
 LD198		clra
 LD199		puls a,b,x,pc
@@ -2680,35 +2715,35 @@
 LD215		anda #$1f
 		bsr LD24C
 		bra LD1EF
-LD21B		ldy V20D
-		ldb ,y+
-		bpl LD229
-		dod S10
-		dod S10
-		jmp START
-LD229		ldx ,y++
-		ldu #V361
-		decodestr
-		leau 1,u
-		dod S10
-		skip2
+LD21B		ldy V20D			fetch pointer to command sequence
+		ldb ,y+				do we have a command to do?
+		bpl LD229			brif so
+		delay				wait for a bit
+		delay				wait for a bit more
+		jmp START			go start over again with the splash and demo
+LD229		ldx ,y++			get pointer to the word
+		ldu #V361			point to command decode buffer
+		decodestr			decode the keyword
+		leau 1,u			move past the "object type" flag
+		delay				wait a bit
+		skip2				skip next instruction
 LD235		bsr LD24C
-		lda ,u+
-		bpl LD235
-		clra
+		lda ,u+				fetch a character from the decoded string
+		bpl LD235			brif not end of string
+		clra				code for a space
+		bsr LD24C			
+		decb				have we consumed all the words in this command?
+		bne LD229			brif not - get another
+		lda #$1f			code for carriage return
 		bsr LD24C
-		decb
-		bne LD229
-		lda #$1f
-		bsr LD24C
-		sty V20D
+		sty V20D			save new command stream pointer
 LD248		ldd #$0102
 		rts
 LD24C		pshs a,b,x,y,u
 		tst V2AD
 		bne LD256
 		dod S19
-		dod S0F
+		showprompt
 LD256		ldu V211
 		cmpa #$1f
 		beq LD26F
@@ -2749,7 +2784,7 @@
 		beq LD2B4
 		tst V228
 		bne LD2B4
-		dod S0F
+		showprompt
 LD2B4		stu V211
 		puls a,b,x,y,u,pc
 LD2B8		jsr LCC31
@@ -2772,7 +2807,7 @@
 		lda 10,u
 		adda #12
 		ldb #$ff
-		dod S1C
+		playsound
 		lda 9,u
 		cmpa #$13
 		blt LD2F7
@@ -2801,7 +2836,7 @@
 LD319		dod S07
 		anda #3
 		bne LD375
-LD31F		dod S1B,$12
+LD31F		playsoundimm $12
 		renderstrimmp
 		fcb $16,$f7,$b0			packed "!!!" string
 		jsr LD40C
@@ -2818,7 +2853,7 @@
 		dec b,x
 		clr 12,u
 		dod S0E
-		dod S1B,$15
+		playsoundimm $15
 		ldd ,u
 		bsr LD37F
 		addd V217
@@ -2872,7 +2907,7 @@
 		fcb $3c,$0d,$29,$68
 		fcb $0a,$23,$20,$23
 		fcb $de,$dd,$ef,$60
-		dod S10
+		delay
 		ldu V224
 		stu V229
 		beq LD3C4
@@ -2978,7 +3013,7 @@
 		stx V2B2
 		dod S0E
 		rts
-LD489		dod S09
+LD489		cleargfx2
 		ldx ,u
 		ldu #V380
 		stx ,u
@@ -3145,7 +3180,7 @@
 		bne LD5EF
 		sta 9,u
 		dod S18
-		dod S1B,$0D
+		playsoundimm $0D
 		dod S0D
 		clr 7,u
 		cmpa #$12
@@ -3232,7 +3267,7 @@
 		stx V24F
 		clr V28B
 		dod S00
-		dod S08
+		cleargfx1
 		ldx #LD6C6
 		dod S01
 		ldx #$11
@@ -3297,7 +3332,7 @@
 		ldd V213
 		jsr LD136
 		beq LD738
-		dod S1B,$14
+		playsoundimm $14
 		dec ,s
 		ldd V213
 LD738		std V213
@@ -3311,7 +3346,7 @@
 		bne LD757
 		stx V224
 		jsr LD57D
-		dod S1B,$11
+		playsoundimm $11
 		dod S0E
 		rts
 LD757		tfr x,u
@@ -3348,7 +3383,7 @@
 LD792		ldb #$17
 		stb 9,u
 		clr 11,u
-		dod S1B,$0c
+		playsoundimm $0c
 		dod S0D
 		dod S0C
 		rts
@@ -3358,7 +3393,7 @@
 		sta V294
 		tst 11,u
 		bne LD7B6
-		dod S1B,$0e
+		playsoundimm $0e
 		clr V2AD
 		ldx #LCDB2
 		stx V2B2
@@ -3401,9 +3436,9 @@
 		fcb $80				V206
 		fcb 0				V207
 		fcb $4c				V208
-		fdb LD870			V209
-		fdb LD876			V20B
-		fdb LD988			V20D
+		fdb LD870			V209 - pointer to primary display screen info
+		fdb LD876			V20B - pointer to secondary display screen info
+		fdb LD988			V20D - pointer to demo game command sequence
 		fdb VB15			V20F
 		fdb V2F1			V211
 		fcb $0c				V213
@@ -3447,19 +3482,25 @@
 		fcb $04,$00,$00,$05
 		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		fcb $23,$00,$24,$00
-LD880		fcb $00,$00,$3B,$00
-LD884		fcb $3C,$00,$00,$00
-LD888		fcb $24,$00,$28,$00
-LD88C		fcb $00,$00,$3C,$00
-LD890		fcb $40,$00,$00,$00
+LD87C		fdb $2300			start address of status line on first screen
+		fdb $2400			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 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
+		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 0				dummy (SAM register setting)
 
 ; This is the keyword table used for command parsing. Each keyword is stored in packed format.
 ; Each keyword is preceded by a value which indicates the object type. Where the object type is
@@ -3566,21 +3607,29 @@
 		fcb 1				MOVE
 		fdb LD8B6
 		fcb $ff
+; jump table for commands
+LD9D0		fdb LD2B8			ATTACK
+		fdb LD44E			CLIMB
+		fdb LD550			DROP
+		fdb LD481			EXAMINE
+		fdb LD522			GET
+		fdb LD5BC			INCANT
+		fdb LC751			LOOK
+		fdb LD6D0			MOVE
+		fdb LD589			PULL
+		fdb LD623			REVEAL
+		fdb LD579			STOW
+		fdb LD63F			TURN
+		fdb LD741			USE
+		fdb LD7B7			ZLOAD
+		fdb LD7C7			ZSAVE
 
-LD9D0		fcb $D2,$B8,$D4,$4E
-LD9D4		fcb $D5,$50,$D4,$81
-LD9D8		fcb $D5,$22,$D5,$BC
-LD9DC		fcb $C7,$51,$D6,$D0
-LD9E0		fcb $D5,$89,$D6,$23
-LD9E4		fcb $D5,$79,$D6,$3F
-LD9E8		fcb $D7,$41,$D7,$B7
-LD9EC		fcb $D7,$C7
-
-LD9EE		fcb $DC,$19
-
-LD9F0		fcb $DC,$21,$DC,$2A
-LD9F4		fcb $DB,$FA,$DC,$0F
-LD9F8		fcb $DC,$07
+LD9EE		fdb LDC19
+		fdb LDC21
+		fdb LDC2A
+		fdb LDBFA
+		fdb LDC0F
+		fdb LDC07
 
 LD9FA		fcb $05,$01
 
@@ -3721,19 +3770,37 @@
 LDBEC		fcb $DC,$A9,$DC,$45
 LDBF0		fcb $01,$DC,$5D,$DC
 LDBF4		fcb $7B,$DC,$A2,$DC
-LDBF8		fcb $3C,$FF,$86,$AC
+LDBF8		fcb $3C,$FF
+
+LDBFA		fcb $86,$AC
+
 LDBFC		fcb $80,$C0,$7A,$BA
 LDC00		fcb $80,$A8,$FC,$3E
-LDC04		fcb $04,$00,$FE,$76
+LDC04		fcb $04,$00,$FE
+
+LDC07		fcb $76
+
 LDC08		fcb $3C,$FC,$F7,$FF
-LDC0C		fcb $2A,$00,$FE,$72
+LDC0C		fcb $2A,$00,$FE
+
+LDC0F		fcb $72
+
 LDC10		fcb $50,$7C,$64,$FF
 LDC14		fcb $76,$52,$72,$56
-LDC18		fcb $FE,$6E,$A2,$FC
+LDC18		fcb $FE
+
+LDC19		fcb $6E,$A2,$FC
+
 LDC1C		fcb $51,$0E,$B1,$00
-LDC20		fcb $FE,$7A,$3C,$FC
+LDC20		fcb $FE
+
+LDC21		fcb $7A,$3C,$FC
+
 LDC24		fcb $11,$1F,$FF,$F1
-LDC28		fcb $00,$FE,$76,$C2
+LDC28		fcb $00,$FE
+
+LDC2A		fcb $76,$C2
+
 LDC2C		fcb $FC,$1F,$34,$F1
 LDC30		fcb $DC,$00,$FE,$10
 LDC34		fcb $1B,$26,$40,$72