changeset 35:7072cfd10af3

Fill in various bits and give various variables friendly names Fill in and correct various comments. Also give friendly names to various variables that have been identified.
author William Astle <lost@l-w.ca>
date Fri, 26 Dec 2014 22:01:53 -0700
parents acf702e04bdf
children 25ba333c286e
files dod.s
diffstat 1 files changed, 133 insertions(+), 129 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Fri Dec 26 21:33:20 2014 -0700
+++ b/dod.s	Fri Dec 26 22:01:53 2014 -0700
@@ -125,6 +125,10 @@
 updatestatus	macro noexpand
 		dod S0D
 		endm
+; update dungeon display
+updatedungeon	macro noexpand
+		dod S0E
+		endm
 ; do a newline, show prompt, and cursor
 showprompt	macro noexpand
 		dod S0F
@@ -241,7 +245,7 @@
 screendraw	rmb 2				; pointer to the parameter block of the screen to use for drawing
 V20D		rmb 2				; pointer to demo game command sequence
 objectfree	rmb 2				; pointer to next free object data slot
-V211		rmb 2
+linebuffptr		rmb 2				; line input buffer pointer
 playerloc	rmb 1				; current player position in maze (Y)
 V214		rmb 1				; current player position in maze (X)
 carryweight	rmb 2
@@ -336,7 +340,7 @@
 		rmb 2				; 1 minute tick event list
 		rmb 2				; 1 hour tick event list
 V2AB		rmb 2				; the "ready" list (also 1 day tick event list)
-V2AD		rmb 1
+V2AD		rmb 1				; nonzero will cause the command processor to clear and reset on input
 V2AE		rmb 1
 V2AF		rmb 1
 V2B0		rmb 1
@@ -352,18 +356,17 @@
 keybufread	rmb 1				; keyboard buffer read offset
 keybufwrite	rmb 1				; keyboard buffer write offset
 		rmb 3
-V2C1		rmb 1				; temporary variable used during line drawing and division
-V2C2		rmb 1				; temporary variable used during division
-V2C3		rmb 1				; temporary variable used during division
-V2C4		rmb 1
-V2C5		rmb 1
-V2C6		rmb 1
-V2C7		rmb 10
+accum0		rmb 3				; temporary 24 bit accumulator
+accum1		rmb 3				; temporary 24 bit accumulator
+accum2		rmb 1				; temporary 8 bit accumulator
+		rmb 9
 keybuf		rmb 32				; keyboard ring buffer
-V2F1		rmb 32
-V311		rmb 2
-wordbuff	rmb 32
-V333		rmb 2
+linebuff	rmb 32				; line input buffer
+linebuffend	equ *				; end of line input buffer		
+		rmb 2
+wordbuff	rmb 32				; buffer used for parsing words from the line
+wordbuffend	equ *				; end of word buffer		
+		rmb 2
 stringbuf	rmb 34				; temporary buffer used for decoding immediate packed strings
 fontbuf		rmb 10				; temporary buffer used for decoding font data
 V361		rmb 31
@@ -387,13 +390,13 @@
 		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
-V9FD		rmb $10a
+creaturetab	rmb 32*17			; the creatures currently active on this level
+mazedata	rmb $400			; the actual room data for the current level
+neighbourbuff	rmb 9				; buffer for calculating neighbors in maze generation
+schedtab	rmb $10a			; scheduler entries
 emptyhand	rmb 14				; "object" information for empty hand
 objecttab	rmb 72*14			; the object data table (room for 72 entries)
-VF05		equ *
+datatop		equ *
 
 
 		org $c000
@@ -440,7 +443,7 @@
 LC05A		clr ,x+				; clear a byte
 		cmpx #V2AD			; are we finished clearing things?
 		blo LC05A			; brif not
-		ldx #V9FD			; start of the sceduling list
+		ldx #schedtab			; start of the sceduling list
 		stx V2B9			; mark that as the end of it
 LC066		clr ,x+				; clear more data
 		cmpx #emptyhand			; end of area to clear?
