changeset 40:37d79ba45284

Decoded GET and DROP commands Decoded GET and DROP. Also improved comments for STOW and added some missing comments.
author William Astle <lost@l-w.ca>
date Sat, 27 Dec 2014 00:45:52 -0700
parents 8fd288f0b01c
children 1152ddbb3781
files dod.s
diffstat 1 files changed, 49 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Sat Dec 27 00:37:47 2014 -0700
+++ b/dod.s	Sat Dec 27 00:45:52 2014 -0700
@@ -3329,57 +3329,57 @@
 		skip2				; move on with routine
 LD51E		bsr LD4FE			; do a newline
 		puls a,b,x,pc			; restore registers and return
-cmd_get		bsr LD576
-		bne LD573
-		jsr parseobj
-		clr V291
-LD52B		ldd playerloc
-		jsr LCF53
-		beq LD573
-		tst parsegenobj
-		bne LD53C
-		lda 10,x
-		cmpa parseobjtypegen
-		bra LD540
-LD53C		lda 9,x
-		cmpa parseobjtype
-LD540		bne LD52B
-		stx ,u
-		inc 5,x
-		ldb 10,x
-		ldx #LD9FA
-		ldb b,x
-		clra
-		bra LD56B
-cmd_drop	bsr LD576
-		beq LD573
-		clra
+cmd_get		bsr LD576			; go parse hand and return pointer to it
+		bne LD573			; brif no direction
+		jsr parseobj			; go parse an object
+		clr V291			; reset object iterator
+LD52B		ldd playerloc			; get current dungeon location
+		jsr LCF53			; fetch next object
+		beq LD573			; brif no more objects
+		tst parsegenobj			; did we get a generic object type?
+		bne LD53C			; brif not
+		lda 10,x			; get object type we're looking at
+		cmpa parseobjtypegen		; does it match?
+		bra LD540			; go finish up
+LD53C		lda 9,x				; get specific object type
+		cmpa parseobjtype		; does it match?
+LD540		bne LD52B			; brif not - try another
+		stx ,u				; put object in selected hand
+		inc 5,x				; mark as not on floor
+		ldb 10,x			; get object general type
+		ldx #LD9FA			; point to weight table
+		ldb b,x				; get object weight
+		clra				; zero extend
+		bra LD56B			; go adjust carried weight
+cmd_drop	bsr LD576			; parse a hand and get pointer
+		beq LD573			; brif no hand
+		clra				; NULL Pointer
 		clrb
-		std ,u
-		clr 5,x
-		ldd playerloc
-		std 2,x
-		lda currentlevel
-		sta 4,x
-		ldb 10,x
-		ldx #LD9FA
-		ldb b,x
-		negb
-		sex
-LD56B		addd carryweight
-		std carryweight
-		checkdamage
-		bra LD5B7
-LD573		jmp badcommand
-LD576		jmp LCC31
+		std ,u				; empty the hand out
+		clr 5,x				; mark object as on floor
+		ldd playerloc			; get dungeon location
+		std 2,x				; set object location
+		lda currentlevel		; get current level
+		sta 4,x				; set object level
+		ldb 10,x			; get object general type
+		ldx #LD9FA			; point to weight table
+		ldb b,x				; get weight of object
+		negb				; negate it for subtraction
+		sex				; sign extend
+LD56B		addd carryweight		; add weight adjustment to carried weight
+		std carryweight			; save new carried weight
+		checkdamage			; go update the damage situation
+		bra LD5B7			; update display and return
+LD573		jmp badcommand			; complain about bad command
+LD576		jmp LCC31			; go parse a hand and return pointer
 cmd_stow	bsr LD576			; get pointer to object in requested hand
 		beq LD573			; brif no object in the hand
-LD57D		ldd backpack			; add this item to the start of the backpack list
-		std ,x
-		stx backpack
-		clra				; mark the selected hand as empty
+LD57D		ldd backpack			; get first item in backpack
+		std ,x				; make it the next item in the list
+		stx backpack			; make this item the first item in the backpack
+		clra				; NULL pointer
 		clrb
-		std ,u
+		std ,u				; mark selected hand empty
 		bra LD5B7			; update status line, etc.
 cmd_pull	bsr LD576			; fetch pointer to object in specified hand
 		bne LD573			; brif there is something in that hand
@@ -3405,8 +3405,8 @@
 		bne LD5B7			; brif not
 		std curtorch			; turn off current torch
 LD5B7		updatestatus			; update status line to reflect new hand contents
-		updatedungeon
-		rts
+		updatedungeon			; update the dungeon display
+		rts				; return to caller
 cmd_incant	ldx #kwlist_adj
 		jsr LCBEC
 		ble LD5EF