;--------------------------------------------------------------
;
;  MOSTEK COMPUTER ROMs. 4 x 2708s from E000-EFFF.
;
;  A monitor/debugger is in the first three ROMs (E000-EBFF).
;  The fourth ROM at EC00-EFFF is a disk support ROM that
;  provides disk I/O functions. The monitor uses the disk
;  ROM to boot the disk and to load and save files from
;  memory. Both FLP-80DOS and MOS-80 use the disk ROM for
;  disk I/O
;
;  Commented disassembly starts at E94F for the boot command
;  and at EC00 for the disk driver code.
;
;  Mike Douglas, March 2016
l
;--------------------------------------------------------------

; LE522 Read Console
; LE666 Process a command

SIOCR	equ	0DDh		;serial port control register
SIODR	equ	0DCh		;serial port data register

SIOTDRE	equ	080h		;transmit register empty bit
SIORDRF	equ	040h		;receive register full bit

SIOCR1	equ	0DEh		;CTS input handshake line port
SIOCTS	equ	001h		;bit high when OK to xmit


					org	0E000H
				;
E000 : C3 09 E0		"   "		jp	LE009		;Reset entry vector
E003 : C3 1B EA		"   "		jp	dispErr		;Display error passed in A?
E006 : C3 4F E9		" O "		jp	boot		;boot disk vector
				;
E009				LE009:
E009 : DB DF		"  "		in	a,(0DFH)
E00B : AF		" "		xor	a
E00C : 32 0C FF		"2  "		ld	(XFF0C),a
E00F : 32 FA FF		"2  "		ld	(XFFFA),a
E012 : 21 AA FF		"!  "		ld	hl,0FFAAH
E015 : 22 E6 FF		""  "		ld	(XFFE6),hl
E018 : 3E 05		"> "		ld	a,005H
E01A : D3 D8		"  "		out	(0D8H),a
E01C : 3E 03		"> "		ld	a,003H
E01E : D3 DE		"  "		out	(0DEH),a
E020 : 0E DE		"  "		ld	c,0DEH
E022 : 21 05 00		"!  "		ld	hl,00005H
E025				LE025:
E025 : ED 78		" x"		in	a,(c)
E027 : F2 25 E0		" % "		jp	p,LE025
E02A				LE02A:
E02A : 23		"#"		inc	hl
E02B : ED 78		" x"		in	a,(c)
E02D : FA 2A E0		" * "		jp	m,LE02A
E030 : 11 60 E0		" ` "		ld	de,0E060H
E033				LE033:
E033 : 29		")"		add	hl,hl
E034 : 1B		" "		dec	de
E035 : 30 FC		"0 "		jr	nc,LE033
E037 : 1A		" "		ld	a,(de)
E038 : D3 D8		"  "		out	(0D8H),a
E03A : 32 E0 FF		"2  "		ld	(XFFE0),a
E03D : FE 57		" W"		cp	057H
E03F : 3E B0		"> "		ld	a,0B0H
E041 : 3F		"?"		ccf
E042 : 1F		" "		rra
E043 : D3 DD		"  "		out	(SIOCR),a
E045 : 3E D0		"> "		ld	a,0D0H
E047 : D3 E4		"  "		out	(0E4H),a
E049 : 31 E0 FF		"1  "		ld	sp,XFFE0
E04C : CD EC E5		"   "		call	LE5EC
E04F : DB DC		"  "		in	a,(SIODR)
E051				LE051:
E051 : 18 B3		"  "		jr	LE006
				;
E053 : 01 02 04		"   "		ld	bc,00402H
E056 : 08		" "		ex	af,af'
E057 : 10 20		"  "		djnz	LE079
E059 : 57		"W"		ld	d,a
E05A : 54		"T"		ld	d,h
E05B : 20 D6		"  "		jr	nz,LE033
E05D : FD 21 0A 0C	" !  "		ld	iy,00C0AH
E061 : CD 77 09		" w "		call	L0977
E064 : CD 40 C3		" @ "		call	LC340
E067 : 69		"i"		ld	l,c
E068 : E0		" "		ret	po
E069 : ED 73 E6 FF	" s  "		ld	(XFFE6),sp
E06D : 31 00 00		"1  "		ld	sp,00000H
E070 : F5		" "		push	af
E071 : F5		" "		push	af
E072 : B7		" "		or	a
E073				LE073:
E073 : DB DF		"  "		in	a,(0DFH)
E075 : ED 57		" W"		ld	a,i
E077 : F5		" "		push	af
E078 : F3		" "		di
E079				LE079:
E079 : C5		" "		push	bc
E07A : D5		" "		push	de
E07B : E5		" "		push	hl
E07C : D9		" "		exx
E07D : 08		" "		ex	af,af'
E07E : F5		" "		push	af
E07F : C5		" "		push	bc
E080 : D5		" "		push	de
E081 : E5		" "		push	hl
E082 : 3A FA FF		":  "		ld	a,(XFFFA)
E085 : E6 04		"  "		and	004H
E087 : 32 FA FF		"2  "		ld	(XFFFA),a
E08A : D9		" "		exx
E08B : 08		" "		ex	af,af'
E08C : DD E5		"  "		push	ix
E08E : FD E5		"  "		push	iy
E090 : 30 16		"0 "		jr	nc,LE0A8
E092 : 21 0D FF		"!  "		ld	hl,0FF0DH
E095 : ED 5B 10 FF	" [  "		ld	de,(XFF10)
E099 : 01 03 00		"   "		ld	bc,00003H
E09C : ED B0		"  "		ldir
E09E : 2A 10 FF		"*  "		ld	hl,(XFF10)
E0A1				LE0A1:
E0A1 : 3E 80		"> "		ld	a,080H
E0A3 : 32 0C FF		"2  "		ld	(XFF0C),a
E0A6 : 18 09		"  "		jr	LE0B1
				;
E0A8				LE0A8:
E0A8 : ED 7B E6 FF	" {  "		ld	sp,(XFFE6)
E0AC : E1		" "		pop	hl
E0AD : ED 73 E6 FF	" s  "		ld	(XFFE6),sp
E0B1				LE0B1:
E0B1 : 22 FE FF		""  "		ld	(XFFFE),hl
E0B4 : 31 E0 FF		"1  "		ld	sp,XFFE0
E0B7 : C3 39 E6		" 9 "		jp	LE639
				;
E0BA				LE0BA:
E0BA : ED 73 E6 FF	" s  "		ld	(XFFE6),sp
E0BE : 31 00 00		"1  "		ld	sp,00000H
E0C1 : F5		" "		push	af
E0C2 : F5		" "		push	af
E0C3 : 37		"7"		scf
E0C4 : 18 AD		"  "		jr	LE073
				;
E0C6				LE0C6:
E0C6 : AF		" "		xor	a
E0C7 : 18 02		"  "		jr	LE0CB
				;
E0C9				LE0C9:
E0C9 : 3E 01		"> "		ld	a,001H
E0CB				LE0CB:
E0CB : 32 21 FF		"2! "		ld	(XFF21),a
E0CE : ED 7B E6 FF	" {  "		ld	sp,(XFFE6)
E0D2 : 2A FE FF		"*  "		ld	hl,(XFFFE)
E0D5 : E5		" "		push	hl
E0D6 : 2A FC FF		"*  "		ld	hl,(XFFFC)
E0D9 : E5		" "		push	hl
E0DA : ED 73 E4 FF	" s  "		ld	(XFFE4),sp
E0DE : 31 E8 FF		"1  "		ld	sp,XFFE8
E0E1 : FD E1		"  "		pop	iy
E0E3 : DD E1		"  "		pop	ix
E0E5 : D9		" "		exx
E0E6 : 08		" "		ex	af,af'
E0E7 : E1		" "		pop	hl
E0E8 : D1		" "		pop	de
E0E9 : C1		" "		pop	bc
E0EA : F1		" "		pop	af
E0EB : D9		" "		exx
E0EC : 08		" "		ex	af,af'
E0ED : E1		" "		pop	hl
E0EE : D1		" "		pop	de
E0EF : C1		" "		pop	bc
E0F0 : 3A 24 FF		":$ "		ld	a,(XFF24)
E0F3 : B7		" "		or	a
E0F4 : C4 34 E5		" 4 "		call	nz,LE534
E0F7 : F1		" "		pop	af
E0F8 : ED 47		" G"		ld	i,a
E0FA : ED 7B E4 FF	" {  "		ld	sp,(XFFE4)
E0FE : 3A 22 FF		":" "		ld	a,(XFF22)
E101 : 32 12 FF		"2  "		ld	(XFF12),a
E104 : 3A 21 FF		":! "		ld	a,(XFF21)
E107 : EA 0F E1		"   "		jp	pe,LE10F
E10A : D3 DF		"  "		out	(0DFH),a
E10C : F1		" "		pop	af
E10D : F3		" "		di
E10E : C9		" "		ret
				;
E10F				LE10F:
E10F : D3 DF		"  "		out	(0DFH),a
E111 : F1		" "		pop	af
E112 : FB		" "		ei
E113 : C9		" "		ret
				;
E114				LE114:
E114 : 3A 12 FF		":  "		ld	a,(XFF12)
E117 : 32 22 FF		"2" "		ld	(XFF22),a
E11A : C9		" "		ret
				;
E11B : 20 04		"  "		jr	nz,LE121

				; main command processing loop ?

E11D				LE11D:
E11D : 31 E0 FF		"1  "		ld	sp,XFFE0
E120 : CD 14 E1		"   "		call	LE114
E123 : CD B3 E3		"   "		call	LE3B3
E126 : 3C		"<"		inc	a
E127 : 32 12 FF		"2  "		ld	(XFF12),a

			;** '.' entered on command line **
E12A				LE12A:
E12A : 1E 00		"  "		ld	e,000H
E12C : CD 9C E5		"   "		call	LE59C
E12F				LE12F:
E12F : 11 00 2E		"  ."		ld	de,02E00H
E132 : CD 27 E5		" ' "		call	LE527
E135 : CD 97 E5		"   "		call	LE597
E138 : FE 2E		" ."		cp	02EH
E13A : 28 EE		"( "		jr	z,LE12A
E13C : 21 1C FF		"!  "		ld	hl,XFF1C
E13F : 72		"r"		ld	(hl),d
E140 : CD A5 E5		"   "		call	LE5A5
E143 : CD 14 E4		"   "		call	LE414
E146 : DB DE		"  "		in	a,(0DEH)
E148 : CB 5F		" _"		bit	3,a
E14A : C4 04 F0		"   "		call	nz,LF004
E14D : 3A 1C FF		":  "		ld	a,(XFF1C)
E150 : 21 2A E1		"!* "		ld	hl,0E12AH
E153 : E5		" "		push	hl
E154 : 2A 16 FF		"*  "		ld	hl,(XFF16)
E157 : ED 5B 14 FF	" [  "		ld	de,(XFF14)
E15B : FE 4D		" M"		cp	04DH
E15D : C2 46 E2		" F "		jp	nz,LE246
E160 : EB		" "		ex	de,hl
E161 : 1E 01		"  "		ld	e,001H
E163 : 3A 1A FF		":  "		ld	a,(XFF1A)
E166 : FE 01		"  "		cp	001H
E168 : 28 30		"(0"		jr	z,LE19A
E16A				LE16A:
E16A : E5		" "		push	hl
E16B : C1		" "		pop	bc
E16C : E5		" "		push	hl
E16D : 2A 16 FF		"*  "		ld	hl,(XFF16)
E170 : B7		" "		or	a
E171 : ED 42		" B"		sbc	hl,bc
E173 : 38 5D		"8]"		jr	c,LE1D2
E175 : 01 0F 00		"   "		ld	bc,0000FH
E178 : B7		" "		or	a
E179 : ED 42		" B"		sbc	hl,bc
E17B : 06 10		"  "		ld	b,010H
E17D : 28 05		"( "		jr	z,LE184
E17F : 30 05		"0 "		jr	nc,LE186
E181 : 7D		"}"		ld	a,l
E182 : 80		" "		add	a,b
E183 : 47		"G"		ld	b,a
E184				LE184:
E184 : CB EB		"  "		set	5,e
E186				LE186:
E186 : E1		" "		pop	hl
E187 : C5		" "		push	bc
E188 : CD F6 E5		"   "		call	LE5F6
E18B : C1		" "		pop	bc
E18C : CD B6 E6		"   "		call	LE6B6
E18F : CD 9C E5		"   "		call	LE59C
E192 : CD D2 E3		"   "		call	LE3D2
E195 : CB 6B		" k"		bit	5,e
E197 : C0		" "		ret	nz
E198 : 18 D0		"  "		jr	LE16A
				;
E19A				LE19A:
E19A : CD F6 E5		"   "		call	LE5F6
E19D : CB 73		" s"		bit	6,e
E19F : 28 12		"( "		jr	z,LE1B3
E1A1 : E5		" "		push	hl
E1A2 : D9		" "		exx
E1A3 : DD E1		"  "		pop	ix
E1A5 : DD 6E 00		" n "		ld	l,(ix+000H)
E1A8 : DD 66 01		" f "		ld	h,(ix+001H)
E1AB : 1E 00		"  "		ld	e,000H
E1AD : CD F6 E5		"   "		call	LE5F6
E1B0 : D9		" "		exx
E1B1 : 18 04		"  "		jr	LE1B7
				;
E1B3				LE1B3:
E1B3 : 7E		"~"		ld	a,(hl)
E1B4 : CD AA E5		"   "		call	LE5AA
E1B7				LE1B7:
E1B7 : D5		" "		push	de
E1B8 : 22 1D FF		""  "		ld	(XFF1D),hl
E1BB : CD 14 E4		"   "		call	LE414
E1BE : 2A 1D FF		"*  "		ld	hl,(XFF1D)
E1C1 : D1		" "		pop	de
E1C2 : 3A 1B FF		":  "		ld	a,(XFF1B)
E1C5 : FE 2E		" ."		cp	02EH
E1C7 : C8		" "		ret	z
E1C8 : FE 5E		" ^"		cp	05EH
E1CA : 28 09		"( "		jr	z,LE1D5
E1CC : FE 0D		"  "		cp	00DH
E1CE : 28 05		"( "		jr	z,LE1D5
E1D0 : FE 2F		" /"		cp	02FH
E1D2				LE1D2:
E1D2 : C2 FA E3		"   "		jp	nz,LE3FA
E1D5				LE1D5:
E1D5 : 3A 1A FF		":  "		ld	a,(XFF1A)
E1D8 : E6 03		"  "		and	003H
E1DA : 28 23		"(#"		jr	z,LE1FF
E1DC : 3A 14 FF		":  "		ld	a,(XFF14)
E1DF : 77		"w"		ld	(hl),a
E1E0 : 23		"#"		inc	hl
E1E1 : CB 73		" s"		bit	6,e
E1E3 : 28 05		"( "		jr	z,LE1EA
E1E5 : 3A 15 FF		":  "		ld	a,(XFF15)
E1E8 : 77		"w"		ld	(hl),a
E1E9 : 23		"#"		inc	hl
E1EA				LE1EA:
E1EA : 3A 1B FF		":  "		ld	a,(XFF1B)
E1ED : FE 2F		" /"		cp	02FH
E1EF : C8		" "		ret	z
E1F0 : FE 0D		"  "		cp	00DH
E1F2 : 28 A6		"( "		jr	z,LE19A
E1F4				LE1F4:
E1F4 : 2B		"+"		dec	hl
E1F5 : 2B		"+"		dec	hl
E1F6 : CD BA E5		"   "		call	LE5BA
E1F9 : FA FD E1		"   "		jp	m,LE1FD
E1FC				LE1FC:
E1FC : 23		"#"		inc	hl
E1FD				LE1FD:
E1FD : 18 9B		"  "		jr	LE19A
				;
