changeset 29:eacb6679cbf4

Converted to using ASCII throughout Theoretically, the entire game is now operating on ASCII. No doubt there are a few lurking bugs.
author William Astle <lost@l-w.ca>
date Fri, 02 Jan 2015 17:40:04 -0700
parents 5725b69d1b7d
children e57518b96c15
files dod.s
diffstat 1 files changed, 225 insertions(+), 178 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Fri Jan 02 15:14:09 2015 -0700
+++ b/dod.s	Fri Jan 02 17:40:04 2015 -0700
@@ -1288,7 +1288,7 @@
 		std 4,u				; save display position
 		ldx lefthand			; fetch object in left hand
 		bsr LC617			; get name of object
-		renderstr			; display left hand object
+		jsr putstr			; display left hand object
 		ldd #17				; set position to start clearing
 		bsr LC609			; go clear half the line
 		ldx righthand			; fetch object in right hand
@@ -1297,15 +1297,15 @@
 		ldd #$21			; set up offset for displaying right justified
 LC5FD		decb				; move cursor point left
 		tst ,y+				; end of string yet?
-		bpl LC5FD			; brif not - keep moving left
+		bne LC5FD			; brif not - keep moving left
 		std 4,u				; save render position
-		renderstr			; display the right hand object
+		jsr putstr			; display the right hand object
 		clr textother			; reset to standard text rendering
 		rts
 LC609		pshs a,b			; save registers
 		std 4,u				; save the start position
-		ldd #15				; set up for a space (code 0) 15 times
-LC610		renderchar			; render a space
+		ldd #32*256+15			; set up for a space (code 0) 15 times
+LC610		jsr putchr			; render a space
 		decb				; done yet?
 		bne LC610			; brif not
 		puls a,b,pc			; restore registers and return
@@ -1318,24 +1318,28 @@
 		tst 11,y			; has it been revealed?
 		bne LC632			; brif not
 		lda 9,y				; fetch sub type
-		ldx #kw_supreme			; point to first "adjective" keyword
+		ldx #kwlist_adj+1		; point to first "adjective" keyword
 		bsr LC63E			; copy correct string into buffer
-		clr -1,u			; make a space after adjective
+		lda #32				; code for space
+		sta -1,u			; make a space after adjective
 LC632		lda 10,y			; get base type
-		ldx #kw_flask			; point to first base type keyword
+		ldx #kwlist_obj+1		; point to first base type keyword
 		bsr LC63E			; copy correct string into buffer
 		ldx #wordbuff			; point to start of string
 LC63C		puls a,b,y,u,pc			; restore registers and return
 LC63E		pshs a,x			; save registers
-LC640		decodestrsb			; decode the current string into buffer
-		deca				; are we there yet?
-		bpl LC640			; brif not
-		ldx #stringbuf+1		; point to actual string (past object type)
+LC640		deca				; are we there yet?
+		bmi LC640b			; brif so
+		leax 1,x			; move past object code
+LC640a		ldb ,x+				; are we at the end of the string?
+		bne LC640a			; brif not
+		bra LC640			; go see if we're there yet
+LC640b		leax 1,x			; move past object code
 LC648		lda ,x+				; fetch character from decoded keyword
 		sta ,u+				; save in output buffer
-		bpl LC648			; brif not end of string yet
+		bne LC648			; brif not end of string yet
 		puls a,x,pc			; restore registers and return
-LC650		fcb $05,$0d,$10,$14,$19,$ff	; unpacked string "EMPTY"
+LC650		fcn 'EMPTY'
 ; swi 14 routine
 LC656		tst nokeyboard			; is keyboard disabled?
 		bne LC65F			; brif so - return, don't update display
@@ -1354,10 +1358,10 @@
 		puls a,b,x,y,u,pc
 ; swi 15 routine
 LC674		ldx #LC67A			; point to newline followed by prompt
-		renderstr			; go display the newline and prompt
+		jsr putstr			; go display the newline and prompt
 		rts				; return to caller
-LC67A		fcb $1f,$1e			; unpacked string CR PERIOD UNDERSCORE BS (including following)
-LC67C		fcb $1c,$24,$ff			; unpacked string UNDERSCORE BS
+LC67A		fcb 13,'.			; unpacked string CR PERIOD UNDERSCORE BS (including following)
+LC67C		fcb '_,8,0			; UNDERSCORE BS
 
 ; swi 16 routine
 ; delay for 81 ticks (1.3 seconds)