@@ -548,7 +551,7 @@
 		ldx #displayscroll		; set to scroll display
 		stx displayptr
 		dec V294			; set to show creatures on map
-		dod S0E				; show the dungeon map
+		updatedungeon			; show the dungeon map
 		delay				; delay for about 2.5 seconds
 		delay
 		clr disablesched		; enable scheduling events
@@ -585,7 +588,7 @@
 		std BLKTYP
 		stx CBUFAD			; set start of buffer to write
 		romcall BLKOUT			; write a data block
-		cmpx #VF05			; have we reached end of state?
+		cmpx #datatop			; have we reached end of state?
 		blo LC1A6			; brif not
 		stu BLKTYP			; write trailing block
 		romcall BLKOUT
@@ -1115,37 +1118,37 @@
 ; swi 12 routine
 ; Check for fainting or recovery from damage and handle the fading out and fading in as a result.
 ; Also check for death due to damage level exceeding power level.
-LC529		clr V2C1			; mark high bits of 24 bit accumulator
+LC529		clr accum0			; mark high bits of 24 bit accumulator
 		ldd powerlevel			; get current power level
-		std V2C2			; save it in accumulator
+		std accum0+1			; save it in accumulator
 		lda #6				; shift left 6 bits (times 64)
-LC531		lsl V2C3			;* do one left shift
-		rol V2C2			;*
-		rol V2C1			;*
+LC531		lsl accum0+2			;* do one left shift
+		rol accum0+1			;*
+		rol accum0			;*
 		deca				; done enough shifts?
 		bne LC531			; brif not
-		clr V2C4			; clear high bits of 24 bit accumulator
+		clr accum1			; clear high bits of 24 bit accumulator
 		ldd damagelevel			; get damage level
-		std V2C5			; stow in accumulator
-		lsl V2C6			;* shift left (times 2)
-		rol V2C5			;*
-		rol V2C4			;*
+		std accum1+1			; stow in accumulator
+		lsl accum1+2			;* shift left (times 2)
+		rol accum1+1			;*
+		rol accum1			;*
 		ldd powerlevel			; get current power level
-		addd V2C5			; add in half damage level
-		std V2C5			; save low word
-		ldb V2C4			;* propagate carry
+		addd accum1+1			; add in half damage level
+		std accum1+1			; save low word
+		ldb accum1			;* propagate carry
 		adcb #0				;*
-		stb V2C4			;*
-		clr V2C7			; clear high bits of 24 bit accumulator
-LC554		ldd V2C2			; get low bits of powerlevel/64
-		subd V2C5			; subtract (powerlevel + damagelevel * 2)
-		std V2C2			; save low word
-		lda V2C1			; fetch msb of powerlevel/64
-		sbca V2C4			; finish subtracting with msb of (powerlevel + damagelevel * 2)
-		sta V2C1			; save it in msb of result
-		inc V2C7			; bump lsb of result
-		bcc LC554			; brif no carry from addition
-		lda V2C7			; get low bits
+		stb accum1			;*
+		clr accum2			; initialize quotient
+LC554		ldd accum0+1			; get low bits of powerlevel/64
+		subd accum1+1			; subtract (powerlevel + damagelevel * 2)
+		std accum0+1			; save low word
+		lda accum0			; fetch msb of powerlevel/64
+		sbca accum1			; finish subtracting with msb of (powerlevel + damagelevel * 2)
+		sta accum0			; save it in msb of result
+		inc accum2			; bump quotient
+		bcc LC554			; brif no carry from addition - we haven't got a result yet
+		lda accum2			; get division result
 		suba #19			; subtract 19
 		sta V2AF			; save number of ticks before redoing the calculation
 		tst nokeyboard			; are we blocking the keyboard?
@@ -1260,8 +1263,8 @@
 		puls a,x,pc			; restore registers and return
 LC650		fcb $05,$0d,$10,$14,$19,$ff	; unpacked string "EMPTY"
 ; swi 14 routine