E1FF				LE1FF:
E1FF : 3A 1B FF		":  "		ld	a,(XFF1B)
E202 : FE 5E		" ^"		cp	05EH
E204 : 28 EE		"( "		jr	z,LE1F4
E206 : 23		"#"		inc	hl
E207 : CB 73		" s"		bit	6,e
E209 : 20 F1		"  "		jr	nz,LE1FC
E20B : 18 8D		"  "		jr	LE19A
				;
E20D				LE20D:
E20D : DB DD		"  "		in	a,(SIOCR)
E20F : CB 7F		"  "		bit	7,a
E211 : 28 FA		"( "		jr	z,LE20D
E213 : 7A		"z"		ld	a,d
E214 : D3 DC		"  "		out	(SIODR),a
E216 : 3A E0 FF		":  "		ld	a,(XFFE0)
E219 : FE 20		"  "		cp	020H
E21B : 28 04		"( "		jr	z,LE221
E21D : FE 08		"  "		cp	008H
E21F : 20 0E		"  "		jr	nz,LE22F
E221				LE221:
E221 : C5		" "		push	bc
E222 : 7A		"z"		ld	a,d
E223 : 0E C3		"  "		ld	c,0C3H
E225 : FE 0D		"  "		cp	00DH
E227 : 28 02		"( "		jr	z,LE22B
E229 : 0E 20		"  "		ld	c,020H
E22B				LE22B:
E22B : CD EE E5		"   "		call	LE5EE
E22E : C1		" "		pop	bc
E22F				LE22F:
E22F : CB BB		"  "		res	7,e
E231 : 7A		"z"		ld	a,d
E232 : C9		" "		ret
				;
E233				LE233:
E233 : DB DD		"  "		in	a,(SIOCR)
E235 : CB 77		" w"		bit	6,a
E237 : 20 05		"  "		jr	nz,LE23E
E239 : CB 7B		" {"		bit	7,e
E23B : C0		" "		ret	nz
E23C : 18 F5		"  "		jr	LE233
				;
E23E				LE23E:
E23E : DB DC		"  "		in	a,(SIODR)
E240 : CB BB		"  "		res	7,e
E242 : CB BF		"  "		res	7,a
E244 : 57		"W"		ld	d,a
E245 : C9		" "		ret
				;
E246				LE246:
E246 : FE 50		" P"		cp	050H
E248 : 20 36		" 6"		jr	nz,LE280
E24A : 3A 14 FF		":  "		ld	a,(XFF14)
E24D : 4F		"O"		ld	c,a
E24E				LE24E:
E24E : 1E 01		"  "		ld	e,001H
E250 : 79		"y"		ld	a,c
E251 : CD AA E5		"   "		call	LE5AA
E254 : ED 78		" x"		in	a,(c)
E256 : CD AA E5		"   "		call	LE5AA
E259 : C5		" "		push	bc
E25A : CD 14 E4		"   "		call	LE414
E25D : C1		" "		pop	bc
E25E : 3A 1B FF		":  "		ld	a,(XFF1B)
E261 : FE 2E		" ."		cp	02EH
E263 : C8		" "		ret	z
E264 : 67		"g"		ld	h,a
E265 : 3A 1A FF		":  "		ld	a,(XFF1A)
E268 : A7		" "		and	a
E269 : 28 0D		"( "		jr	z,LE278
E26B : 3A 14 FF		":  "		ld	a,(XFF14)
E26E : ED 79		" y"		out	(c),a
E270 : 3E 5E		">^"		ld	a,05EH
E272 : BC		" "		cp	h
E273 : 28 D9		"( "		jr	z,LE24E
E275				LE275:
E275 : 0C		" "		inc	c
E276 : 18 D6		"  "		jr	LE24E
				;
E278				LE278:
E278 : 3E 5E		">^"		ld	a,05EH
E27A : BC		" "		cp	h
E27B : 20 F8		"  "		jr	nz,LE275
E27D : 0D		" "		dec	c
E27E : 18 CE		"  "		jr	LE24E
				;
E280				LE280:
E280 : FE 53		" S"		cp	053H
E282 : 06 00		"  "		ld	b,000H
E284 : 28 06		"( "		jr	z,LE28C
E286 : 06 80		"  "		ld	b,080H
E288 : FE 57		" W"		cp	057H
E28A : 20 63		" c"		jr	nz,LE2EF
E28C				LE28C:
E28C : F1		" "		pop	af
E28D : 3A 1A FF		":  "		ld	a,(XFF1A)
E290 : A7		" "		and	a
E291 : 28 04		"( "		jr	z,LE297
E293 : EB		" "		ex	de,hl
E294 : 22 FE FF		""  "		ld	(XFFFE),hl
E297				LE297:
E297 : 2A 18 FF		"*  "		ld	hl,(XFF18)
E29A : E5		" "		push	hl
E29B : 11 1D 01		"   "		ld	de,0011DH
E29E : B7		" "		or	a
E29F : ED 52		" R"		sbc	hl,de
E2A1 : E1		" "		pop	hl
E2A2 : 20 05		"  "		jr	nz,LE2A9
E2A4 : CD BB E3		"   "		call	LE3BB
E2A7 : 18 0D		"  "		jr	LE2B6
				;
E2A9				LE2A9:
E2A9 : 11 3C 0E		" < "		ld	de,00E3CH
E2AC : AF		" "		xor	a
E2AD : ED 52		" R"		sbc	hl,de
E2AF : 20 05		"  "		jr	nz,LE2B6
E2B1 : 21 13 FF		"!  "		ld	hl,XFF13
E2B4 : CB 86		"  "		res	0,(hl)
E2B6				LE2B6:
E2B6 : 3A 16 FF		":  "		ld	a,(XFF16)
E2B9 : A7		" "		and	a
E2BA : 20 01		"  "		jr	nz,LE2BD
E2BC : 3C		"<"		inc	a
E2BD				LE2BD:
E2BD : 32 06 FF		"2  "		ld	(XFF06),a
E2C0 : DB DE		"  "		in	a,(0DEH)
E2C2 : CB 5F		" _"		bit	3,a
E2C4 : 28 1F		"( "		jr	z,LE2E5
E2C6 : 2A 18 FF		"*  "		ld	hl,(XFF18)
E2C9 : 11 3C 0E		" < "		ld	de,00E3CH
E2CC : B7		" "		or	a
E2CD : ED 52		" R"		sbc	hl,de
E2CF : DD 2A FE FF	" *  "		ld	ix,(XFFFE)
E2D3 : 20 0B		"  "		jr	nz,LE2E0
E2D5 : C5		" "		push	bc
E2D6 : 2A FE FF		"*  "		ld	hl,(XFFFE)
E2D9 : CD F6 E5		"   "		call	LE5F6
E2DC : CD DD F7		"   "		call	LF7DD
E2DF : C1		" "		pop	bc
E2E0				LE2E0:
E2E0 : CB 78		" x"		bit	7,b
E2E2 : CA C9 E0		"   "		jp	z,LE0C9
E2E5				LE2E5:
E2E5 : AF		" "		xor	a
E2E6 : 32 1A FF		"2  "		ld	(XFF1A),a
E2E9 : CD F3 E2		"   "		call	LE2F3
E2EC : C3 01 E8		"   "		jp	LE801
				;
E2EF				LE2EF:
E2EF : FE 42		" B"		cp	042H
E2F1 : 20 3C		" <"		jr	nz,LE32F
E2F3				LE2F3:
E2F3 : D5		" "		push	de
E2F4 : 3A 0C FF		":  "		ld	a,(XFF0C)
E2F7 : CB 47		" G"		bit	0,a
E2F9 : 28 10		"( "		jr	z,LE30B
E2FB : ED 5B 10 FF	" [  "		ld	de,(XFF10)
E2FF : 21 0D FF		"!  "		ld	hl,0FF0DH
E302 : 01 03 00		"   "		ld	bc,00003H
E305 : ED B0		"  "		ldir
E307 : AF		" "		xor	a
E308 : 32 0C FF		"2  "		ld	(XFF0C),a
E30B				LE30B:
E30B : 3A 1A FF		":  "		ld	a,(XFF1A)
E30E : A7		" "		and	a
E30F : E1		" "		pop	hl
E310 : 28 19		"( "		jr	z,LE32B
E312				LE312:
E312 : 22 10 FF		""  "		ld	(XFF10),hl
E315 : E5		" "		push	hl
E316 : 11 0D FF		"   "		ld	de,0FF0DH
E319 : 01 03 00		"   "		ld	bc,00003H
E31C : C5		" "		push	bc
E31D : ED B0		"  "		ldir
E31F : 21 2C E3		"!, "		ld	hl,0E32CH
E322 : C1		" "		pop	bc
E323 : D1		" "		pop	de
E324 : ED B0		"  "		ldir
E326 : 3E 01		"> "		ld	a,001H
E328 : 32 0C FF		"2  "		ld	(XFF0C),a
E32B				LE32B:
E32B : C9		" "		ret
E32C : C3 BA E0		"   "		jp	LE0BA
				;
E32F				LE32F:
E32F : FE 45		" E"		cp	045H
E331 : 20 13		"  "		jr	nz,LE346
E333 : 3A 1A FF		":  "		ld	a,(XFF1A)
E336 : A7		" "		and	a
E337 : 28 05		"( "		jr	z,LE33E
E339 : ED 53 FE FF	" S  "		ld	(XFFFE),de
E33D : F1		" "		pop	af
E33E				LE33E:
E33E : 3E 01		"> "		ld	a,001H
E340 : 32 06 FF		"2  "		ld	(XFF06),a
E343 : C3 C6 E0		"   "		jp	LE0C6
				;
E346				LE346:
E346 : FE 51		" Q"		cp	051H
E348 : 20 0C		"  "		jr	nz,LE356
E34A : AF		" "		xor	a
E34B : 32 1A FF		"2  "		ld	(XFF1A),a
E34E : CD F3 E2		"   "		call	LE2F3
E351 : 3E 01		"> "		ld	a,001H
E353 : C3 26 FF		" & "		jp	LFF26
				;
E356				LE356:
E356 : FE 43		" C"		cp	043H
E358 : 20 22		" ""		jr	nz,LE37C
E35A : CD DB E3		"   "		call	LE3DB
E35D : 44		"D"		ld	b,h
E35E : 4D		"M"		ld	c,l
E35F : 2A 18 FF		"*  "		ld	hl,(XFF18)
E362 : EB		" "		ex	de,hl
E363 : B7		" "		or	a
E364 : ED 52		" R"		sbc	hl,de
E366 : 30 0E		"0 "		jr	nc,LE376
E368 : 2A 18 FF		"*  "		ld	hl,(XFF18)
E36B : 09		" "		add	hl,bc
E36C : 2B		"+"		dec	hl
E36D : 54		"T"		ld	d,h
E36E : 5D		"]"		ld	e,l
E36F : 2A 16 FF		"*  "		ld	hl,(XFF16)
E372 : ED B8		"  "		lddr
E374 : 18 05		"  "		jr	LE37B
				;
E376				LE376:
E376 : 2A 14 FF		"*  "		ld	hl,(XFF14)
E379 : ED B0		"  "		ldir
E37B				LE37B:
E37B : C9		" "		ret
				;
E37C				LE37C:
E37C : FE 52		" R"		cp	052H
E37E : 20 22		" ""		jr	nz,LE3A2
E380 : FD 21 00 FF	" !  "		ld	iy,0FF00H
E384 : AF		" "		xor	a
E385 : FD BE 14		"   "		cp	(iy+014H)
E388 : 28 03		"( "		jr	z,LE38D
E38A : CD BB E3		"   "		call	LE3BB
E38D				LE38D:
E38D : FD CB 1A 4E	"   N"		bit	1,(iy+01AH)
E391 : 28 0C		"( "		jr	z,LE39F
E393 : AF		" "		xor	a
E394 : FD CB 13 26	"   &"		sla	(iy+013H)
E398 : 1F		" "		rra
E399 : FD B6 16		"   "		or	(iy+016H)
E39C : FD 77 13		" w "		ld	(iy+013H),a
E39F				LE39F:
E39F : C3 90 E6		"   "		jp	LE690
				;
E3A2				LE3A2:
E3A2 : FE 46		" F"		cp	046H
E3A4 : CA 9B E7		"   "		jp	z,LE79B
E3A7 : FE 4C		" L"		cp	04CH
E3A9 : CA AC E7		"   "		jp	z,LE7AC
E3AC : FE 56		" V"		cp	056H
E3AE : CA CC E7		"   "		jp	z,LE7CC
E3B1 : 18 2F		" /"		jr	LE3E2
				;
E3B3				LE3B3:
E3B3 : AF		" "		xor	a
E3B4 : 32 24 FF		"2$ "		ld	(XFF24),a
E3B7 : 3C		"<"		inc	a
E3B8 : D3 D9		"  "		out	(0D9H),a
E3BA : C9		" "		ret
				;
E3BB				LE3BB:
E3BB : 3A 13 FF		":  "		ld	a,(XFF13)
E3BE : 17		" "		rla
E3BF : 21 FA E6		"!  "		ld	hl,0E6FAH
E3C2 : 38 03		"8 "		jr	c,dispMsg
E3C4 : 21 00 E7		"!  "		ld	hl,0E700H

				; dispMsg - display message pointed to by HL. Message is terminated
				;     by 03h.

				dispMsg:
E3C7 : 56		"V"		ld	d,(hl)
E3C8 : 7A		"z"		ld	a,d
E3C9 : FE 03		"  "		cp	003H
E3CB : C8		" "		ret	z
E3CC : CD 27 E5		" ' "		call	LE527
E3CF : 23		"#"		inc	hl
E3D0 : 18 F5		"  "		jr	dispMsg
				;
E3D2				LE3D2:
E3D2 : DB DC		"  "		in	a,(SIODR)
E3D4 : E6 7F		"  "		and	07FH
E3D6 : FE 2E		" ."		cp	02EH
E3D8 : C0		" "		ret	nz
E3D9 : 18 1F		"  "		jr	LE3FA
				;
E3DB				LE3DB:
E3DB : B7		" "		or	a
E3DC : ED 52		" R"		sbc	hl,de
E3DE : 38 1A		"8 "		jr	c,LE3FA
E3E0 : 23		"#"		inc	hl
E3E1 : C9		" "		ret
				;
E3E2				LE3E2:
E3E2 : FE 4F		" O"		cp	04FH
E3E4 : 20 11		"  "		jr	nz,LE3F7
E3E6 : ED 53 1F FF	" S  "		ld	(XFF1F),de
E3EA : 21 13 FF		"!  "		ld	hl,XFF13
E3ED : CB BE		"  "		res	7,(hl)
E3EF : 3A 1A FF		":  "		ld	a,(XFF1A)
E3F2 : A7		" "		and	a
E3F3 : C8		" "		ret	z
E3F4 : CB FE		"  "		set	7,(hl)
E3F6 : C9		" "		ret
				;
E3F7				LE3F7:
E3F7 : FE 48		" H"		cp	048H
E3F9 : C8		" "		ret	z
E3FA				LE3FA:
E3FA : 16 3F		" ?"		ld	d,03FH
E3FC : CD 27 E5		" ' "		call	LE527
E3FF : C3 2F E1		" / "		jp	LE12F
				;
E402				LE402:
E402 : DB DE		"  "		in	a,(0DEH)
E404 : CB 5F		" _"		bit	3,a
E406 : CA FA E4		"   "		jp	z,LE4FA
E409 : DD 2A 1D FF	" *  "		ld	ix,(XFF1D)
E40D : CD DD F7		"   "		call	LF7DD
E410 : C3 14 E4		"   "		jp	LE414
				;
