changeset 32:8a94218c2a4c

Decode object creation for new game. Decoded object creation for a new game. This includes the table that specifies which objects and how many of each need to be created for each level.
author William Astle <lost@l-w.ca>
date Fri, 26 Dec 2014 19:20:30 -0700
parents 5a661416e322
children 28a84507a829
files dod.s
diffstat 1 files changed, 38 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Fri Dec 26 18:55:05 2014 -0700
+++ b/dod.s	Fri Dec 26 19:20:30 2014 -0700
@@ -444,23 +444,23 @@
 		bra LC076
 LC084		puls cc,a,b,x,y,u,pc
 LC086		bsr LC053			; initialize new level data
-		ldu #LDA91			; point to objects to create for demo game
+		ldu #LDA91			; point to objects to create for game
 		clra				; initialize object type
 LC08C		ldb ,u				; get object info
 		andb #$0f			; get low nibble
-		stb V28C			; save number to create
+		stb V28C			; save number to create (total)
 		ldb ,u+				; get object info again
-		lsrb				; get high nibble
+		lsrb				; get high nibble (object starting level)
 		lsrb
 		lsrb
 		lsrb
-		stb V28D
+		stb V28D			; save starting level
 LC09A		createobject			; create an object
-		dec 5,x
-		incb
-		cmpb #5
-		ble LC0A5
-		ldb V28D
+		dec 5,x				; mark as equipped or carried
+		incb				; bump level
+		cmpb #5				; was it level 5?
+		ble LC0A5			; brif yes
+		ldb V28D			; get level back
 LC0A5		dec V28C			; created enough objects?
 		bne LC09A			; brif not
 		inca				; move to next object type
@@ -477,7 +477,7 @@
 		fcb $da,$cc,$63,$09
 		fcb $48
 		clr V2B7			; reset text rendering to standard mode
-		rts					
+		rts				; transfer control to correct game loop
 dodemo		dec waitnewgame			; flag demo game
 		bsr enablepiairq		; set up interrupts and sound
 		ldx #img_wizard			; point to wizard image
@@ -522,7 +522,7 @@
 LC139		lda ,u+				; get object to create
 		bmi LC14F			; brif end of list
 		createobject			; create requested object
-		inc 5,x
+		inc 5,x				; mark object as in inventory or equipeed
 		exg x,u				; swap object pointer and list pointer
 		setobjectspecs			; set the specs properly (as in fully revealed)
 		exg x,u				; swap pointers back
@@ -1346,12 +1346,13 @@
 		dec pageswap			; set graphic swap required
 		rts				; return to caller
 ; swi 23 routine
+; Create a new object. Associate it with the level number in B. Object type in A.
 LC6FB		ldu objectfree			; fetch free point in object table
 		stu 6,s				; save pointer for return
 		leax 14,u			; move to next entry in table
 		stx objectfree			; save as new free point in object table
 		sta 9,u				; set object type to requested type
-		stb 4,u
+		stb 4,u				; set object level
 		setobjectspecs			; set up object specs from data tables
 		ldb 10,u			; fetch object general type
 		ldx #LC719			; point to modifier table
@@ -3825,14 +3826,31 @@
 		fcb $10,$6C,$80,$00		; leather shield
 		fcb $18,$00,$00,$00		; dead torch
 		fcb $FF				; end of table
-
-LDA91		fcb $41,$31,$31
-
-LDA94		fcb $32,$23,$23,$11
-LDA98		fcb $13,$16,$14,$14
-LDA9C		fcb $16,$01,$04,$08
-LDAA0		fcb $08,$03,$04
-
+; This is the table of objects to create for a game. Each entry corresponds to
+; a single object type. The first nibble is the minimum level number on which it
+; appears. The second nibble is the number of objects of that type to generate.
+; Generation starts at the specified level and creates one object assigned to
+; that level. Then it creates another assigned to the next level, and so on.
+; If it gets to level 5, it will reset to the minimum level. It cycles like this
+; until there are the specified number of objects in the entire game.
+LDA91		fcb $41				; 1 supreme ring, level 5
+		fcb $31				; 1 joule ring, level 4
+		fcb $31				; 1 elvish sword, level 4
+		fcb $32				; 1 mithril shield each, level 4 and 5
+		fcb $23				; 1 seer scroll each, level 3-5
+		fcb $23				; 1 thews flask each, level 3-5
+		fcb $11				; 1 rime ring, level 2
+		fcb $13				; 1 vision scrool each, level 2-4
+		fcb $16				; 2 abye flask each, level 2-3; 1 abye flask each level 4-5
+		fcb $14				; 1 hale flask each, level 2-5
+		fcb $14				; 1 solar torch each, level 2-5
+		fcb $16				; 2 bronze shield each, level 2-3; 1 bronze shield each, level 4-5
+		fcb $01				; 1 vulcan ring, level 1
+		fcb $04				; 1 iron sword each, level 1-4
+		fcb $08				; 2 lunar torch each, level 1-3; 1 lunar torch each, level 4-5
+		fcb $08				; 2 pine torch each, level 1-3; 1 pine torch each, level 4-5
+		fcb $03				; 1 leather shield each, level 1-3
+		fcb $04				; 1 wooden sword each, level 1-4
 ; pointers to creature images
 LDAA3		fdb LDE26
 		fdb LDFCA