@@ -1425,7 +1429,6 @@
 		std 4,u				;*
 		jsr putstrimm			; display the PREPARE! message
 		fcn 'PREPARE!'
-;		renderstrimmp			; display the PREPARE! message
 		clr textother			; reset to standard text rendering
 		dec pageswap			; set graphic swap required
 		rts				; return to caller
@@ -2204,37 +2207,41 @@
 		puls a,b,x,y,u,pc		; restore registers and return
 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 linebuffptr			; get input buffer/line pointer
-		ldu #wordbuff			; point to word buffer
-LCB9D		lda ,x+				; get character from input
-		beq LCB9D			; brif space
-		bra LCBA5			; get on with things
-LCBA3		lda ,x+				; get new character from input
-LCBA5		ble LCBAF			; brif not valid character
-		sta ,u+				; save filename character
-		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 linebuffptr			; save new input pointer location
-		tst wordbuff			; set flags for whether we have a word
+LCB96
+; Parse a word from the command line and place it in wordbuff. Set Z if no word.
+parse_word	pshs a,x,u			; save registers
+		ldu linebuffptr			; get input line location
+		ldx #wordbuff			; point to word buffer
+parse_word000	lda ,u+				; get input character
+		cmpa #32			; is it space?
+		beq parse_word000		; brif so
+		bra parse_word002		; go strip word off line
+parse_word001	lda ,u+				; fetch input character
+parse_word002	beq parse_word003		; brif end of buffer
+		cmpa #32			; is it space?
+		beq parse_word003		; brif so
+		sta ,x+				; save characte rin word buffer
+		cmpx #wordbuffend-1		; end of buffer?
+		blo parse_word001		; brif not - fetch another character
+parse_word003	clr ,x				; flag end of word
+		stu linebuffptr			; save new location in input buffer
+		tst wordbuff			; set Z if no word
 		puls a,x,u,pc			; restore registers and return
 ; Parse an object from command line
 parseobj	clr parsegenobj			; flag generic object type
 		ldx #kwlist_obj			; point to object type list
-		bsr LCBEC			; look up word in object type list
+		bsr lookup_word			; look up word in object type list
 		bmi parseobj000			; brif no match - try matching specific type
 		beq badcommandret		; brif no match - error out
 		std parseobjtype		; save object type matched
 		rts				; return to caller
 parseobj000	dec parsegenobj			; flag specific object type found
 		ldx #kwlist_adj			; point to specific object types
-		bsr LCBE7			; look up word in object type list
+		bsr lookup_wordb		; look up word in object type list
 		ble badcommandret		; brif no match
 		std parseobjtype		; save object type
 		ldx #kwlist_obj			; point to generic object types
-		bsr LCBEC			; look up keyword
+		bsr lookup_word			; look up keyword
 		ble badcommandret		; brif no match
 		cmpb parseobjtypegen		; did the object type match?
 		bne badcommandret		; brif not
@@ -2243,45 +2250,52 @@
 badcommand	jsr putstrimm			; display "???" for unknown command
 		fcn '???'
 		rts				; return to caller's caller