E413 : 00		" "		nop
E414				LE414:
E414 : AF		" "		xor	a
E415 : 21 14 FF		"!  "		ld	hl,XFF14
E418 : E5		" "		push	hl
E419 : FD E1		"  "		pop	iy
E41B : 77		"w"		ld	(hl),a
E41C : 01 05 00		"   "		ld	bc,00005H
E41F : 11 15 FF		"   "		ld	de,XFF15
E422 : ED B0		"  "		ldir
E424 : 5F		"_"		ld	e,a
E425 : 32 1A FF		"2  "		ld	(XFF1A),a
E428 : D9		" "		exx
E429 : 57		"W"		ld	d,a
E42A				LE42A:
E42A : 06 00		"  "		ld	b,000H
E42C				LE42C:
E42C : AF		" "		xor	a
E42D : 67		"g"		ld	h,a
E42E : 6F		"o"		ld	l,a
E42F				LE42F:
E42F : 5A		"Z"		ld	e,d
E430 : D9		" "		exx
E431 : CD 97 E5		"   "		call	LE597
E434 : D9		" "		exx
E435 : 57		"W"		ld	d,a
E436 : FE 4C		" L"		cp	04CH
E438 : 28 1C		"( "		jr	z,LE456
E43A : FE 52		" R"		cp	052H
E43C : 28 22		"(""		jr	z,LE460
E43E : FE 3B		" ;"		cp	03BH
E440 : 28 C0		"( "		jr	z,LE402
E442 : CD 6A E5		" j "		call	LE56A
E445 : 7A		"z"		ld	a,d
E446 : 20 0E		"  "		jr	nz,LE456
E448 : CD 83 E5		"   "		call	LE583
E44B : 29		")"		add	hl,hl
E44C : 29		")"		add	hl,hl
E44D : 29		")"		add	hl,hl
E44E : 29		")"		add	hl,hl
E44F : 85		" "		add	a,l
E450 : 6F		"o"		ld	l,a
E451 : 30 DC		"0 "		jr	nc,LE42F
E453 : 24		"$"		inc	h
E454 : 18 D9		"  "		jr	LE42F
				;
E456				LE456:
E456 : FE 24		" $"		cp	024H
E458 : 20 12		"  "		jr	nz,LE46C
E45A : 2A 1D FF		"*  "		ld	hl,(XFF1D)
E45D : 23		"#"		inc	hl
E45E : 18 CF		"  "		jr	LE42F
				;
E460				LE460:
E460 : 06 00		"  "		ld	b,000H
E462 : 21 13 FF		"!  "		ld	hl,XFF13
E465 : CB FE		"  "		set	7,(hl)
E467 : 2A 1F FF		"*  "		ld	hl,(XFF1F)
E46A : 16 2B		" +"		ld	d,02BH
E46C				LE46C:
E46C : D5		" "		push	de
E46D : E5		" "		push	hl
E46E : FD E5		"  "		push	iy
E470 : D1		" "		pop	de
E471 : EB		" "		ex	de,hl
E472 : AF		" "		xor	a
E473 : 80		" "		add	a,b
E474 : 28 09		"( "		jr	z,LE47F
E476 : 7E		"~"		ld	a,(hl)
E477 : 93		" "		sub	e
E478 : 77		"w"		ld	(hl),a
E479 : 23		"#"		inc	hl
E47A : 7E		"~"		ld	a,(hl)
E47B : 9A		" "		sbc	a,d
E47C : 77		"w"		ld	(hl),a
E47D : 18 07		"  "		jr	LE486
				;
E47F				LE47F:
E47F : 7E		"~"		ld	a,(hl)
E480 : 83		" "		add	a,e
E481 : 77		"w"		ld	(hl),a
E482 : 23		"#"		inc	hl
E483 : 7E		"~"		ld	a,(hl)
E484 : 8A		" "		adc	a,d
E485 : 77		"w"		ld	(hl),a
E486				LE486:
E486 : E1		" "		pop	hl
E487 : D1		" "		pop	de
E488 : 7A		"z"		ld	a,d
E489 : FE 2B		" +"		cp	02BH
E48B : 20 04		"  "		jr	nz,LE491
E48D : 06 00		"  "		ld	b,000H
E48F : 18 9B		"  "		jr	LE42C
				;
E491				LE491:
E491 : FE 2D		" -"		cp	02DH
E493 : 20 04		"  "		jr	nz,LE499
E495 : 06 01		"  "		ld	b,001H
E497				LE497:
E497 : 18 93		"  "		jr	LE42C
				;
E499				LE499:
E499 : FE 20		"  "		cp	020H
E49B : 28 10		"( "		jr	z,LE4AD
E49D : FE 2C		" ,"		cp	02CH
E49F : 28 0C		"( "		jr	z,LE4AD
E4A1 : FE 0D		"  "		cp	00DH
E4A3 : 28 08		"( "		jr	z,LE4AD
E4A5 : FE 5E		" ^"		cp	05EH
E4A7 : 28 04		"( "		jr	z,LE4AD
E4A9 : FE 2F		" /"		cp	02FH
E4AB : 20 3F		" ?"		jr	nz,LE4EC
E4AD				LE4AD:
E4AD : 3A 1A FF		":  "		ld	a,(XFF1A)
E4B0 : FE 03		"  "		cp	003H
E4B2 : 28 0C		"( "		jr	z,LE4C0
E4B4 : 3C		"<"		inc	a
E4B5 : 32 1A FF		"2  "		ld	(XFF1A),a
E4B8 : FE 03		"  "		cp	003H
E4BA : 28 04		"( "		jr	z,LE4C0
E4BC : FD 23		" #"		inc	iy
E4BE : FD 23		" #"		inc	iy
E4C0				LE4C0:
E4C0 : 7A		"z"		ld	a,d
E4C1 : D9		" "		exx
E4C2 : FE 0D		"  "		cp	00DH
E4C4 : 28 11		"( "		jr	z,LE4D7
E4C6 : FE 5E		" ^"		cp	05EH
E4C8 : 28 08		"( "		jr	z,LE4D2
E4CA : FE 2F		" /"		cp	02FH
E4CC : 28 04		"( "		jr	z,LE4D2
E4CE : D9		" "		exx
E4CF : C3 2A E4		" * "		jp	LE42A
				;
E4D2				LE4D2:
E4D2 : 16 0D		"  "		ld	d,00DH
E4D4 : CD 27 E5		" ' "		call	LE527
E4D7				LE4D7:
E4D7 : CD A1 E5		"   "		call	LE5A1
E4DA : D9		" "		exx
E4DB : 7B		"{"		ld	a,e
E4DC : A7		" "		and	a
E4DD : 20 07		"  "		jr	nz,LE4E6
E4DF : 3A 1A FF		":  "		ld	a,(XFF1A)
E4E2 : 3D		"="		dec	a
E4E3 : 32 1A FF		"2  "		ld	(XFF1A),a
E4E6				LE4E6:
E4E6 : 7A		"z"		ld	a,d
E4E7 : 32 1B FF		"2  "		ld	(XFF1B),a
E4EA : D9		" "		exx
E4EB : C9		" "		ret
				;
E4EC				LE4EC:
E4EC : FE 3A		" :"		cp	03AH
E4EE : CA C0 E6		"   "		jp	z,LE6C0
E4F1 : FE 4C		" L"		cp	04CH
E4F3 : CA C0 E6		"   "		jp	z,LE6C0
E4F6 : FE 2E		" ."		cp	02EH
E4F8 : 20 07		"  "		jr	nz,LE501
E4FA				LE4FA:
E4FA : AF		" "		xor	a
E4FB : 32 1C FF		"2  "		ld	(XFF1C),a
E4FE : D9		" "		exx
E4FF : 18 D1		"  "		jr	LE4D2
				;
E501				LE501:
E501 : FE 3D		" ="		cp	03DH
E503 : 20 F5		"  "		jr	nz,LE4FA
E505 : FD 7E 01		" ~ "		ld	a,(iy+001H)
E508 : D9		" "		exx
E509 : CD 8B E5		"   "		call	LE58B
E50C : FD 7E 00		" ~ "		ld	a,(iy+000H)
E50F : CD 8B E5		"   "		call	LE58B
E512 : D9		" "		exx
E513 : 18 82		"  "		jr	LE497
				;
E515				LE515:
E515 : CB 4F		" O"		bit	1,a
E517 : C2 33 E2		" 3 "		jp	nz,LE233
E51A : 3E 02		"> "		ld	a,002H
E51C : C3 26 FF		" & "		jp	LFF26
				;
E51F : 00		" "		nop
E520 : 39		"9"		add	hl,sp
E521 : 00		" "		nop
				;
E522				LE522:
E522 : 3A 12 FF		":  "		ld	a,(XFF12)
E525 : 18 EE		"  "		jr	LE515
				;
E527				LE527:
E527 : 3A 12 FF		":  "		ld	a,(XFF12)
E52A : CB 4F		" O"		bit	1,a
E52C : C2 0D E2		"   "		jp	nz,LE20D
E52F : 3E 03		"> "		ld	a,003H
E531 : C3 26 FF		" & "		jp	LFF26
				;
E534				LE534:
E534 : 3E A5		"> "		ld	a,0A5H
E536 : D3 D9		"  "		out	(0D9H),a
E538 : AF		" "		xor	a
E539 : D3 D9		"  "		out	(0D9H),a
E53B : 3C		"<"		inc	a
E53C : 32 24 FF		"2$ "		ld	(XFF24),a
E53F : C9		" "		ret
				;
E540 : 39		"9"		add	hl,sp
E541				LE541:
E541 : D5		" "		push	de
E542 : 11 42 E7		" B "		ld	de,0E742H
E545 : 18 04		"  "		jr	LE54B
				;
E547				LE547:
E547 : D5		" "		push	de
E548 : 11 2F FF		" / "		ld	de,0FF2FH
E54B				LE54B:
E54B : EB		" "		ex	de,hl
E54C				LE54C:
E54C : 7E		"~"		ld	a,(hl)
E54D : FE 80		"  "		cp	080H
E54F : 28 0F		"( "		jr	z,LE560
E551 : BB		" "		cp	e
E552 : 20 10		"  "		jr	nz,LE564
E554 : 23		"#"		inc	hl
E555 : 7E		"~"		ld	a,(hl)
E556 : E6 7F		"  "		and	07FH
E558 : BA		" "		cp	d
E559 : 20 0A		"  "		jr	nz,LE565
E55B : 23		"#"		inc	hl
E55C : 5E		"^"		ld	e,(hl)
E55D : 23		"#"		inc	hl
E55E : 56		"V"		ld	d,(hl)
E55F : AF		" "		xor	a
E560				LE560:
E560 : E1		" "		pop	hl
E561 : EB		" "		ex	de,hl
E562 : B7		" "		or	a
E563 : C9		" "		ret
				;
E564				LE564:
E564 : 23		"#"		inc	hl
E565				LE565:
E565 : 23		"#"		inc	hl
E566 : 23		"#"		inc	hl
E567 : 23		"#"		inc	hl
E568 : 18 E2		"  "		jr	LE54C
				;
E56A				LE56A:
E56A : FE 27		" '"		cp	027H
E56C : 28 10		"( "		jr	z,LE57E
E56E : FE 30		" 0"		cp	030H
E570 : 38 0E		"8 "		jr	c,LE580
E572 : FE 3A		" :"		cp	03AH
E574 : 38 08		"8 "		jr	c,LE57E
E576 : FE 40		" @"		cp	040H
E578 : 38 06		"8 "		jr	c,LE580
E57A : FE 5B		" ["		cp	05BH
E57C : 30 02		"0 "		jr	nc,LE580
E57E				LE57E:
E57E : AF		" "		xor	a
E57F : C9		" "		ret
				;
E580				LE580:
E580 : AF		" "		xor	a
E581 : 3C		"<"		inc	a
E582 : C9		" "		ret
				;
E583				LE583:
E583 : D6 30		" 0"		sub	030H
E585 : FE 0A		"  "		cp	00AH
E587 : F8		" "		ret	m
E588 : D6 07		"  "		sub	007H
E58A : C9		" "		ret
				;
E58B				LE58B:
E58B : F5		" "		push	af
E58C : 0F		" "		rrca
E58D : 0F		" "		rrca
E58E : 0F		" "		rrca
E58F : 0F		" "		rrca
E590 : CD AF E5		"   "		call	LE5AF
E593 : F1		" "		pop	af
E594 : C3 AF E5		"   "		jp	LE5AF
				;
E597				LE597:
E597 : CD 22 E5		" " "		call	LE522
E59A : 18 07		"  "		jr	LE5A3
				;
E59C				LE59C:
E59C : 16 0D		"  "		ld	d,00DH
E59E : CD 27 E5		" ' "		call	LE527
E5A1				LE5A1:
E5A1 : 16 0A		"  "		ld	d,00AH
E5A3				LE5A3:
E5A3 : 18 02		"  "		jr	LE5A7
				;
E5A5				LE5A5:
E5A5 : 16 20		"  "		ld	d,020H
E5A7				LE5A7:
E5A7 : C3 27 E5		" ' "		jp	LE527
				;
E5AA				LE5AA:
E5AA : CD 8B E5		"   "		call	LE58B
E5AD : 18 F6		"  "		jr	LE5A5
				;
E5AF				LE5AF:
E5AF : E6 0F		"  "		and	00FH
E5B1 : C6 90		"  "		add	a,090H
E5B3 : 27		"'"		daa
E5B4 : CE 40		" @"		adc	a,040H
E5B6 : 27		"'"		daa
E5B7 : 57		"W"		ld	d,a
E5B8 : 18 ED		"  "		jr	LE5A7
				;
E5BA				LE5BA:
E5BA : FD 21 42 E7	" !B "		ld	iy,0E742H
E5BE				LE5BE:
E5BE : 0E 00		"  "		ld	c,000H
E5C0 : FD 7E 00		" ~ "		ld	a,(iy+000H)
E5C3 : FE 80		"  "		cp	080H
E5C5 : 28 23		"(#"		jr	z,LE5EA
E5C7 : FD 23		" #"		inc	iy
E5C9 : FD 23		" #"		inc	iy
E5CB : FD 7E 00		" ~ "		ld	a,(iy+000H)
E5CE : BD		" "		cp	l
E5CF : 20 13		"  "		jr	nz,LE5E4
E5D1 : FD 23		" #"		inc	iy
E5D3 : FD 7E 00		" ~ "		ld	a,(iy+000H)
E5D6 : BC		" "		cp	h
E5D7 : 20 0D		"  "		jr	nz,LE5E6
E5D9 : FD 46 FD		" F "		ld	b,(iy+0FDH)
E5DC : FD 7E FE		" ~ "		ld	a,(iy+0FEH)
E5DF : 4F		"O"		ld	c,a
E5E0 : E6 80		"  "		and	080H
E5E2 : 3C		"<"		inc	a
E5E3 : C9		" "		ret
				;
E5E4				LE5E4:
E5E4 : FD 23		" #"		inc	iy
E5E6				LE5E6:
E5E6 : FD 23		" #"		inc	iy
E5E8 : 18 D4		"  "		jr	LE5BE
				;
E5EA				LE5EA:
E5EA : AF		" "		xor	a
E5EB : C9		" "		ret
				;
E5EC				LE5EC:
E5EC : 0E C3		"  "		ld	c,0C3H
E5EE				LE5EE:
E5EE : 06 BD		"  "		ld	b,0BDH
E5F0				LE5F0:
E5F0 : 10 FE		"  "		djnz	LE5F0
E5F2 : 0D		" "		dec	c
E5F3 : 20 F9		"  "		jr	nz,LE5EE
E5F5 : C9		" "		ret
				;
