changeset 28:81d1282860e5

Identified creature counts data Identified initial creature count data. Also identified where the creature counts are stored at run time.
author William Astle <lost@l-w.ca>
date Fri, 26 Dec 2014 11:42:20 -0700
parents 811c4d1ee25d
children b431d0f1fbef
files dod.s
diffstat 1 files changed, 35 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Fri Dec 26 11:23:12 2014 -0700
+++ b/dod.s	Fri Dec 26 11:42:20 2014 -0700
@@ -299,8 +299,9 @@
 V27C		rmb 1
 V27D		rmb 1
 V27E		rmb 3
-V281		rmb 1
-V282		rmb 4
+currentlevel	rmb 1				; currently playing dungeon level
+creaturecountptr rmb 2				; pointer to creature count table for the current level
+V284		rmb 2
 V286		rmb 2
 V288		rmb 2
 V28A		rmb 1
@@ -369,8 +370,11 @@
 V394		rmb 2				; current cursor position in entry area
 V396		rmb 1				; background colour mask of background area
 V397		rmb 1				; nonzero if main text should not be rendered on secondary screen
-V398		rmb 43
-V3C3		rmb 17
+creaturecounts	rmb 12				; creature counts for level 1
+		rmb 12				; creature counts for level 2
+		rmb 12				; creature counts for level 3
+		rmb 12				; creature counts for level 4
+		rmb 12				; creature counts for level 5
 V3D4		rmb $220
 mazedata	rmb $400
 V9F4		rmb 9
@@ -1394,12 +1398,12 @@
 		dod S0E
 		rts
 ; swi 26 routine
-LC759		sta V281
-		ldb #12
-		mul
-		addd #V398
-		std V282
-		ldb V281
+LC759		sta currentlevel		; save current dungeon level
+		ldb #12				; number of entries in creature count table
+		mul				; calculate offset to creature counts for this level
+		addd #creaturecounts		; point to correct creature count table for this level
+		std creaturecountptr		; save pointer to creature count table
+		ldb currentlevel		; get back current level number
 		ldx #LCFFD
 LC768		stx V286
 LC76A		lda ,x+
@@ -1411,7 +1415,7 @@
 		clearblock			; go clear area to zeros
 		jsr LC053
 		jsr LCC9C
-		ldu V282
+		ldu creaturecountptr
 		lda #11
 LC783		ldb a,u
 		beq LC78D
@@ -1420,7 +1424,7 @@
 		bne LC787
 LC78D		deca
 		bpl LC783
-		ldu #V3C3
+		ldu #V3D4-17
 		clr V291
 LC795		jsr LCF63
 		beq LC7B6
@@ -1436,7 +1440,7 @@
 		stx 8,u
 		std ,x
 		bra LC795
-LC7B6		lda V281
+LC7B6		lda currentlevel
 		anda #1
 		nega
 		sta levbgmask
@@ -2173,7 +2177,7 @@
 		ldu #V9F4			; get end address
 		setblock			; go set block to $ff
 		ldx #LCD9F
-		ldb V281
+		ldb currentlevel
 		abx
 		ldd ,x++
 		std V26B
@@ -2332,7 +2336,7 @@
 		ldd #8
 		bsr LCE1D
 		bra LCDE3
-LCDF7		ldx #V3C3
+LCDF7		ldx #V3D4-17
 LCDFA		leax $11,x
 		cmpx #mazedata
 		beq LCE2B
@@ -2498,7 +2502,7 @@
 		andcc #$fb
 LCF62		rts
 LCF63		pshs a
-		lda V281
+		lda currentlevel
 		ldx V292
 		tst V291
 		bne LCF72
@@ -2512,7 +2516,7 @@
 		bne LCF72
 		andcc #$fb
 LCF80		puls a,pc
-LCF82		ldx #V3C3
+LCF82		ldx #V3D4-17
 LCF85		leax $11,x
 		cmpx #mazedata
 		beq LCF96
@@ -2529,7 +2533,7 @@
 		beq LCF99
 		puls a,b,x,pc
 LCFA5		pshs a,b,x,y,u
-LCFA7		ldu #V3C3
+LCFA7		ldu #V3D4-17
 LCFAA		leau $11,u
 		tst 12,u
 		bne LCFAA
@@ -2581,7 +2585,7 @@
 LD01D		fcb $05,$00,$00,$16
 LD021		fcb $1c,$00,$1f,$10
 LD025		fcb $80,$80
-LD027		ldx V282
+LD027		ldx creaturecountptr
 		ldb #11
 		clra
 LD02C		adda b,x
@@ -2956,7 +2960,7 @@
 LD31F		playsoundimm $12		; play the "HIT" sound
 		renderstrimmp			; display the "!!!" for a successful hit
 		fcb $16,$f7,$b0			; packed "!!!" string
-		jsr LD40C
+		jsr LD40C			; calculate damage, apply to victim
 		bhi LD375
 		leax 8,u
 LD32E		ldx ,x
@@ -2965,10 +2969,10 @@
 		ldd 15,u
 		std 2,x
 		bra LD32E
-LD33A		ldx V282
-		ldb 13,u
-		dec b,x
-		clr 12,u
+LD33A		ldx creaturecountptr		; point to creature count table for this level
+		ldb 13,u			; get type of creature killed
+		dec b,x				; reduce number of this creature type
+		clr 12,u			
 		dod S0E
 		playsoundimm $15		; play the "kill" sound
 		ldd ,u				; fetch creature power level
@@ -3124,7 +3128,7 @@
 		cmpb #1
 		bne LD46F
 LD478		showprepare
-		adda V281
+		adda currentlevel
 		dod S1A
 		dod S19
 		rts
@@ -3232,7 +3236,7 @@
 		clr 5,x
 		ldd V213
 		std 2,x
-		lda V281
+		lda currentlevel
 		sta 4,x
 		ldb 10,x
 		ldx #LD9FA
@@ -3587,21 +3591,11 @@
 		fdb 0				; V394 - text cursor is at top of area
 		fcb 0				; V396 - background is black
 		fcb 0				; V397 - do render on secondary screen
-		fcb $09,$09,$04,$02
-		fcb $00,$00,$00,$00
-		fcb $00,$00,$00,$00
-		fcb $02,$04,$00,$06
-		fcb $06,$06,$00,$00
-		fcb $00,$00,$00,$00
-		fcb $00,$00,$00,$04
-		fcb $00,$06,$08,$04
-		fcb $00,$00,$01,$00
-		fcb $00,$00,$00,$00
-		fcb $00,$00,$08,$06
-		fcb $06,$04,$00,$00
-		fcb $02,$02,$02,$02
-		fcb $02,$02,$02,$04
-		fcb $04,$08,$00,$01
+		fcb 9,9,4,2,0,0,0,0,0,0,0,0	; initial creature counts for level 1
+		fcb 2,4,0,6,6,6,0,0,0,0,0,0	; initial creature counts for level 2
+		fcb 0,0,0,4,0,6,8,4,0,0,1,0	; initial creature counts for level 3
+		fcb 0,0,0,0,0,0,8,6,6,4,0,0	; initial creature counts for level 4
+		fcb 2,2,2,2,2,2,2,4,4,8,0,1	; initial creature counts for level 5
 		fcb 4
 		fdb emptyhand+10
 		fcb $04,$00,$00,$05		; empty hand attack data