-LC656		tst nokeyboard
-		bne LC65F
+LC656		tst nokeyboard			; is keyboard disabled?
+		bne LC65F			; brif so - return, don't update display
 		bsr LC660			; go update the display
 		dec pageswap			; flag graphics swap required
 		sync				; wait for swap to happen
@@ -1412,12 +1415,12 @@
 		clearcommand			; clear the command area
 		checkdamage			; update damage information
 		inc V2AE
-		dec V2AD
+		dec V2AD			; set command processing to proceed normally
 		dec V2B1
 		updatestatus			; update status line to current information
 cmd_look	ldx #LCE66			; standard dungeon view routine
 		stx displayptr			; restore display to standard dungeon view
-		dod S0E				; update display
+		updatedungeon			; update display
 		rts				; return to caller
 ; swi 26 routine
 LC759		sta currentlevel		; save current dungeon level
@@ -1432,7 +1435,7 @@
 		bpl LC76A			; brif we didn't consume a flag
 		decb				; are we at the right set of data for the level?
 		bpl LC768			; brif not - save new pointer and search again
-		ldx #V3D4			; get start address to clear
+		ldx #creaturetab		; get start address to clear
 		ldu #mazedata			; get end address to clear
 		clearblock			; go clear area to zeros
 		jsr LC053			; initialize data for new level
@@ -1446,7 +1449,7 @@
 		bne LC787			; brif not
 LC78D		deca				; move on to next creature
 		bpl LC783			; brif not finished all creatures
-		ldu #V3D4-17			; point to creature table
+		ldu #creaturetab-17		; point to creature table
 		clr V291
 LC795		jsr LCF63			
 		beq LC7B6
@@ -1455,7 +1458,7 @@
 LC79E		leau 17,u
 		cmpu #mazedata
 		blo LC7AA
-		ldu #V3D4
+		ldu #creaturetab
 LC7AA		tst 12,u
 		beq LC79E
 		ldd 8,u
@@ -1892,23 +1895,23 @@
 LCA67		pshs a,b,x			; make hole for result and save divisor
 		clr ,s				;* initialize quotient
 		clr 1,s				;*
-		clr V2C1			; use V2C1 for extra precision on dividend
-		std V2C2			; save dividend
+		clr accum0			; use accum0 for extra precision on dividend
+		std accum0+1			; save dividend
 		beq LCA97			; brif dividend is zero - nothing to do
 		cmpd 2,s			; is dividend equal to divisor?
 		bne LCA7C			; brif not
 		inc ,s				; set quotient to 1.0
 		bra LCA97			; go return
 LCA7C		ldx #16				; we need to do 16 iterations
-LCA7F		lsl V2C3			;* shift dividend
-		rol V2C2			;*
-		rol V2C1			;*
+LCA7F		lsl accum0+2			;* shift dividend
+		rol accum0+1			;*
+		rol accum0			;*
 		lsl 1,s				;= shift quotient
 		rol ,s				;=
-		ldd V2C1			; get dividend high word
+		ldd accum0			; get dividend high word
 		subd 2,s			; subtract out divisor
 		bcs LCA93			; brif it doesn't go
-		std V2C1			; save new dividend residue
+		std accum0			; save new dividend residue
 		inc 1,s				; record the fact that it went
 LCA93		leax -1,x			; have we done all 16 bits?
 		bne LCA7F			; brif not
@@ -1948,7 +1951,7 @@
 ; xystep	the offset for when Y coordinate goes to a new line
 ; drawstart	the start address of the graphics screen area the line is within
 ; drawend	the end address of the graphics screen area the line is within
-; V2C1		a temporary scratch variable
+; accum0		a temporary scratch variable
 ;
 ; Note: ypstep+1 and xpstep+1 are also used as temporary holding values for the
 ; integer difference in the Y and X coordinates respectively.
@@ -2033,7 +2036,7 @@
 		sta ,x				; save new graphics data on the screen
 LCB54		lda xcur+1			; get X coordinate lsb
 		anda #$f8			; mask off the pixel offset in the byte
-		sta V2C1			; save it for later
+		sta accum0			; save it for later
 		ldd xcur+1			; get X coordinate low bits
 		addd xpstep+1			; add in X difference
 		std xcur+1			; save new low bits for X coordinate