E5F6				LE5F6:
E5F6 : 3A 13 FF		":  "		ld	a,(XFF13)
E5F9 : 17		" "		rla
E5FA : 30 13		"0 "		jr	nc,LE60F
E5FC : 16 27		" '"		ld	d,027H
E5FE : CD 27 E5		" ' "		call	LE527
E601 : E5		" "		push	hl
E602 : D5		" "		push	de
E603 : ED 5B 1F FF	" [  "		ld	de,(XFF1F)
E607 : B7		" "		or	a
E608 : ED 52		" R"		sbc	hl,de
E60A : D1		" "		pop	de
E60B : CD 0F E6		"   "		call	LE60F
E60E : E1		" "		pop	hl
E60F				LE60F:
E60F : CB B3		"  "		res	6,e
E611 : CD BA E5		"   "		call	LE5BA
E614 : F2 19 E6		"   "		jp	p,LE619
E617 : CB F3		"  "		set	6,e
E619				LE619:
E619 : C2 27 E6		" ' "		jp	nz,LE627
E61C : 7C		"|"		ld	a,h
E61D : CD 8B E5		"   "		call	LE58B
E620 : 7D		"}"		ld	a,l
E621 : CD 8B E5		"   "		call	LE58B
E624				LE624:
E624 : C3 A5 E5		"   "		jp	LE5A5
				;
E627				LE627:
E627 : 16 3A		" :"		ld	d,03AH
E629 : CD 27 E5		" ' "		call	LE527
E62C : 50		"P"		ld	d,b
E62D : CD 27 E5		" ' "		call	LE527
E630 : 51		"Q"		ld	d,c
E631 : CD 27 E5		" ' "		call	LE527
E634 : CD A5 E5		"   "		call	LE5A5
E637 : 18 EB		"  "		jr	LE624
				;
E639				LE639:
E639 : 1E 00		"  "		ld	e,000H
E63B : CD 14 E1		"   "		call	LE114
E63E : 3E 02		"> "		ld	a,002H
E640 : 32 12 FF		"2  "		ld	(XFF12),a
E643 : CD 90 E6		"   "		call	LE690
E646 : 3A 0C FF		":  "		ld	a,(XFF0C)
E649 : 47		"G"		ld	b,a
E64A : AF		" "		xor	a
E64B : 32 0C FF		"2  "		ld	(XFF0C),a
E64E : 21 06 FF		"!  "		ld	hl,XFF06
E651 : 35		"5"		dec	(hl)
E652 : 28 0D		"( "		jr	z,LE661
E654 : 1E 80		"  "		ld	e,080H
E656 : CD 22 E5		" " "		call	LE522
E659 : CB 7B		" {"		bit	7,e
E65B : CB BB		"  "		res	7,e
E65D : 28 07		"( "		jr	z,LE666
E65F : 18 20		"  "		jr	LE681
				;
E661				LE661:
E661 : 1E 00		"  "		ld	e,000H
E663 : CD 97 E5		"   "		call	LE597

			** process a command ** 
				LE666:
E666 : FE 2E		" ."		cp	02EH
E668 : CA 2A E1		" * "		jp	z,LE12A		'.' typed
E66B : FE 20		"  "		cp	020H
E66D : 28 19		"( "		jr	z,LE688		' ' typed
E66F : FE 0D		"  "		cp	00DH		CR typed
E671 : 28 0C		"( "		jr	z,LE67F
E673 : FE 0A		"  "		cp	00AH
E675 : 20 EA		"  "		jr	nz,LE661	All other characters
E677 : E5		" "		push	hl		LF typed
E678 : CD 9C E5		"   "		call	LE59C
E67B : CD BB E3		"   "		call	LE3BB
E67E : E1		" "		pop	hl
E67F				LE67F:
E67F : 36 01		"6 "		ld	(hl),001H
E681				LE681:
E681 : CD 9C E5		"   "		call	LE59C
E684 : 7E		"~"		ld	a,(hl)
E685 : C3 BD E2		"   "		jp	LE2BD
				;
E688				LE688:
E688 : AF		" "		xor	a
E689 : BE		" "		cp	(hl)
E68A : 36 00		"6 "		ld	(hl),000H
E68C : 20 D3		"  "		jr	nz,LE661
E68E : 18 F1		"  "		jr	LE681
				;
E690				LE690:
E690 : 2A FE FF		"*  "		ld	hl,(XFFFE)
E693 : CD F6 E5		"   "		call	LE5F6
E696 : 3A 13 FF		":  "		ld	a,(XFF13)
E699 : 1F		" "		rra
E69A : 06 01		"  "		ld	b,001H
E69C : 30 02		"0 "		jr	nc,LE6A0
E69E : 06 0C		"  "		ld	b,00CH
E6A0				LE6A0:
E6A0 : 21 FD FF		"!  "		ld	hl,0FFFDH
E6A3				LE6A3:
E6A3 : 7E		"~"		ld	a,(hl)
E6A4 : CD 8B E5		"   "		call	LE58B
E6A7 : 2B		"+"		dec	hl
E6A8 : 7E		"~"		ld	a,(hl)
E6A9 : CD AA E5		"   "		call	LE5AA
E6AC : 2B		"+"		dec	hl
E6AD : 10 F4		"  "		djnz	LE6A3
E6AF : C9		" "		ret
				;
E6B0				LE6B0:
E6B0 : 0D		" "		dec	c
E6B1 : 20 05		"  "		jr	nz,LE6B8
E6B3 : CD A5 E5		"   "		call	LE5A5
E6B6				LE6B6:
E6B6 : 0E 04		"  "		ld	c,004H
E6B8				LE6B8:
E6B8 : 7E		"~"		ld	a,(hl)
E6B9 : CD AA E5		"   "		call	LE5AA
E6BC : 23		"#"		inc	hl
E6BD : 10 F1		"  "		djnz	LE6B0
E6BF : C9		" "		ret
				;
E6C0				LE6C0:
E6C0 : 67		"g"		ld	h,a
E6C1 : D9		" "		exx
E6C2 : CD 97 E5		"   "		call	LE597
E6C5 : D9		" "		exx
E6C6 : 6F		"o"		ld	l,a
E6C7 : D9		" "		exx
E6C8 : CD 97 E5		"   "		call	LE597
E6CB : D9		" "		exx
E6CC : 57		"W"		ld	d,a
E6CD : 5F		"_"		ld	e,a
E6CE : FE 2E		" ."		cp	02EH
E6D0 : CA FA E4		"   "		jp	z,LE4FA
E6D3 : CD 6A E5		" j "		call	LE56A
E6D6 : 28 02		"( "		jr	z,LE6DA
E6D8 : 16 20		"  "		ld	d,020H
E6DA				LE6DA:
E6DA : 7C		"|"		ld	a,h
E6DB : 62		"b"		ld	h,d
E6DC : FE 4C		" L"		cp	04CH
E6DE : 28 10		"( "		jr	z,LE6F0
E6E0 : CD 47 E5		" G "		call	LE547
E6E3 : 28 0B		"( "		jr	z,LE6F0
E6E5 : CD 41 E5		" A "		call	LE541
E6E8 : 28 06		"( "		jr	z,LE6F0
E6EA : AF		" "		xor	a
E6EB : 67		"g"		ld	h,a
E6EC : 6F		"o"		ld	l,a
E6ED				LE6ED:
E6ED : C3 2F E4		" / "		jp	LE42F
				;
E6F0				LE6F0:
E6F0 : 7B		"{"		ld	a,e
E6F1 : CD 6A E5		" j "		call	LE56A
E6F4 : 53		"S"		ld	d,e
E6F5 : 28 F6		"( "		jr	z,LE6ED
E6F7 : C3 6C E4		" l "		jp	LE46C
				;
E6FA : 20 27		" '"		jr	nz,LE723
E6FC : 50		"P"		ld	d,b
E6FD : 43		"C"		ld	b,e
E6FE : 20 20		"  "		jr	nz,LE720
E700 : 20 50		" P"		jr	nz,LE752
E702 : 43		"C"		ld	b,e
E703 : 20 20		"  "		jr	nz,LE725
E705 : 20 41		" A"		jr	nz,LE748
E707 : 46		"F"		ld	b,(hl)
E708 : 20 20		"  "		jr	nz,LE72A
E70A : 49		"I"		ld	c,c
E70B : 20 49		" I"		jr	nz,LE756
E70D : 46		"F"		ld	b,(hl)
E70E : 20 20		"  "		jr	nz,LE730
E710 : 42		"B"		ld	b,d
E711 : 43		"C"		ld	b,e
E712 : 20 20		"  "		jr	nz,LE734
E714 : 20 44		" D"		jr	nz,LE75A
E716 : 45		"E"		ld	b,l
E717 : 20 20		"  "		jr	nz,LE739
E719 : 20 48		" H"		jr	nz,LE763
E71B : 4C		"L"		ld	c,h
E71C : 20 20		"  "		jr	nz,LE73E
E71E : 41		"A"		ld	b,c
E71F : 27		"'"		daa
E720				LE720:
E720 : 46		"F"		ld	b,(hl)
E721 : 27		"'"		daa
E722 : 20 42		" B"		jr	nz,LE766
E724 : 27		"'"		daa
E725				LE725:
E725 : 43		"C"		ld	b,e
E726 : 27		"'"		daa
E727 : 20 44		" D"		jr	nz,LE76D
E729 : 27		"'"		daa
E72A				LE72A:
E72A : 45		"E"		ld	b,l
E72B : 27		"'"		daa
E72C : 20 48		" H"		jr	nz,LE776
E72E : 27		"'"		daa
E72F : 4C		"L"		ld	c,h
E730				LE730:
E730 : 27		"'"		daa
E731 : 20 20		"  "		jr	nz,LE753
E733 : 49		"I"		ld	c,c
E734				LE734:
E734 : 58		"X"		ld	e,b
E735 : 20 20		"  "		jr	nz,LE757
E737 : 20 49		" I"		jr	nz,LE782
E739				LE739:
E739 : 59		"Y"		ld	e,c
E73A : 20 20		"  "		jr	nz,LE75C
E73C : 20 53		" S"		jr	nz,LE791
E73E				LE73E:
E73E : 50		"P"		ld	d,b
E73F : 0D		" "		dec	c
E740 : 0A		" "		ld	a,(bc)
E741 : 03		" "		inc	bc
E742				LE742:
E742 : 41		"A"		ld	b,c
E743 : 20 FD		"  "		jr	nz,LE742
E745				LE745:
E745 : FF		" "		rst	L0038
E746 : 46		"F"		ld	b,(hl)
E747 : 20 FC		"  "		jr	nz,LE745
E749 : FF		" "		rst	L0038
E74A : 48		"H"		ld	c,b
E74B : 20 F5		"  "		jr	nz,LE742
E74D : FF		" "		rst	L0038
E74E				LE74E:
E74E : 4C		"L"		ld	c,h
E74F : 20 F4		"  "		jr	nz,LE745
E751				LE751:
E751 : FF		" "		rst	L0038
E752				LE752:
E752 : 42		"B"		ld	b,d
E753				LE753:
E753 : 20 F9		"  "		jr	nz,LE74E
E755 : FF		" "		rst	L0038
E756				LE756:
E756 : 43		"C"		ld	b,e
E757				LE757:
E757 : 20 F8		"  "		jr	nz,LE751
E759 : FF		" "		rst	L0038
E75A				LE75A:
E75A : 44		"D"		ld	b,h
E75B : 20 F7		"  "		jr	nz,LE754
E75D : FF		" "		rst	L0038
E75E : 45		"E"		ld	b,l
E75F : 20 F6		"  "		jr	nz,LE757
E761 : FF		" "		rst	L0038
E762 : 49		"I"		ld	c,c
E763				LE763:
E763 : D8		" "		ret	c
E764 : EA FF 49		"  I"		jp	pe,L49FF
E767 : D9		" "		exx
E768				LE768:
E768 : E8		" "		ret	pe
E769 : FF		" "		rst	L0038
E76A : 49		"I"		ld	c,c
E76B : 20 FB		"  "		jr	nz,LE768
E76D				LE76D:
E76D : FF		" "		rst	L0038
E76E : 49		"I"		ld	c,c
E76F : 46		"F"		ld	b,(hl)
E770 : FA FF 53		"  S"		jp	m,L53FF
E773 : D0		" "		ret	nc
E774 : E6 FF		"  "		and	0FFH
E776				LE776:
E776 : 50		"P"		ld	d,b
E777 : C3 FE FF		"   "		jp	LFFFE
				;
E77A : 41		"A"		ld	b,c
E77B : 27		"'"		daa
E77C : F3		" "		di
E77D : FF		" "		rst	L0038
E77E : 46		"F"		ld	b,(hl)
E77F : 27		"'"		daa
E780 : F2 FF 48		"  H"		jp	p,L48FF
E783 : 27		"'"		daa
				;
E784 : ED		" "		db	0EDH
				;
E785 : FF		" "		rst	L0038
E786 : 4C		"L"		ld	c,h
E787 : 27		"'"		daa
E788 : EC FF 42		"  B"		call	pe,L42FF
E78B : 27		"'"		daa
E78C : F1		" "		pop	af
E78D : FF		" "		rst	L0038
E78E : 43		"C"		ld	b,e
E78F : 27		"'"		daa
E790 : F0		" "		ret	p
E791				LE791:
E791 : FF		" "		rst	L0038
E792 : 44		"D"		ld	b,h
E793 : 27		"'"		daa
E794 : EF		" "		rst	L0028
E795 : FF		" "		rst	L0038
E796 : 45		"E"		ld	b,l
E797 : 27		"'"		daa
E798 : EE FF		"  "		xor	0FFH
E79A : 80		" "		add	a,b
E79B				LE79B:
E79B : 2B		"+"		dec	hl
E79C : CD EE E7		"   "		call	LE7EE
E79F : 73		"s"		ld	(hl),e
E7A0 : 54		"T"		ld	d,h
E7A1 : 5D		"]"		ld	e,l
E7A2 : 13		" "		inc	de
E7A3 : 0B		" "		dec	bc
E7A4 : ED B0		"  "		ldir
E7A6 : C9		" "		ret
				;
E7A7				LE7A7:
E7A7 : 7E		"~"		ld	a,(hl)
E7A8 : 23		"#"		inc	hl
E7A9 : C3 AA E5		"   "		jp	LE5AA
				;
E7AC				LE7AC:
E7AC : CD EE E7		"   "		call	LE7EE
E7AF				LE7AF:
E7AF : 7B		"{"		ld	a,e
E7B0 : ED B1		"  "		cpir
E7B2 : E0		" "		ret	po
E7B3 : 7A		"z"		ld	a,d
E7B4 : B7		" "		or	a
E7B5 : 28 05		"( "		jr	z,LE7BC
E7B7 : 03		" "		inc	bc
E7B8 : ED A1		"  "		cpi
E7BA : 20 F3		"  "		jr	nz,LE7AF
E7BC				LE7BC:
E7BC : D5		" "		push	de
E7BD : CD FA E7		"   "		call	LE7FA
E7C0 : CD A7 E7		"   "		call	LE7A7
E7C3 : CD 9C E5		"   "		call	LE59C
E7C6 : CD D2 E3		"   "		call	LE3D2
E7C9 : D1		" "		pop	de
E7CA : 18 E3		"  "		jr	LE7AF
				;
E7CC				LE7CC:
E7CC : CD EE E7		"   "		call	LE7EE
E7CF				LE7CF:
E7CF : 1A		" "		ld	a,(de)
E7D0 : ED A1		"  "		cpi
E7D2 : 13		" "		inc	de
E7D3 : E0		" "		ret	po
E7D4 : 28 F9		"( "		jr	z,LE7CF
E7D6 : D5		" "		push	de
E7D7 : CD FA E7		"   "		call	LE7FA
E7DA : CD A7 E7		"   "		call	LE7A7
E7DD : E3		" "		ex	(sp),hl
E7DE : CD FA E7		"   "		call	LE7FA
E7E1 : CD A7 E7		"   "		call	LE7A7
E7E4 : CD 9C E5		"   "		call	LE59C
E7E7 : CD D2 E3		"   "		call	LE3D2
E7EA : EB		" "		ex	de,hl
E7EB : E1		" "		pop	hl
E7EC : 18 E1		"  "		jr	LE7CF
				;