-LCBE7		pshs a,b,x,y,u			; save registers
-		clra				; initialize specific type to zero
-		bra LCBF4			; go look up keyword
-LCBEC		pshs a,b,x,y,u			; save registers
-		clra				; initialize specific type to zero
-		clrb				; initialize generic type to zero
-		bsr LCB96			; parse a word from the input line
-		bmi LCC2D			; brif no word present
-LCBF4		clr kwmatch			; flag no match
-		clr kwexact			; flag incomplete match
-		ldb ,x+				; fetch number of keywords in list
-		stb kwcount			; save it in temp counter
-LCBFC		ldu #wordbuff			; point to decode buffer
-		decodestrsb			; decode the keyword string
-		ldy #stringbuf+1		; point to decoded keyword string (past the object code)
-LCC05		ldb ,u+				; get a character from word string
-		bmi LCC17			; brif end of string
-		cmpb ,y+			; does it match?
-		bne LCC22			; brif not
-		tst ,y				; are we at the end of the keyword?
-		bpl LCC05			; brif not
-		tst ,u				; are we at the end of the word?
-		bpl LCC22			; brif not
-LCC15		dec kwexact			; flag complete match
-LCC17		tst kwmatch			; do we already have a match?
-		bne LCC2B			; brif so
-		inc kwmatch			; mark match found
-		ldb stringbuf			; get the keyword code
-		std ,s				; save keyword number and object code
-LCC22		inca				; bump keyword count
-		dec kwcount			; have we reached the end of the list?
-		bne LCBFC			; brif not - check another keyword
+; Look up word at wordbuff in keyword list.
+lookup_wordb	pshs a,b,x,y,u			; save registers
+		clra				; initialize keyword entry
+		bra lookup_word000		; go look up keyword
+; Look up the word at the start of the line  against the keyword list in X. Each keyword list has a prefix byte containing
+; additional flags, etc.
+lookup_word	pshs a,b,x,y,u			; save registers
+		clra				; initialize keyword number
+		clrb				; flag for no match
+		bsr parse_word			; fetch a word from input
+		beq lookup_word007		; brif no word - return Z set
+lookup_word000	clr kwmatch			; flag no match found
+		clr kwexact			; flag if match is exact
+		ldb ,x+				; get number of keywords in list
+		stb kwcount			; save interation count
+lookup_word001	leay 1,x			; point to start of this keyword
+		ldu #wordbuff			; point to start of parsed word
+lookup_word002	ldb ,u+				; fetch input character
+		beq lookup_word004		; brif end of input
+		cmpb ,y+			; does it match?	
+		bne lookup_word005		; brif it doesn't match
+		tst ,y				; end of keyword?
+		bne lookup_word002		; brif not
+		tst ,u				; end of word?
+		bne lookup_word005		; brif not - no match, keep looking
+lookup_word003	dec kwexact			; we had an exact match
+lookup_word004	tst kwmatch			; do we already have a match?
+		bne lookup_word006		; brif so - return no match
+		inc kwmatch			; flag match found
+		ldb ,x				; fetch type code
+		std ,s				; save code type and return value
+lookup_word005	inca				; bump keyword number
+		dec kwcount			; are we done iterating?
+		bne lookup_word009		; brif not
 		tst kwmatch			; do we have a match?
-		bne LCC2F			; brif so
-LCC2B		ldd allones			; flag error (-1)
-LCC2D		std ,s				; save result
-LCC2F		puls a,b,x,y,u,pc		; restore registers and return value, return
+		bne lookup_word008		; brif so
+lookup_word006	ldd allones			; load error flag
+lookup_word007	std ,s				; save return value
+lookup_word008	puls a,b,x,y,u,pc		; return results
+lookup_word009	leax 1,x			; move past flag byte
+lookup_word010	ldb ,x+				; fetch character in keyword
+		bne lookup_word010		; brif not end of keyword
+		bra lookup_word001		; go check next word
+
 LCC31		ldx #kwlist_dir			; point to direction keywords
-		bsr LCBEC			; evaluate the specified keyword
+		bsr lookup_word			; evaluate the specified keyword
 		ble badcommandret		; brif no matching keyword
 		ldu #righthand			; point to right hand contents
 		cmpa #1				; is it right hand wanted?
@@ -3019,23 +3033,7 @@
 		beq LD248			; brif not
 		tst nokeyboard			; is keyboard disabled?
 		bne LD1EF			; brif so - keep draining buffer
-		cmpa #$20			; is it a space?
-		beq LD215			; brif so
-		ldb #$1f			; value for CR
-		cmpa #$0d			; is it CR?
-		beq LD212			; brif so
-		ldb #$24			; value for BS
-		cmpa #8				; is it BS?
-		beq LD212			; brif so
-		clrb				; value for nothing (space)
-		cmpa #$41			; is it a letter?
-		blo LD212			; brif below uppercase alpha
-		cmpa #$5a			; is it still a letter?
-		bls LD215			; brif uppercase alpha
-LD212		tfr b,a				; save calculated code
-		skip2				; skip instruction
-LD215		anda #$1f			; normalize down to 0...31
-		bsr LD24C			
+		bsr LD24C			; go process input character
 		bra LD1EF			; go handle another character
 LD21B		ldy demoseqptr			; fetch pointer to command sequence
 		ldb ,y+				; do we have a command to do?
