changeset 41:1152ddbb3781

Decoded INCANT command.
author William Astle <lost@l-w.ca>
date Sat, 27 Dec 2014 00:51:24 -0700
parents 37d79ba45284
children ae9b5c72c3f3
files dod.s
diffstat 1 files changed, 28 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Sat Dec 27 00:45:52 2014 -0700
+++ b/dod.s	Sat Dec 27 00:51:24 2014 -0700
@@ -3407,48 +3407,48 @@
 LD5B7		updatestatus			; update status line to reflect new hand contents
 		updatedungeon			; update the dungeon display
 		rts				; return to caller
-cmd_incant	ldx #kwlist_adj
-		jsr LCBEC
-		ble LD5EF
-		tst V27B
+cmd_incant	ldx #kwlist_adj			; point to object types list
+		jsr LCBEC			; look up object
+		ble LD5EF			; brif not found in list or no type specified
+		tst V27B			
 		beq LD5EF
 		std parseobjtype
-		ldu lefthand
-		bsr LD5D0
-		ldu righthand
-LD5D0		beq LD5EF
-		lda 10,u
-		cmpa #1
-		bne LD5EF
-		lda 7,u
-		beq LD5EF
-		cmpa parseobjtype
-		bne LD5EF
-		sta 9,u
-		setobjectspecs
-		playsoundimm $0D
-		updatestatus
-		clr 7,u
-		cmpa #$12
-		beq LD5F0
-LD5EF		rts
-LD5F0		ldx #img_goodwiz
+		ldu lefthand			; get left hand object
+		bsr LD5D0			; check if matching object is there
+		ldu righthand			; get right hand object and continue
+LD5D0		beq LD5EF			; brif no object carried
+		lda 10,u			; get general type
+		cmpa #1				; is it a ring?
+		bne LD5EF			; brif not
+		lda 7,u				; get incant to type
+		beq LD5EF			; brif there isn't one
+		cmpa parseobjtype		; does it match the one we incanted?
+		bne LD5EF			; brif not
+		sta 9,u				; set new type to the incanted type
+		setobjectspecs			; reset object specs
+		playsoundimm $0D		; play the ring sound
+		updatestatus			; update the status area
+		clr 7,u				; mark ring as incanted
+		cmpa #$12			; is it the FINAL ring?
+		beq LD5F0			; brif so
+LD5EF		rts				; return to caller
+LD5F0		ldx #img_goodwiz		; point to good wizard image
 		dec V29E
-		fadeinclrst
-		renderstrimmp
+		fadeinclrst			; fade in the wizard
+		renderstrimmp			; display victory message line 1
 		fcb $ff,$c4,$54,$3d		; packed string victory message line 1
 		fcb $84,$d8,$08,$59
 		fcb $D1,$2e,$c8,$03
 		fcb $70,$a6,$93,$05
 		fcb $10,$50,$20,$2e
 		fcb $20
-		renderstrimmp
+		renderstrimmp			; dispaly victory message line 2
 		fcb $c8,$00,$00,$00		; packed string victory message line 2
 		fcb $00,$03,$cc,$00
 		fcb $81,$c5,$b8,$2e
 		fcb $9d,$06,$44,$f7
 		fcb $bc
-LD621		bra LD621
+LD621		bra LD621			; Do nothing until IRQ decides something should happen
 cmd_reveal	jsr LCC31
 		ldu ,u
 		beq LD63E