E7EE				LE7EE:
E7EE : B7		" "		or	a
E7EF : ED 52		" R"		sbc	hl,de
E7F1 : 23		"#"		inc	hl
E7F2 : 23		"#"		inc	hl
E7F3 : 44		"D"		ld	b,h
E7F4 : 4D		"M"		ld	c,l
E7F5 : 2A 18 FF		"*  "		ld	hl,(XFF18)
E7F8 : EB		" "		ex	de,hl
E7F9 : C9		" "		ret
				;
E7FA				LE7FA:
E7FA : 2B		"+"		dec	hl
E7FB : C5		" "		push	bc
E7FC : CD F6 E5		"   "		call	LE5F6
E7FF : C1		" "		pop	bc
E800 : C9		" "		ret
				;
E801				LE801:
E801 : ED 5B FE FF	" [  "		ld	de,(XFFFE)
E805 : 1A		" "		ld	a,(de)
E806 : FE 40		" @"		cp	040H
E808 : 38 05		"8 "		jr	c,LE80F
E80A : FE C0		"  "		cp	0C0H
E80C : DA E4 E8		"   "		jp	c,LE8E4
E80F				LE80F:
E80F : E6 03		"  "		and	003H
E811 : 47		"G"		ld	b,a
E812 : 1A		" "		ld	a,(de)
E813 : 1F		" "		rra
E814 : 1F		" "		rra
E815 : E6 1F		"  "		and	01FH
E817 : C5		" "		push	bc
E818 : 01 2B E9		" + "		ld	bc,0E92BH
E81B : 81		" "		add	a,c
E81C : 6F		"o"		ld	l,a
E81D : 60		"`"		ld	h,b
E81E : C1		" "		pop	bc
E81F : 7E		"~"		ld	a,(hl)
E820 : 04		" "		inc	b
E821				LE821:
E821 : 10 29		" )"		djnz	LE84C
E823 : E6 03		"  "		and	003H
E825 : CA CF E8		"   "		jp	z,LE8CF
E828 : F5		" "		push	af
E829 : 1A		" "		ld	a,(de)
E82A : 2A F4 FF		"*  "		ld	hl,(XFFF4)
E82D : FE E9		"  "		cp	0E9H
E82F : CA A1 E0		"   "		jp	z,LE0A1
E832 : FE C3		"  "		cp	0C3H
E834 : 28 70		"(p"		jr	z,LE8A6
E836 : FE CD		"  "		cp	0CDH
E838 : 28 6C		"(l"		jr	z,LE8A6
E83A : FE C9		"  "		cp	0C9H
E83C : 28 5F		"(_"		jr	z,LE89D
E83E : FE 10		"  "		cp	010H
E840 : 20 10		"  "		jr	nz,LE852
E842 : 21 F9 FF		"!  "		ld	hl,0FFF9H
E845 : 35		"5"		dec	(hl)
E846 : 20 47		" G"		jr	nz,LE88F
E848 : 34		"4"		inc	(hl)
E849				LE849:
E849 : C3 05 E9		"   "		jp	LE905
				;
E84C				LE84C:
E84C : CB 3F		" ?"		srl	a
E84E : CB 3F		" ?"		srl	a
E850 : 18 CF		"  "		jr	LE821
				;
E852				LE852:
E852 : FE 18		"  "		cp	018H
E854 : 28 39		"(9"		jr	z,LE88F
E856 : FE 80		"  "		cp	080H
E858 : 30 0A		"0 "		jr	nc,LE864
E85A : EE 20		"  "		xor	020H
E85C : 47		"G"		ld	b,a
E85D : E6 67		" g"		and	067H
E85F : 20 E8		"  "		jr	nz,LE849
E861 : 78		"x"		ld	a,b
E862 : 18 0D		"  "		jr	LE871
				;
E864				LE864:
E864 : E6 C7		"  "		and	0C7H
E866 : FE C2		"  "		cp	0C2H
E868 : 28 06		"( "		jr	z,LE870
E86A : E6 C3		"  "		and	0C3H
E86C : FE C0		"  "		cp	0C0H
E86E : 20 43		" C"		jr	nz,LE8B3
E870				LE870:
E870 : 1A		" "		ld	a,(de)
E871				LE871:
E871 : E6 30		" 0"		and	030H
E873 : 21 4A E9		"!J "		ld	hl,0E94AH
E876				LE876:
E876 : 23		"#"		inc	hl
E877 : D6 10		"  "		sub	010H
E879 : 30 FB		"0 "		jr	nc,LE876
E87B : 3A FC FF		":  "		ld	a,(XFFFC)
E87E : A6		" "		and	(hl)
E87F : 1A		" "		ld	a,(de)
E880 : 28 01		"( "		jr	z,LE883
E882 : 2F		"/"		cpl
E883				LE883:
E883 : CB 5F		" _"		bit	3,a
E885 : 20 C2		"  "		jr	nz,LE849
E887 : F1		" "		pop	af
E888 : F5		" "		push	af
E889 : FE 02		"  "		cp	002H
E88B : 38 10		"8 "		jr	c,LE89D
E88D : 20 17		"  "		jr	nz,LE8A6
E88F				LE88F:
E88F : 13		" "		inc	de
E890 : 1A		" "		ld	a,(de)
E891 : 13		" "		inc	de
E892 : 6F		"o"		ld	l,a
E893 : 17		" "		rla
E894 : 26 00		"& "		ld	h,000H
E896 : 30 01		"0 "		jr	nc,LE899
E898 : 25		"%"		dec	h
E899				LE899:
E899 : 19		" "		add	hl,de
E89A : 18 30		" 0"		jr	LE8CC
				;
E89C				LE89C:
E89C : 1B		" "		dec	de
E89D				LE89D:
E89D : 2A E6 FF		"*  "		ld	hl,(XFFE6)
E8A0 : 7E		"~"		ld	a,(hl)
E8A1 : 23		"#"		inc	hl
E8A2 : 66		"f"		ld	h,(hl)
E8A3 : 6F		"o"		ld	l,a
E8A4 : 18 64		" d"		jr	LE90A
				;
E8A6				LE8A6:
E8A6 : 1A		" "		ld	a,(de)
E8A7 : CB 57		" W"		bit	2,a
E8A9 : 13		" "		inc	de
E8AA : 1A		" "		ld	a,(de)
E8AB : 6F		"o"		ld	l,a
E8AC : 13		" "		inc	de
E8AD : 1A		" "		ld	a,(de)
E8AE : 67		"g"		ld	h,a
E8AF : 20 59		" Y"		jr	nz,LE90A
E8B1 : 18 19		"  "		jr	LE8CC
				;
E8B3				LE8B3:
E8B3 : 1A		" "		ld	a,(de)
E8B4 : E6 C7		"  "		and	0C7H
E8B6 : FE C7		"  "		cp	0C7H
E8B8 : 1A		" "		ld	a,(de)
E8B9 : 20 07		"  "		jr	nz,LE8C2
E8BB : E6 38		" 8"		and	038H
E8BD : 6F		"o"		ld	l,a
E8BE : 26 00		"& "		ld	h,000H
E8C0 : 18 48		" H"		jr	LE90A
				;
E8C2				LE8C2:
E8C2 : FE FB		"  "		cp	0FBH
E8C4 : 20 3F		" ?"		jr	nz,LE905
E8C6 : 2F		"/"		cpl
E8C7 : 32 FA FF		"2  "		ld	(XFFFA),a
E8CA : EB		" "		ex	de,hl
E8CB : 23		"#"		inc	hl
E8CC				LE8CC:
E8CC : C3 A1 E0		"   "		jp	LE0A1
				;
E8CF				LE8CF:
E8CF : 1A		" "		ld	a,(de)
E8D0 : 13		" "		inc	de
E8D1 : FE ED		"  "		cp	0EDH
E8D3 : 20 13		"  "		jr	nz,LE8E8
E8D5 : 06 03		"  "		ld	b,003H
E8D7 : 1A		" "		ld	a,(de)
E8D8 : E6 F7		"  "		and	0F7H
E8DA : FE 45		" E"		cp	045H
E8DC : 28 BE		"( "		jr	z,LE89C
E8DE : E6 C7		"  "		and	0C7H
E8E0 : FE 43		" C"		cp	043H
E8E2 : 28 22		"(""		jr	z,LE906
E8E4				LE8E4:
E8E4 : 06 01		"  "		ld	b,001H
E8E6 : 18 1E		"  "		jr	LE906
				;
E8E8				LE8E8:
E8E8 : FE DD		"  "		cp	0DDH
E8EA : 2A EA FF		"*  "		ld	hl,(XFFEA)
E8ED : 28 03		"( "		jr	z,LE8F2
E8EF : 2A E8 FF		"*  "		ld	hl,(XFFE8)
E8F2				LE8F2:
E8F2 : 1A		" "		ld	a,(de)
E8F3 : FE E9		"  "		cp	0E9H
E8F5 : 28 D5		"( "		jr	z,LE8CC
E8F7 : 21 26 E9		"!& "		ld	hl,0E926H
E8FA : 01 05 00		"   "		ld	bc,00005H
E8FD : ED B1		"  "		cpir
E8FF : 20 0F		"  "		jr	nz,LE910
E901 : 04		" "		inc	b
E902				LE902:
E902 : 04		" "		inc	b
E903				LE903:
E903 : 04		" "		inc	b
E904 : C5		" "		push	bc
E905				LE905:
E905 : C1		" "		pop	bc
E906				LE906:
E906 : EB		" "		ex	de,hl
E907				LE907:
E907 : 23		"#"		inc	hl
E908 : 10 FD		"  "		djnz	LE907
E90A				LE90A:
E90A : CD 12 E3		"   "		call	LE312
E90D : C3 C6 E0		"   "		jp	LE0C6
				;
E910				LE910:
E910 : E6 FE		"  "		and	0FEH
E912 : FE 34		" 4"		cp	034H
E914 : 28 EC		"( "		jr	z,LE902
E916 : 1A		" "		ld	a,(de)
E917 : E6 07		"  "		and	007H
E919 : FE 06		"  "		cp	006H
E91B : 28 E5		"( "		jr	z,LE902
E91D : 1A		" "		ld	a,(de)
E91E : E6 F8		"  "		and	0F8H
E920 : FE 70		" p"		cp	070H
E922 : 28 DE		"( "		jr	z,LE902
E924 : 18 DD		"  "		jr	LE903
				;
E926 : 21 22 2A		"!"*"		ld	hl,02A22H
E929 : 36 CB		"6 "		ld	(hl),0CBH
E92B : 5D		"]"		ld	e,l
E92C : 65		"e"		ld	h,l
E92D : 55		"U"		ld	d,l
E92E : 65		"e"		ld	h,l
E92F : 5E		"^"		ld	e,(hl)
E930 : 65		"e"		ld	h,l
E931 : 56		"V"		ld	d,(hl)
E932 : 65		"e"		ld	h,l
E933 : 7E		"~"		ld	a,(hl)
E934 : 65		"e"		ld	h,l
E935 : 76		"v"		halt
E936 : 65		"e"		ld	h,l
E937 : 7E		"~"		ld	a,(hl)
E938 : 65		"e"		ld	h,l
E939 : 76		"v"		halt
E93A : 65		"e"		ld	h,l
E93B : F5		" "		push	af
E93C : 67		"g"		ld	h,a
E93D : B5		" "		or	l
E93E : 6F		"o"		ld	l,a
E93F : B5		" "		or	l
E940 : 67		"g"		ld	h,a
E941 : B5		" "		or	l
E942 : 63		"c"		ld	h,e
E943 : 75		"u"		ld	(hl),l
E944 : 67		"g"		ld	h,a
E945 : 75		"u"		ld	(hl),l
E946 : 63		"c"		ld	h,e
E947 : 75		"u"		ld	(hl),l
E948 : 67		"g"		ld	h,a
E949 : 75		"u"		ld	(hl),l
E94A : 63		"c"		ld	h,e
E94B : 40		"@"		ld	b,b
E94C : 01 04 80		"   "		ld	bc,08004H
				;------------------------------------------------------------------
				; boot - Boot disk
				;      The boot routine searches sectors from track 0 or track 1
				;      in the order specified by the boot order table (bootOrd).
				;      
				;      It looks for the file "OS.BIN" using a directory format
				;      from FLP-80DOS (most likely). Each directory entry is 14h
				;      bytes in length. If OS.BIN is found in a sector, the bytes
				;      at offset 0Eh and 0Fh in the directory entry contain the
				;      starting sector and track of the file to load.
				;
				;      The file loaded consists of 124 data bytes per sector
				;      followed by backward and forward (sector/track) byte pairs.
				;      The backward link isn't used. A forward link of (FFh,FFh)
				;      indicates this is the last sector of the file.
				;
				;      The file loaded should be a second-stage loader that reads
				;      in the OS from disk.
				;------------------------------------------------------------------
				LDIRENT	equ	14h		;length of each directory entry

				boot:
E94F : F3		" "		di
E950 : FD 21 90 FF	" !  "		ld	iy,0FF90H	;iy->disk DCB
E954 : 31 E0 FF		"1  "		ld	sp,XFFE0
E957 : 3E D0		"> "		ld	a,0D0H		;reset 1771 FDC
E959 : D3 E4		"  "		out	(0E4H),a
E95B : 3E 02		"> "		ld	a,002H
E95D : 32 12 FF		"2  "		ld	(XFF12),a
E960 : 21 D9 E9		"!  "		ld	hl,bootOrd	;hl->boot order table
E963 : D9		" "		exx

E964				nxtBoot:
E964 : D9		" "		exx
E965 : AF		" "		xor	a
E966 : 57		"W"		ld	d,a		;d=0
E967 : B6		" "		or	(hl)		;hl->next byte from boot order table
E968 : 20 07		"  "		jr	nz,tryBoot	;not zero means not done

E96A : 5F		"_"		ld	e,a		;e=0
E96B : 21 05 EA		"!  "		ld	hl,mNotFnd	;"OS.BIN NOT FOUND"
E96E : C3 23 EC		" # "		jp	bootErr		;display message and abort
				;
E971				tryBoot:
E971 : 17		" "		rla			;msbit of table entry into carry
E972 : CB 12		"  "		rl	d		;d = track = 0 or 1 from table msbit
E974 : 1F		" "		rra			;a = sector with table msbit cleared
E975 : 5F		"_"		ld	e,a		;e=sector to try
E976 : ED 53 AE FF	" S  "		ld	(XFFAE),de	;sector, track in DCB at 1Eh, 1Fh
E97A : 23		"#"		inc	hl		;hl->next bootOrd table entry
E97B : D9		" "		exx
E97C : FD 36 03 00	" 6  "		ld	(iy+003H),000H	;set drive zero in DCB
E980 : 21 14 FF		"!  "		ld	hl,XFF14	;hl->sector buffer
E983 : 22 A9 FF		""  "		ld	(XFFA9),hl	;set buffer addr in DCB at 19h, 1Ah 
E986 : FD 36 0F 11	" 6  "		ld	(iy+00FH),011H	;command in DCB = read at 0Fh
E98A : 06 0A		"  "		ld	b,00AH		;b=10 retries
E98C				rtryLp1:
E98C : CD 00 EC		"   "		call	vDskDrv		;call disk driver
E98F : 0E 06		"  "		ld	c,006H		;c=directory entries per sector
E991 : 28 0D		"( "		jr	z,chkEnt	;good read, go check directory for OS.BIN