@@ -2041,18 +2044,18 @@
 		adcb xpstep			; add in difference high bits
 		stb xcur			; save new X coordinate high bits
 		anda #$f8			; mask off pixel offset in data byte
-		cmpa V2C1			; are we in the same byte?
+		cmpa accum0			; are we in the same byte?
 		beq LCB70			; brif so
 		ldb xbstep			; get byte X step value 
 		leax b,x			; move pointer appropriately
 LCB70		ldd ycur+1			; get Y coord low bits
-		sta V2C1			; save screen Y coordinate
+		sta accum0			; save screen Y coordinate
 		addd ypstep+1			; add in Y step value low bits
 		std ycur+1			; save new low bits
 		ldb ycur			; get Y coord high bits
 		adcb ypstep			; add in Y step value high bits
 		stb ycur			; save new Y coord high bits
-		cmpa V2C1			; are we on the same scren row?
+		cmpa accum0			; are we on the same scren row?
 		beq LCB86			; brif so
 		ldb xystep			; get Y byte step value
 		leax b,x			; move pointer appropriately
@@ -2063,7 +2066,7 @@
 LCB8E		fcb $80,$40,$20,$10		; pixels 0, 1, 2, 3 (left to right) in byte
 		fcb $08,$04,$02,$01		; pixels 4, 5, 6, 7 (left to right) in byte
 LCB96		pshs a,x,u			; save registers
-		ldx V211			; get input buffer/line pointer
+		ldx linebuffptr			; get input buffer/line pointer
 		ldu #wordbuff			; point to word buffer
 LCB9D		lda ,x+				; get character from input
 		beq LCB9D			; brif end of line
@@ -2071,11 +2074,11 @@
 LCBA3		lda ,x+				; get new character from input
 LCBA5		ble LCBAF			; brif not valid character
 		sta ,u+				; save filename character
-		cmpu #V333			; are we at the end of the buffer?
+		cmpu #wordbuffend		; are we at the end of the buffer?
 		blo LCBA3			; brif not - check another
 LCBAF		lda #$ff			; put end of word marker
 		sta ,u+
-		stx V211			; save new input pointer location
+		stx linebuffptr			; save new input pointer location
 		tst wordbuff			; set flags for whether we have a word
 		puls a,x,u,pc			; restore registers and return
 ; Parse an object from command line
@@ -2228,7 +2231,7 @@
 		std V288			; save new coordinate
 		tst ,x				; is this room open?
 		beq LCCCA			; brif so - move to next
-		ldu #V9F4			; point to temporary storage area
+		ldu #neighbourbuff		; point to temporary storage area
 		jsr LCC49			; set bytes to FF or 00 depending on whether the rooms in the 3x3 area are open
 		lda 3,u				; get W room
 		adda ,u				; add data for NW room
@@ -2257,7 +2260,7 @@
 		inca				; is ot open?
 		beq LCD41			; brif not
 		ldd V27C			; get coordinates
-		ldu #V9F4			; point to temp area
+		ldu #neighbourbuff		; point to temp area
 		jsr LCC49			; calculate neighbors
 		lda ,x				; get room data at current room
 		ldb #$ff			; data for "no room"
@@ -2371,7 +2374,7 @@
 		ldd #8				; object location symbol
 		bsr LCE1D			; display symbol
 		bra LCDE3			; go check another object
-LCDF7		ldx #V3D4-17			; point to creature table
+LCDF7		ldx #creaturetab-17		; point to creature table
 LCDFA		leax $11,x			; move to next creature
 		cmpx #mazedata			; are we at the end of the creature table?
 		beq LCE2B			; brif so
@@ -2420,6 +2423,7 @@
 		sta V24F
 		sta V250
 		puls a,x,pc
+; This is the routine that shows the regular dungeon view.
 LCE66		cleargfx2
 		clr V28B
 		ldd playerloc
@@ -2428,7 +2432,7 @@
 		ldd V27C
 		jsr LCC7B
 		lda ,x