@@ -3043,20 +3041,17 @@
 		delay				; wait for a bit
 		delay				; wait for a bit more
 		jmp START			; go start over again with the splash and demo
-LD229		ldx ,y++			; get pointer to the word
-		ldu #cmddecodebuff		; point to command decode buffer
-		decodestr			; decode the keyword
-		leau 1,u			; move past the "object type" flag
+LD229		ldu ,y++			; get pointer to the word
 		delay				; wait a bit
 		skip2				; skip next instruction
 LD235		bsr LD24C			; go handle input character
 		lda ,u+				; fetch a character from the decoded string
-		bpl LD235			; brif not end of string
-		clra				; code for a space
+		bne LD235			; brif not end of string
+		lda #32				; code for a space
 		bsr LD24C			; go handle input character
 		decb				; have we consumed all the words in this command?
 		bne LD229			; brif not - get another
-		lda #$1f			; code for carriage return
+		lda #13				; code for carriage return
 		bsr LD24C			; add character to buffer and process if needed
 		sty demoseqptr			; save new command stream pointer
 LD248		ldd #$0102			; reschedule for next tick
@@ -3067,19 +3062,23 @@
 		resetdisplay			; clear command area, reset status, and redisplay dungeon
 		showprompt			; show the prompt
 LD256		ldu linebuffptr			; get input buffer pointer
-		cmpa #$1f			; end of line?
+		cmpa #13			; end of line?
 		beq LD26F			; brif so
-		cmpa #$24			; BS?
+		cmpa #8				; BS?
 		beq LD27D			; brif so
-		renderchar			; render the character
+		cmpa #32			; is it control character?
+		blo LD2B4			; brif so - ignore it
+		cmpa #126			; above ascii?
+		bhi LD2B4			; brif so - ignore it
+		jsr putchr			; render the character
 		sta ,u+				; save in buffer
 		ldx #LC67C			; point to cursor string
-		renderstr			; go render the cursor
+		jsr putstr			; go render the cursor
 		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
+LD26F		lda #32				; make a space
+		jsr putchr			; render it
+		ldd zero			; get end of string marker
 		std ,u++			; save in buffer
 		ldu #linebuff			; reset buffer pointer to start of line
 		stu linebuffptr			; save new buffer pointer
@@ -3088,11 +3087,11 @@
 		beq LD2B4			; brif so - BS does nothing
 		leau -1,u			; move buffer pointer back
 		ldx #LD28C			; pointer to SPACE BS BS _ BS
-		renderstr			; display the backspace string
+		jsr putstr			; display the backspace string
 		bra LD2B4			; get on with things
 LD28C		fcb $00,$24,$24,$1c,$24,$ff	; unpacked SPACE BS BS _ BS string
 LD292		ldx #kwlist_cmd			; point to command list
-		jsr LCBEC			; look up word in command list
+		jsr lookup_word			; look up word in command list
 		beq LD2A7			; brif nothing to match
 		bpl LD2A1			; brif found
 		jsr badcommand			; show bad command string
@@ -3349,7 +3348,7 @@
 		bmi LD46F			; brif no holes
 		sta accum0			; save hole info
 		ldx #kwlist_dir			; point to direction list
-		jsr LCBEC			; go parse direction
+		jsr lookup_word			; go parse direction
 		ble LD46F			; brif no direction
 		ldb accum0			; get hole info
 		cmpa #4				; is it up?
@@ -3402,8 +3401,8 @@
 LD4CD		tst columnctr			; are we at the start of a line?
 		beq LD4D3			; brif so
 		bsr LD4FE			; do a newline
-LD4D3		ldd #$1b20			; set up for displaying a row of !!!!
-LD4D6		renderchar			; display a !
+LD4D3		ldd #'!*256+$20			; set up for displaying a row of !!!!
+LD4D6		jsr putchr			; display a !
 		decb				; done enough of them?
 		bne LD4D6			; brif not
 		ldx 4,u				; get current text location