E993 : 10 F7		"  "		djnz	rtryLp1		;otherwise, retry the read

E995				LE995:
E995 : C3 1E EC		"   "		jp	dskErr		;read fail after retries
				;
E998				nextEnt:
E998 : E1		" "		pop	hl		;hl->sector buffer (FF14)
E999 : 11 14 00		"   "		ld	de,LDIRENT	;increment hl by directory entry length
E99C : 19		" "		add	hl,de
E99D : 0D		" "		dec	c		;decrement directory entry counter
E99E : 28 C4		"( "		jr	z,nxtBoot	;all checked, try next boot from bootOrd table

E9A0				chkEnt:
E9A0 : E5		" "		push	hl		;hl->directory entry
E9A1 : 11 FA E9		"   "		ld	de,mOsBin	;"OS.BIN" string in filename format
E9A4 : 06 0B		"  "		ld	b,FNLEN		;b=filename length (11 bytes)

				; fnComp - filename compare, look for "OS.BIN"

E9A6				fnComp:	
E9A6 : 1A		" "		ld	a,(de)		;compare directory entry to "OS.BIN" string
E9A7 : BE		" "		cp	(hl)
E9A8 : 20 EE		"  "		jr	nz,nextEnt	;not found

E9AA : 13		" "		inc	de
E9AB : 23		"#"		inc	hl
E9AC : 10 F8		"  "		djnz	fnComp

				; OS.BIn found, fill the DCB with information from the directory entry
				;    so the boot file can be loaded.

E9AE : E1		" "		pop	hl		;hl->OS.BIN directory entry
E9AF : 11 94 FF		"   "		ld	de,DCBFN	;copy filename into DCB+04h
E9B2 : 01 0B 00		"   "		ld	bc,FNLEN	;bc=length to copy
E9B5 : ED B0		"  "		ldir

E9B7 : 23		"#"		inc	hl
E9B8 : 5E		"^"		ld	e,(hl)		;e=directory byte 0C
E9B9 : 23		"#"		inc	hl
E9BA : 56		"V"		ld	d,(hl)		;d=directory byte 0D
E9BB : ED 53 AD FF	" S  "		ld	(XFFAD),de	;DCB+1D,1E = dir bytes 0C and 0D
E9BF : 23		"#"		inc	hl
E9C0 : 7E		"~"		ld	a,(hl)		;a=sector for file from offset 0E
E9C1 : FD 77 1E		" w "		ld	(iy+01EH),a	;put sector in DCBSEC
E9C4 : 23		"#"		inc	hl
E9C5 : 7E		"~"		ld	a,(hl)		;a=track for file
E9C6 : FD 77 1F		" w "		ld	(iy+01FH),a	;put track in DCBTRK

E9C9 : 23		"#"		inc	hl		;directory byte 10h
E9CA : 23		"#"		inc	hl		;11h
E9CB : 23		"#"		inc	hl		;12h
E9CC : 5E		"^"		ld	e,(hl)		;e=lsb of load address 
E9CD : 23		"#"		inc	hl
E9CE : 56		"V"		ld	d,(hl)		;d=msb of load address
E9CF : EB		" "		ex	de,hl		;hl=load address
E9D0 : 22 A9 FF		""  "		ld	(DCBDMA),hl	;set load address in DCB

E9D3 : CD 03 EC		"   "		call	vDskFile	;disk driver, read a file
E9D6 : 20 BD		"  "		jr	nz,LE995	;error, abort with "DSK ERR"

E9D8 : E9		" "		jp	(hl)		;otherwise call boot loader

				; bootOrd - boot order table. Sectors are searched in this
				;     order for the file "OS.BIN". Track 0 if the MSBit is
				;     zero, track 1 if the MSbit is 1

E9D9:				bootOrd	db	85h,02h,04h,06h,08h,0Ah,0Ch,0Eh,10h,12h,14h
					db	16h,18h,1Ah,82h,84h,86h,01h,03h,05h,07h,09h
					db	0Bh,0Dh,0Fh,11h,13h,15h,17h,19h,81h,83h,00h

E9FA:				mOsBin	db	'OS    BIN",0,0FFh
				FNLEN	equ	$-mOsBIn	;length of file name

EA05:				mNotFnd	db	'OS.BIN[255] NOT FOUND',3

EA1B				dispErr:
EA1B : E5		" "		push	hl
EA1C : D5		" "		push	de
EA1D : C5		" "		push	bc
EA1E				LEA1E:
EA1E : F5		" "		push	af
EA1F : 21 12 FF		"!  "		ld	hl,XFF12
EA22 : 4E		"N"		ld	c,(hl)
EA23 : CB CE		"  "		set	1,(hl)
EA25 : 21 5E EA		"!^ "		ld	hl,0EA5EH
EA28 : CD C7 E3		"   "		call	dispMsg
EA2B : F1		" "		pop	af
EA2C : B7		" "		or	a
EA2D : 28 26		"(&"		jr	z,LEA55
EA2F : F5		" "		push	af
EA30 : 47		"G"		ld	b,a
EA31 : CD AA E5		"   "		call	LE5AA
EA34 : CD A5 E5		"   "		call	LE5A5
EA37 : 21 69 EA		"!i "		ld	hl,0EA69H
EA3A				LEA3A:
EA3A : 7E		"~"		ld	a,(hl)
EA3B : 23		"#"		inc	hl
EA3C : FE 03		"  "		cp	003H
EA3E : 20 FA		"  "		jr	nz,LEA3A
EA40 : 3E 04		"> "		ld	a,004H
EA42 : BE		" "		cp	(hl)
EA43 : 28 10		"( "		jr	z,LEA55
EA45 : 10 F3		"  "		djnz	LEA3A
EA47 : CD C7 E3		"   "		call	dispMsg
EA4A : CD A5 E5		"   "		call	LE5A5
EA4D : 3E 04		"> "		ld	a,004H
EA4F : CD 26 FF		" & "		call	LFF26
EA52 : CD 9C E5		"   "		call	LE59C
EA55				LEA55:
EA55 : 79		"y"		ld	a,c
EA56 : 32 12 FF		"2  "		ld	(XFF12),a
EA59 : F1		" "		pop	af
EA5A : C1		" "		pop	bc
EA5B : D1		" "		pop	de
EA5C				LEA5C:
EA5C : E1		" "		pop	hl
EA5D : C9		" "		ret
				;
EA5E 					db	'*****ERROR ',03H
EA6A 					db	'INVALID REQUEST',03H
EA77					db	'DUPLICATE FILE',03H
EA86 					db	'FILE TABLE FULL',03H
EA96 					db	'FILE NOT FOUND',03H
EAA5 					db	'DIR FULL',03H
EAAE 					db	'DISK WRITE PROTECT',03H
EAC1 					db	'I/O TIMEOUT',03H
EACE 					db	'FILE NOT OPEN',03H
EADC					db	'READ PAST END OF',03H
EAEA					db	'DISK I/O ERR',03H
EAF7 					db	'DISK FULL',03H
EB01					db	'DISK PTR ERR',03H
EB0E 					db	'DIR MAP ERR',03H
EB1A 					db	'FILE ALREADY OPEN',03H
EB2C 					db	'DISK NO READY',03H
EB3B 					db	' INITIALIZE',03H
EB47 					db	'BAD UNIT',03H
EB50					db	'INVALID RQST',03H
EB5D 					db	'UNIT ALREADY OPEN',03H
EB6F 					db	'UNIT NOT OPEN',03H
EB7D					db	'UNSUPPORTED DEVICE',03H
EB90					db	'INVALID FMAT',03H
EB9D					db	'ALLOC ERR',03H
EBA7					db	'DE-ALLOC ERR',03H
EBB4					db	'BAD FILE NAME,03H,03H
EBC3					db	'BAD UNIT,TRK,OR SCTR',03H
EBD8					db	'SEEK ERR',03H
EBE1					db	'SCTR NOT FOUND',03H
EBF0					db	'CRC',03H
EBF4					db	'DATA LOST',03H
EBFE					db	04H,00H


;**************************************************************
;
;  Disk driver PROM starts here.
;  
;  Bugs found:
;	If a verified seek operation fails (whether explicity
;       called as a command or done as part of a read or write),
;	the code retries the seek twice, each re-seek preceded
;	by a restore command. However, the destination track
;	number is not re-loaded into the 1771 before issuing
;	the new seek command, and the 1771 has zero'd the data
;	register as part of the restore command. Therefore the
;	re-seek command seekS to track zero, not the expected
;	track. No error is resported (assuming track zero is
;	not corrupt) and subsequent I/O takes place on track
;	zero instead of the expected track.
;
;	When a disk I/O occurs, the exit routine does a restore
;	to track zero command and exits without waiting for
;	the restore to complete. A calling program could 
;	easily re-issue a command to the driver long before the
;	restore completes, therefore writing commands to the
;	1771 while it is busy. 
;
;	The write track command (for formatting a track) leaves
;	the FIFO in an invalid state and the calling routine
;	must reset the FIFO and set non-buffered I/O prior to
;	issuing a subsequent write track command.
;
;  Mike Douglas, March 2016
;
;***************************************************************

FDCBASE	equ	0E0H			;controller base I/O address
FDCCMD	equ	FDCBASE+4		;1771 command register
FDCSTAT	equ	FDCBASE+4		;1771 status register
FDCTRK	equ	FDCBASE+5		;1771 track register
FDCSEC	equ	FDCBASE+6		;1771 sector register
FDCDATA	equ	FDCBASE+7		;1771 data in/out register

FDBSTAT	equ	FDCBASE+2		;floppy disk board status
FDBCTL	equ	FDCBASE+3		;floppy disk board control

; Board status bits

mDBLSID	equ	01h		;1=double sided
mINT	equ	02h		;1=1771 interrupt (command done)
mOUTRDY	equ	04h		;1=output ready
mINRDY	equ	08h		;1=input ready

; Board control

mSIDE	equ	10h		;1=top side select
mFFRST	equ	20h		;1=fifo reset
mFFON	equ	40h		;1=buffered mode
mFFRW	equ	80h		;1=write direction, 0=read direction

BADPARM	equ	80h		;bad parameter passsed in DCB
NOTRDY	equ	40h
SEEKERR	equ	20h
S1771	equ	1Ch		;1771 status bits masked by 1C


dcSTAT	equ	10h		;return 1771 status
dcREAD	equ	11h		;read sector
dcWRITE	equ	12h		;write sector
dcSEEK	equ	13h		;seek track with verify
dcRESTR	equ	14h		;restore to track 0
dcGETRK	equ	15h		;read track # from disk, put in 1771
dcDEL	equ	16h		;write deleted sector data mark
dcFMT	equ	17h		;seek track, issue write track for fmt

; dcb structure

dcb	equ	$
	ds	3		;locations 0-2 unknown
dcbDrv	ds	1		;drive number (0-3) at offset 3
dcbFn	ds	11		;file name (not used) at offset 4-0E
dcbCmd	ds	1		;command at offset 0F
	ds	9
dcbDma	ds	2		;transfer buffer address at 19,1A
	ds	2
dcbWSec	ds	1		;number of sectors for file dump to disk
dcbSec	ds	1		;sector to read/write at offset 1E
dcbTrk	ds	1		;track to read/write at offset 1F
dcbLst4	ds	4		;last four bytes of track go here


EC00				vDskDrv:			;disk driver entry
EC00 : C3 64 EC		" d "		jp	dskDrv		
EC03				vDskFile:			;load file (DCB ready)
EC03 : C3 42 EC		" B "		jp	dskFile		
				vDmpRam				;dump RAM range to file
EC06 : C3 33 EF		" 3 "		jp	dmpRam
				vLdRam				;load file to address
EC09 : 21 38 EC		"!8 "		ld	hl,mLoad	;hl->"LOAD ADR:"
EC0C				LEC0C:
EC0C : 31 B4 FF		"1  "		ld	sp,0FFB4H
EC0F : CD 98 EF		"   "		call	fillDCB		;user input to DCB
EC12 : FD 36 0F 14	" 6  "		ld	(iy+00FH),014H	;restore to track zero
EC16 : CD 64 EC		" d "		call	dskDrv
EC19 : CD 42 EC		" B "		call	dskFile		;load a disk file
EC1C : 28 08		"( "		jr	z,LEC26		;home disk and exit

				; dskErr - display "DSK ERR" message, restore head to
				;     track zero and exit

EC1E				dskErr:
EC1E : 1E 00		"  "		ld	e,000H
EC20 : 21 30 EC		"!0 "		ld	hl,mDskErr	;"DSK ERR"

				; bootErr - display message in (hl), restore head to
				;    track zero and exit.

EC23				bootErr:
EC23 : CD C7 E3		"   "		call	dispMsg
EC26				LEC26:
EC26 : FD 36 0F 14	" 6  "		ld	(iy+00FH),014H
EC2A : CD 64 EC		" d "		call	dskDrv
EC2D : C3 1D E1		"   "		jp	LE11D		;exit to command loop?

EC30				mDskErr	db	'DSK ERR',03H
EC38				mLoad:	db	'LOAD ADR:',03H 

				; dskFile - read consecutive sectors until forward link is FF.

EC42 : FD 36 0F 11		dskFile	ld	(iy+00FH),011H		;set command to read
EC46 : 06 0A		"   "	LEC46:	ld	b,00AH			;10 retries
EC48				LEC48:
EC48 : CD 64 EC		" d "		call	dskDrv
EC4B : 28 05		"( "		jr	z,LEC52
EC4D : 10 F9		"  "		djnz	LEC48
EC4F : F6 01		"  "		or	001H
EC51 : C9		" "		ret
				;
EC52				LEC52:					;last 4 bytes of sector
EC52 : 3E FF		"> "		ld	a,0FFH			;at iY+20h-23h. Next sector,
EC54 : FD 46 23		" F#"		ld	b,(iy+023H)		;track at 22h,23h.	
EC57 : FD 4E 22		" N""		ld	c,(iy+022H)
EC5A : B9		" "		cp	c
EC5B : C8		" "		ret	z			;sector FF = done

EC5C : FD 70 1F		" p "		ld	(iy+01FH),b		;next track
EC5F : FD 71 1E		" q "		ld	(iy+01EH),c		;next sector
EC62 : 18 E2		"  "		jr	LEC46			;read next

EC64				dskDrv:
EC64 : F5		" "		push	af
EC65 : C5		" "		push	bc
EC66 : D5		" "		push	de
EC67 : E5		" "		push	hl
EC68 : 08		" "		ex	af,af'
EC69 : F5		" "		push	af
EC6A : ED 73 E2 FF	" s  "		ld	(XFFE2),sp  	;save SP at FFE2
EC6E : FD CB 17 86	"    "		res	0,(iy+017H) 	;clear return status flag
EC72 : CD BD EC		"   "		call	doCmd
EC75				exitSP:
EC75 : ED 7B E2 FF	" {  "		ld	sp,(XFFE2)
EC79 : F1		" "		pop	af
EC7A				exitNS:
EC7A : 08		" "		ex	af,af'
EC7B : E1		" "		pop	hl
EC7C : D1		" "		pop	de
EC7D : C1		" "		pop	bc
EC7E : F1		" "		pop	af
EC7F				LEC7F:
EC7F : FD CB 17 46	"   F"		bit	0,(iy+017H)	;return status flag in Z
EC83 : C9		" "		ret

				; chkWait - check the status of the operation just
				;    completed against the bit mask in af'. If bit 1
				;    of DCBFLGS is set, then wait for the 1771 to finish
				;    the current command. If 1771 status AND'd with af' 
				;    is non-zero, restore the disk to track zero and 
				;    exit the driver with the error status.