-		ldu #V9F4
+		ldu #neighbourbuff
 		ldx #4
 LCE7D		tfr a,b
 		andb #3
@@ -2439,7 +2443,7 @@
 		leax -1,x
 		bne LCE7D
 		ldb V223
-		ldu #V9F4
+		ldu #neighbourbuff
 		leau b,u
 		ldy #LDBDE
 LCE96		lda ,y+
@@ -2551,15 +2555,15 @@
 		bne LCF72			; brif not - look for another object
 		andcc #$fb			; turn off Z flag for object found
 LCF80		puls a,pc			; restore registers and return
-LCF82		ldx #V3D4-17
-LCF85		leax $11,x
-		cmpx #mazedata
-		beq LCF96
-		cmpd 15,x
-		bne LCF85
-		tst 12,x
-		beq LCF85
-LCF96		rts
+LCF82		ldx #creaturetab-17		; point to creature table
+LCF85		leax $11,x			; move to next entry
+		cmpx #mazedata			; end of table?
+		beq LCF96			; brif so
+		cmpd 15,x			; is the creature in the desired maze location
+		bne LCF85			; brif not - check another
+		tst 12,x			; is the creature alive?
+		beq LCF85			; brif not - check another
+LCF96		rts				; return to caller, Z clear if we found a creature
 LCF97		pshs a,b,x
 LCF99		jsr LCC71
 		std ,s
@@ -2568,7 +2572,7 @@
 		beq LCF99
 		puls a,b,x,pc
 LCFA5		pshs a,b,x,y,u
-LCFA7		ldu #V3D4-17
+LCFA7		ldu #creaturetab-17
 LCFAA		leau $11,u
 		tst 12,u
 		bne LCFAA
@@ -2672,7 +2676,7 @@
 		stx 8,y
 		std ,x
 		dec 5,x
-		dod S0E
+		updatedungeon
 LD06A		jmp LD103
 LD06D		ldd 15,y
 		cmpd playerloc
@@ -2750,7 +2754,7 @@
 		ldx 15,y
 		cmpx playerloc
 		bne LD111
-		dod S0E
+		updatedungeon
 		clr V2B5
 LD10F		lda 7,y
 LD111		ldb #4
@@ -2802,11 +2806,11 @@
 LD16F		subb playerloc+1
 		bpl LD174
 		negb
-LD174		stb V2C1
-		cmpa V2C1
+LD174		stb accum0
+		cmpa accum0
 		bge LD17C
 		exg a,b
-LD17C		sta V2C1
+LD17C		sta accum0
 		cmpa #8
 		bgt LD198
 		cmpb #2
@@ -2814,7 +2818,7 @@
 		getrandom
 		bita #1
 		beq LD196
-		lda V2C1
+		lda accum0
 		ldb #$1f
 		mul
 		comb
@@ -2853,7 +2857,7 @@
 		cmpx displayptr
 		bne LD1D1			; brif not
 LD1CD		clr V2B5			; mark update not required
-		dod S0E				; update dungeon display
+		updatedungeon			; update dungeon display
 LD1D1		ldd #$0304			; reschedule check for 0.5 seconds
 		rts				; return to caller
 
@@ -2921,11 +2925,11 @@
 LD248		ldd #$0102			; reschedule for next tick
 		rts				; return to caller
 LD24C		pshs a,b,x,y,u			; save registers
-		tst V2AD
-		bne LD256
+		tst V2AD			; are we starting a new command string?
+		bne LD256			; brif not
 		dod S19				; clear command area, reset status, and redisplay dungeon
 		showprompt			; show the prompt
-LD256		ldu V211			; get input buffer pointer
+LD256		ldu linebuffptr			; get input buffer pointer
 		cmpa #$1f			; end of line?
 		beq LD26F			; brif so
 		cmpa #$24			; BS?
@@ -2934,16 +2938,16 @@
 		sta ,u+				; save in buffer
 		ldx #LC67C			; point to cursor string
 		renderstr			; go render the cursor