@@ -3421,13 +3420,13 @@
 		bra LD4ED			; go display another object
 LD4FB		clr textother			; reset to standard text rendering
 		rts				; return to caller
-LD4FE		lda #$1f			; character code for newline
-		renderchar			; go move to next line
+LD4FE		lda #13				; character code for newline
+		jsr putchr			; go move to next line
 		clr columnctr			; flag column 1
 		rts				; return to caller
 LD505		pshs a,b,x			; save registers
 		jsr LC617			; fetch object name string (decoded)
-		renderstr			; display object name
+		jsr putstr			; display object name
 		lda levbgmask			; get current level mask
 		sta 6,u				; restore proper background
 		com columnctr			; are we on column 1 or 2?
@@ -3518,7 +3517,7 @@
 		updatedungeon			; update the dungeon display
 		rts				; return to caller
 cmd_incant	ldx #kwlist_adj			; point to object types list
-		jsr LCBEC			; look up object
+		jsr lookup_word			; look up object
 		ble LD5EF			; brif not found in list or no type specified
 		tst kwexact			; was it a complete match?
 		beq LD5EF			; brif not
@@ -3563,7 +3562,7 @@
 		updatestatus			; update the status area
 LD63E		rts				; return to caller
 cmd_turn	ldx #kwlist_dir			; point to direction list
-		jsr LCBEC			; look up word in list
+		jsr lookup_word			; look up word in list
 		ble LD693			; brif no match or no word
 		ldb facing			; get current direction
 		cmpa #0				; TURN LEFT?
@@ -3636,7 +3635,7 @@
 		gfxcoord 136,255
 		gfxend
 cmd_move	ldx #kwlist_dir			; point to direction list
-		jsr LCBEC			; look up direction
+		jsr lookup_word			; look up direction
 		blt LD693			; brif bad direction
 		bgt LD6E3			; brif there is a direction
 		dec movehalf			; mark half step
@@ -3774,10 +3773,10 @@
 		lbne START			; brif not - do a cold start
 		dec loadsaveflag		; unfreeze interrupts
 		jmp badcommand			; show the ??? thing
-LD7BC		ldx #wordbuff			; get start address to set to $ff
+LD7BC		ldx #wordbuff			; get start address to clear
 		leau $20,x			; set $20 bytes
-		setblock			; go clear block to $ff
-		jmp LCB96			; go parse a word off command
+		clearblock			; go clear block to indicate empty
+		jmp parse_word			; go parse a word off command
 ; ZSAVE has been replaced with a routine that saves to disk.
 ;cmd_zsave	bsr LD7BC			; parse the file name
 ;		stx CBUFAD			; point buffer to file name
@@ -3875,66 +3874,115 @@
 		fdb SCREEN1+$1400		; start address of command area on second screen
 		fdb SCREEN1+$1800		; end address of command area on second screen
 		fdb 0				; dummy (SAM register setting)