EC84				chkWait:
EC84 : FD CB 17 4E	"   N"		bit	1,(iy+017H)	;test don't wait for command flag
EC88 : FD CB 17 8E	"    "		res	1,(iy+017H)	;and clear it
EC8C : 20 06		"  "		jr	nz,chkStat	;flag set, don't wait
EC8E				LEC8E:
EC8E : DB E2		"  "		in	a,(FDBSTAT)	;wait for 1771 command to finish
EC90 : CB 4F		" O"		bit	1,a
EC92 : 28 FA		"( "		jr	z,LEC8E

				; chkStat - check the status of the operation just
				;    completed against the bit mask in af'. If 1771
				;    status AND'd with af' is non-zero, restore the
				;    disk to track zero and exit the driver with the
				;    error status.

EC94				chkStat:
EC94 : DB E3		"  "		in	a,(FDBCTL)	;get board control
EC96 : E6 1F		"  "		and	01FH		;bypass FIFO
EC98 : D3 E3		"  "		out	(FDBCTL),a
EC9A : FD CB 17 86	"    "		res	0,(iy+017H)	;clear return status flag
EC9E : DB E4		"  "		in	a,(FDCSTAT)	;a=1771 status
ECA0 : 5F		"_"		ld	e,a		;save in e
ECA1 : 08		" "		ex	af,af'		;af' has bit mask to check
ECA2 : A3		" "		and	e		;check for errors
ECA3 : 20 02		"  "		jr	nz,resExit	;have error, restore and exit
ECA5 : 08		" "		ex	af,af'
ECA6 : C9		" "		ret

				; resExit - restore disk to track zero and exit with error

ECA7				resExit:			;wait for 1771 not busy
ECA7 : DB E4		"  "		in	a,(FDCSTAT)
ECA9 : CB 47		" G"		bit	0,a
ECAB : 20 FA		"  "		jr	nz,resExit

				; this code issues a restore to track zero command and the call
				;    to chkSeek immediately checks the 1771's status without
				;    waiting for the restore command to complete. Seems like
				;    this is a bug.

ECAD : 3E 0A		"> "		ld	a,00AH		;issue restore to zero
ECAF : D3 E4		"  "		out	(FDCCMD),a	
ECB1 : CD 70 EE		" p "		call	chkSeek		;check for seek complete
ECB4 : FD CB 17 C6	"    "		set	0,(iy+017H)	;set return status error flag
ECB8 : 7B		"{"		ld	a,e
ECB9 : E6 1C		"  "		and	01CH		;error bits in A
ECBB : 18 73		" s"		jr	errExit
				;
				doCmd:
ECBD : AF		" "		xor	a
ECBE : 32 07 FF		"2  "		ld	(XFF07),a	;FF07 holds current 1771 cmd
ECC1 : CD A1 ED		"   "		call	getDrv		;get currently selected drive #
ECC4 : 30 08		"0 "		jr	nc,LECCE	;no drive currently selected

ECC6 : FD 7E 03		" ~ "		ld	a,(iy+003H)	;A=new drive number
ECC9 : E6 03		"  "		and	003H
ECCB : B9		" "		cp	c		;same as selected?
ECCC : 28 0F		"( "		jr	z,sameDrv	;yes

				;  select a different drive

ECCE				LECCE:
ECCE : CD 8C EE		"   "		call	selDrv
ECD1 : FD 7E 0F		" ~ "		ld	a,(iy+00FH)	;a=command
ECD4 : FE 17		"  "		cp	017H		;format track?
ECD6 : 28 05		"( "		jr	z,sameDrv	;yes, skip read of track ID
ECD8 : FE 14		"  "		cp	014H		;also skip for restore
ECDA : C4 AE ED		"   "		call	nz,getTrk	;read track id, put in 1771
	
				sameDrv:
ECDD : FD 7E 1E		" ~ "		ld	a,(iy+01EH)	;a=sector 
ECE0 : FE 1B		"  "		cp	01BH		;verify 1-26
ECE2 : 30 56		"0V"		jr	nc,badParm	;bad parameter
ECE4 : FE 00		"  "		cp	000H
ECE6 : 28 52		"(R"		jr	z,badParm

ECE8 : 06 4D		" M"		ld	b,04DH		;single sided 77 tracks
ECEA : DB E2		"  "		in	a,(FDBSTAT)
ECEC : CB 47		" G"		bit	0,a		;double sided?
ECEE : 28 02		"( "		jr	z,LECF2
ECF0 : 06 9A		"  "		ld	b,09AH		;double sided 154 tracks
ECF2				LECF2:
ECF2 : FD 7E 1F		" ~ "		ld	a,(iy+01FH)	;a=track
ECF5 : B8		" "		cp	b		;validate
ECF6 : D2 3A ED		" : "		jp	nc,badParm	;invalid track
ECF9 : FD 7E 0F		" ~ "		ld	a,(iy+00FH)
ECFC : 47		"G"		ld	b,a

ECFD : FE 10		"  "		cp	010H		;10H = return status in A
ECFF : CA 83 ED		"   "		jp	z,dStatus	;  and at FF09

ED02 : DB E4		"  "		in	a,(FDCSTAT)	;drive ready?
ED04 : CB 7F		"  "		bit	7,a
ED06 : 3E 40		">@"		ld	a,040H		;drive not ready error
ED08 : 20 26		" &"		jr	nz,errExit

ED0A : 78		"x"		ld	a,b
ED0B : FE 11		"  "		cp	011H		;11H = Read sector
ED0D : CA E9 ED		"   "		jp	z,dRead

ED10 : FE 12		"  "		cp	012H		;12H = Write sector
ED12 : CA 2C EE		" , "		jp	z,dWrite

ED15 : FE 13		"  "		cp	013H		;13H = Seek and verify
ED17 : CA 45 ED		" E "		jp	z,dSeek	

ED1A : FE 14		"  "		cp	014H		;14H = Restore to track 0
ED1C : CA 6B EE		" k "		jp	z,restore

ED1F : FE 15		"  "		cp	015H		;15H = get track from disk, put in 1771
ED21 : CA AE ED		"   "		jp	z,getTrk

ED24 : FE 16		"  "		cp	016H		;16h = write deleted data mark
ED26 : CA 67 EE		" g "		jp	z,LEE67

ED29 : FE 17		"  "		cp	017H		;17h = seek and write track (format)
ED2B : CA F7 EE		"   "		jp	z,dFmtTrk

ED2E : 3E 00		"> "		ld	a,000H

ED30				errExit:
ED30 : 32 09 FF		"2  "		ld	(XFF09),a	;save error passed in A
ED33 : FD CB 17 C6	"    "		set	0,(iy+017H)	;set return status error flag
ED37 : C3 75 EC		" u "		jp	exitSP		;exit and restore stack
				;
ED3A				badParm:
ED3A : 3E 80		"> "		ld	a,080H
ED3C : 18 F2		"  "		jr	errExit
				;
ED3E				saveHL:				;save HL into DCBDMA
ED3E : FD 75 19		" u "		ld	(iy+019H),l
ED41 : FD 74 1A		" t "		ld	(iy+01AH),h
ED44 : C9		" "		ret

				; dSeek (13H) - Seek and verify track at iy+1Fh with retries. If
				;    no seek is required, the ready status of the 1771 is not
				;    checked.

ED45				dSeek:
ED45 : 06 00		"  "		ld	b,000H
ED47 : FD 7E 1F		" ~ "		ld	a,(iy+01FH)	;a=track
ED4A : FE 4D		" M"		cp	04DH
ED4C : 38 04		"8 "		jr	c,LED52
ED4E : 06 10		"  "		ld	b,010H
ED50 : D6 4D		" M"		sub	04DH
ED52				LED52:
ED52 : D3 E7		"  "		out	(FDCDATA),a
ED54 : 5F		"_"		ld	e,a
ED55 : DB E5		"  "		in	a,(FDCTRK)
ED57 : BB		" "		cp	e
ED58 : F5		" "		push	af
ED59 : DB E3		"  "		in	a,(FDBCTL)
ED5B : 5F		"_"		ld	e,a
ED5C : E6 10		"  "		and	010H
ED5E : B8		" "		cp	b
ED5F : 28 0B		"( "		jr	z,LED6C
ED61 : 7B		"{"		ld	a,e
ED62 : E6 0F		"  "		and	00FH
ED64 : B0		" "		or	b
ED65 : D3 E3		"  "		out	(FDBCTL),a
ED67 : 3E 01		"> "		ld	a,001H
ED69 : CD B0 EE		"   "		call	delayMs
ED6C				LED6C:
ED6C : F1		" "		pop	af
ED6D : C8		" "		ret	z		;same track immediately exits

				; seek and verify retry loop. This loop has a bug. If the first
				;    seek operation fails (e.g., unformatted/corrupt track), the
				;    code issues a restore to zero which internally clears the data
				;    register in the 1771 to zero. Previously the DR held the orig-
				;    inal target track number. The code does not reload DR with the
				;    target track after the restore operation, so the seek retry
				;    does a seek to track zero, not to the target track. If track
				;    zero is not corrupt, then the seek & verify "works" and this
				;    code exits to the caller, which now reads or writes track zero
				;    instead of the intended track.

ED6E : 06 02		"  "		ld	b,002H		;2 retries
ED70				LED70:
ED70 : 3E 1E		"> "		ld	a,01EH
ED72 : CD 78 EE		" x "		call	LEE78		;issue seek and verify
ED75 : DB E4		"  "		in	a,(FDCSTAT)
ED77 : CB 67		" g"		bit	4,a		;seek error?
ED79 : C8		" "		ret	z		;no

ED7A : CD 6B EE		" k "		call	restore		
ED7D : 10 F1		"  "		djnz	LED70

ED7F : 3E 20		"> "	seekErr	ld	a,020H		;seek error code
ED81 : 18 AD		"  "		jr	errExit
				
				; dStatus (10H) - return drive status in FF09. The status
				;       is a custom format (not 1771) as shown below. This
				;       point is never even reached if the drive is not
				;       ready, so test the drive not ready bit first to
				;       qualify the remaining bits.
				;
				;   bit 1 = write protect
				;       3 = CRC error
				;       5 = seek error
				;       6 = drive not ready

ED83				dStatus:
ED83 : CD DF EE		"   "		call	fdcRset		;force type 1 status
ED86 : DB E4		"  "		in	a,(FDCSTAT)
ED88 : 57		"W"		ld	d,a
ED89 : E6 08		"  "		and	008H		;preserve CRC error?
ED8B : CB 7A		" z"		bit	7,d		;drive ready?
ED8D : 28 02		"( "		jr	z,LED91		;yes
ED8F : CB F7		"  "		set	6,a		;set not ready status
ED91				LED91:
ED91 : CB 72		" r"		bit	6,d		;read write protect?	
ED93 : 28 02		"( "		jr	z,LED97		;no
ED95 : CB CF		"  "		set	1,a		;set write protect status
ED97				LED97:
ED97 : CB 62		" b"		bit	4,d		;seek error?
ED99 : 28 02		"( "		jr	z,LED9D		;no
ED9B : CB EF		"  "		set	5,a		;set seek error status
ED9D				LED9D:
ED9D : 32 09 FF		"2  "		ld	(XFF09),a	;save status in FF09
EDA0 : C9		" "		ret

				; getDrv - return drive number as binary 0-3 in A or
				;     also zero if no drive selected. If carry clear
				;     on return, no drive was selected.
				getDrv:
EDA1 : DB E3		"  "		in	a,(FDBCTL)	;read board control
EDA3 : E6 0F		"  "		and	00FH		;get drive select bits alone
EDA5 : C8		" "		ret	z		;no drive selected

EDA6 : 0E FF		"  "		ld	c,0FFH		;c=drive number, start at -1
EDA8				gdLoop:
EDA8 : 0C		" "		inc	c		;increment drive number
EDA9 : 1F		" "		rra			;look for bit to be set
EDAA : 30 FC		"0 "		jr	nc,gdLoop

EDAC : 79		"y"		ld	a,c		;a=binary drive number
EDAD : C9		" "		ret

				; set track register to match what is read from address mark

				getTrk:
EDAE : CD C6 EE		"   "		call	rstFifo		;reset FIFO
EDB1 : 21 08 FF		"!  "		ld	hl,XFF08
EDB4 : 01 E7 04		"   "		ld	bc,004E7H	;read 4 bytes (address mark)
EDB7 : 3E FC		"> "		ld	a,0FCH		;status bits to check at completion
EDB9 : 08		" "		ex	af,af'
EDBA : 3E C4		"> "		ld	a,0C4H		;read address mark
EDBC : 32 07 FF		"2  "		ld	(XFF07),a
EDBF : D3 E4		"  "		out	(FDCCMD),a	;issue command
EDC1				LEDC1:
EDC1 : DB E3		"  "		in	a,(FDBCTL)	;set FIFO for reqd
EDC3 : F6 40		" @"		or	040H
EDC5 : D3 E3		"  "		out	(FDBCTL),a
EDC7				LEDC7:
EDC7 : DB E2		"  "		in	a,(FDBSTAT)
EDC9 : CB 4F		" O"		bit	1,a		;command done?
EDCB : 20 11		"  "		jr	nz,LEDDE	;yes

EDCD : CB 57		" W"		bit	2,a		;data byte ready?
EDCF : 28 F6		"( "		jr	z,LEDC7		;no, wait

EDD1 : ED A2		"  "		ini			;move byte to (hl++)
EDD3 : 20 F2		"  "		jr	nz,LEDC7

EDD5 : CD 84 EC		"   "		call	chkWait		;wait and then check 1771 status
EDD8 : 3A 08 FF		":  "		ld	a,(XFF08)	;a=track read from disk
EDDB : D3 E5		"  "		out	(FDCTRK),a	;set track in 1771
EDDD : C9		" "		ret
				;
EDDE				LEDDE:
EDDE : E5		" "		push	hl
EDDF : CD 94 EC		"   "		call	chkStat
EDE2 : E1		" "		pop	hl
EDE3 : FD CB 17 CE	"    "		set	1,(iy+017H)	;don't wait when chkWait called
EDE7 : 18 D8		"  "		jr	LEDC1
				
				; dRead (11H) - read sector from disk

EDE9				dRead:
EDE9 : CD 45 ED		" E "		call	dSeek		;seek to track specified
EDEC : 3E FC		"> "		ld	a,0FCH		;bit mask to check 1771 status
EDEE : 08		" "		ex	af,af'
EDEF : CD B8 EE		"   "		call	initIo		;init for I/O
EDF2 : 3E 88		"> "		ld	a,088H		;read command
EDF4 : CD E9 EE		"   "		call	setEbit		;set E head wait bit
EDF7 : 32 07 FF		"2  "		ld	(XFF07),a
EDFA : D3 E4		"  "		out	(FDCCMD),a
EDFC : 16 02		"  "		ld	d,002H		;used to read last 4 bytes
EDFE				LEDFE:
EDFE : DB E3		"  "		in	a,(FDBCTL)	;set FIFO direction
EE00 : F6 40		" @"		or	040H
EE02 : D3 E3		"  "		out	(FDBCTL),a

				; transfer 1st 124 bytes to buffer, last four to DCB

EE04				LEE04:	
EE04 : DB E2		"  "		in	a,(FDBSTAT)	;wait for complete or data
EE06 : CB 4F		" O"		bit	1,a
EE08 : 20 19		"  "		jr	nz,LEE23	;transfer completed early

EE0A : CB 57		" W"		bit	2,a		;wait for data available
EE0C : 28 F6		"( "		jr	z,LEE04

EE0E : ED A2		"  "		ini			;in c, to hl, inc hl, decr b
EE10 : 20 F2		"  "		jr	nz,LEE04