-		cmpu #V311			; is the buffer full?
+		cmpu #linebuffend		; is the buffer full?
 		bne LD2B4			; brif not
 LD26F		clra				; make a space
 		renderchar			; render it
 		ldd allones			; get end of string marker
 		std ,u++			; save in buffer
-		ldu #V2F1			; reset buffer pointer to start of line
-		stu V211			; save new buffer pointer
+		ldu #linebuff			; reset buffer pointer to start of line
+		stu linebuffptr			; save new buffer pointer
 		bra LD292			; go process command
-LD27D		cmpu #V2F1			; are we at the start of the line?
+LD27D		cmpu #linebuff			; are we at the start of the line?
 		beq LD2B4			; brif so - BS does nothing
 		leau -1,u			; move buffer pointer back
 		ldx #LD28C			; pointer to SPACE BS BS _ BS
@@ -2959,23 +2963,23 @@
 LD2A1		lsla				; two bytes per jump table entry
 		ldx #LD9D0			; point to command jump table
 		jsr [a,x]			; go handle command
-LD2A7		ldu #V2F1			; start of command buffer
-		tst V2AD
-		beq LD2B4
+LD2A7		ldu #linebuff			; start of command buffer
+		tst V2AD			; have we been told to start a new command stream?
+		beq LD2B4			; brif so - don't display prompt
 		tst nokeyboard			; is keyboard disabled?
-		bne LD2B4			; brif so
+		bne LD2B4			; brif so - no prompt
 		showprompt			; show a new prompt
-LD2B4		stu V211			; save new buffer pointer
+LD2B4		stu linebuffptr			; save new buffer pointer
 		puls a,b,x,y,u,pc		; restore registers and return
 cmd_attack	jsr LCC31			; get pointer to specified hand
 		ldu ,u				; fetch item in specified hand
 		bne LD2C2			; brif item there
 		ldu #emptyhand			; point to data for emtpy hand
 LD2C2		tfr u,y				; save object data pointer
-		lda 12,u			
-		sta V219
-		lda 13,u
-		sta V21B
+		lda 12,u			; fetch magical offense value
+		sta V219			; save for combat calculations
+		lda 13,u			; fetch physical offense value
+		sta V21B			; save for combat calculations
 		adda V219			; calculate sum of magical and physical damage
 		rora				; divide by 8
 		lsra
@@ -2998,7 +3002,7 @@
 		lda #$16			; type for "GOLD"
 		sta 9,u				; set to GOLD ring
 		jsr LD638			; update object stats appropriately
-LD2F7		ldd playerloc
+LD2F7		ldd playerloc			; get current location in dungeon
 		jsr LCF82
 		beq LD375
 		ldu #powerlevel
@@ -3032,7 +3036,7 @@
 		ldb 13,u			; get type of creature killed
 		dec b,x				; reduce number of this creature type
 		clr 12,u			
-		dod S0E
+		updatedungeon
 		playsoundimm $15		; play the "kill" sound
 		ldd ,u				; fetch creature power level
 		bsr LD37F			; divide by 8
@@ -3105,15 +3109,15 @@
 		rts
 LD3D7		pshs a,b,x,u
 		lda #15
-		sta V2C1
+		sta accum0
 		ldd ,u
 		subd 10,u
 		jsr LCA12
 LD3E4		subd ,x
 		bcs LD3EC
-		dec V2C1
+		dec accum0
 		bne LD3E4
-LD3EC		ldb V2C1
+LD3EC		ldb accum0
 		subb #3
 		bpl LD3FB
 		negb
@@ -3154,15 +3158,15 @@
 ; Multiply X by the value in A, where the binary point in A is to the left of bit 6. Return only the
 ; integer result in D (rounded down).
 applyscale	pshs a,b,x			; save parameters and registers
-		clr V2C1			; blank out temp storage area
+		clr accum0			; blank out temp storage area
 		ldb 3,s				; get LSB of X
 		mul				; multiply LSB
-		std V2C2			; save in scratch variable
+		std accum0+1			; save in scratch variable
 		lda ,s				; fetch muliplier
 		ldb 2,s				; fetch MSB of X
 		mul				; multiply it