-
-; This is the keyword table used for command parsing. Each keyword is stored in packed format.
-; Each keyword is preceded by a value which indicates the object type. Where the object type is
-; not relevant, that value will be zero. The value is shown in parentheses below.
-kwlist_cmd	fcb 15				; 15 keywords in the command list
-kw_attack	fcb $30,$03,$4a,$04,$6b		; "ATTACK" keyword
-		fcb $28,$06,$c4,$b4,$40		; "CLIMB" keyword
-		fcb $20,$09,$27,$c0		; "DROP" keyword
-kw_examine	fcb $38,$0b,$80,$b5,$2e,$28	; "EXAMINE" keyword
-		fcb $18,$0e,$5a,$00		; "GET" keyword
-		fcb $30,$12,$e1,$85,$d4		; "INCANT" keyword
-kw_look		fcb $20,$18,$f7,$ac		; "LOOK" keyword
-kw_move		fcb $20,$1A,$fb,$14		; "MOVE" keyword
-kw_pull		fcb $20,$21,$56,$30		; "PULL" keyword
-		fcb $30,$24,$5b,$14,$2c		; "REVEAL" keyword
-		fcb $20,$27,$47,$dc		; "STOW" keyword
-kw_turn		fcb $20,$29,$59,$38		; "TURN" keyword
-kw_use		fcb $18,$2b,$32,$80		; "USE" keyword
-		fcb $28,$34,$c7,$84,$80		; "ZLOAD" keyword
-		fcb $28,$35,$30,$d8,$a0		; "ZSAVE" keyword
-kwlist_dir	fcb 6				; 6 keywords in direction list
-kw_left		fcb $20,$18,$53,$50		; "LEFT" keyword
-kw_right	fcb $28,$24,$93,$a2,$80		; "RIGHT" keyword
-		fcb $20,$04,$11,$ac		; "BACK" keyword
-		fcb $30,$03,$27,$d5,$c4		; "AROUND" keyword		
-		fcb $10,$2b,$00			; "UP" keyword
-		fcb $20,$08,$fb,$b8		; "DOWN" keyword
+; These are the keyword tables used in parsing. Each table is prefixed by a byte with the number
+; of keywords in the list. Each keyword has a single byte flag (usually type object number)
+; followed by a NUL terminated ASCII string.
+kwlist_cmd	fcb 15				; 15 commands
+		fcb 0				; ATTACK
+kw_attack	fcn 'ATTACK'
+		fcb 0				; CLIMB
+		fcn 'CLIMB'
+		fcb 0				; DROP
+		fcn 'DROP'
+		fcb 0				; EXAMINE
+kw_examine	fcn 'EXAMINE'
+		fcb 0				; GET
+		fcn 'GET'
+		fcb 0				; INCANT
+		fcn 'INCANT'
+		fcb 0				; LOOK
+kw_look		fcn 'LOOK'
+		fcb 0				; MOVE
+kw_move		fcn 'MOVE'
+		fcb 0				; PULL
+kw_pull		fcn 'PULL'
+		fcb 0				; REVEAL
+		fcn 'REVEAL'
+		fcb 0				; STOW
+		fcn 'STOW'
+		fcb 0				; TURN
+kw_turn		fcn 'TURN'
+		fcb 0				; USE
+kw_use		fcn 'USE'
+		fcb 0				; ZLOAD
+		fcn 'ZLOAD'
+		fcb 0				; ZSAVE
+		fcn 'ZSAVE'
+kwlist_dir	fcb 6
+		fcb 0				; LEFT
+kw_left		fcn 'LEFT'
+		fcb 0				; RIGHT
+kw_right	fcn 'RIGHT'
+		fcb 0				; BACK
+		fcn 'BACK'
+		fcb 0				; AROUND
+		fcn 'AROUND'
+		fcb 0				; UP
+		fcn 'UP'
+		fcb 0				; DOWN
+		fcn 'DOWN'
 kwlist_adj	fcb 25				; 25 keywords in the misc keywords list