EE12 : E5		" "		push	hl
EE13 : 06 04		"  "		ld	b,004H		;last four bytes go to DCBLST4
EE15 : CD D5 EE		"   "		call	LEED5		;get HL=DCBLST4
EE18 : 15		" "		dec	d
EE19 : 20 E9		"  "		jr	nz,LEE04

EE1B : CD 84 EC		"   "		call	chkWait		;wait and then check 1771 status
EE1E : E1		" "		pop	hl
EE1F : E1		" "		pop	hl
EE20 : C3 3E ED		" > "		jp	saveHL		;update DMA address with HL
				;
EE23				LEE23:				;1771 interrupted before all bytes
EE23 : CD 94 EC		"   "		call	chkStat		
EE26 : FD CB 17 CE	"    "		set	1,(iy+017H)	;don't wait in chkWait call next time
EE2A : 18 D2		"  "		jr	LEDFE		;get rest of bytes
				
				; dWrite (12H) - write sector to disk

				dWrite:
EE2C : 3E A8		"> "		ld	a,0A8H		;write normal
EE2E				LEE2E:
EE2E : F5		" "		push	af
EE2F : CD 45 ED		" E "		call	dSeek
EE32 : 3E 9C		"> "		ld	a,09CH		;bit mask to check 1771 status
EE34 : 08		" "		ex	af,af'
EE35 : CD B8 EE		"   "		call	initIo
EE38 : F1		" "		pop	af
EE39 : CD E9 EE		"   "		call	setEbit		;set E head bit, does 1771 reset
EE3C : 32 07 FF		"2  "		ld	(XFF07),a
EE3F : F3		" "		di
EE40 : D3 E4		"  "		out	(FDCCMD),a
EE42 : DB E3		"  "		in	a,(FDBCTL)
EE44 : F6 C0		"  "		or	0C0H
EE46 : D3 E3		"  "		out	(FDBCTL),a	;buffered write
EE48 : 16 02		"  "		ld	d,002H
EE4A				LEE4A:
EE4A : ED B3		"  "		otir			;port c=(hl++), b--
EE4C : E5		" "		push	hl
EE4D : 06 04		"  "		ld	b,004H
EE4F : CD D5 EE		"   "		call	LEED5		;HL->DCBLST4
EE52 : 15		" "		dec	d
EE53 : 20 F5		"  "		jr	nz,LEE4A	;goes once to write last 4 bytes

EE55 : FB		" "		ei
EE56 : CD 8E EC		"   "		call	LEC8E		;wait for finish, check status
EE59 : DB E4		"  "		in	a,(FDCSTAT)
EE5B : CB 77		" w"		bit	6,a		;write protect?
EE5D : E1		" "		pop	hl
EE5E : E1		" "		pop	hl
EE5F : CA 3E ED		" > "		jp	z,saveHL	;no, update DCBDMA with HL and exit

EE62 : 3E 02		"> "		ld	a,002H		;else, return write protect err
EE64 : C3 30 ED		" 0 "		jp	errExit
				;
EE67				LEE67:
EE67 : 3E AB		"> "		ld	a,0ABH		;write "deleted" data mark
EE69 : 18 C3		"  "		jr	LEE2E

				; restore to track 0

EE6B				restore:
EE6B : 3E 0A		"> "		ld	a,00AH
EE6D : CD 78 EE		" x "		call	LEE78		;issue restore command

				chkSeek:
EE70 : DB E4		"  "		in	a,(FDCSTAT)
EE72 : CB 67		" g"		bit	4,a		;seek error?
EE74 : C8		" "		ret	z		;no
EE75 : C3 7F ED		"   "		jp	seekErr		;exit with seek error code

				; EE78 - issue command checking only for drive not ready
				;     and CRC errors

EE78				LEE78:
EE78 : 32 07 FF		"2  "		ld	(XFF07),a	;save disk command
EE7B : 3E 88		"> "		ld	a,088H		;status bits to check
EE7D : 08		" "		ex	af,af'
EE7E				LEE7E:
EE7E : DB E4		"  "		in	a,(FDCSTAT)	;wait for not busy
EE80 : CB 47		" G"		bit	0,a
EE82 : 20 FA		"  "		jr	nz,LEE7E

EE84 : 3A 07 FF		":  "		ld	a,(XFF07)	;a=command to issue
EE87 : D3 E4		"  "		out	(FDCCMD),a
EE89 : C3 8E EC		"   "		jp	LEC8E		;wait for finish, check status

				; selDrv - select drive specified in DCBDRV

				selDrv:
EE8C : FD 7E 03		" ~ "		ld	a,(iy+003H)	;a=drive number
EE8F : E6 03		"  "		and	003H
EE91 : 0E 01		"  "		ld	c,001H		;c=drive bit
EE93 : B7		" "		or	a
EE94 : 28 05		"( "		jr	z,haveDrv
EE96				sdLoop:				;convert drive number to drive bit
EE96 : CB 21		" !"		sla	c
EE98 : 3D		"="		dec	a
EE99 : 20 FB		"  "		jr	nz,sdLoop
E
				haveDrv:
EE9B : 79		"y"		ld	a,c		;a=drive select bit
EE9C : D3 E3		"  "		out	(FDBCTL),a	;select the drive
EE9E : 3E 23		">#"		ld	a,023H		;delay 35ms
EEA0 : CD B0 EE		"   "		call	delayMs
EEA3 : DB E4		"  "		in	a,(FDCSTAT)	;drive ready?
EEA5 : CB 7F		"  "		bit	7,a
EEA7 : 28 06		"( "		jr	z,LEEAF		;yes, exit
EEA9 : F1		" "		pop	af		;else pop af
EEAA : 3E 40		">@"		ld	a,040H		;drive not ready
EEAC : C3 30 ED		" 0 "		jp	errExit		;jump to error routine
EEAF				LEEAF:
EEAF : C9		" "		ret
			
				; delayMs - delay #ms specified in a

				delayMs:	
EEB0 : 06 BF		"  "		ld	b,0BFH		;191 * 13 cycles = 1ms
EEB2				LEEB2:
EEB2 : 10 FE		"  "		djnz	LEEB2		;(13)
EEB4 : 3D		"="		dec	a		;(4)
EEB5 : 20 F9		"  "		jr	nz,delayMs	;(12)
EEB7 : C9		" "		ret
				
				; initIo - init for disk transfer

EEB8				initIo:

EEB8 : FD 6E 19		" n "		ld	l,(iy+019H)	;hl->buffer
EEBB : FD 66 1A		" f "		ld	h,(iy+01AH)
EEBE : 01 E7 7C		"  |"		ld	bc,07CE7H	;b=124 bytes, c=E7 port
EEC1 : FD 7E 1E		" ~ "		ld	a,(iy+01EH)	;a=sector number
EEC4 : D3 E6		"  "		out	(FDCSEC),a	;give sector to 1771

EEC6				rstFifo:
EEC6 : DB E3		"  "		in	a,(FDBCTL)	;reset FIFO buffer
EEC8 : F6 20		"  "		or	020H
EECA : D3 E3		"  "		out	(FDBCTL),a
EECC : E6 1F		"  "		and	01FH
EECE : D3 E3		"  "		out	(FDBCTL),a

EED0 : FD CB 17 8E	"    "		res	1,(iy+017H)
EED4 : C9		" "		ret
			
EED5				LEED5:
EED5 : FD E5		"  "		push	iy		;compute hl=iy+20H
EED7 : E1		" "		pop	hl
EED8 : D5		" "		push	de
EED9 : 11 20 00		"   "		ld	de,00020H
EEDC : 19		" "		add	hl,de
EEDD : D1		" "		pop	de
EEDE : C9		" "		ret

				; fdcRset - reset the 1771
	
				fdcRset:
EEDF : 3E D0		"> "		ld	a,0D0H		;force interupt
EEE1 : D3 E4		"  "		out	(FDCCMD),a
EEE3 : 3E 02		"> "		ld	a,002H
EEE5				LEEE5:
EEE5 : 3D		"="		dec	a
EEE6 : 20 FD		"  "		jr	nz,LEEE5
EEE8 : C9		" "		ret

				; setEbit - set E flag in command byte (a) if the head is not
				;   presently loaded

EEE9				setEbit:
EEE9 : 57		"W"		ld	d,a
EEEA : CD DF EE		"   "		call	fdcRset
EEED : DB E4		"  "		in	a,(FDCSTAT)
EEEF : CB 6F		" o"		bit	5,a		;head loaded?
EEF1 : 7A		"z"		ld	a,d
EEF2 : 20 02		"  "		jr	nz,LEEF6
EEF4 : F6 04		"  "		or	004H
EEF6				LEEF6:
EEF6 : C9		" "		ret

				; dFmtTrk (17h) - seek to track in DCB, issue a Write Track
				;     command and track is written with data pointed to
				;     by FDBDMA. This buffer should be a track worth of
				;     data for formatting

EEF7				dFmtTrk:
EEF7 : FD 7E 1F		" ~ "		ld	a,(iy+01FH)	;a=track
EEFA : D3 E7		"  "		out	(FDCDATA),a
EEFC : 3E 1A		"> "		ld	a,01AH		;seek, no verify
EEFE : CD 78 EE		" x "		call	LEE78		;issue command
EF01 : 1E 13		"  "		ld	e,013H		;128 + 256 * 19 = 4992 bytes
EF03 : 3E 60		">`"		ld	a,060H		;bit mask for status check
EF05 : 08		" "		ex	af,af'
EF06 : FD 6E 19		" n "		ld	l,(iy+019H)	;HL=DMA address
EF09 : FD 66 1A		" f "		ld	h,(iy+01AH)
EF0C : 3E F4		"> "		ld	a,0F4H		;write track
EF0E : 32 07 FF		"2  "		ld	(XFF07),a
EF11 : D3 E4		"  "		out	(FDCCMD),a
EF13 : DB E3		"  "		in	a,(FDBCTL)	;set FIFO for write
EF15 : F6 C0		"  "		or	0C0H
EF17 : D3 E3		"  "		out	(FDBCTL),a
EF19 : 01 E7 80		"   "		ld	bc,080E7h	;write 128 bytes 
EF1C : ED B3		"  "		otir
EF1E				LEF1E:
EF1E : 01 E7 00		"   "		ld	bc,00E7H	;write 256 bytes
EF21				LEF21:
EF21 : DB E2		"  "		in	a,(FDBSTAT)	;wait for OK to write to FIFO
EF23 : E6 08		"  "		and	008H
EF25 : 28 FA		"( "		jr	z,LEF21

EF27 : ED A3		"  "		outi			;output byte to fifo
EF29 : C2 21 EF		" ! "		jp	nz,LEF21	;repeat 256 times

EF2C : 1D		" "		dec	e		;repeat 19 times	
EF2D : C2 1E EF		"   "		jp	nz,LEF1E

EF30 : C3 8E EC		"   "		jp	LEC8E		;wait for finish, check status

				; dmpRam - dump RAM to user specified file.

EF33				dmpRam:
EF33 : 21 70 EF		"!p "		ld	hl,mDump		;"SAVE ADR,#SCTRS:"
EF36 : 31 B4 FF		"1  "		ld	sp,0FFB4H
EF39 : CD 98 EF		"   "		call	fillDCB
EF3C : FD 36 0F 12	" 6  "		ld	(iy+00FH),012H		;load write command
EF40				LEF40:
EF40 : 11 FF FF		"   "		ld	de,0FFFFH
EF43 : FD 46 1F		" F "		ld	b,(iy+01FH)
EF46 : FD 4E 1E		" N "		ld	c,(iy+01EH)
EF49 : 3E 01		"> "		ld	a,001H
EF4B : FD BE 1D		"   "		cp	(iy+01DH)
EF4E : 28 09		"( "		jr	z,LEF59
EF50 : CD 87 EF		"   "		call	LEF87
EF53 : FD 56 1F		" V "		ld	d,(iy+01FH)
EF56 : FD 5E 1E		" ^ "		ld	e,(iy+01EH)
EF59				LEF59:
EF59 : FD 73 22		" s""		ld	(iy+022H),e
EF5C : FD 72 23		" r#"		ld	(iy+023H),d
EF5F : FD 71 1E		" q "		ld	(iy+01EH),c
EF62 : FD 70 1F		" p "		ld	(iy+01FH),b
EF65 : CD 64 EC		" d "		call	dskDrv
EF68 : C2 1E EC		"   "		jp	nz,dskErr
EF6B : CD 81 EF		"   "		call	LEF81
EF6E : 18 D0		"  "		jr	LEF40
				;
EF70:				mDump	db	'SAVE ADR,#SCTRS:',03h

EF81 : FD 35 1D		":  "	LEF81:	dec	(iy+01DH)
EF84 : CA 1D E1		"   "		jp	z,LE11D			;exit to command loop

EF87				LEF87:
EF87 : FD 34 1E		" 4 "		inc	(iy+01EH)
EF8A : 3E 1B		"> "		ld	a,01BH
EF8C : FD BE 1E		"   "		cp	(iy+01EH)
EF8F : C0		" "		ret	nz
EF90 : FD 34 1F		" 4 "		inc	(iy+01FH)
EF93 : FD 36 1E 01	" 6  "		ld	(iy+01EH),001H
EF97 : C9		" "		ret

				; fillDCB - fill DCB with user input of unit, track sector

EF98				fillDCB:
EF98 : 1E 00		"  "		ld	e,000H
EF9A : CD C7 E3		"   "		call	dispMsg
EF9D : CD 14 E4		"   "		call	LE414		;read addr, possible num sectors
EFA0 : FD 21 60 FF	" !` "		ld	iy,0FF60H
EFA4 : 2A 14 FF		"*  "		ld	hl,(XFF14)
EFA7 : FD 75 19		" u "		ld	(iy+019H),l	;put address in DCB
EFAA : FD 74 1A		" t "		ld	(iy+01AH),h
EFAD : 3A 16 FF		":  "		ld	a,(XFF16)
EFB0 : FD 77 1D		" w "		ld	(iy+01DH),a	;num sectors to write

EFB3 : 21 D3 EF		"!  "		ld	hl,mUnit	;"UNIT,TRK,SCT:"
EFB6 : CD C7 E3		"   "		call	dispMsg
EFB9 : CD 14 E4		"   "		call	LE414		;read unit, track, sector
EFBC : FD 21 60 FF	" !` "		ld	iy,0FF60H
EFC0 : 3A 14 FF		":  "		ld	a,(XFF14)
EFC3 : FD 77 03		" w "		ld	(iy+003H),a	;unit to DCB
EFC6 : 3A 16 FF		":  "		ld	a,(XFF16)
EFC9 : FD 77 1F		" w "		ld	(iy+01FH),a	;track to DCB
EFCC : 3A 18 FF		":  "		ld	a,(XFF18)
EFCF : FD 77 1E		" w "		ld	(iy+01EH),a	;sector to DCB
EFD2 : C9		" "		ret

EFD3				mUnit:	db	'UNIT,TRK,SCT:',03H

EFE1 : CD 42 EC		":  "		call	LEC42
EFE4 : 28 0B		" ( "		jr	z,LEFF1
EFE6 : 21 30 EC		"!0 "		ld	hl,mDskErr
EFE9 : 1E 01		"  "		ld	e,001H
EFEB : CD C7 E3		"   "		call	dispMsg
EFEE : C3 51 E0		" Q "		jp	LE051
				;
EFF1 : 3E A5		"> "	LEFF1	ld	a,0A5H
EFF3 : D3 D9		"  "		out	(0D9H),a
EFF5 : AF		" "		xor	a
EFF6 : D3 D9		"  "		out	(0D9H),a
EFF8 : 31 AA FF		"1  "		ld	sp,0FFAAH
EFFB : 2A FE FF		"*  "		ld	hl,(XFFFE)
EFFE : E9		" "		jp	(hl)
				;
EFFF : 00		" "		nop

