view dod.s @ 4:dc07cebba65c

Additional comments related to text rendering Added an explanation of the text display system and updated various comments on the text rendering.
author William Astle <>
date Fri, 24 May 2013 23:07:53 -0600
parents 969c3d833728
children ff6eaa09bb56
line wrap: on
line source
; Dungeons of Daggorath
; Original game copyright © 1982 by Dyna Micro
; The code contained in this file is not the original source code to Dungeons of Daggorath. It was
; constructed by William Astle in 2013 by disassembling the Dungeons of Daggorath ROM.
; According to a web page retrieved from on May 24, 2013,
; this endeavour is permitted. In case the web page becomes unavailable, and because it contains what
; I believe to be important credit information, I have reproduced the text of it below:
;* Grant of license to reproduce Dungeons of Daggorath
;* My name is Douglas J. Morgan.  I was the president of DynaMicro, Inc. (since dissolved), the company
;* which conceived, created and wrote Dungeons of Daggorath, a best selling Radio Shack Color Computer
;* adventure game. 
;* I have examined the contract I signed with Radio Shack for their license of the game.  The contract
;* provides that Radio Shack shall have an exclusive license to manufacture and produce the game, but
;* that said exclusive license shall revert to a non-exclusive license should Radio Shack cease to
;* produce and sell the game.  To the best of my knowledge, they have not produced the game for many
;* years.  Thus, it is my belief that the right to grant a license for the game has reverted to me. 
;* I hereby grant a non-exclusive permanent world-wide license to any and all Color Computer site
;* administrators, emulator developers, programmers or any other person or persons who wish to develop,
;* produce, duplicate, emulate, or distribute the game on the sole condition that they exercise every
;* effort to preserve the game insofar as possible in its original and unaltered form. 
;* The game was a labor of love.  Additional credits to Phillip C. Landmeier - who was my partner and
;* who originally conceived the vision of the game and was responsible for the (then) state of the art
;* sounds and realism, to April Landmeier, his wife - the artist who drew all the creatures as well as
;* all the artwork for the manual and game cover, and to Keith Kiyohara - a gifted programmer who helped
;* write the original game and then contributed greatly to compressing a 16K game into 8K so that it
;* could be carried and produced by Radio Shack.
;* The game did very well for us.  I give it to the world with thanks to all who bought it, played it
;* or enjoyed it. 
;* There is one existing copy of the original source code.  Anyone willing to pay for the copying of
;* the listing (at Kinko's) and shipment to them, who intends to use it to enhance or improve the emulator
;* versions of the game is welcome to it. 
;* Verification of this license grant or requests for the listing can be made by contacting Louis Jordan,
;* Thank you.
; Louis Jordan's email address is given as in a hyperlink in the above statement.
; It is my belief that this endeavor to disassemble Dungeons of Daggorath is in compliance with the above
; license grant. I have done so for my own amusement and for the challenge. I have also done so because
; I failed to elicit a response from Louis Jordan as described in the license grant. I am not surprised
; that I received no reply given that the page above was put online during or prior to 2006.

; some utility macros
dod		macro noexpand
		fcb \1
		ifeq \1-$1B
		fcb \2

skip2		macro noexpand
		fcb $8c

; macros for color basic ROM calls
romcall		macro noexpand
		fcb \1

; decode a 5 bit packed string from (X) to (U)
decodestr	macro noexpand
		dod S06
; decode a 5 bit packed string from (X) to V335
decodestrsb	macro noexpand
		dod S05

; ROM call numbers
POLCAT		equ 0
CSRDON		equ 4
BLKIN		equ 6
BLKOUT		equ 8
WRTLDR		equ 12

ROMTAB		equ $A000

BLKTYP		equ $7c
BLKLEN		equ $7d
CBUFAD		equ $7e

RESVEC		equ $A027

; SWI routines - some of these might not actually be used
S00		equ 0
S01		equ 1
S02		equ 2
S03		equ 3
S04		equ 4
S05		equ 5
S06		equ 6
S07		equ 7
S08		equ 8
S09		equ 9
S0A		equ $0A
S0B		equ $0B
S0C		equ $0C
S0D		equ $0D
S0E		equ $0E
S0F		equ $0F
S10		equ $10
S11		equ $11
S12		equ $12
S13		equ $13
S14		equ $14
S15		equ $15
S16		equ $16
S17		equ $17
S18		equ $18
S19		equ $19
S1A		equ $1A
S1B		equ $1B
S1C		equ $1C

PIA0		equ $ff00
PIA1		equ $ff20
SAMREG		equ $ffc0
TOPRAM		equ $4000
STACK		equ $1000

; the direct page
		org $200
V1F4		equ $1f4
V200		rmb 2				initialized to $0000
V202		rmb 1
V203		rmb 2				initialized to $ffff
V205		rmb 1
V206		rmb 1
V207		rmb 1
V208		rmb 1
V209		rmb 2
V20B		rmb 2
V20D		rmb 2
V20F		rmb 2
V211		rmb 2
V213		rmb 1
V214		rmb 1
V215		rmb 2
V217		rmb 2
V219		rmb 1
V21A		rmb 1
V21B		rmb 1
V21C		rmb 1
V21D		rmb 2
V21F		rmb 2
V221		rmb 2
V223		rmb 1
V224		rmb 2
V226		rmb 2
V228		rmb 1
V229		rmb 2
V22B		rmb 1
V22C		rmb 1
V22D		rmb 1
V22E		rmb 1
V22F		rmb 2
V231		rmb 2
V233		rmb 2
V235		rmb 2
V237		rmb 1
V238		rmb 1
V239		rmb 1
V23A		rmb 1
V23B		rmb 1
V23C		rmb 1
V23D		rmb 1
V23E		rmb 2
V240		rmb 1
V241		rmb 2
V243		rmb 2
V245		rmb 1
V246		rmb 1
V247		rmb 2
V249		rmb 6
V24F		rmb 1
V250		rmb 1
V251		rmb 1
V252		rmb 2
V254		rmb 2
V256		rmb 3
V259		rmb 2
V25B		rmb 2
V25D		rmb 2
V25F		rmb 2
V261		rmb 1
V262		rmb 1
V263		rmb 2
V265		rmb 6
V26B		rmb 1
V26C		rmb 1
V26D		rmb 1
V26E		rmb 1
V26F		rmb 1
V270		rmb 3
V273		rmb 1
V274		rmb 1
V275		rmb 2
V277		rmb 1
V278		rmb 1
V279		rmb 2
V27B		rmb 1
V27C		rmb 1
V27D		rmb 1
V27E		rmb 3
V281		rmb 1
V282		rmb 4
V286		rmb 2
V288		rmb 2
V28A		rmb 1
V28B		rmb 1
V28C		rmb 1
V28D		rmb 1
V28E		rmb 1
V28F		rmb 1
V290		rmb 1
V291		rmb 1
V292		rmb 2
V294		rmb 1
V295		rmb 2
V297		rmb 3
V29A		rmb 1
V29B		rmb 1
V29C		rmb 1
V29D		rmb 1
V29E		rmb 1
V29F		rmb 2
V2A1		rmb 10
V2AB		rmb 2
V2AD		rmb 1
V2AE		rmb 1
V2AF		rmb 1
V2B0		rmb 1
V2B1		rmb 1
V2B2		rmb 2
V2B4		rmb 1
V2B5		rmb 1
V2B6		rmb 1
V2B7		rmb 1				nonzero means nonstandard text location
V2B8		rmb 1
V2B9		rmb 2
V2BB		rmb 1
V2BC		rmb 1				keyboard buffer read offset
V2BD		rmb 1				keyboard buffer write offset
		rmb 3
V2C1		rmb 1
V2C2		rmb 1
V2C3		rmb 1
V2C4		rmb 1
V2C5		rmb 1
V2C6		rmb 1
V2C7		rmb 10
V2D1		rmb 32				keyboard ring buffer
V2F1		rmb 32
V311		rmb 2
V313		rmb 32
V333		rmb 2
V335		rmb 1
V336		rmb 33
V357		rmb 10				temporary buffer used for decoding font data
V361		rmb 31
V380		rmb 6
V386		rmb 2
V388		rmb 6
V38E		rmb 2
V390		rmb 2				current start offset of the text area
V392		rmb 2				current end of offset of text area (character cell)
V394		rmb 2				current text cursor position (character cell)
V396		rmb 1				current screen background color mask
V397		rmb 1				nonzero if text should NOT be rendered to secondary screen
V398		rmb 43
V3C3		rmb 17
V3D4		rmb 20
V3E8		rmb $20c
V5F4		rmb $400
V9F4		rmb 9
V9FD		rmb $10a
VB07		rmb 10
VB11		rmb $3f4
VF05		equ *

		org $c000
START		ldu #LC0D1			point to the demo setup routine
		bra LC008			go handle the game
LC005		ldu #LC124			point to the real game setup routine
LC008		lds #STACK			put the stack somewhere safe
		ldx #PIA0			point at PIA0
		ldd #$34fa			initializers for the PIA
		sta 3,x				set data mode, interrupts disabled (side B)
		sta 1,x				set data mode, interrupts disabled (side A)
		ldx #PIA1			point at PIA1
		sta 1,x				set data mode, interrupts disabled (side A)
		clr 3,x				set direction mode for side B
		stb 2,x				set VDG and single bit sound to output
		lda #$3c			flags for data mode, no interrupts, sound enabled
		sta 3,x				set side B for data mode
		ldd #$2046			SAM value for "pmode 4" graphics, screen at $1000
		jsr LC266			go set the SAM register
		lda #$f8			value for "pmode 4", color set 1
		sta 2,x				set VDG mode
		ldx #V200			point to start of variables
LC030		clr ,x+				clear a byte
		cmpx #TOPRAM			are we at the top of memory?
		blo LC030			brif not
		stu ,--s			set return address to the game initialization routine
		lda #V200/256			point to MSB of direct page
		tfr a,dp			set DP appropriately
		setdp V200/256			tell the assembler about DP
		ldy #LD7E8			point to variable initialization table
LC041		lda ,y+				fetch number of bytes in this initializer
		beq LC086			brif zero - we're done
		ldx ,y++			get address to copy bytes to
		bsr LC04B			go copy bytes
		bra LC041			go handle another initializer
LC04B		ldb ,y+				fetch source byte
		stb ,x+				stow at destination
		deca				are we done yet?
		bne LC04B			brif not
		rts				return to caller
LC053		pshs cc,a,b,x,y,u		save registers and interrupt status
		orcc #$10			disable IRQ
		ldx #V29F
LC05A		clr ,x+
		cmpx #V2AD
		blo LC05A
		ldx #V9FD
		stx V2B9
LC066		clr ,x+
		cmpx #VB07
		blo LC066
		ldy #LD7DC
		dec V2BB
		ldd #12
LC076		ldx ,y++
		beq LC084
		jsr LC25C
		stx 3,u
		jsr LC21D
		bra LC076
LC084		puls cc,a,b,x,y,u,pc
LC086		bsr LC053
		ldu #LDA91
LC08C		ldb ,u
		andb #$0f
		stb V28C
		ldb ,u+
		stb V28D
LC09A		dod S17
		dec 5,x
		cmpb #5
		ble LC0A5
		ldb V28D
LC0A5		dec V28C
		bne LC09A
		cmpu #LDAA3
		blo LC08C
		ldu #V388
		dec V2B7
		dod S0A
		dod S02			display copyright message
		fcb $f8,$df,$0c,$c9
		fcb $27,$45,$00,$02
		fcb $65,$c1,$03,$52
		fcb $39,$3c,$00,$68
		fcb $da,$cc,$63,$09
		fcb $48
		clr <$b7
LC0D1		dec V277
		bsr LC114
		ldx #LDF10
		dec V29E
		dod S14
		dod S02			display "I DARE YE ENTER..."
		fcb $9f,$d2,$02,$06
		fcb $45,$06,$4a,$02
		fcb $ba,$85,$97,$bd
		fcb $ef,$80
		dod S02			display "THE DUNGEONS OF DAGGORATH!!!!"
		fcb $f7,$bd,$ea,$20
		fcb $a0,$25,$5c,$72
		fcb $bd,$d3,$03,$cc
		fcb $02,$04,$e7,$7c
		fcb $83,$44,$6f,$7b
		dod S10
		dod S10
		dod S15
		dod S09
		dec V2B4
		lda #2
		ldu #LD7D5
		bra LC131
LC114		ldd #$343c
		sta PIA1+1
		stb PIA1+3
		sta PIA0+3
		cwai #$ef
LC124		bsr LC114
		ldd #$100b
		std V213
		clr V217
		ldu #LD7D9
LC131		dod S16
		dod S1A
		ldy #V229
LC139		lda ,u+
		bmi LC14F
		dod S17
		inc 5,x
		exg x,u
		dod S18
		exg x,u
		clr 11,x
		stx ,y
		tfr x,y
		bra LC139
LC14F		tst V277
		beq LC166
		dec V29B
		ldx #LCDB2
		stx V2B2
		dec V294
		dod S0E
		dod S10
		dod S10
		clr V29B
LC166		dod S19
		dod S0F
		jmp LC1F5
		romcall BLKIN
		lbne RESVEC
		ldb BLKTYP
LC17C		ldu #PIA0
		ldd #$343c
		sta 3,u
		sta PIA1+3
		stb PIA1+1
LC18B		ldx V200
LC18D		leax -1,x
		bne LC18D
LC192		bsr LC17C
		bsr LC18B
		bsr LC18B
		romcall WRTLDR
		romcall BLKOUT
		bsr LC18B
		romcall WRTLDR
		ldx #V200
LC1A6		ldd #$0180
		std BLKTYP
		stx CBUFAD
		romcall BLKOUT
		cmpx #VF05
		blo LC1A6
		stu BLKTYP
		romcall BLKOUT
		bsr LC18B
		bra LC1EC
LC1C1		bsr LC17C
		romcall CSRDON
LC1C6		ldu V20B
		ldx ,u
		bsr LC16D
		bne LC1C6
		ldx ,u
		ldu #V313
		ldb #8
LC1D5		lda ,x+
		cmpa ,u+
		bne LC1C1
		bne LC1D5
		romcall CSRDON
		ldx #V200
LC1E4		bsr LC16D
		bpl LC1E4
		lds #STACK
LC1EC		jsr LC114
		clr V2B8
		dod S19
		dod S0F
LC1F5		ldu #V2AB
		clr V2BB
LC1FA		tfr u,y
LC1FC		tst V2B8
		bgt LC192
		bmi LC1C1
		ldu ,u
		beq LC1F5
		pshs y,u
		jsr [3,u]
		puls y,u
		tst V2BB
		bne LC1F5
		cmpb #12
		beq LC1FA
		bsr LC238
		bsr LC21D
		tfr y,u
		bra LC1FC
LC21D		pshs cc,a,b,x
		orcc #$10
		sta 2,u
		ldx #V29F
		std ,u
LC22B		cmpd ,x
		beq LC234
		ldx ,x
		bra LC22B
LC234		stu ,x
		puls cc,a,b,x,pc
LC238		pshs cc,x
		orcc #$10
		ldx ,u
		stx ,y
		puls cc,x,pc
LC242		pshs b,x,y,u
		tst V29B
		bne LC25A
LC248		tfr u,y
		ldu ,u
		beq LC25A
		dec 2,u
		bne LC248
		bsr LC238
		ldb #12
		bsr LC21D
		bra LC248
LC25A		puls b,x,y,u,pc
LC25C		pshs x
		ldu V2B9
		leax 7,u
		stx V2B9
		puls x,pc
LC266		pshs x,b,a			save registers
		ldx #SAMREG			point to SAM register
LC26B		lsra				; shift the bit value to set to carry
		rorb				;
		bcs LC272			brif bit set
		sta ,x				clear the bit
		skip2				skip next instruction
LC272		sta 1,x				set the bit
		leax 2,x			move to next SAM register bit
		cmpx #SAMREG+$14		are we at the end of the register?
		blo LC26B			brif not
		puls a,b,x,pc			restore registers and return
; IRQ service routine
LC27D		ldx #PIA1
		lda -29,x
		lbpl LC320
		lda #2
		tfr a,dp
		tst V2B4
		beq LC29D
		ldd V209
		ldu V20B
		std V20B
		stu V209
		ldd 4,u
		bsr LC266
		clr V2B4
LC29D		tst V29C
		beq LC2A9
		com V29D
		lda V29D
		sta ,x
LC2A9		tst V2B1
		beq LC2DC
		dec V2AE
		bne LC2DC
		lda V2AF
		sta V2AE
		ldb 2,x
		eorb #2
		stb 2,x
		tst V2AD
		beq LC2DC
		ldu #V388
		ldx 4,u
		ldd #15
		std 4,u
		lda #$20
		com V2B0
		beq LC2D1
		lda #$22
LC2D1		jsr LCA17
		inc 5,u
		jsr LCA17
		stx 4,u
LC2DC		ldu #V2A1
		jsr LC242
		ldx #V295
		ldy #LC324
LC2E9		inc ,x
		cmpx #V29A
		beq LC2FF
		lda ,x
		cmpa ,y+
		blt LC2FF
		clr ,x+
		leau 2,u
		jsr LC242
		bra LC2E9
LC2FF		tst V228
		bne LC320
		tst V277
		beq LC318
		clr PIA0+2			strobe all keyboard columns
		lda PIA0			fetch row data
		anda #$7f			mask off comparator input
		cmpa #$7f			did we have any keys down?
		beq LC320			brif not
		ldx #LC005			; stop any demo game active; start a game
		stx 10,s			;
LC318		romcall POLCAT			poll the keyboard
		tsta				was a key down?
		beq LC320			brif not
		bsr LC340			go process keyboard input
LC320		lda PIA0+2			clear interrupt status
LC324		fcb $06,$0a,$3c,$3c,$18
LC329		pshs cc,b,x			save registers and interrupt status
		orcc #$10			disable IRQ
		clra				flag no key pressed
		ldx #V2D1			point to keyboard ring buffer
		ldb V2BC			get buffer read offset
		cmpb V2BD			same as buffer write offset?
		beq LC33E			brif so - no key available
		lda b,x				fetch key from buffer
		incb				bump buffer pointer
		andb #$1f			wrap around if needed
		stb V2BC			save new buffer read offset
LC33E		puls cc,b,x,pc			restore registers and interrupts
LC340		pshs cc,b,x			save registers and interrupt status
		orcc #$10			disable IRQ
		ldx #V2D1			point to keyboard ring buffer
		ldb V2BD			get buffer write offset
		sta b,x				stash new key
		incb				bump buffer pointer
		andb #$1f			wrap around if needed
		stb V2BD			save new buffer write offset
		puls cc,b,x,pc			restore registers and interrupts
; SWI handler
LC352		andcc #$ef			re-enable IRQ - SWI disables it
		ldx 10,s			get return address
		lda ,x+				get operation code
		stx 10,s			save new return address
		ldx #LC384			point to first SWI routine
		ldu #LC995			point to routine offset table
LC360		ldb ,u+				get length of previous routine
		abx				add to routine pointer
		deca				are we at the right routine?
		bpl LC360			brif not
		stx ,--s			save routine address
		ldd 3,s				restore D register
		ldx 6,s				restore X register
		ldu 10,s			restore U register
		jsr [,s++]			call the routine
		rti				return to caller
; SWI2 handler
LC371		clrb				; restore direct page for ROM call
		tfr b,dp			;
		ldu 10,s			get return address
		ldb ,u+				get ROM routine offset
		stu 10,s			save new return address
		ldu #ROMTAB			point to ROM vector table
		jsr [b,u]			call the ROM routine
		sta 1,s				; save return values
		stx 4,s				;
		rti				return to caller
; SWI 0 routine
LC384		lda V26E
		tst V275
		beq LC38E
		lda V26F
		clr V275
LC38E		clrb
		suba #7
		suba V28B
		bge LC39F
		cmpa #$f9
		ble LC39F
		ldx #LCB96
		ldb a,x
LC39F		stb V22D
; SWI 1 routine
LC3A2		clr V251
		lda V22D
		beq LC3F6
LC3A9		ldb ,x
		subb #$fa
		blo LC3CF
		leax 1,x
		ldy #LC3B9
		ldb b,y
		jmp b,y
LC3B9		fcb LC3C9-LC3B9
		fcb LC3BF-LC3B9
		fcb LC417-LC3B9
		fcb LC3C6-LC3B9
		fcb LC3F6-LC3B9
		fcb LC3CB-LC3B9
LC3BF		ldd ,x++
		stx ,--s
		tfr d,x
LC3C6		ldx ,x
LC3C9		ldx ,s++
LC3CB		clr V251
		bra LC3A9
LC3CF		tst V251
		bne LC3D9
		bsr LC3E2
		dec V251
		bra LC3A9
LC3D9		bsr LC3E0
		jsr LCAB7
		bra LC3A9
LC3E0		bsr LC3F7
LC3E2		ldb ,x+
		stb V254
		bsr LC400
		addd V207
		std V233
		ldb ,x+
		stb V252
		bsr LC406
		addd V205
		std V235
LC3F6		rts
LC3F7		ldd V233
		std V22F
		ldd V235
		std V231
LC400		lda V250
		subb V208
		bra LC40A
LC406		lda V24F
		subb V206
LC40A		bcs LC40F
		bra LC414
LC40F		negb
		jsr LCA99
LC414		jmp LD377
LC417		lda ,x+
		beq LC3CB
		bsr LC3F7
		ldb -1,x
		addb V254
		stb V254
		bsr LC400
		addd V207
		std V233
		ldb -1,x
		andb #$0f
		bitb #8
		beq LC438
		orb #$f0
LC438		lslb
		addb V252
		stb V252
		bsr LC406
		addd V205
		std V235
		jsr LCAB7
		bra LC417
; swi 2 routine
; fetch a packed string immediately following the call and display it
LC448		ldx 12,s			fetch return address - string address
		decodestrsb			go decode string
		stx 12,s			save new return address - after string
		ldx #V335			point to decoded string
LC452		dod S04				display character in A
; swi 3 routine
; display an unpacked string pointed to by X
LC454		lda ,x+				fetch byte from string
		bpl LC452			brif not end of string - display it
; swi 4 routine
; display character in A
LC459		tst V2B7			are we looking for standard text mode?
		bne LC460			brif not
		ldu #V390			point to display state information
LC460		ldx 4,u				fetch current screen location
		jsr LC9B2			actually display the appropriate character
		cmpx 2,u			are we at the end of text area?
		blo LC46C			brif not
		jsr LC9D4			go scroll the text area
LC46C		stx 4,u				save new screen location
		rts				return to caller
; swi 5 routine - decode packed string at X to V335
LC46F		ldu #V335			point to output buffer
; swi 6 routine - decode a packed string at X to U
; the first value is the length of the string less one
LC472		leay -1,u			point to working data before buffer
		clr ,y				initialize value counter
		bsr LC48C			fetch a value
		tfr b,a				save length
LC47A		bsr LC48C			fetch a value
		stb ,u+				save in output
		deca				done yet?
		bpl LC47A			brif not
		sta ,u				flag end of string with $ff
		tst ,y				did we consume an even number of bytes?
		beq LC489			brif so
		leax 1,x			move pointer forward
LC489		stx 6,s				save pointer past end of input
LC48C		pshs a,u			save registers
		lda ,y				get value counter
		ldu #LC4A2			point to value handlers
		lda a,u				get offset to handler for this value
		jsr a,u				call the handler for this value
		lda ,y				get value counter
		inca				bump it
		anda #7				wrap it around - the pattern repeats every 8 values
		sta ,y				save new value counter
		andb #$1f			values are only 5 bits - clear out extra bits
		puls a,u,pc			restore registers and return
LC4A2		fcb LC4AA-LC4A2			value 0 handler
		fcb LC4B0-LC4A2			value 1 handler
		fcb LC4B5-LC4A2			value 2 handler
		fcb LC4B9-LC4A2			value 3 handler
		fcb LC4BE-LC4A2			value 4 handler
		fcb LC4C3-LC4A2			value 5 handler
		fcb LC4C7-LC4A2			value 6 handler
		fcb LC4CC-LC4A2			value 7 handler
; value 0: upper 5 bits of current input byte
LC4AA		ldb ,x				fetch input byte
		lsrb				; align in low bits of B
LC4AD		lsrb				;
LC4AE		lsrb				;
; value 1: lower 3 bits of current input byte and upper 2 bits of next one
; consumes a byte
LC4B0		ldd ,x+				fetch input data and consume a byte
		jmp LD379			; align in low bits of B
; value 2: bits 5...1 of current input byte
LC4B5		ldb ,x				fetch input byte
		bra LC4AE			align in low bits of B
; value 3: bits 0 of current byte and upper 4 bits of next one
; consumes a byte
LC4B9		ldd ,x+				fetch input data and consume a byte
		jmp LD37D			align in low bits of B
; value 4: low 4 bits of input byte and high bit of next one
; consumes a byte
LC4BE		ldd ,x+				fetch input data and consume a byte
		jmp LD377			align in low bits of B
; value 5: bits 6...2 of current input byte
LC4C3		ldb ,x				fetch input data
		bra LC4AD			align in low bits of B
; value 6: low two bits of current input byte and high 3 bits of next one
; consums a byte
LC4C7		ldd ,x+				fetch input data and consume a byte
		jmp LD37B			align in low bits of B
; value 7: low 5 bits of current input byte
; consumes a byte
LC4CC		ldb ,x+				fetch input data - already aligned
; swi 7 routine
LC4CF		ldx #8
LC4D2		clrb
		ldy #8
		lda V26D
		anda #$e1
LC4DB		lsla
		bcc LC4DF
LC4DF		leay -1,y
		bne LC4DB
		rol V26B
		rol V26C
		rol V26D
		leax -1,x
		bne LC4D2
		lda V26B
		sta 3,s
; swi 8 routine
LC4F3		ldu V209
; swi 9 routine
LC4F6		ldu V20B
		ldb V22C
		bsr LC517
		stu 10,s
; swi 10 routine
LC4FF		ldx #V388
		ldu #LD87C
		bra LC50D
; swi 11 routine
LC507		ldx #V390
		ldu #LD888
LC50D		clr 4,x
		clr 5,x
		ldb 6,x
		bsr LC517
		leau 6,u
LC517		pshs a,b,x,y,u
		tfr d,y
		leax ,u
		ldu 2,u
LC520		pshu a,b,y
		cmpu ,x
		bne LC520
		puls a,b,x,y,u,pc
; swi 12 routine
LC529		clr V2C1
		ldd V217
		std V2C2
		lda #6
LC531		lsl V2C3
		rol V2C2
		rol V2C1
		bne LC531
		clr V2C4
		ldd V221
		std V2C5
		lsl V2C6
		rol V2C5
		rol V2C4
		ldd V217
		addd V2C5
		std V2C5
		ldb V2C4
		adcb #0
		stb V2C4
		clr V2C7
LC554		ldd V2C2
		subd V2C5
		std V2C2
		lda V2C1
		sbca V2C4
		sta V2C1
		inc V2C7
		bcc LC554
		lda V2C7
		suba #19
		sta V2AF
		tst V228
		bne LC595
		cmpa #3
		bgt LC5AE
		dod S0B
		lda V26E
		sta V270
LC578		dec V26F
		jsr [V2B2]
		dec V2B4
		dec V26E
		lda V26E
		cmpa #$f8
		bgt LC578
		dod S09
		dec V2B4
		dec V228
		clr V2BC			; reset keyboard buffer
		clr V2BD			;
		bra LC5AE
LC595		cmpa #4
		ble LC5AE
LC599		jsr [V2B2]
		dec V2B4
		inc V26F
		inc V26E
		lda V26E
		cmpa V270
		ble LC599
		clr V228
		dod S0F
LC5AE		ldx V217
		cmpx V221
		blo LC5B5
LC5B5		ldx #LDF10
		dec V29E
		dod S13
		dod S02
		fcb $ff,$c1,$92,$d0		"YET ANOTHER DOES NOT RETURN..."
		fcb $01,$73,$e8,$82
		fcb $c8,$04,$79,$66
		fcb $07,$3e,$80,$91
		fcb $69,$59,$3b,$de
		fcb $f0
		clr V228
		dec V277
LC5D7		bra LC5D7
; swi 13 routine
LC5D9		ldu #V388
		dec V2B7
		lda V22C
		sta 6,u
		bsr LC609
		std 4,u
		ldx V21D
		bsr LC617
		dod S03
		ldd #17
		bsr LC609
		ldx V21F
		bsr LC617
		tfr x,y
		ldd #$21
LC5FD		decb
		tst ,y+
		bpl LC5FD
		std 4,u
		dod S03
		clr V2B7
LC609		pshs a,b
		std 4,u
		ldd #15
LC610		dod S04
		bne LC610
		puls a,b,pc
LC617		pshs a,b,y,u
		leay ,x
		bne LC622
		ldx #LC650
		bra LC63C
LC622		ldu #V313
		tst 11,y
		bne LC632
		lda 9,y
		ldx #LD8F4
		bsr LC63E
		clr -1,u
LC632		lda 10,y
		ldx #LD96B
		bsr LC63E
		ldx #V313
LC63C		puls a,b,y,u,pc
LC63E		pshs a,x
LC640		decodestrsb
		bpl LC640
		ldx #V336
LC648		lda ,x+
		sta ,u+
		bpl LC648
		puls a,x,pc
LC650		fcb $05,$0d,$10,$14		unpacked string "EMPTY"
		fcb $19,$ff
; swi 14 routine
LC656		tst V228
		bne LC65F
		bsr LC660
		dec V2B4
LC65F		rts
LC660		pshs a,b,x,y,u
		ldd V226
		ldu V224
		beq LC66C
		adda 7,u
		addb 8,u
LC66C		std V26E
		jsr [V2B2]
		puls a,b,x,y,u,pc
; swi 15 routine
LC674		ldx #LC67A
		dod S03
LC67A		fcb $1f,$1e,$1c,$24		unpacked string...
		fcb $ff
LC67C		equ LC67A+2			????

; swi 16 routine
; delay for 81 ticks (1.3 seconds)
LC67F		ldb #$51			fetch delay tick count
LC681		sync				wait for a tick
		decb				are we done yet?
		bne LC681			brif not
; swi 17 routine
LC686		clra
; swi 18 routine
LC688		lda #$ff
LC68A		sta ,x+
		cmpx 10,s
		bne LC68A
; This looks like a leftover from earlier development which had the
; rom calls as a SWI call instead of using SWI2. This routine cannot
; be reached through the SWI mechanism and it cannot be called directly
LC691		clrb				; reset direct page for ROM call
		tfr b,dp			;
		ldu 12,s			fetch return address
		ldb ,u+				fetch rom call wanted
		stu 12,s			save new return address
		ldu #ROMTAB			point to ROM vector table
		jsr [b,u]			call the routine
		sta 3,s				; save return values
		stx 6,s				;
; swi 19 routine
LC6A4		clr V2B1
		dod S0A
; swi 20 routine
LC6A8		dod S0B
		ldd #$8080
		std V24F
		ldb V29E
		beq LC6B7
		ldb #$20
		dec V29C
LC6B7		bsr LC6D7
		bpl LC6B7
		clr V29C
		clr V29E
LC6C1		dod S1B,$16
; swi 21 routine
LC6C5		dod S0B
		bsr LC6C1
		dec V29C
LC6CC		bsr LC6D7
		cmpb #$20
		bne LC6CC
		clr V29C
LC6D7		pshs x,u
		stb V22D
		stb V29D
		dod S09
		dod S01
		dec V2B4
		puls x,u,pc
; swi 22 routine
LC6E6		jsr LD489
		ldd #$12c
		std 4,u
		dod S02
		fcb $3c,$24,$58,$06	packed string "PREPARE!"
		fcb $45,$d8
		clr V2B7
		dec V2B4
; swi 23 routine
LC6FB		ldu V20F
		stu 6,s
		leax 14,u
		stx V20F
		sta 9,u
		stb 4,u
		dod S18
		ldb 10,u
		ldx #LC719
		lda b,x
		bmi LC718
		ldb 11,u
		dod S18
		stb 11,u
LC718		rts
LC719		fcb $ff,$ff,$ff,$10
		fcb $11,$0f
; swi 24 routine
LC71F		lsla
		ldx #LDA00
		leay a,x
		leax 10,u
		lda #4
		jsr LC04B
		ldx #LDA60
LC730		leax 4,x
		lda ,x
		bmi LC742
		cmpa 3,s
		bne LC730
		ldd 1,x
		std 6,u
		lda 3,x
		sta 8,u
LC742		rts
; swi 25 routine
LC743		dod S0A
		dod S0B
		dod S0C
		inc V2AE
		dec V2AD
		dec V2B1
		dod S0D
		ldx #LCE66
		stx V2B2
		dod S0E
; swi 26 routine
LC759		sta V281
		ldb #12
		addd #V398
		std V282
		ldb V281
		ldx #LCFFD
LC768		stx V286
LC76A		lda ,x+
		bpl LC76A
		bpl LC768
		ldx #V3D4
		ldu #V5F4
		dod S11
		jsr LC053
		jsr LCC9C
		ldu V282
		lda #11
LC783		ldb a,u
		beq LC78D
LC787		jsr LCFA5
		bne LC787
LC78D		deca
		bpl LC783
		ldu #V3C3
		clr V291
LC795		jsr LCF63
		beq LC7B6
		tst 5,x
		bpl LC795
LC79E		leau 17,u
		cmpu #V5F4
		blo LC7AA
		ldu #V3D4
LC7AA		tst 12,u
		beq LC79E
		ldd 8,u
		stx 8,u
		std ,x
		bra LC795
LC7B6		lda V281
		anda #1
		sta V22C
		sta V396
		sta V386
		sta V38E
; swi 27 routine
; play a sound specified by the immediate identifier
LC7C8		ldx 12,s			fetch return address
		lda ,x+				fetch immediate data
		stx 12,s			update return address
		ldb #$ff
; swi 28 routine
; play a sound specified by the value in A
LC7D0		stb V261
		ldx #LC7DC			point to sound routine jump table
		lsla				two bytes per jump table entry
		jsr [a,x]			call the sound generator routine
		clr PIA1			turn off sound output
		rts				return to caller
; the jump table for sound routines
LC7DC		fdb LC82B			sound 0
		fdb LC850			sound 1
		fdb LC951			sound 2
		fdb LC83C			sound 3
		fdb LC8E2			sound 4
		fdb LC955			sound 5
		fdb LC84A			sound 6
		fdb LC8DE			sound 7
		fdb LC84D			sound 8
		fdb LC959			sound 9
		fdb LC877			sound 10
		fdb LC877			sound 11
		fdb LC80A			sound 12
		fdb LC811			sound 13
		fdb LC827			sound 14
		fdb LC8DA			sound 15
		fdb LC8A6			sound 16
		fdb LC8B2			sound 17
		fdb LC93F			sound 18
		fdb LC8E6			sound 19
		fdb LC872			sound 20
		fdb LC86D			sound 21
		fdb LC88A			sound 22
; sound 12
LC80A		ldu #LC823
		lda #4
		bra LC816
; sound 13
LC811		ldu #LC81F
		lda #10
LC816		sta V25F
LC818		jsr ,u
		dec V25F
		bne LC818
LC81F		ldx #$40
		fcb $10
LC823		ldx #$80
		fcb $10
; sound 14
LC827		ldx #$100
		fcb $10
; sound 0
LC82B		ldx #$20
LC82E		bsr LC835
		leax -1,x
		bne LC82E
LC835		lda #$ff
		bsr LC869
		bra LC869
; sound 3
LC83C		ldx #$500
LC83F		bsr LC835
		leax $30,x
		cmpx #$800
		blo LC83F
; sound 6
LC84A		lda #2
; sound 8
LC84D		lda #1
; sound 1
LC850		lda #10
		sta V262
LC854		ldy #$c0
LC858		bsr LC8CE
		bsr LC8C5
		leay -1,y
		bne LC858
		bsr LC8BA
		dec V262
		bne LC854
LC867		bsr LC8CE
LC869		bsr LC8C5
		bra LC8BD
; sound 21
LC86D		ldu #LDBDA
		bra LC893
; sound 20
LC872		ldu #LDBD2
		bra LC893
; sound 10, sound 11
LC877		lda #8
		sta V25F
LC87B		bsr LC8CE
		bne LC882
LC882		tfr d,x
		bsr LC82E
		dec V25F
		bne LC87B
; sound 22
LC88A		ldu #LDBD2
		bsr LC893
		bsr LC8BA
		leau 4,u
LC893		ldx ,u
LC895		ldy 2,u
LC898		bsr LC867
		leay -1,y
		bne LC898
		leax 2,x
		cmpx #$150
		bne LC895
; sound 16
LC8A6		jsr LC931
		fcb $80
LC8AA		bsr LC922
		bcs LC8B2
		bsr LC8C5
		bra LC8AA
; sound 17
LC8B2		jsr LC92E
		fcb $a0
LC8B6		bsr LC926
		bra LC8B6
LC8BA		ldx #$1000
LC8BD		pshs x
LC8BF		leax -1,x
		bne LC8BF
LC8C3		puls x,pc
LC8C5		ldb V261
		anda #$fc
		sta PIA1
LC8CE		ldd V256
		addd V256
		std V256
; sound 15
LC8DA		bsr LC915
		fdb $6424
; sound 7
LC8DE		bsr LC915
		fdb $3212
; sound 4
LC8E2		bsr LC915
		fdb $AF36
; sound 19
LC8E6		bsr LC915
		fdb $1909
LC8EA		bsr LC92E
		fcb $60
LC8ED		ldx V263
		ldy V265
LC8F3		leax -1,x
		bne LC8FD
		ldx V263
		eora #$7f
		bsr LC90A
LC8FD		leay -1,y
		bne LC8F3
		ldy V265
		eora #$80
		bsr LC90A
		bra LC8F3
LC90A		sta V259
		bsr LC97E
		bls LC8C3			skip the caller to this routine and return to its caller
		bsr LC8C5
		lda V259
; this routine doesn't return to the caller but to the caller's caller
LC915		ldx ,s++
		ldb ,x+
		std V263
		ldb ,x+
		std V265
		bra LC8EA
LC922		bsr LC8CE
		bra LC98D
LC926		bsr LC8CE
LC928		bsr LC97E
		bls LC8C3			skip the caller to this routine and return to its caller
		bra LC8C5
LC92E		ldx V203
		fcb $10
LC931		ldx V200
LC933		stx V25B
		ldx ,s
		ldb ,x+
		std V25D
		stx ,s
; sound 18
LC93F		bsr LC92E
		fcb $60
LC942		jsr LC8CE
		bsr LC928
		jsr LC8CE
		ora #$80
		bsr LC928
		bra LC942
; sound 2
LC951		ldx #$300
		fcb $10
; sound 5
LC955		ldx #$200
		fcb $10
; sound 9
LC959		ldx #$100
		stx V25D
		std V25B
LC962		bsr LC922
		bcs LC971
		jsr LC8C5
		ldx #$f0
		jsr LC8BD
		bra LC962
LC971		bsr LC92E
		fcb $40
LC974		bsr LC926
		ldx #$60
		jsr LC8BD
		bra LC974
LC97E		pshs a
		ldd V25B
		subd V25D
LC984		pshs cc
		std V25B
		ldb 1,s
		puls cc,b,pc
LC98D		pshs a
		ldd V25B
		addd V25D
		bra LC984
; this is the swi routine offset table - each byte is the difference between the entry point
; of the previous routine and itself
LC995		fcb 0				first routine has nothing before it
		fcb LC3A2-LC384
		fcb LC448-LC3A2
		fcb LC454-LC448
		fcb LC459-LC454
		fcb LC46F-LC459
		fcb LC472-LC46F
		fcb LC4CF-LC472
		fcb LC4F3-LC4CF
		fcb LC4F6-LC4F3
		fcb LC4FF-LC4F6
		fcb LC507-LC4FF
		fcb LC529-LC507
		fcb LC5D9-LC529
		fcb LC656-LC5D9
		fcb LC674-LC656
		fcb LC67F-LC674
		fcb LC686-LC67F
		fcb LC688-LC686
		fcb LC6A4-LC688
		fcb LC6A8-LC6A4
		fcb LC6C5-LC6A8
		fcb LC6E6-LC6C5
		fcb LC6FB-LC6E6
		fcb LC71F-LC6FB
		fcb LC743-LC71F
		fcb LC759-LC743
		fcb LC7C8-LC759
		fcb LC7D0-LC7C8
; The following code handles displaying text on the screen. It works as follows.
; The graphics screen is divided into a grid of character cells 32 columns wide by 24 rows high. Each cell
; is 8 pixels wide by 8 pixels high. Text can be rendered anywhere on the screen as long as it fits within
; a character cell. The cells line up on even bytes which makes actually rendering the characters fast.
; Characters are encoded in 5 bits as follows: A through Z are given codes 1 through 26. 0 is a space. 27
; is the exclamation point, 28 is the underscore, 29 is the question mark, and 30 is the period. Code 31
; is used as a carriage return. Codes 32 and 33 are the left and right parts of the contracted heart symbol
; while 34 and 35 are the left and right parts of the expanded heart symbol. 36 is backspace.
; Glyphs for codes 0 through 30 are encoded using the packed five bit encoding and are located at LDB1B. They
; are encoded in a 5 by 7 bitmap which is shifted to be offset one pixel from the left of the character cell
; upon decoding.
; The glyphs for the heart codes are in unpacked encoding and are located at LDBB6 and occupy the entire
; 8 bit width of the character cell.
; These routines expect a pointer to the text configuration parameters in U. At offset 0 is the start address
; of the scrollable area of the screen (memory address). At offset 2 is the ending character cell address of
; the scrollable area of the screen. At offset 4 is the current printing position. At offset 6 is a mask with
; all pixels set to the background colour. At offset 7 a flag which when nonzero inhibits rendering text to
; the secondary graphics screen area. For the ordinary command entry area at the bottom of the screen, this
; will point to V390.
LC9B2		cmpa #$24			is it backspace?	
		beq LC9BF			brif so
		cmpa #$1f			vertical spacer?
		beq LC9CA			brif so
		bsr LCA17			go handle a glyph
		leax 1,x			move to next character position
		rts				return to caller
LC9BF		leax -1,x			move display pointer back one
		cmpx V203			did we wrap around negative?			
		bne LC9C9			brif not
		ldx 2,u				get end of text area
		leax -1,x			move back one position to be in the text area
LC9C9		rts				return to caller
LC9CA		leax $20,x			move pointer forward one character row
		exg d,x				move pointer so we can do math
		andb #$e0			force pointer to the start of the line
		exg d,x				put pointer back where it belongs
		rts				return to caller
LC9D4		pshs a,b,x,y			save registers
		ldx ,u				get start of screen address
		ldd 2,u				get end of text area
		subd #$20			knock one character row off it
		std 2,s				save new display location
		bsr LCA10			multiply by 8 - 8 pixel rows per cell
		tfr d,y				save counter
LC9E3		ldd $100,x			get bytes 8 pixel rows ahead
		tst 7,u				do we need to skip the second screen?
		bne LC9EF			brif so
		std $1800,x			save scroll data on second screen
LC9EF		std ,x++			save scroll data and move pointer ahead
		leay -2,y			are we done yet?
		bne LC9E3			brif not
		ldb 6,u				fetch current background colour
		sex				and make A match
		ldy #$100			number of bytes to blank bottom row
LC9FC		tst 7,u				are we doing second screen too?
		bne LCA04			brif not
		std $1800,x			blank pixels in second screen
LCA04		std ,x++			blank pixels and move pointer forward
		leay -2,y			are we done yet?
		bne LC9FC			brif not
		puls a,b,x,y,pc			restore registers and return
LCA0C		lslb				; enter here to shift D left 5 bits
		rola				;
		lslb				;
		rola				;
LCA10		lslb				; enter here to shift D left 3 bits
		rola				;
LCA12		lslb				; enter here to shift D left 2 bits
		rola				;
		lslb				;
		rola				;
LCA17		pshs a,b,x,y,u			save registers
		cmpa #$20			is it a printing character?
		blo LCA29			brif so
		suba #$20			mask off printing characters
		ldb #7				7 bytes per font table entry
		mul				get offset in table
		addd #LDBB6			add in base address of table
		tfr d,x				put font pointer somewhere useful
		bra LCA44			go draw glyph
LCA29		ldb #5				5 bytes per font table entry
		mul				get offset in table
		addd #LDB1B			add in base address of table
		tfr d,x				put pointer somewhere useful
		ldu #V357			point to buffer to decode glyph data
		decodestr			go decode a packed string
		ldx #V357+7			point one past end of buffer
LCA39		lsl ,-x				; centre glyph data in byte
		lsl ,x				;
		cmpx #V357			at start of buffer?
		bhi LCA39			brif not - keep centring
		ldu 6,s				get back U value
LCA44		ldd 4,u				get display address location
		bsr LCA10			multiply by 8 - gets start of row in 11..8
		lsrb				; and divide lsb by 8 again to get offset within
		lsrb				; the row to bits 4..0
		lsrb				; and force to top of character cell
		addd ,u				add in start of text area
		tfr d,y				put pointer somewhere useful
		ldb #7				seven bytes to copy
LCA51		lda ,x+				get byte from font data
		eora 6,u			merge with background colour
		sta ,y				save it on the screen
		tst 7,u				do we need to update second screen?
		bne LCA5F			brif not
		sta $1800,y			save pixels on second screen
LCA5F		leay $20,y			move display pointer down one pixel row
		decb				are we done yet?
		bne LCA51			brif not - do another
		puls a,b,x,y,u,pc		restore registers and return
LCA67		pshs a,b,x
		clr ,s
		clr 1,s
		clr V2C1
		std V2C2
		beq LCA97
		cmpd 2,s
		bne LCA7C
		inc ,s
		bra LCA97
LCA7C		ldx #16
LCA7F		lsl V2C3
		rol V2C2
		rol V2C1
		lsl 1,s
		rol ,s
		ldd V2C1
		subd 2,s
		bcs LCA93
		std V2C1
		inc 1,s
LCA93		leax -1,x
		bne LCA7F
LCA97		puls a,b,x,pc
LCA99		coma
		addd #1
LCA9F		pshs a,b,x
		ldx V243
		ldd ,s
		bpl LCAAE
		bsr LCA99
		bsr LCA67
		bsr LCA99
LCAAE		bsr LCA67
		std ,s
		puls a,b,x,pc
LCAB4		jmp LCB8A
LCAB7		pshs a,b,x,y,u
		inc V22D
		beq LCAB4
		lda V22D
		sta V22E
		ldd V235
		subd V231
		std V23E
		bpl LCACB
		bsr LCA99
LCACB		std V243
		ldd V233
		subd V22F
		std V241
		bpl LCAD7
		bsr LCA99
LCAD7		cmpd V243
		blt LCAE0
		std V243
		beq LCAB4
LCAE0		ldd V23E
		bsr LCA9F
		std V23E
		tfr a,b
		ldb #1
		sta V23D
		bpl LCAF0
LCAF0		stb V245
		ldd V241
		bsr LCA9F
		std V241
		tfr a,b
		ldb #$20
		sta V240
		bpl LCB02
LCB02		stb V246
		ldd V231
		std V237
		ldd V22F
		std V23A
		lda #$80
		sta V239
		sta V23C
		ldx 2,u
		stx V249
		ldx ,u
		stx V247
		ldd V23A
		jsr LCA0C
		leax d,x
		ldd V237
		jsr LD37F
		leax d,x
		ldu #LCB8E
		ldy V243
LCB2E		dec V22E
		bne LCB54
		lda V22D
		sta V22E
		tst V237
		bne LCB54
		cmpx V247
		blo LCB54
		cmpx V249
		bhs LCB54
		ldb V238
		andb #7
		lda b,u
		tst V22C
		beq LCB50
		anda ,x
LCB50		ora ,x
		sta ,x
LCB54		lda V238
		anda #$f8
		sta V2C1
		ldd V238
		addd V23E
		std V238
		ldb V237
		adcb V23D
		stb V237
		anda #$f8
		cmpa V2C1
		beq LCB70
		ldb V245
		leax b,x
LCB70		ldd V23B
		sta V2C1
		addd V241
		std V23B
		ldb V23A
		adcb V240
		stb V23A
		cmpa V2C1
		beq LCB86
		ldb V246
		leax b,x
LCB86		leay -1,y
		bne LCB2E
LCB8A		dec V22D
		puls a,b,x,y,u,pc
LCB8E		fcb $80,$40,$20,$10
		fcb $08,$04,$02,$01
LCB96		pshs a,x,u
		ldx V211
		ldu #V313
LCB9D		lda ,x+
		beq LCB9D
		bra LCBA5
LCBA3		lda ,x+
		sta ,u+
		cmpu #V333
		blo LCBA3
LCBAF		lda #$ff
		sta ,u+
		stx V211
		tst V313
		puls a,x,u,pc
LCBBA		clr V290
		ldx #LD96A
		bsr LCBEC
		bmi LCBC8
		beq LCBDF
		std V28E
LCBC8		dec V290
		ldx #LD8F3
		bsr LCBE7
		ble LCBDF
		std V28E
		ldx #LD96A
		bsr LCBEC
		ble LCBDF
		cmpb V28F
		bne LCBDF
LCBDF		leas 2,s
LCBE1		dod S02
		fcb $17,$7b,$d0			packed string
LCBE7		pshs a,b,x,y,u
		bra LCBF4
LCBEC		pshs a,b,x,y,u
		bsr LCB96
		bmi LCC2D
LCBF4		clr V278
		clr V27B
		ldb ,x+
		stb V279
LCBFC		ldu #V313
		ldy #V336
LCC05		ldb ,u+
		bmi LCC17
		cmpb ,y+
		bne LCC22
		tst ,y
		bpl LCC05
		tst ,u
		bpl LCC22
LCC15		dec V27B
LCC17		tst V278
		bne LCC2B
		inc V278
		ldb V335
		std ,s
LCC22		inca
		dec V279
		bne LCBFC
		tst V278
		bne LCC2F
LCC2B		ldd V203
LCC2D		std ,s
LCC2F		puls a,b,x,y,u,pc
LCC31		ldx #LD8D9
		bsr LCBEC
		ble LCBDF
		ldu #V21F
		cmpa #1
		beq LCC46
		ldu #V21D
		cmpa #0
		bne LCBDF
LCC46		ldx ,u
LCC49		pshs a,b,x,u
		bsr LCC56
		bsr LCC56
		bsr LCC56
		puls a,b,x,u,pc
LCC56		pshs a,b
		bsr LCC60
		bsr LCC60
LCC60		pshs a,b
		bsr LCC8E
		bne LCC6B
		bsr LCC7B
		lda ,x
LCC6B		lda #$ff
		sta ,u+
		puls a,b,pc
LCC71		dod S07
		anda #$1f
		tfr a,b
		dod S07
		anda #$1f
LCC7B		pshs a,b
		anda #$1f
		andb #$1f
		tfr d,x
		ldb #$20
		addd #V5F4
		exg d,x
		puls a,b,pc
LCC8E		pshs a,b
		anda #$1f
		cmpa ,s
		bne LCC9A
		andb #$1f
		cmpb 1,s
LCC9A		puls a,b,pc
LCC9C		ldx #V5F4
		ldu #V9F4
		dod S12
		ldx #LCD9F
		ldb V281
		ldd ,x++
		std V26B
		lda ,x
		sta V26D
		ldy #V1F4
		jsr LCC71
		std V27C
LCCBB		dod S07
		anda #3
		sta V28A
		dod S07
		anda #7
		sta V27E
		bra LCCD2
LCCCA		ldd V288
		std V27C
		dec V27E
		beq LCCBB
LCCD2		ldd V27C
		jsr LD11B
		bsr LCC8E
		bne LCCBB
		std V288
		tst ,x
		beq LCCCA
		ldu #V9F4
		jsr LCC49
		lda 3,u
		adda ,u
		adda 1,u
		beq LCCBB
		lda 1,u
		adda 2,u
		adda 5,u
		beq LCCBB
		lda 5,u
		adda 8,u
		adda 7,u
		beq LCCBB
		lda 7,u
		adda 6,u
		adda 3,u
		beq LCCBB
		clr ,x
		leay -1,y
		bne LCCCA
		clr V27C
		clr V27D
LCD11		ldd V27C
		jsr LCC7B
		lda ,x
		beq LCD41
		ldd V27C
		ldu #V9F4
		jsr LCC49
		lda ,x
		ldb #$ff
		cmpb 1,u
		bne LCD2D
		ora #3
LCD2D		cmpb 3,u
		bne LCD33
		ora #$c0
LCD33		cmpb 5,u
		bne LCD39
		ora #$0c
LCD39		cmpb 7,u
		bne LCD3F
		ora #$30
LCD3F		sta ,x
LCD41		ldb #$20
		inc V27D
		cmpb V27D
		bne LCD11
		clr V27D
		inc V27C
		cmpb V27C
		bne LCD11
		ldb #$46
		ldu #LCDAA
LC056		bsr LCD6D
		bne LC056
		ldb #$2d
		ldu #LCDAE
LCD60		bsr LCD6D
		bne LCD60
		ldb V297
LCD67		dod S07
		bne LCD67
LCD6D		pshs a,b,x,y,u
		ldy #LCDA6
LCD73		jsr LCC71
		std V288
		ldb ,x
		cmpb #$ff
		beq LCD73
		dod S07
		anda #3
		sta V28A
		bitb a,y
		bne LCD73
		orb a,u
		stb ,x
		ldd V288
		jsr LD11B
		ldb V28A
		addb #2
		andb #3
		lda ,x
		ora b,u
		sta ,x
		puls a,b,x,y,u,pc
LCD9F		fcb $73,$c7,$5d,$97
		fcb $f3,$13,$87
LCDA6		fcb $03,$0c,$30,$c0
LCDAA		fcb $01,$04,$10,$40
LCDAE		fcb $02,$08,$20,$80
LCDB2		ldu V20B
		ldd #$1f1f
		std V27C
LCDB9		ldd V27C
		bsr LCE11
		jsr LCC7B
		lda ,x
		bne LCDC7
LCDC7		lda #6
LCDC9		stb ,y
		leay $20,y
		bne LCDC9
		dec V27D
		bpl LCDB9
		lda #$1f
		sta V27D
		dec V27C
		bpl LCDB9
		tst V294
		beq LCE2B
		clr V291
LCDE3		jsr LCF63
		beq LCDF7
		tst 5,x
		bne LCDE3
		ldd 2,x
		bsr LCE11
		ldd #8
		bsr LCE1D
		bra LCDE3
LCDF7		ldx #V3C3
LCDFA		leax $11,x
		cmpx #V5F4
		beq LCE2B
		tst 12,x
		beq LCDFA
		ldd 15,x
		bsr LCE11
		ldd #$1054
		bsr LCE1D
		bra LCDFA
LCE11		tfr d,y
		ldb #$c0
		addd ,u
		exg d,y
		leay b,y
LCE1D		sta $20,y
		stb $40,y
		stb $60,y
		sta $80,y
LCE2A		rts
LCE2B		ldd V213
		bsr LCE11
		ldd #$2418
		bsr LCE1D
		ldx V286
		bsr LCE38
LCE38		lda ,x+
		bmi LCE2A
		ldd ,x++
		bsr LCE11
		ldd #$3c24
		bsr LCE1D
		bra LCE38
LCE47		pshs a,x
		ldx #LCF48
		tst V273
		bne LCE5C
		leax >1,x
		tst V274
LCE56		bne LCE5C
		leax $fff5,x
LCE5C		lda V28B
		lda a,x
		sta V24F
		sta V250
		puls a,x,pc
LCE66		dod S09
		clr V28B
		ldd V213
		std V27C
LCE6E		bsr LCE47
		ldd V27C
		jsr LCC7B
		lda ,x
		ldu #V9F4
		ldx #4
LCE7D		tfr a,b
		andb #3
		stb 4,u
		stb ,u+
		leax -1,x
		bne LCE7D
		ldb V223
		ldu #V9F4
		leau b,u
		ldy #LDBDE
LCE96		lda ,y+
		bmi LCED8
		ldb a,u
		cmpb #4
		bne LCEA9
		ldx b,y
		dec V275
		bsr LCECE
		ldb #6
LCEA9		ldx b,y
		bsr LCECE
		leay 8,y
		bra LCE96
LCEB1		rts
LCEB2		tfr x,y
		tst b,u
		bne LCEB1
		addb V223
		stb V28A
		ldd V27C
		jsr LD11B
		jsr LCF82
		beq LCEB1
		exg x,y
LCEC8		tst 2,y
		beq LCECE
		dec V275
LCECE		pshs u
		dod S00
		ldu V20B
		dod S01
		puls u,pc
LCED8		ldd V27C
		jsr LCF82
		beq LCEEB
		tfr x,y
		ldb 13,y
		ldx #LDAA3
		ldx b,x
		bsr LCEC8
LCEEB		ldb #3
		ldx #LDCB0
		bsr LCEB2
		ldb #1
		ldx #LDCB9
		bsr LCEB2
		ldx #LDD3C
		ldd V27C
		jsr LCFE1
		bmi LCF09
		ldx #LDCC2
		ldx a,x
LCF09		bsr LCECE
		clr V291
LCF0D		ldd V27C
		jsr LCF53
		beq LCF24
		lda 10,x
		ldx #LD9EE
		ldx a,x
		dec V275
		bsr LCECE
		bsr LCECE
		bra LCF0D
LCF24		tst ,u
		bne LCF3D
		lda V223
		sta V28A
		ldd V27C
		jsr LD11B
		std V27C
		inc V28B
		lda V28B
		cmpa #9
		lble LCE6E
LCF3D		rts
LCF3E		fcb $c8,$80,$50,$32
		fcb $1f,$14
LCF44		fcb $0c,$08,$04,$02
LCF48		fcb $ff,$9c,$64,$41
		fcb $28,$1a,$10,$0a
LCF50		fcb $06,$03,$01
LCF53		bsr LCF63
		beq LCF62
		cmpd 2,x
		bne LCF53
		tst 5,x
		bne LCF53
		andcc #$fb
LCF62		rts
LCF63		pshs a
		lda V281
		ldx V292
		tst V291
		bne LCF72
		ldx #VB07
		dec V291
LCF72		leax 14,x
		stx V292
		cmpx V20F
		beq LCF80
		cmpa 4,x
		bne LCF72
		andcc #$fb
LCF80		puls a,pc
LCF82		ldx #V3C3
LCF85		leax $11,x
		cmpx #V5F4
		beq LCF96
		cmpd 15,x
		bne LCF85
		tst 12,x
		beq LCF85
LCF96		rts
LCF97		pshs a,b,x
LCF99		jsr LCC71
		std ,s
		lda ,x
		beq LCF99
		puls a,b,x,pc
LCFA5		pshs a,b,x,y,u
LCFA7		ldu #V3C3
LCFAA		leau $11,u
		tst 12,u
		bne LCFAA
		dec 12,u
		sta 13,u
		ldb #8
		addd #LDABB
		tfr d,y
		tfr u,x
		lda #8
		jsr LC04B
LCFC4		bsr LCF97
		bsr LCF82
		bne LCFC4
		std 15,u
		tfr u,x
		jsr LC25C
		stx 5,u
		ldd #LD041
		std 3,u
		lda 6,x
		ldb #4
		jsr LC21D
		puls a,b,x,y,u,pc
LCFE1		pshs a,b,x,u
		ldu V286
		bsr LCFF2
		bpl LCFEE
		bsr LCFF2
		adda #2
LCFEE		sta ,s
		puls a,b,x,u,pc
LCFF2		lda ,u+
		bmi LCFFC
		ldx ,u++
		cmpx 2,s
		bne LCFF2
LCFFC		rts
LCFFD		fcb $80,$01,$00,$17
LD001		fcb $00,$0f,$04,$00
LD005		fcb $14,$11,$01,$1c
LD009		fcb $1e,$80,$01,$02
LD00D		fcb $03,$00,$03,$1f
LD011		fcb $00,$13,$14,$00
LD015		fcb $1f,$00,$80,$80
LD019		fcb $00,$00,$1f,$00
LD01D		fcb $05,$00,$00,$16
LD021		fcb $1c,$00,$1f,$10
LD025		fcb $80,$80
LD027		ldx V282
		ldb #11
LD02C		adda b,x
		bpl LD02C
		cmpa #$20
		bhs LD03D
		dod S07
		anda #7
		adda #2
		inc a,x
LD03D		ldd #$0508
LD041		ldy 5,u
		tst V22B
		bne LD06A
		ldb 12,y
		bne LD04D
LD04D		lda 13,y
		cmpa #6
		beq LD06D
		cmpa #10
		bge LD06D
		ldd 15,y
		clr V291
		jsr LCF53
		beq LD06D
		ldd 8,y
		stx 8,y
		std ,x
		dec 5,x
		dod S0E
LD06A		jmp LD103
LD06D		ldd 15,y
		cmpd V213
		bne LD0B2
		lda 13,y
		ldb #$ff
		dod S1C
		ldd #$8080
		ldx V21D
		bsr LD09E
		ldx V21F
		bsr LD09E
		sta V21A
		stb V21C
		tfr y,x
		ldu #V217
		jsr LD3D7
		bmi LD099
		dod S1B,$13
		jsr LD40C
LD099		dod S0C
		jmp LD10F
LD09E		pshs a,b,x
		beq LD0B0
		lda 10,x
		cmpa #3
		bne LD0B0
		ldx 6,x
		cmpx ,s
		bhs LD0B0
		stx ,s
LD0B0		puls a,b,x,pc
LD0B2		cmpa V213
		bne LD0C3
		lda 16,y
		ldb #1
		suba V214
		bmi LD0D0
		ldb #3
		bra LD0D0
LD0C3		ldd 15,y
		cmpb V214
		bne LD0E4
		ldb #2
		suba V213
		bmi LD0D0
LD0D0		stb V28A
		ldd 15,y
LD0D4		bsr LD136
		bne LD0E4
		cmpd V213
		bne LD0D4
		ldb V28A
		stb 14,y
		bra LD101
LD0E4		ldx #LD114
		dod S07
		bmi LD0EE
		leax 3,x
LD0EE		anda #3
		bne LD0F4
		leax 1,x
LD0F4		lda #3
LD0F6		ldb ,x+
		bsr LD14F
		beq LD103
		bne LD0F6
		ldb #2
LD101		bsr LD14F
LD103		lda 6,y
		ldx 15,y
		cmpx V213
		bne LD111
		dod S0E
		clr V2B5
LD10F		lda 7,y
LD111		ldb #4
LD114		fcb $00,$03,$01,$00
		fcb $01,$03,$00		
LD11B		pshs a,b
		ldb V28A
		andb #3
		ldx #LD12E
		ldd b,x
		adda ,s+
		addb ,s+
		jmp LCC7B
LD12E		fdb $ff00
		fdb 1
		fdb $100
		fdb $ff
LD136		pshs a,b,x,y,u
		bsr LD11B
		jsr LCC8E
		bne LD14D
		tfr d,u
		lda ,x
		beq LD14C
		stu ,s
		stx 2,s
		lda #1
LD14C		deca
LD14D		puls a,b,x,y,u,pc
LD14F		pshs a,b,x
		addb 14,y
		andb #3
		stb V28A
		ldd 15,y
		bsr LD136
		bne LD199
		jsr LCF82
		bne LD199
		std 15,y
		ldb V28A
		stb 14,y
		ldd 15,y
		suba V213
		bpl LD16F
LD16F		subb V214
		bpl LD174
LD174		stb V2C1
		cmpa V2C1
		bge LD17C
		exg a,b
LD17C		sta V2C1
		cmpa #8
		bgt LD198
		cmpb #2
		bgt LD198
		dod S07
		bita #1
		beq LD196
		lda V2C1
		ldb #$1f
		lda 13,y
		dod S1C
LD196		dec V2B5
LD198		clra
LD199		puls a,b,x,pc
LD19B		ldu V224
		beq LD1BC
		lda 6,u
		beq LD1BC
		sta 6,u
		cmpa #5
		bgt LD1B0
		ldb #$18
		stb 9,u
		clr 11,u
LD1B0		cmpa 7,u
		bge LD1B6
		sta 7,u
LD1B6		cmpa 8,u
		bge LD1BC
		sta 8,u
LD1BC		dec V2B5
		ldd #$0108
LD1C2		tst V2B5
		bne LD1CD
		ldx #LCDB2
		cmpx V2B2
		bne LD1D1
LD1CD		clr V2B5
		dod S0E
LD1D1		ldd #$0304
LD1D5		clra
		subd V221
		jsr LD379
		addd V221
		bgt LD1E2
LD1E2		std V221
		dod S0C
		lda V2AF
		ldb #2
LD1EB		tst V277
		bne LD21B
LD1EF		jsr LC329
		beq LD248
		tst V228
		bne LD1EF
		cmpa #$20
		beq LD215
		ldb #$1f
		cmpa #$0d
		beq LD212
		ldb #$24
		cmpa #8
		beq LD212
		cmpa #$41
		blo LD212
		cmpa #$5a
		bls LD215
LD212		tfr b,a
LD215		anda #$1f
		bsr LD24C
		bra LD1EF
LD21B		ldy V20D
		ldb ,y+
		bpl LD229
		dod S10
		dod S10
		jmp START
LD229		ldx ,y++
		ldu #V361
		leau 1,u
		dod S10
LD235		bsr LD24C
		lda ,u+
		bpl LD235
		bsr LD24C
		bne LD229
		lda #$1f
		bsr LD24C
		sty V20D
LD248		ldd #$0102
LD24C		pshs a,b,x,y,u
		tst V2AD
		bne LD256
		dod S19
		dod S0F
LD256		ldu V211
		cmpa #$1f
		beq LD26F
		cmpa #$24
		beq LD27D
		dod S04
		sta ,u+
		ldx #LC67C
		dod S03
		cmpu #V311
		bne LD2B4
LD26F		clra
		dod S04
		ldd V203
		std ,u++
		ldu #V2F1
		stu V211
		bra LD292
LD27D		cmpu #V2F1
		beq LD2B4
		leau -1,u
		ldx #LD28C
		dod S03
		bra LD2B4
LD28C		fcb $00,$24,$24,$1c
		fcb $24,$ff
LD292		ldx #LD894
		jsr LCBEC
		beq LD2A7
		bpl LD2A1
		jsr LCBE1
		bra LD2A7
LD2A1		lsla
		ldx #LD9D0
		jsr [a,x]
LD2A7		ldu #V2F1
		tst V2AD
		beq LD2B4
		tst V228
		bne LD2B4
		dod S0F
LD2B4		stu V211
		puls a,b,x,y,u,pc
LD2B8		jsr LCC31
		ldu ,u
		bne LD2C2
		ldu #VB07
LD2C2		tfr u,y
		lda 12,u
		sta V219
		lda 13,u
		sta V21B
		adda V219
		ldx V217
		jsr LD436
		addd V221
		std V221
		lda 10,u
		adda #12
		ldb #$ff
		dod S1C
		lda 9,u
		cmpa #$13
		blt LD2F7
		cmpa #$15
		bgt LD2F7
		dec 6,u
		bne LD2F7
		lda #$16
		sta 9,u
		jsr LD638
LD2F7		ldd V213
		jsr LCF82
		beq LD375
		ldu #V217
		exg x,u
		lda 10,y
		cmpa #1
		beq LD31F
		jsr LD3D7
		bmi LD375
		ldy V224
		beq LD319
		lda 9,y
		cmpa #$18
		bne LD31F
LD319		dod S07
		anda #3
		bne LD375
LD31F		dod S1B,$12
		dod S02
		fcb $16,$f7,$b0			packed "!!!" string
		jsr LD40C
		bhi LD375
		leax 8,u
LD32E		ldx ,x
		beq LD33A
		clr 5,x
		ldd 15,u
		std 2,x
		bra LD32E
LD33A		ldx V282
		ldb 13,u
		dec b,x
		clr 12,u
		dod S0E
		dod S1B,$15
		ldd ,u
		bsr LD37F
		addd V217
		bpl LD351
		lda #$7f
LD351		std V217
		lda 13,u
		cmpa #10
		beq LD386
		cmpa #11
		bne LD375
		dec V22B
		ldd #$713
		std V226
		ldx #$b23
		stx V20F
		ldd V200
		std V229
		std V224
		std V21F
		std V21D
		dod S19
LD375		dod S0C
LD377		asra
LD379		asra
LD37B		asra
LD37D		asra
LD37F		asra
LD381		asra
LD383		asra
LD386		ldx #LDF10
		dod S13
		dod S02
		fcb $ff,$c0,$57,$3e		packed string "ENOUGH! I TIRE OF THIS PLAY..."
		fcb $a7,$46,$c0,$90
		fcb $51,$32,$28,$1e
		fcb $60,$51,$09,$98
		fcb $20,$c0,$e7,$de
		fcb $f0
		dod S02
		fcb $e8,$00,$08,$48		packed string "PREPARE TO MEET THY DOOM!!!"
		fcb $b0,$0c,$8a,$0a
		fcb $3c,$0d,$29,$68
		fcb $0a,$23,$20,$23
		fcb $de,$dd,$ef,$60
		dod S10
		ldu V224
		stu V229
		beq LD3C4
		std ,u
LD3C4		ldd #200
		std V215
		lda #3
		dod S1A
		jsr LCF97
		std V213
		dod S15
		dod S19
LD3D7		pshs a,b,x,u
		lda #15
		sta V2C1
		ldd ,u
		subd 10,u
		jsr LCA12
LD3E4		subd ,x
		bcs LD3EC
		dec V2C1
		bne LD3E4
LD3EC		ldb V2C1
		subb #3
		bpl LD3FB
		lda #$19
		jsr LCA99
		bra LD3FE
LD3FB		lda #10
LD3FE		std ,--s
		dod S07
		tfr a,b
		addd ,s++
		subd #$7f
		puls a,b,x,u,pc
LD40C		pshs a,b,x,y,u
		tfr x,y
		ldx ,y
		lda 2,y
		bsr LD436
		tfr d,x
		lda 3,u
		bsr LD436
		addd 10,u
		std 10,u
		ldx ,y
		lda 4,y
		bsr LD436
		tfr d,x
		lda 5,u
		bsr LD436
		addd 10,u
		std 10,u
		ldx ,u
		cmpx 10,u
		puls a,b,x,y,u,pc
LD436		pshs a,b,x
		clr V2C1
		ldb 3,s
		std V2C2
		lda ,s
		ldb 2,s
		addd V2C1
		lsl V2C3
		std ,s
		puls a,b,x,pc
LD44E		ldd V213
		jsr LCFE1
		bmi LD46F
		sta V2C1
		ldx #LD8D9
		jsr LCBEC
		ble LD46F
		ldb V2C1
		cmpa #4
		beq LD472
		cmpa #5
		bne LD46F
		lda #1
		bitb #2
		bne LD478
LD46F		jmp LCBE1
LD472		lda #$ff
		cmpb #1
		bne LD46F
LD478		dod S16
		adda V281
		dod S1A
		dod S19
LD481		ldx #LD495
		stx V2B2
		dod S0E
LD489		dod S09
		ldx ,u
		ldu #V380
		stx ,u
		dec V2B7
LD495		bsr LD489
		clr V2B6
		ldd #10
		std 4,u
		dod S02
		fcb $62,$5c,$0a,$21		packed string "IN THIS ROOM"
		fcb $33,$04,$9e,$f6
		fcb $fc
		ldd V213
		jsr LCF82
		beq LD4C0
		ldx 4,u
		leax 11,x
		stx 4,u
		dod S02
		fcb $56,$c7,$22,$86		packed string "!CREATURE!"
		fcb $95,$91,$77,$f0
LD4C0		clr V291
LD4C2		ldd V213
		jsr LCF53
		beq LD4CD
		bsr LD505
		bra LD4C2
LD4CD		tst V2B6
		beq LD4D3
		bsr LD4FE
LD4D3		ldd #$1b20
LD4D6		dod S04
		bne LD4D6
		ldx 4,u
		leax 12,x
		stx 4,u
		dod S02
		fcb $40,$82,$35,$c0		packed string "BACKPACK"
		fcb $23,$5f,$c0
		ldx #V229
LD4ED		ldx ,x
		beq LD4FB
		cmpx V224
		bne LD4F7
		com 6,u
LD4F7		bsr LD505
		bra LD4ED
LD4FB		clr V2B7
LD4FE		lda #$1f
		dod S04
		clr V2B6
LD505		pshs a,b,x
		jsr LC617
		dod S03
		lda V22C
		sta 6,u
		com V2B6
		beq LD51E
		ldd 4,u
		addd #$10
		andb #$f0
		std 4,u
LD51E		bsr LD4FE
		puls a,b,x,pc
LD522		bsr LD576
		bne LD573
		jsr LCBBA
		clr V291
LD52B		ldd V213
		jsr LCF53
		beq LD573
		tst V290
		bne LD53C
		lda 10,x
		cmpa V28F
		bra LD540
LD53C		lda 9,x
		cmpa V28E
LD540		bne LD52B
		stx ,u
		inc 5,x
		ldb 10,x
		ldx #LD9FA
		ldb b,x
		bra LD56B
LD550		bsr LD576
		beq LD573
		std ,u
		clr 5,x
		ldd V213
		std 2,x
		lda V281
		sta 4,x
		ldb 10,x
		ldx #LD9FA
		ldb b,x
LD56B		addd V215
		std V215
		dod S0C
		bra LD5B7
LD573		jmp LCBE1
LD576		jmp LCC31
LD579		bsr LD576
		beq LD573
LD57D		ldd V229
		std ,x
		stx V229
		std ,u
		bra LD5B7
LD589		bsr LD576
		bne LD573
		jsr LCBBA
		ldx #V229
LD593		tfr x,y
		ldx ,x
		beq LD573
		tst V290
		bne LD5A3
		lda 10,x
		cmpa V28F
		bra LD5A7
LD5A3		lda 9,x
		cmpa V28E
LD5A7		bne LD593
		ldd ,x
		std ,y
		stx ,u
LD5AF		clra
		cmpx V224
		bne LD5B7
		std V224
LD5B7		dod S0D
		dod S0E
LD5BC		ldx #LD8F3
		jsr LCBEC
		ble LD5EF
		tst V27B
		beq LD5EF
		std V28E
		ldu V21D
		bsr LD5D0
		ldu V21F
LD5D0		beq LD5EF
		lda 10,u
		cmpa #1
		bne LD5EF
		lda 7,u
		beq LD5EF
		cmpa V28E
		bne LD5EF
		sta 9,u
		dod S18
		dod S1B,$0D
		dod S0D
		clr 7,u
		cmpa #$12
		beq LD5F0
LD5EF		rts
LD5F0		ldx #LDF39
		dec V29E
		dod S13
		dod S02
		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
		dod S02
		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
LD623		jsr LCC31
		ldu ,u
		beq LD63E
		lda 11,u
		beq LD63E
		ldb #$19
		cmpd V217
		bgt LD63E
		lda 9,u
LD638		dod S18
		clr 11,u
		dod S0D
LD63E		rts
LD63F		ldx #LD8D9
		jsr LCBEC
		ble LD693
		ldb V223
		cmpa #0
		bne LD654
		bsr LD66D
		bsr LD674
		bra LD669
LD654		cmpa #1
		bne LD65D
		bsr LD66D
		bra LD667
LD65D		cmpa #3
		bne LD693
		addb #2
		bsr LD66D
		bsr LD684
LD667		bsr LD684
LD669		dec V2B4
LD66D		andb #3
		stb V223
		jmp LC660
LD674		bsr LD696
		bne LD683
		ldd #8
LD67B		bsr LD6BA
		addd #$20
		beq LD67B
LD683		rts
LD684		bsr LD696
		bne LD692
		ldd #$f8
LD68B		bsr LD6BA
		subd #$20
		bpl LD68B
LD692		rts
LD693		jmp LCBE1
LD696		ldu V2B2
		cmpu #LCE66
		bne LD6B9
		ldx #$8080
		stx V24F
		clr V28B
		dod S00
		dod S08
		ldx #LD6C6
		dod S01
		ldx #$11
		stx V22F
		ldx #$87
		stx V233
LD6B9		rts
LD6BA		std V231
		std V235
		bsr LD6C0
LD6C0		jsr LCAB7
		com V22C
LD6C6		fcb $10,$00,$10,$ff
		fcb $ff,$88,$00,$88
		fcb $ff,$fe
LD6D0		ldx #LD8D9
		jsr LCBEC
		blt LD693
		bgt LD6E3
		dec V273
		dod S0E
		clr V273
		bra LD6EF
LD6E3		cmpa #2
		bne LD6F3
		dec V274
		dod S0E
		ldb #2
		clr V274
LD6EF		bsr LD720
		bra LD70E
LD6F3		cmpa #1
		bne LD701
		ldb #1
		bsr LD720
		bne LD70E
		bsr LD684
		bra LD70E
LD701		cmpa #0
		bne LD693
		ldb #3
		bsr LD720
		bne LD70E
		jsr LD674
LD70E		ldd V215
		jsr LD37F
		addd #3
		addd V221
		std V221
		dod S0C
		dec V2B4
LD720		pshs a,b
		clr ,-s
		addb V223
		andb #3
		stb V28A
		ldd V213
		jsr LD136
		beq LD738
		dod S1B,$14
		dec ,s
		ldd V213
LD738		std V213
		jsr LC660
		tst ,s+
		puls a,b,pc
LD741		jsr LCC31
		beq LD767
		ldd 9,x
		cmpb #5
		bne LD757
		stx V224
		jsr LD57D
		dod S1B,$11
		dod S0E
LD757		tfr x,u
		ldx #LD76B
LD75C		cmpa ,x
		beq LD768
		leax 3,x
		cmpx #LD77A
		blo LD75C
LD767		rts
LD768		jmp [1,x]
LD76B		fcb $05
		fdb LD77A
		fcb $09
		fdb LD783
		fcb $08
		fdb LD787
		fcb $04
		fdb LD7A2
		fcb $07
		fdb LD7A0
LD77A		ldd #V3E8
		addd V217
		std V217
		bra LD792
LD783		clra
		bra LD790
LD787		ldx V217
		lda #$66
		jsr LD436
		addd V221
LD790		std V221
LD792		ldb #$17
		stb 9,u
		clr 11,u
		dod S1B,$0c
		dod S0D
		dod S0C
LD7A0		clra
LD7A2		lda #$ff
		sta V294
		tst 11,u
		bne LD7B6
		dod S1B,$0e
		clr V2AD
		ldx #LCDB2
		stx V2B2
		dod S0E
LD7B6		rts
LD7B7		bsr LD7BC
		dec V2B8
LD7BC		ldx #V313
		leau $20,x
		dod S12
		jmp LCB96
LD7C7		bsr LD7BC
		stx CBUFAD
		ldd #$0f
		std BLKTYP
		inc V2B8
LD7D5		fcb $0d,$0f,$10,$ff
LD7D9		fcb $11,$0f
		fcb $ff
LD7DC		fdb LD1EB
		fdb LD1C2
		fdb LD1D5
		fdb LD19B
		fdb LD027
		fdb 0
; cold start variable initializers
LD7E8		fcb 12
		fdb $103
		jmp LC371
		jmp LC352
		jmp LC27D
		jmp LC27D
		fcb $17
		fdb V202
		fcb $01				V202
		fdb $ffff			V203 - 16 bit all ones value, or -1
		fcb $00
		fcb $80,$00,$4c,$d8
		fcb $70,$d8,$76,$d9
		fcb $88,$0b,$15,$02
		fcb $f1,$0c,$16,$00
		fcb $23,$17,$a0
		fcb $54
		fdb V380
		fcb $10,$00,$02,$60
		fcb $00,$00,$00,$FF
		fcb $23,$00,$00,$40
		fcb $00,$00,$FF,$00
		fcb $24,$00,$00,$80
		fcb $00,$00,$00,$00
		fcb $09,$09,$04,$02
		fcb $00,$00,$00,$00
		fcb $00,$00,$00,$00
		fcb $02,$04,$00,$06
		fcb $06,$06,$00,$00
		fcb $00,$00,$00,$00
		fcb $00,$00,$00,$04
		fcb $00,$06,$08,$04
		fcb $00,$00,$01,$00
		fcb $00,$00,$00,$00
		fcb $00,$00,$08,$06
		fcb $06,$04,$00,$00
		fcb $02,$02,$02,$02
		fcb $02,$02,$02,$04
		fcb $04,$08,$00,$01
		fcb 4
		fdb VB11
		fcb $04,$00,$00,$05
		fcb 0

LD870		fcb $10,$00,$23,$00
LD874		fcb $20,$46,$28,$00
LD878		fcb $3B,$00,$20,$A6
LD87C		fcb $23,$00,$24,$00
LD880		fcb $00,$00,$3B,$00
LD884		fcb $3C,$00,$00,$00
LD888		fcb $24,$00,$28,$00
LD88C		fcb $00,$00,$3C,$00
LD890		fcb $40,$00,$00,$00
LD894		fcb $0F,$30,$03,$4A
LD898		fcb $04,$6B,$28,$06
LD89C		fcb $C4,$B4,$40,$20
LD8A0		fcb $09,$27,$C0,$38
LD8A4		fcb $0B,$80,$B5,$2E
LD8A8		fcb $28,$18,$0E,$5A
LD8AC		fcb $00,$30,$12,$E1
LD8B0		fcb $85,$D4,$20,$18
LD8B4		fcb $F7,$AC,$20,$1A
LD8B8		fcb $FB,$14,$20,$21
LD8BC		fcb $56,$30,$30,$24
LD8C0		fcb $5B,$14,$2C,$20
LD8C4		fcb $27,$47,$DC,$20
LD8C8		fcb $29,$59,$38,$18
LD8CC		fcb $2B,$32,$80,$28
LD8D0		fcb $34,$C7,$84,$80
LD8D4		fcb $28,$35,$30,$D8
LD8D8		fcb $A0

LD8D9		fcb $06,$20,$18

LD8DC		fcb $53,$50,$28,$24
LD8E0		fcb $93,$A2,$80,$20
LD8E4		fcb $04,$11,$AC,$30
LD8E8		fcb $03,$27,$D5,$C4
LD8EC		fcb $10,$2B,$00,$20
LD8F0		fcb $08,$FB,$B8

LD8F3		fcb $19

LD8F4		fcb $38,$67,$58,$48
LD8F8		fcb $AD,$28,$28,$54
LD8FC		fcb $FA,$B0,$A0,$31
LD900		fcb $0A,$CB,$26,$68
LD904		fcb $38,$DA,$9A,$22
LD908		fcb $49,$60,$20,$A6
LD90C		fcb $52,$C8,$28,$28
LD910		fcb $82,$DE,$60,$20
LD914		fcb $64,$96,$94,$30
LD918		fcb $AC,$99,$A5,$EE
LD91C		fcb $20,$02,$2C,$94
LD920		fcb $20,$10,$16,$14
LD924		fcb $29,$66,$F6,$06
LD928		fcb $40,$30,$C5,$27
LD92C		fcb $BB,$45,$30,$6D
LD930		fcb $56,$0C,$2E,$21
LD934		fcb $13,$27,$B8,$29
LD938		fcb $59,$57,$06,$40
LD93C		fcb $21,$60,$97,$14
LD940		fcb $38,$D8,$50,$D1
LD944		fcb $05,$90,$31,$2E
LD948		fcb $F7,$90,$AE,$28
LD94C		fcb $4C,$97,$05,$80
LD950		fcb $30,$4A,$E2,$C8
LD954		fcb $F9,$18,$52,$32
LD958		fcb $80,$20,$4C,$99
LD95C		fcb $14,$20,$4E,$F6
LD960		fcb $10,$28,$0A,$D8
LD964		fcb $53,$20,$21,$48
LD968		fcb $50,$90

LD96A		fcb $06
LD96B		fcb $28

LD96C		fcb $0C,$C0,$CD,$60
LD970		fcb $20,$64,$97,$1C
LD974		fcb $30,$A6,$39,$3D
LD978		fcb $8C,$30,$E6,$84
LD97C		fcb $95,$84,$29,$27
LD980		fcb $77,$C8,$80,$29
LD984		fcb $68,$F9,$0D,$00
LD988		fcb $01,$D8,$A3,$03
LD98C		fcb $D8,$BA,$D8,$DE
LD990		fcb $D9,$83,$02,$D8
LD994		fcb $CB,$D8,$DE,$01
LD998		fcb $D8,$B2,$01,$D8
LD99C		fcb $B6,$03,$D8,$BA
LD9A0		fcb $D8,$DA,$D9,$79
LD9A4		fcb $03,$D8,$BA,$D8
LD9A8		fcb $DE,$D9,$7E,$01
LD9AC		fcb $D8,$B6,$01,$D8
LD9B0		fcb $B6,$02,$D8,$95
LD9B4		fcb $D8,$DE,$02,$D8
LD9B8		fcb $C7,$D8,$DE,$01
LD9BC		fcb $D8,$B6,$01,$D8
LD9C0		fcb $B6,$01,$D8,$B6
LD9C4		fcb $02,$D8,$C7,$D8
LD9C8		fcb $DE,$01,$D8,$B6
LD9CC		fcb $01,$D8,$B6,$FF
LD9D0		fcb $D2,$B8,$D4,$4E
LD9D4		fcb $D5,$50,$D4,$81
LD9D8		fcb $D5,$22,$D5,$BC
LD9DC		fcb $C7,$51,$D6,$D0
LD9E0		fcb $D5,$89,$D6,$23
LD9E4		fcb $D5,$79,$D6,$3F
LD9E8		fcb $D7,$41,$D7,$B7
LD9EC		fcb $D7,$C7

LD9EE		fcb $DC,$19

LD9F0		fcb $DC,$21,$DC,$2A
LD9F4		fcb $DB,$FA,$DC,$0F
LD9F8		fcb $DC,$07

LD9FA		fcb $05,$01

LD9FC		fcb $0A,$19,$19,$0A
LDA00		fcb $01,$FF,$00,$05
LDA04		fcb $01,$AA,$00,$05
LDA08		fcb $04,$96,$40,$40
LDA0C		fcb $03,$8C,$0D,$1A
LDA10		fcb $02,$82,$00,$05
LDA14		fcb $00,$46,$00,$05
LDA18		fcb $01,$34,$00,$05
LDA1C		fcb $02,$32,$00,$05
LDA20		fcb $00,$30,$00,$05
LDA24		fcb $00,$28,$00,$05
LDA28		fcb $05,$46,$00,$05
LDA2C		fcb $03,$19,$00,$1A
LDA30		fcb $01,$0D,$00,$05
LDA34		fcb $04,$0D,$00,$28
LDA38		fcb $05,$19,$00,$05
LDA3C		fcb $05,$05,$00,$05
LDA40		fcb $03,$05,$00,$0A
LDA44		fcb $04,$05,$00,$10
LDA48		fcb $01,$00,$00,$00
LDA4C		fcb $01,$00,$FF,$FF
LDA50		fcb $01,$00,$FF,$FF
LDA54		fcb $01,$00,$FF,$FF
LDA58		fcb $01,$00,$00,$05
LDA5C		fcb $00,$00,$00,$05
LDA60		fcb $05,$05,$00,$05
LDA64		fcb $00,$03,$12,$00
LDA68		fcb $01,$03,$13,$00
LDA6C		fcb $03,$40,$40,$00
LDA70		fcb $06,$03,$14,$00
LDA74		fcb $0A,$3C,$0D,$0B
LDA78		fcb $0B,$60,$80,$00
LDA7C		fcb $0C,$03,$15,$00
LDA80		fcb $0E,$1E,$0A,$04
LDA84		fcb $0F,$0F,$07,$00
LDA88		fcb $10,$6C,$80,$00
LDA8C		fcb $18,$00,$00,$00
LDA90		fcb $FF

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

LDAA3		fcb $DE

LDAA4		fcb $26,$DF,$CA,$DD
LDAA8		fcb $41,$DE,$59,$DE
LDAAC		fcb $82,$DD,$51,$DE
LDAB0		fcb $3F,$DE,$9D,$DE
LDAB4		fcb $07,$DD,$A3,$DF
LDAB8		fcb $65,$DF,$10

LDABB		fcb $00

LDABC		fcb $20,$00,$FF,$80
LDAC0		fcb $FF,$17,$0B,$00
LDAC4		fcb $38,$00,$FF,$50
LDAC8		fcb $80,$0F,$07,$00
LDACC		fcb $C8,$00,$FF,$34
LDAD0		fcb $C0,$1D,$17,$01
LDAD4		fcb $30,$00,$FF,$60
LDAD8		fcb $A7,$1F,$1F,$01
LDADC		fcb $F8,$00,$80,$60
LDAE0		fcb $3C,$0D,$07,$02
LDAE4		fcb $C0,$00,$80,$80
LDAE8		fcb $30,$11,$0D,$01
LDAEC		fcb $90,$FF,$80,$FF
LDAF0		fcb $80,$05,$04,$03
LDAF4		fcb $20,$00,$40,$FF
LDAF8		fcb $08,$0D,$07,$03
LDAFC		fcb $20,$C0,$10,$C0
LDB00		fcb $08,$03,$03,$03
LDB04		fcb $E8,$FF,$05,$FF
LDB08		fcb $03,$04,$03,$03
LDB0C		fcb $E8,$FF,$06,$FF
LDB10		fcb $00,$0D,$07,$1F
LDB14		fcb $40,$FF,$06,$FF
LDB18		fcb $00,$0D,$07

; This is the text font - these values are in packed format
LDB1B		fcb $30,$00,$00,$00,$00		char code 0 - space
		fcb $31,$15,$18,$fe,$31		char code 1 - A
		fcb $37,$a3,$1f,$46,$3e		char code 2 - B
		fcb $33,$a3,$08,$42,$2e		char code 3 - C
		fcb $37,$a3,$18,$c6,$3e		char code 4 - D	
		fcb $37,$e1,$0f,$42,$1f		char code 5 - E
		fcb $37,$e1,$0f,$42,$10		char code 6 - F
		fcb $33,$e3,$08,$4e,$2f		char code 7 - G
		fcb $34,$63,$1f,$c6,$31		char code 8 - H
		fcb $33,$88,$42,$10,$8e		char code 9 - I
		fcb $30,$42,$10,$86,$2e		char code 10 - J
		fcb $34,$65,$4c,$52,$51		char code 11 - K
		fcb $34,$21,$08,$42,$1f		char code 12 - L
		fcb $34,$77,$5a,$d6,$31		char code 13 - M
		fcb $34,$63,$9a,$ce,$31		char code 14 - N
		fcb $33,$a3,$18,$c6,$2e		char code 15 - O
		fcb $37,$a3,$1f,$42,$10		char code 16 - P
		fcb $33,$a3,$18,$d6,$4d		char code 17 - Q
		fcb $37,$a3,$1f,$52,$51		char code 18 - R
		fcb $33,$a3,$07,$06,$2e		char code 19 - S
		fcb $37,$ea,$42,$10,$84		char code 20 - T
		fcb $34,$63,$18,$c6,$2e		char code 21 - U
		fcb $34,$63,$15,$28,$84		char code 22 - V
		fcb $34,$63,$1a,$d7,$71		char code 23 - W
		fcb $34,$62,$a2,$2a,$31		char code 24 - X
		fcb $34,$62,$a2,$10,$84		char code 25 - Y
		fcb $37,$c2,$22,$22,$1f		char code 26 - Z
		fcb $31,$08,$42,$10,$04		char code 27 - !
		fcb $30,$00,$00,$00,$1f		char code 28 - underscore
		fcb $33,$a2,$13,$10,$04		char code 29 - ?
		fcb $30,$00,$00,$00,$04		char code 30 - .
; some special glyphs
LDBB6		fcb $00,$00,$01,$01,$00,$00,$00	char code 32 - left part of contracted heart
		fcb $00,$a0,$f0,$f0,$e0,$40,$00	char code 33 - right part of contracted heart
		fcb $00,$01,$03,$03,$01,$00,$00	char code 34 - left half of expanded heart
		fcb $00,$b0,$f8,$f8,$f0,$e0,$40	char code 35 - right part of expanded heart

LDBD2		fcb $00,$80

LDBD4		fcb $00,$01,$00,$50
LDBD8		fcb $00,$04

LDBDA		fcb $00,$50

LDBDC		fcb $00,$05

LDBDE		fcb $03,$DC

LDBE0		fcb $4F,$DC,$6B,$DC
LDBE4		fcb $9B,$DC,$33,$00
LDBE8		fcb $DC,$6A,$DC,$8B
LDBEC		fcb $DC,$A9,$DC,$45
LDBF0		fcb $01,$DC,$5D,$DC
LDBF4		fcb $7B,$DC,$A2,$DC
LDBF8		fcb $3C,$FF,$86,$AC
LDBFC		fcb $80,$C0,$7A,$BA
LDC00		fcb $80,$A8,$FC,$3E
LDC04		fcb $04,$00,$FE,$76
LDC08		fcb $3C,$FC,$F7,$FF
LDC0C		fcb $2A,$00,$FE,$72
LDC10		fcb $50,$7C,$64,$FF
LDC14		fcb $76,$52,$72,$56
LDC18		fcb $FE,$6E,$A2,$FC
LDC1C		fcb $51,$0E,$B1,$00
LDC20		fcb $FE,$7A,$3C,$FC
LDC24		fcb $11,$1F,$FF,$F1
LDC28		fcb $00,$FE,$76,$C2
LDC2C		fcb $FC,$1F,$34,$F1
LDC30		fcb $DC,$00,$FE,$10
LDC34		fcb $1B,$26,$40,$72
LDC38		fcb $40,$88,$1B,$FE
LDC3C		fcb $10,$E5,$26,$C0
LDC40		fcb $72,$C0,$88,$E5
LDC44		fcb $FE,$26,$40,$26
LDC48		fcb $C0,$FF,$72,$40
LDC4C		fcb $72,$C0,$FE,$26
LDC50		fcb $1D,$26,$40,$72
LDC54		fcb $40,$72,$1B,$FF
LDC58		fcb $10,$1B,$26,$40
LDC5C		fcb $FE,$26,$E5,$26
LDC60		fcb $C0,$72,$C0,$72
LDC64		fcb $E5,$FF,$10,$E5
LDC68		fcb $26,$C0,$FE,$80
LDC6C		fcb $28,$41,$28,$44
LDC70		fcb $38,$77,$38,$FF
LDC74		fcb $5C,$30,$5D,$34
LDC78		fcb $FD,$DC,$33,$80
LDC7C		fcb $D8,$41,$D8,$44
LDC80		fcb $C8,$77,$C8,$FF
LDC84		fcb $5C,$D0,$5D,$CC
LDC88		fcb $FD,$DC,$3C,$72
LDC8C		fcb $6C,$43,$6C,$43
LDC90		fcb $94,$72,$94,$FF
LDC94		fcb $5E,$7E,$5E,$82
LDC98		fcb $FD,$DC,$45,$80
LDC9C		fcb $28,$42,$32,$75
LDCA0		fcb $3A,$FE,$80,$D8
LDCA4		fcb $42,$CE,$75,$C6
LDCA8		fcb $FE,$71,$6C,$43
LDCAC		fcb $80,$72,$94,$FE
LDCB0		fcb $64,$1C,$FC,$44
LDCB4		fcb $2E,$42,$4C,$00
LDCB8		fcb $FE

LDCB9		fcb $64,$E4,$FC

LDCBC		fcb $4C,$22,$4E,$44
LDCC0		fcb $00,$FE

LDCC2		fcb $DD,$0E

LDCC4		fcb $DC,$CA,$DD,$2A
LDCC8		fcb $DC,$D0,$FB,$DC
LDCCC		fcb $D6,$FD,$DD,$0E
LDCD0		fcb $FB,$DC,$D6,$FD
LDCD4		fcb $DD,$2A,$18,$74
LDCD8		fcb $80,$74,$FF,$18
LDCDC		fcb $8C,$80,$8C,$FF
LDCE0		fcb $1C,$74,$1C,$8C
LDCE4		fcb $FF,$28,$74,$28
LDCE8		fcb $8C,$FF,$34,$74
LDCEC		fcb $34,$8C,$FF,$40
LDCF0		fcb $74,$40,$8C,$FF
LDCF4		fcb $4C,$74,$4C,$8C
LDCF8		fcb $FF,$58,$74,$58
LDCFC		fcb $8C,$FF,$64,$74
LDD00		fcb $64,$8C,$FF,$70
LDD04		fcb $74,$70,$8C,$FF
LDD08		fcb $7B,$74,$7B,$8C
LDD0C		fcb $FF,$FA,$22,$64
LDD10		fcb $18,$5C,$18,$A4
LDD14		fcb $22,$9C,$22,$64
LDD18		fcb $18,$64,$FF,$22
LDD1C		fcb $9C,$18,$9C,$FF
LDD20		fcb $1C,$2F,$1C,$60
LDD24		fcb $FF,$1C,$A1,$1C
LDD28		fcb $D2,$FE,$76,$64
LDD2C		fcb $80,$5C,$80,$A4
LDD30		fcb $76,$9C,$76,$64
LDD34		fcb $80,$64,$FF,$76
LDD38		fcb $9C,$80,$9C,$FF
LDD3C		fcb $1C,$2F,$1C,$D2
LDD40		fcb $FE,$68,$62,$FC
LDD44		fcb $D7,$D4,$14,$12
LDD48		fcb $30,$1D,$0D,$FD
LDD4C		fcb $29,$00,$FD,$DD
LDD50		fcb $62,$68,$62,$5E
LDD54		fcb $7C,$60,$7E,$6A
LDD58		fcb $64,$FF,$66,$84
LDD5C		fcb $5C,$72,$66,$76
LDD60		fcb $6E,$72,$66,$84
LDD64		fcb $FC,$02,$56,$56
LDD68		fcb $17,$EE,$02,$EA
LDD6C		fcb $BB,$BB,$EA,$EA
LDD70		fcb $00,$4E,$5C,$FC
LDD74		fcb $C2,$51,$3E,$CF
LDD78		fcb $FC,$42,$13,$00
LDD7C		fcb $6A,$5A,$FC,$1E
LDD80		fcb $11,$F3,$62,$39
LDD84		fcb $E2,$0C,$E4,$8A
LDD88		fcb $E2,$00,$56,$54
LDD8C		fcb $FC,$54,$65,$2E
LDD90		fcb $CA,$BA,$A1,$D4
LDD94		fcb $EE,$12,$D2,$13
LDD98		fcb $E1,$20,$F6,$24
LDD9C		fcb $72,$58,$EE,$C5
LDDA0		fcb $BE,$00,$FE,$50
LDDA4		fcb $7C,$5E,$72,$6E
LDDA8		fcb $78,$84,$70,$68
LDDAC		fcb $4E,$84,$30,$44
LDDB0		fcb $48,$54,$20,$16
LDDB4		fcb $58,$34,$72,$5C
LDDB8		fcb $80,$34,$8E,$16
LDDBC		fcb $A8,$58,$E0,$44
LDDC0		fcb $B8,$84,$D0,$70
LDDC4		fcb $B2,$84,$90,$6E
LDDC8		fcb $88,$5E,$8E,$50
LDDCC		fcb $84,$FF,$84,$70
LDDD0		fcb $FC,$C5,$92,$BE
LDDD4		fcb $C3,$43,$5E,$72
LDDD8		fcb $45,$00,$52,$7A
LDDDC		fcb $FC,$78,$E9,$8D
LDDE0		fcb $EC,$33,$0C,$24
LDDE4		fcb $72,$47,$E7,$00
LDDE8		fcb $16,$A8,$FC,$2D
LDDEC		fcb $C2,$3D,$30,$4B
LDDF0		fcb $4B,$ED,$B2,$9D
LDDF4		fcb $71,$3D,$DD,$91
LDDF8		fcb $7D,$52,$63,$A3
LDDFC		fcb $2D,$ED,$2D,$CB
LDE00		fcb $CB,$D0,$DD,$42
LDE04		fcb $ED,$00,$FE,$3E
LDE08		fcb $44,$44,$58,$38
LDE0C		fcb $64,$FF,$4A,$5A
LDE10		fcb $46,$4A,$FC,$33
LDE14		fcb $F5,$F5,$C1,$5A
LDE18		fcb $62,$0E,$00,$64
LDE1C		fcb $50,$FC,$B3,$17
LDE20		fcb $34,$EB,$0A,$3D
LDE24		fcb $00,$FE,$7C,$A0
LDE28		fcb $FC,$C2,$22,$E4
LDE2C		fcb $24,$2C,$EC,$04
LDE30		fcb $04,$E2,$42,$00
LDE34		fcb $7C,$A8,$FC,$C1
LDE38		fcb $21,$12,$F2,$E1
LDE3C		fcb $41,$00,$FE,$70
LDE40		fcb $4A,$FC,$E0,$EE
LDE44		fcb $2C,$42,$14,$14
LDE48		fcb $20,$0C,$CC,$22
LDE4C		fcb $0C,$22,$00,$7C
LDE50		fcb $5A,$FC,$E0,$0C
LDE54		fcb $2C,$20,$04,$00
LDE58		fcb $FE,$52,$82,$FC
LDE5C		fcb $28,$7D,$5F,$50
LDE60		fcb $5B,$F5,$2F,$D5
LDE64		fcb $17,$17,$F3,$22
LDE68		fcb $E1,$14,$DD,$8F
LDE6C		fcb $8D,$DB,$EC,$00
LDE70		fcb $56,$82,$FC,$33
LDE74		fcb $31,$1B,$91,$3B
LDE78		fcb $5F,$F5,$00,$6C
LDE7C		fcb $74,$72,$76,$78
LDE80		fcb $90,$FE,$22,$7C
LDE84		fcb $FC,$04,$1F,$0E
LDE88		fcb $FF,$00,$50,$8E
LDE8C		fcb $40,$88,$2E,$92
LDE90		fcb $40,$9C,$52,$8C
LDE94		fcb $4C,$88,$40,$92
LDE98		fcb $3A,$8C,$FD,$DE
LDE9C		fcb $B3,$1E,$7E,$FC
LDEA0		fcb $50,$0F,$E0,$00
LDEA4		fcb $2C,$96,$34,$A6
LDEA8		fcb $4C,$A4,$5C,$96
LDEAC		fcb $4C,$88,$34,$86
LDEB0		fcb $2C,$96,$FF,$50
LDEB4		fcb $8C,$80,$98,$84
LDEB8		fcb $A0,$84,$90,$7E
LDEBC		fcb $90,$54,$82,$FF
LDEC0		fcb $54,$7E,$7E,$6E
LDEC4		fcb $84,$6E,$84,$5C
LDEC8		fcb $80,$66,$50,$74
LDECC		fcb $FF,$50,$8C,$FC
LDED0		fcb $3A,$D9,$83,$DE
LDED4		fcb $AD,$E6,$A1,$E2
LDED8		fcb $22,$61,$26,$EA
LDEDC		fcb $20,$3D,$DD,$E0
LDEE0		fcb $00,$34,$80,$14
LDEE4		fcb $80,$FC,$0E,$21
LDEE8		fcb $02,$E1,$0E,$00
LDEEC		fcb $4A,$66,$FC,$E0
LDEF0		fcb $02,$D0,$08,$30
LDEF4		fcb $02,$20,$01,$30
LDEF8		fcb $02,$D0,$01,$87
LDEFC		fcb $00,$2E,$6E,$40
LDF00		fcb $66,$40,$64,$1E
LDF04		fcb $66,$14,$62,$1E
LDF08		fcb $5E,$40,$60,$40
LDF0C		fcb $62,$14,$62,$FE
LDF10		fcb $2E,$62,$FC,$21
LDF14		fcb $2F,$2D,$FD,$CE
LDF18		fcb $C2,$F2,$12,$0F
LDF1C		fcb $1E,$3F,$21,$12
LDF20		fcb $E3,$E0,$00,$68
LDF24		fcb $9A,$FC,$21,$2F
LDF28		fcb $2D,$FD,$CE,$C2
LDF2C		fcb $F2,$12,$0F,$1E
LDF30		fcb $3F,$22,$12,$E2
LDF34		fcb $E0,$00,$FD,$DF
LDF38		fcb $65

LDF39		fcb $28,$56,$40

LDF3C		fcb $5C,$2A,$64,$36
LDF40		fcb $52,$38,$68,$28
LDF44		fcb $56,$FF,$42,$8C
LDF48		fcb $FC,$70,$AD,$35
LDF4C		fcb $1B,$B3,$00,$60
LDF50		fcb $92,$78,$94,$64
LDF54		fcb $88,$6A,$9A,$74
LDF58		fcb $8A,$60,$92,$FF
LDF5C		fcb $50,$74,$FC,$53
LDF60		fcb $EC,$E4,$4D,$B0
LDF64		fcb $00,$40,$7C,$FC
LDF68		fcb $4E,$C0,$7B,$9C
LDF6C		fcb $D4,$E4,$E1,$E1
LDF70		fcb $DD,$1C,$96,$03
LDF74		fcb $00,$1C,$82,$FC
LDF78		fcb $03,$45,$71,$DA
LDF7C		fcb $1E,$11,$E1,$00
LDF80		fcb $30,$86,$36,$8E
LDF84		fcb $74,$A4,$84,$84
LDF88		fcb $82,$76,$78,$5E
LDF8C		fcb $5A,$6E,$84,$84
LDF90		fcb $48,$6A,$FF,$40
LDF94		fcb $66,$FC,$1F,$BD
LDF98		fcb $F1,$53,$00,$42
LDF9C		fcb $66,$FC,$1E,$32
LDFA0		fcb $11,$73,$00,$58
LDFA4		fcb $70,$48,$78,$FF
LDFA8		fcb $3E,$84,$14,$80
LDFAC		fcb $34,$7A,$40,$7A
LDFB0		fcb $3C,$7C,$72,$80
LDFB4		fcb $50,$82,$44,$82
LDFB8		fcb $3E,$84,$FF,$28
LDFBC		fcb $82,$FC,$FF,$1E
LDFC0		fcb $11,$F2,$3F,$20
LDFC4		fcb $0F,$C0,$FF,$31
LDFC8		fcb $00,$FE,$84,$82
LDFCC		fcb $70,$7A,$5C,$7C
LDFD0		fcb $5E,$7E,$5E,$82
LDFD4		fcb $5C,$84,$70,$82
LDFD8		fcb $80,$8C,$84,$88
LDFDC		fcb $84,$72,$78,$6C
LDFE0		fcb $6A,$76,$78,$70
LDFE4		fcb $7C,$74,$7C,$7E
LDFE8		fcb $FF,$64,$78,$FC
LDFEC		fcb $E0,$E2,$EE,$E0
LDFF0		fcb $F1,$22,$EE,$06
LDFF4		fcb $2E,$E2,$11,$20
LDFF8		fcb $2E,$22,$20,$00
LDFFC		fcb $FE,$4B,$53,$4B