-kw_supreme	fcb $38,$67,$58,$48,$ad,$28	; "SUPREME" keyword (1)
-		fcb $28,$54,$fa,$b0,$a0		; "JOULE" keyword (1)
-		fcb $31,$0a,$cb,$26,$68		; "ELVISH" keyword (4)
-		fcb $38,$da,$9a,$22,$49,$60	; "MITHRIL" keyword (3)
-		fcb $20,$a6,$52,$c8		; "SEER" keyword (2)
-		fcb $28,$28,$82,$de,$60		; "THEWS" keyword (0)
-		fcb $20,$64,$96,$94		; "RIME" keyword (1)
-		fcb $30,$ac,$99,$a5,$ee		; "VISION" keyword (2)
-		fcb $20,$02,$2c,$94		; "ABYE" keyword (0)
-		fcb $20,$10,$16,$14		; "HALE" keyword (0)
-		fcb $29,$66,$f6,$06,$40		; "SOLAR" keyword (5)
-		fcb $30,$c5,$27,$bb,$45		; "BRONZE" keyword (3)
-		fcb $30,$6d,$56,$0c,$2e		; "VULCAN" keyword (1)
-		fcb $21,$13,$27,$b8		; "IRON" keyword (4)
-		fcb $29,$59,$57,$06,$40		; "LUNAR" keyword (5)
-		fcb $21,$60,$97,$14		; "PINE" keyword (5)
-		fcb $38,$d8,$50,$d1,$05,$90	; "LEATHER" keyword (3)
-		fcb $31,$2e,$f7,$90,$ae		; "WOODEN" keyword (4)
-		fcb $28,$4c,$97,$05,$80		; "FINAL" keyword (1)
-		fcb $30,$4a,$e2,$c8,$f9		; "ENERGY" keyword (1)
-		fcb $18,$52,$32,$80		; "ICE" keyword (1)
-		fcb $20,$4c,$99,$14		; "FIRE" keyword (1)
-		fcb $20,$4e,$f6,$10		; "GOLD" keyword (1)
-		fcb $28,$0a,$d8,$53,$20		; "EMPTY" keyword (0)
-		fcb $21,$48,$50,$90		; "DEAD" keyword (5)
+		fcb 1				; SUPREME (1)
+		fcn 'SUPREME'
+		fcb 1				; JOULE (1)
+		fcn 'JOULE'
+		fcb 4				; ELVISH (4)
+		fcn 'ELVISH'
+		fcb 3				; MITHRIL (3)
+		fcn 'MITHRIL'
+		fcb 2				; SEER (2)
+		fcn 'SEER'
+		fcb 0				; THEWS (0)
+		fcn 'THEWS'
+		fcb 1				; RIME (1)
+		fcn 'RIME'
+		fcb 2				; VISION (2)
+		fcn 'VISION'
+		fcb 0				; ABYE (0)
+		fcn 'ABYE'
+		fcb 0				; HALE (0)
+		fcn 'HALE'
+		fcb 5				; SOLAR (5)
+		fcn 'SOLAR'
+		fcb 3				; BRONZE (3)
+		fcn 'BRONZE'
+		fcb 1				; VULCAN (1)
+		fcn 'VULCAN'
+		fcb 4				; IRON (4)
+		fcn 'IRON'
+		fcb 5				; LUNAR (5)
+		fcn 'LUNAR'
+		fcb 5				; PINE (5)
+		fcn 'PINE'
+		fcb 3				; LEATHER (3)
+		fcn 'LEATHER'
+		fcb 4				; WOODEN (4)
+		fcn 'WOODEN'
+		fcb 1				; FINAL (1)
+		fcn 'FINAL'
+		fcb 1				; ENERGY (1)
+		fcn 'ENERGY'
+		fcb 1				; ICE (1)
+		fcn 'ICE'
+		fcb 1				; FIRE (1)
+		fcn 'FIRE'
+		fcb 1				; GOLD (1)
+		fcn 'GOLD'
+		fcb 5				; DEAD (5)
+		fcn 'DEAD'
 kwlist_obj	fcb 6				; 6 object types in the following list
-kw_flask	fcb $28,$0c,$c0,$cd,$60		; "FLASK" keyword (0)
-		fcb $20,$64,$97,$1c		; "RING" keyword (1)
-		fcb $30,$a6,$39,$3d,$8c		; "SCROLL" keyword (2)
-kw_shield	fcb $30,$e6,$84,$95,$84		; "SHIELD" keyword (3)
-kw_sword	fcb $29,$27,$77,$c8,$80		; "SWORD" keyword (4)
-kw_torch	fcb $29,$68,$f9,$0d,$00		; "TORCH" keyword (5)
+		fcb 0				; FLASK (0)
+		fcn 'FLASK'
+		fcb 1				; RING (1)
+		fcn 'RING'
+		fcb 2				; SCROLL (2)
+		fcn 'SCROLL'
+		fcb 3				; SHIELD (3)
+kw_shield	fcn 'SHIELD'
+		fcb 4				; SWORD (4)
+kw_sword	fcn 'SWORD'
+		fcb 5				; TORCH (5)
+kw_torch	fcn 'TORCH'
 ; The following is the sequence of commands used in the demo game
 demogame	fcb 1				; EXAMINE
 		fdb kw_examine
@@ -5124,8 +5172,7 @@
 loadsave_setfn	ldb #8				; 8 characters max for file name
 		ldx #DNAMBF			; point to file name location
 loadsave_setfn0	lda ,u+				; fetch character from file name
-		bmi loadsave_setfn1		; brif end of specified name
-		adda #$40			; adjust back to ASCII range
+		beq loadsave_setfn1		; brif end of specified name
 		sta ,x+				; put character in buffer
 		decb				; have we reached the end of the buffer?
 		bne loadsave_setfn0		; brif not