-		addd V2C1			; add in partial product
-		lsl V2C3			;* shift product left so binary point is to the right of
+		addd accum0			; add in partial product
+		lsl accum0+2			;* shift product left so binary point is to the right of
 		rolb				;* of the upper 16 bits - leave interger result in D.
 		rola
 		std ,s				; save integer result for return
@@ -3170,11 +3174,11 @@
 cmd_climb	ldd playerloc
 		jsr LCFE1
 		bmi LD46F
-		sta V2C1
+		sta accum0
 		ldx #kwlist_dir
 		jsr LCBEC
 		ble LD46F
-		ldb V2C1
+		ldb accum0
 		cmpa #4
 		beq LD472
 		cmpa #5
@@ -3193,7 +3197,7 @@
 		rts
 cmd_examine	ldx #LD495			; pointer to the inventory display routine
 		stx displayptr			; set up the display update routine
-		dod S0E				; update the display
+		updatedungeon			; update the display
 		rts
 LD489		cleargfx2			; clear graphics
 		ldx ,u
@@ -3341,7 +3345,7 @@
 		bne LD5B7			; brif not
 		std curtorch			; turn off current torch
 LD5B7		updatestatus			; update status line to reflect new hand contents
-		dod S0E
+		updatedungeon
 		rts
 cmd_incant	ldx #kwlist_adj
 		jsr LCBEC
@@ -3472,14 +3476,14 @@
 		blt LD693
 		bgt LD6E3
 		dec V273
-		dod S0E
+		updatedungeon
 		clrb
 		clr V273
 		bra LD6EF
 LD6E3		cmpa #2
 		bne LD6F3
 		dec V274
-		dod S0E
+		updatedungeon
 		ldb #2
 		clr V274
 LD6EF		bsr LD720
@@ -3529,8 +3533,8 @@
 		stx curtorch			; set object as currently mounted
 		jsr LD57D			; go place the object in the backpack
 		playsoundimm $11		; play the torch sound
-		dod S0E
-		rts
+		updatedungeon			; update dungeon with new lighting
+		rts				; return to caller
 LD757		tfr x,u				; save object pointer
 		ldx #LD76B			; point to jump table
 LD75C		cmpa ,x				; does the sub type match?
@@ -3564,7 +3568,7 @@
 LD790		std damagelevel			; save new damage level
 LD792		ldb #$17			; type for "EMPTY"
 		stb 9,u				; change flask to EMPTY
-		clr 11,u
+		clr 11,u			; mark flask as revealed
 		playsoundimm $0c		; play the flask sound
 		updatestatus			; update status line to reflect changed flask state
 		checkdamage			; check the damage level and recovery interval
@@ -3573,14 +3577,14 @@
 		skip2				; skip over next instruction
 LD7A2		lda #$ff			; flag for do show creatures
 		sta V294			; set creature display flag
-		tst 11,u
-		bne LD7B6
+		tst 11,u			; is flask revealed?
+		bne LD7B6			; brif not - do nothing
 		playsoundimm $0e		; play the scroll sound
-		clr V2AD
+		clr V2AD			; flag command processor to do a "restart"
 		ldx #displayscroll		; point to scroll display routine
 		stx displayptr			; set the display handler
-		dod S0E
-LD7B6		rts
+		updatedungeon			; update display with scroll
+LD7B6		rts				; return to caller
 cmd_zload	bsr LD7BC			; parse the file name
 		dec V2B8			; flag ZLOAD
 		rts
@@ -3629,7 +3633,7 @@
 		fdb LD876			; screendraw - pointer to secondary display screen info
 		fdb demogame			; V20D - pointer to demo game command sequence
 		fdb objecttab			; objectfree - next free object entry
-		fdb V2F1			; V211
+		fdb linebuff			; linebuffptr - the line input buffer pointer
 		fcb 12,22			; playerloc - starting coordinates in maze (y, x)
 		fdb $23				; carryweight - the weight of objects the player is carrying
 		fdb $17a0			; powerlevel - player power level