source/page7D/initial.asm
author brandonlw
Tue, 20 May 2014 02:59:10 -0400
changeset 41 9ef17625274f
parent 29 1c4ed1f8d543
child 42 adad2f097dcb
permissions -rw-r--r--
Finished _newContext and other page 0 cleanup. Still lots left to go...

Page7D_2CA9:
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	p7Dsub_6FAC
		jp		c, relockFlashBack
		push	af
		call	p7Dsub_576D
		pop		af
		call	Page7D_2BE3
		jp		relockFlashBack

; =============== S U B	R O U T	I N E =======================================


DeleteApp:
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	p7Dsub_6FAC
		jp		c, relockFlashBack
		call	Page7D_2BE3
		jp		relockFlashBack
; End of function DeleteApp


; =============== S U B	R O U T	I N E =======================================


Page7D_2BE3:
		; DeleteApp+17p ...
		ld		b, a
		ld		hl, 4000h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		cp		0FFh
		ld		a, b
		jr		z, locret_4077
		call	FindAppNumPages
		ld		b, c
		push	af
		ld		a, c
		or		a
		jr		z, p7Dloc_4078
		res		6, (iy+24h)
		res		7, (iy+24h)
		xor		a
		ld		(unk_9C87), a
		pop		af

p7Dloc_4061:
		set		0, (iy+25h)
		push	af
		push	bc
		ld		de, 4000h
		ld		b, 0
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80C6h
; ---------------------------------------------------------------------------
		pop		bc
		pop		af
		dec		a
		djnz	p7Dloc_4061
		ld		(appSearchPage+1), a

locret_4077:
		ret
; ---------------------------------------------------------------------------

p7Dloc_4078:
		pop		af
		ret
; End of function Page7D_2BE3


; =============== S U B	R O U T	I N E =======================================


Page7D_2BAD:
		; p7Dsub_7CDA:p7Dloc_7D01p
		push	hl
		call	p7Dsub_4894
		call	p7Dsub_457C
		pop		hl
		ret
; End of function Page7D_2BAD


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4083:
		; p7Dsub_430E+2Ap
		call	p7Dsub_7700
		push	bc
		push	hl
		push	de
		push	af

p7Dloc_408A:
		pop		af
		push	hl
		push	bc
		push	af
		call	LoadAIndPaged_Copy
		ld		b, a
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		pop		af
		pop		bc
		pop		hl
		inc		hl
		push	af
		dec		bc
		ld		a, b
		or		c
		jr		nz, p7Dloc_408A
		pop		af
		pop		de
		pop		hl
		pop		bc
		ret
; End of function p7Dsub_4083


; =============== S U B	R O U T	I N E =======================================


p7Dsub_40A6:
		call	p7Dsub_7700
; End of function p7Dsub_40A6


p7Dloc_40A9:
		push	bc
		push	hl
		push	de
		push	af

p7Dloc_40AD:
		pop		af
		push	hl
		push	bc
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ld		b, a
		pop		af
		push	af
		ld		a, (OP2)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		pop		af
		pop		bc
		pop		hl
		inc		hl
		push	af
		dec		bc
		ld		a, b
		or		c
		jr		nz, p7Dloc_40AD
		pop		af
		pop		de
		pop		hl
		pop		bc
		ret

; =============== S U B	R O U T	I N E =======================================


Page7D_2B5F:
		ld		(unk_9C20), a
		push	de
		push	bc
		push	hl
		call	p7Dsub_4894
		call	p7Dsub_4566
		cp		0FFh
		jr		nz, p7Dloc_40E5
		ld		bc, 0
		ld		(OP6), bc
		jr		p7Dloc_4105
; ---------------------------------------------------------------------------

p7Dloc_40E5:
		ld		bc, 1
		ld		(OP6), bc
		push	hl
		call	p7Dsub_4574
		add		hl, bc
		call	p7Dsub_4574
		add		hl, bc
		pop		bc
		sbc		hl, bc
		push	hl
		pop		bc
		call	p7Dsub_4894
		ld		de, 4000h
		push	de
		push	bc
		call	p7Dsub_42DF

p7Dloc_4105:
		call	p7Dsub_4894
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8060h
; ---------------------------------------------------------------------------
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8057h
; ---------------------------------------------------------------------------
		push	hl
		push	hl
		call	Page7D_2BE9
		ex		de, hl
		pop		hl
		inc		de
		inc		hl

p7Dloc_4117:
		; Page7D_2B5F:p7Dloc_4178j
		call	p7Dsub_4566
		cp		0
		jr		z, p7Dloc_415C
		cp		0FFh
		jp		z, p7Dloc_417B
		push	hl
		push	bc
		push	hl
		call	p7Dsub_521D
		call	NZIf83Plus
		jr		nz, p7Dloc_4131
		call	p7Dsub_522B

p7Dloc_4131:
		push	hl
		pop		bc
		pop		hl
		sbc		hl, bc
		jr		nc, p7Dloc_417B
		pop		bc
		pop		hl
		push	hl
		ld		(arcInfo), de
		call	p7Dsub_4574
		pop		de
		push	de
		or		a
		sbc		hl, de
		ld		a, l
		add		a, c
		ld		c, a
		jr		nc, p7Dloc_414D
		inc		b

p7Dloc_414D:
		pop		hl
		ld		de, (arcInfo)
		call	p7Dsub_4083
		add		hl, bc
		ex		de, hl
		add		hl, bc
		ex		de, hl
		jp		p7Dloc_4117
; ---------------------------------------------------------------------------

p7Dloc_415C:
		push	de
		call	p7Dsub_4574
		pop		de
		add		hl, bc
		call	p7Dsub_4566
		cp		2
		jr		nz, p7Dloc_4178
		push	de
		push	hl
		call	p7Dsub_4574
		pop		de
		sbc		hl, de
		adc	hl, bc
		push	hl
		pop		bc
		ex		de, hl
		pop		de
		add		hl, bc

p7Dloc_4178:
		jp		p7Dloc_4117
; ---------------------------------------------------------------------------

p7Dloc_417B:
		; Page7D_2B5F+6Aj
		call	NZIf83Plus
		jr		nz, p7Dloc_41DF
		ld		a, (unk_9C20)
		or		a
		jr		z, p7Dloc_41DF
		cp		1
		jr		z, p7Dloc_41A4
		cp		3
		jr		z, p7Dloc_41B2
		cp		4
		jr		z, p7Dloc_41C0
		cp		5
		jr		z, p7Dloc_41D1
		call	p7Dsub_427F
		call	p7Dsub_4211
		call	p7Dsub_425E
		call	p7Dsub_4228
		jr		p7Dloc_41E2
; ---------------------------------------------------------------------------

p7Dloc_41A4:
		call	p7Dsub_4261
		call	p7Dsub_4211
		call	p7Dsub_427C
		call	p7Dsub_4230
		jr		p7Dloc_41E2
; ---------------------------------------------------------------------------

p7Dloc_41B2:
		call	p7Dsub_4214
		call	p7Dsub_425E
		call	p7Dsub_427C
		call	p7Dsub_4238
		jr		p7Dloc_41E2
; ---------------------------------------------------------------------------

p7Dloc_41C0:
		call	p7Dsub_4214
		call	p7Dsub_42A2
		call	p7Dsub_4269
		call	p7Dsub_428F
		call	p7Dsub_4238
		jr		p7Dloc_41E2
; ---------------------------------------------------------------------------

p7Dloc_41D1:
		call	p7Dsub_42A2
		call	p7Dsub_425E
		call	p7Dsub_428F
		call	p7Dsub_4211
		jr		p7Dloc_41E2
; ---------------------------------------------------------------------------

p7Dloc_41DF:
		; Page7D_2B5F+B8j
		call	p7Dsub_427F

p7Dloc_41E2:
		; Page7D_2B5F+E4j ...
		call	p7Dsub_4894
		ex		de, hl
		ld		b, 8Fh ; '�'
		call	p7Dsub_456D
		pop		hl
		ex		de, hl
		call	p7Dsub_4894
		ex		de, hl
		push	de
		call	p7Dsub_457C
		pop		de
		ld		b, 0
		call	p7Dsub_456D
		ld		bc, (OP6)
		ld		a, c
		cp		1
		jr		nz, p7Dloc_420D
		call	p7Dsub_4894
		ex		de, hl
		pop		bc
		pop		hl
		call	p7Dsub_42AE

p7Dloc_420D:
		pop		hl
		pop		bc
		pop		de
		ret
; End of function Page7D_2B5F


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4211:
		; Page7D_2B5F+DBp ...
		call	p7Dsub_4243
; End of function p7Dsub_4211


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4214:
		; Page7D_2B5F:p7Dloc_41C0p
		call	p7Dsub_522B
		ld		bc, 66h	; 'f'

p7Dloc_421A:
		ld		de, tempSwapArea

p7Dloc_421D:
		call	Page7D_2BE9
		ex		de, hl
		call	p7Dsub_7700
		call	p7Dsub_7666
		ret
; End of function p7Dsub_4214


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4228:
		call	p7Dsub_521D
		ld		bc, 0E8h ; '�'
		jr		p7Dloc_423E
; End of function p7Dsub_4228


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4230:
		call	p7Dsub_5236
		ld		bc, 0C8h ; '�'
		jr		p7Dloc_423E
; End of function p7Dsub_4230


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4238:
		; Page7D_2B5F+100p
		call	p7Dsub_522B
		ld		bc, 66h	; 'f'

p7Dloc_423E:
		call	Page7D_2BE9
		jr		p7Dloc_4249
; End of function p7Dsub_4238


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4243:
		call	p7Dsub_522B
		ld		bc, 66h	; 'f'

p7Dloc_4249:
		ld		de, tempSwapArea
; End of function p7Dsub_4243


; =============== S U B	R O U T	I N E =======================================


p7Dsub_424C:
		call	p7Dsub_7700
		call	FlashToRam
		ret
; End of function p7Dsub_424C


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4253:
		; Page7D_2B83+1Ep
		call	Page7D_2B7D
		ld		bc, 20h	; ' '
		ld		de, 836Dh
		jr		p7Dsub_424C
; End of function p7Dsub_4253


; =============== S U B	R O U T	I N E =======================================


p7Dsub_425E:
		; Page7D_2B5F+E9p ...
		call	p7Dsub_4274
; End of function p7Dsub_425E


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4261:
		call	p7Dsub_5236
		ld		bc, 0C8h ; '�'
		jr		p7Dloc_421A
; End of function p7Dsub_4261


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4269:
		call	p7Dsub_5236
		ld		bc, 0C8h ; '�'
		ld		de, ramStart
		jr		p7Dloc_421D
; End of function p7Dsub_4269


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4274:
		; Page7D_2B83:p7Dloc_47D1p
		call	p7Dsub_5236
		ld		bc, 0C8h ; '�'
		jr		p7Dloc_4249
; End of function p7Dsub_4274


; =============== S U B	R O U T	I N E =======================================


p7Dsub_427C:
		; Page7D_2B5F+ECp
		call	p7Dsub_4287
; End of function p7Dsub_427C


; =============== S U B	R O U T	I N E =======================================


p7Dsub_427F:
		; Page7D_2B5F:p7Dloc_41DFp
		call	p7Dsub_521D
		ld		bc, 0E8h ; '�'
		jr		p7Dloc_421A
; End of function p7Dsub_427F


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4287:
		; Page7D_2B83:p7Dloc_47D9p
		call	p7Dsub_521D
		ld		bc, 0E8h ; '�'
		jr		p7Dloc_4249
; End of function p7Dsub_4287


; =============== S U B	R O U T	I N E =======================================


p7Dsub_428F:
		; Page7D_2B5F+10Bp
		call	p7Dsub_429A
		call	p7Dsub_521D
		ld		bc, 0C8h ; '�'
		jr		p7Dloc_421A
; End of function p7Dsub_428F


; =============== S U B	R O U T	I N E =======================================


p7Dsub_429A:
		call	p7Dsub_521D
		ld		bc, 0C8h ; '�'
		jr		p7Dloc_4249
; End of function p7Dsub_429A


; =============== S U B	R O U T	I N E =======================================


p7Dsub_42A2:
		; Page7D_2B5F:p7Dloc_41D1p
		call	p7Dsub_523C
		ld		bc, 20h	; ' '
		ld		de, 836Dh
		jp		p7Dloc_421D
; End of function p7Dsub_42A2


; =============== S U B	R O U T	I N E =======================================


p7Dsub_42AE:
		; p7Dsub_42AE+23j	...
		push	bc
		push	hl
		push	de
		call	FindSwapSector
		inc		a
		ld		de, OP1
		ld		bc, 1
		call	FlashToRam
		pop		de
		push	de
		ld		hl, OP1
		call	p7Dsub_7700
		call	p7Dsub_7663
		pop		de
		pop		hl
		inc		hl
		inc		de
		pop		bc
		dec		bc
		ld		a, c
		or		b
		jr		nz, p7Dsub_42AE
; End of function p7Dsub_42AE


; =============== S U B	R O U T	I N E =======================================


p7Dsub_42D3:
		call	FindSwapSector
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8084h
; ---------------------------------------------------------------------------
		pop		af
		call	Page7D_2C3D
		ret
; End of function p7Dsub_42D3


; =============== S U B	R O U T	I N E =======================================


p7Dsub_42DF:
		; p7Dsub_468A+19p
		push	bc
		push	hl
		push	de
		call	p7Dsub_42D3
		pop		de
		pop		hl
		pop		bc

p7Dloc_42E8:
		push	bc
		push	hl
		push	de
		ld		de, OP1
		ld		bc, 1
		call	p7Dsub_424C
		pop		de
		push	de
		ld		hl, OP1
		call	FindSwapSector
		inc		a
		ld		bc, 1
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		pop		de
		pop		hl
		inc		hl
		inc		de
		pop		bc
		dec		bc
		ld		a, c
		or		b
		jr		nz, p7Dloc_42E8
		ret
; End of function p7Dsub_42DF


; =============== S U B	R O U T	I N E =======================================


p7Dsub_430E:
		push	bc
		push	de
		ld		a, 2
		call	Page7D_2B5F
		rst		28h
; ---------------------------------------------------------------------------
		.dw		802Dh
; ---------------------------------------------------------------------------
		push	hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8057h
; ---------------------------------------------------------------------------
		ld		de, 1F18h
		call	NZIf83Plus
		jr		nz, p7Dloc_4327
		ld		de, 1DEAh

p7Dloc_4327:
		add		hl, de
		pop		de
		or		a
		sbc		hl, de
		jr		c, p7Dloc_433D
		sbc		hl, bc
		jr		c, p7Dloc_433D
		rst		28h
; ---------------------------------------------------------------------------
		.dw		802Dh
; ---------------------------------------------------------------------------
		pop		de
		ex		de, hl
		pop		bc
		call	p7Dsub_4083
		xor		a
		ret
; ---------------------------------------------------------------------------

p7Dloc_433D:
		pop		de
		pop		de
		ret
; End of function p7Dsub_430E

; ---------------------------------------------------------------------------

Page7D_2BCB:
		push	hl
		call	p7Dsub_4894
		call	p7Dsub_4574
		push	bc
		push	hl
		call	p7Dsub_4894
		push	hl
		pop		bc
		pop		hl
		sbc		hl, bc
		push	hl
		pop		bc
		pop		hl
		adc	hl, bc
		push	hl
		pop		bc
		call	p7Dsub_4894
		rst		28h
; ---------------------------------------------------------------------------
		.dw		808Dh
; ---------------------------------------------------------------------------

p7Dloc_435E:
		push	hl
		push	bc
		ld		bc, 1
		ld		de, tempSwapArea
		call	p7Dsub_424C
		ld		bc, 1
		ld		hl, tempSwapArea
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8090h
; ---------------------------------------------------------------------------
		pop		bc
		pop		hl
		inc		hl
		dec		bc
		ld		a, b
		or		c
		jr		nz, p7Dloc_435E
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8018h
; ---------------------------------------------------------------------------
		call	p7Dsub_4894
		call	p7Dsub_7700
		call	p7Dsub_55CE
		jp		nz, p7Dloc_43EC
		ld		hl, tempSwapArea
		push	af
		push	bc
		push	de
		push	hl
		call	p7Dsub_4894
		inc		hl
		call	p7Dsub_4566
		and		0F0h ; '�'
		ld		hl, 310h
		cp		l
		jr		nz, p7Dloc_43B9
		call	p7Dsub_7700
		call	p7Dsub_762A
		call	p7Dsub_4442
		jr		nz, p7Dloc_43DA
		adc	hl, bc
		call	p7Dsub_7700
		ld		de, 830h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_43DA
		jr		p7Dloc_43CF
; ---------------------------------------------------------------------------

p7Dloc_43B9:
		ld		hl, 320h
		cp		l
		jr		nz, p7Dloc_43C4
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80CCh
; ---------------------------------------------------------------------------
		jr		p7Dloc_43DA
; ---------------------------------------------------------------------------

p7Dloc_43C4:
		ld		de, 0A20h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_43DA
		call	p7Dsub_4574

p7Dloc_43CF:
		dec		hl
		inc		bc
		call	p7Dsub_7700
		ld		de, ramStart
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------

p7Dloc_43DA:
		pop		hl
		pop		de
		pop		bc
		pop		af
		rst		28h
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_4442
		.dw		801Bh
; ---------------------------------------------------------------------------
		ld		de, OP1
		ld		hl, 8291h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		801Eh
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_43F4

p7Dloc_43EC:
		push	af
		call	p7Dsub_4894
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8060h
; ---------------------------------------------------------------------------
		pop		af

p7Dloc_43F4:
		pop		hl
		ret
; END OF FUNCTION CHUNK	FOR p7Dsub_4442

; =============== S U B	R O U T	I N E =======================================


p7Dsub_43F6:
		push	af
		call	p7Dsub_5525
		jr		nz, P1orAret
		push	af
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		add		hl, bc
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ld		(unk_83E6), a
		inc		hl
		pop		af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ld		(unk_83E7), a
		pop		af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		809Fh
; ---------------------------------------------------------------------------
		ld		hl, tempSwapArea
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80A2h
; ---------------------------------------------------------------------------
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80A5h
; ---------------------------------------------------------------------------
		ld		de, MD5Buffer
		ld		hl, OP1
		rst		28h
; ---------------------------------------------------------------------------
		.dw		801Eh
; ---------------------------------------------------------------------------
		ret
; ---------------------------------------------------------------------------

P1orAret:
		pop		af
		or		a
		ret
; End of function p7Dsub_43F6

; ---------------------------------------------------------------------------

p7Dloc_442C:
		push	hl
		push	af
		ld		c, a
		ld		de, 400h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Dh
; ---------------------------------------------------------------------------
		jr		nz, locret_4441
		inc		hl
		ld		a, c
		push	de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		pop		de
		ex		de, hl
		pop		af
		pop		hl

locret_4441:
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_4442:



		push	hl
		push	bc
		call	p7Dsub_70D1
		ld		de, 800h
		call	p7Dsub_777E
		call	p7Dsub_4574
		pop		bc
		pop		de

p7Dloc_4452:
		push	de
		push	bc
		push	bc
		push	de
		ld		de, 810h
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		pop		de
		ld		a, c
		pop		bc
		jr		nz, p7Dloc_4489
		cp		c
		push	hl
		ld		c, a
		ld		b, 0
		push	bc
		jr		nz, p7Dloc_4482
		ld		b, c

p7Dloc_446D:
		call	p7Dsub_7700
		call	p7Dsub_4C73
		jr		nz, p7Dloc_4482
		inc		de
		inc		hl
		djnz	p7Dloc_446D
		pop		bc
		pop		hl
		pop		bc
		pop		de
		ld		a, 0
		bit		7, a
		ret
; ---------------------------------------------------------------------------

p7Dloc_4482:
		pop		bc
		pop		hl
		add		hl, bc
		pop		bc
		pop		de
		jr		p7Dloc_4452
; ---------------------------------------------------------------------------

p7Dloc_4489:
		pop		bc
		pop		de
		ld		a, 0FFh
		bit		7, a
		ret
; End of function p7Dsub_4442


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4490:
		push	hl
		push	bc
		call	p7Dsub_4442
		pop		bc
		pop		hl
		ret
; End of function p7Dsub_4490


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4498:
		call	p7Dsub_7700
		call	p7Dsub_4894
		call	p7Dsub_7700
		call	p7Dsub_4873
		call	p7Dsub_70D1
		jr		nz, p7Dloc_44B8
		call	p7Dsub_7700
		push	bc
		call	p7Dsub_4873
		push	bc
		pop		hl
		pop		bc
		or		a
		sbc		hl, bc
		jr		nc, p7Dloc_44BE

p7Dloc_44B8:
		ld		a, 0
		bit		7, a
		jr		locret_44C2
; ---------------------------------------------------------------------------

p7Dloc_44BE:
		ld		a, 0FFh
		bit		7, a

locret_44C2:
		ret
; End of function p7Dsub_4498

; ---------------------------------------------------------------------------

p7Dloc_44C3:
		call	p7Dsub_4894
		call	p7Dsub_7700
		call	p7Dloc_442C
		push	de
		push	bc
		ld		de, 0A10h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		push	de
		call	p7Dsub_4574
		pop		de
		ld		a, c
		pop		bc
		cp		c
		jr		nz, p7Dloc_44F7
		ex		de, hl
		pop		hl
		ld		b, c

p7Dloc_44E1:
		ex		de, hl
		call	p7Dsub_4566
		ld		c, a
		ex		de, hl
		call	p7Dsub_4566
		cp		c
		jr		nz, locret_44F8
		dec		b
		ld		a, b
		cp		0
		jr		z, locret_44F8
		inc		hl
		inc		de
		jr		p7Dloc_44E1
; ---------------------------------------------------------------------------

p7Dloc_44F7:
		pop		bc

locret_44F8:
		ret
; ---------------------------------------------------------------------------

Page7D_2BFB:
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	p7Dsub_7700
		call	p7Dsub_4894
		call	p7Dsub_4574
		call	p7Dsub_7700
		call	p7Dsub_50C5
		jr		nz, p7Dloc_4530
		ld		de, 320h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_4529
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		802Ah
; ---------------------------------------------------------------------------

p7Dloc_4529:
		call	p7Dsub_4894
		call	p7Dsub_5083
		xor		a

p7Dloc_4530:
		jp		relockFlashBack

; =============== S U B	R O U T	I N E =======================================


p7Dsub_4533:
		call	Page7D_2B7D
		call	p7Dsub_4566
		ld		(unk_8439+1), a
		inc		hl
		call	p7Dsub_4566
		ld		(unk_843B), a
		call	NZIf83Plus
		ret		nz
		inc		hl
		call	p7Dsub_7700
		ld		bc, 0Bh
		ld		de, 9C9Eh
		call	FlashToRam
		ld		hl, 9CA8h
		ld		a, 0FEh	; '�'
		or		(hl)
		ld		(hl), a
		ret
; End of function p7Dsub_4533


; =============== S U B	R O U T	I N E =======================================


p7Dsub_455C:
		call	p7Dsub_4565
		ld		e, a
		call	p7Dsub_4565
		ld		d, a
		ret
; End of function p7Dsub_455C


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4565:
		inc		hl
; End of function p7Dsub_4565


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4566:
		; Page7D_2B5F:p7Dloc_4117p ...
		call	p7Dsub_7700
		call	LoadAIndPaged_Copy
		ret
; End of function p7Dsub_4566


; =============== S U B	R O U T	I N E =======================================


p7Dsub_456D:
		; Page7D_2B5F+12Cp ...
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		ret
; End of function p7Dsub_456D


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4574:
		; Page7D_2B5F+25p ...
		inc		hl

p7Dloc_4575:
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ret
; End of function p7Dsub_4574


; =============== S U B	R O U T	I N E =======================================


p7Dsub_457C:
		; Page7D_2B5F+126p ...
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8024h
; ---------------------------------------------------------------------------
		ret
; End of function p7Dsub_457C

; ---------------------------------------------------------------------------

Page7D_2BD1:
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		push	bc
		push	de
		push	hl
		push	ix
		call	p7Dsub_4533
		call	p7Dloc_44C3
		jr		nz, p7Dloc_45D9
		call	p7Dsub_4498
		jr		nz, p7Dloc_45D9
		call	p7Dsub_50A8

p7Dloc_45A9:
		call	p7Dsub_4C8B
		res		6, (iy+24h)
		xor		a
		ld		(unk_9C87), a
		call	p7Dsub_70D1
		ld		bc, 0
		jr		nz, p7Dloc_45BF
		rst		28h
; ---------------------------------------------------------------------------
		.dw		802Ah
; ---------------------------------------------------------------------------

p7Dloc_45BF:
		call	p7Dsub_468A
		call	p7Dsub_70D1
		call	p7Dsub_45E4
		ld		a, 0
		bit		7, a

p7Dloc_45CC:
		push	af
		call	p7Dsub_4926
		pop		af
		pop		ix
		pop		hl
		pop		de
		pop		bc
		jp		relockFlashBack
; ---------------------------------------------------------------------------

p7Dloc_45D9:
		call	p7Dsub_4894
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8060h
; ---------------------------------------------------------------------------
		ld		a, 0FFh
		or		a
		jr		p7Dloc_45CC

; =============== S U B	R O U T	I N E =======================================


p7Dsub_45E4:
		push	bc
		push	de
		ld		a, (unk_8439+1)
		ld		b, a
		call	Page7D_2B7D
		ex		de, hl
		call	p7Dsub_456D
		ld		a, (unk_843B)
		ld		b, a
		call	p7Dsub_456D
		call	NZIf83Plus
		jr		nz, p7Dloc_4609
		call	p7Dsub_7700
		ld		bc, 0Bh
		ld		hl, 9C9Eh
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------

p7Dloc_4609:
		call	p7Dsub_70D1
		jr		nz, p7Dloc_464B
		call	p7Dsub_464E
		call	p7Dsub_4574
		add		hl, bc
		call	p7Dsub_70D1
		ld		de, 800h
		call	p7Dsub_777E
		call	p7Dsub_4574

p7Dloc_4621:
		ld		de, 810h
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_464B
		push	hl
		push	bc
		ld		b, c
		ld		(OP2), bc
		ld		b, 0
		call	p7Dsub_7700
		ld		de, 8484h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8066h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_4646
		call	p7Dsub_464E

p7Dloc_4646:
		pop		bc
		pop		hl
		add		hl, bc
		jr		p7Dloc_4621
; ---------------------------------------------------------------------------

p7Dloc_464B:
		pop		de
		pop		bc
		ret
; End of function p7Dsub_45E4


; =============== S U B	R O U T	I N E =======================================


p7Dsub_464E:
		push	af
		push	bc
		push	de
		push	hl
		push	ix
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8099h
; ---------------------------------------------------------------------------
		ld		de, 700h
		call	p7Dsub_777E
		call	p7Dsub_4574

p7Dloc_4660:
		ld		de, 710h
		call	p7Dsub_705E
		jr		nz, p7Dloc_4683
		call	p7Dsub_4574
		push	bc
		push	hl
		call	p7Dsub_7700
		ld		de, 838Fh
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80A8h
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_467E
		call	p7Dsub_51C3

p7Dloc_467E:
		pop		hl
		pop		bc
		add		hl, bc
		jr		p7Dloc_4660
; ---------------------------------------------------------------------------

p7Dloc_4683:
		pop		ix
		pop		hl
		pop		de
		pop		bc
		pop		af
		ret
; End of function p7Dsub_464E


; =============== S U B	R O U T	I N E =======================================


p7Dsub_468A:

		call	p7Dsub_4894
		push	hl
		call	p7Dsub_4574
		add		hl, bc
		call	p7Dsub_4574
		add		hl, bc
		pop		bc
		push	bc
		or		a
		sbc		hl, bc
		push	hl
		pop		bc
		pop		hl
		push	bc
		push	hl
		ld		de, 4000h
		call	p7Dsub_42DF
		pop		hl
		push	hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8060h
; ---------------------------------------------------------------------------
		pop		de
		pop		bc
		ld		hl, 4000h
		push	bc
		call	p7Dsub_42AE
		call	p7Dsub_4894
		pop		bc
		ex		de, hl
		ld		a, d
		xor		20h ; ' '
		ld		d, a
		call	p7Dsub_430E
		ret		z
; End of function p7Dsub_468A

; START	OF FUNCTION CHUNK FOR p7Dsub_5083

p7Dloc_46C1:
		call	relockFlashBack
		jp		JErrorNo
; END OF FUNCTION CHUNK	FOR p7Dsub_5083
; ---------------------------------------------------------------------------

p7Dloc_46C7:
		push	de
		push	bc
		call	p7Dsub_762A
		ld		(OP2), bc
		ld		de, 8484h
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8066h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_4715
		push	hl
		ld		de, 100h
		call	p7Dsub_777E
		jr		nz, p7Dloc_4714
		call	p7Dsub_4574
		push	hl
		call	p7Dsub_4894
		ld		de, 100h
		call	p7Dsub_777E
		call	p7Dsub_4574
		pop		de
		ex		de, hl
		call	p7Dsub_7700
		call	p7Dsub_5CFF
		call	p7Dsub_5D1E
		ex		de, hl
		call	p7Dsub_7700
		call	p7Dsub_5CFF
		call	p7Dsub_5D43
		ex		de, hl
		or		a
		sbc		hl, bc
		ld		a, 0
		bit		7, a

p7Dloc_4714:
		pop		hl

p7Dloc_4715:
		pop		bc
		pop		de
		ret
; ---------------------------------------------------------------------------

Page7D_2C01:
		push	bc
		push	de
		push	hl
		call	p7Dsub_7634
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		call	p7Dsub_4490
		jp		nz, p7Dloc_47A5
		call	p7Dloc_46C7
		jr		nz, p7Dloc_4746
		jp		nc, p7Dloc_47A5
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8066h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_4746
		call	p7Dsub_50A8
		call	p7Dloc_46C7
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8066h
; ---------------------------------------------------------------------------
		call	p7Dsub_47E3
		rst		28h
; ---------------------------------------------------------------------------
		.dw		802Ah
; ---------------------------------------------------------------------------
		jr		p7Dloc_474C
; ---------------------------------------------------------------------------

p7Dloc_4746:
		call	p7Dsub_50A8
		call	p7Dsub_5124

p7Dloc_474C:
		ld		de, 836Dh
		call	Page7D_2B7D
		ld		bc, 20h	; ' '
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		call	p7Dsub_521D
		ld		bc, 0Dh
		sla	c
		call	p7Dsub_7700
		ld		de, tempSwapArea
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		call	p7Dsub_762A
		ld		(appID), bc
		ld		de, 838Eh
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		call	p7Dsub_468A
		ld		bc, (appID)
		ld		b, 0
		ld		(OP2), bc
		ld		hl, 838Eh
		ld		de, 8484h
		ldir
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8066h
; ---------------------------------------------------------------------------
		call	p7Dsub_45E4
		call	p7Dsub_4894
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8060h
; ---------------------------------------------------------------------------

p7Dloc_479D:
		call	p7Dsub_4926
		pop		hl
		pop		de
		pop		bc
		xor		a
		ret
; ---------------------------------------------------------------------------

p7Dloc_47A5:
		call	p7Dsub_4894
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8060h
; ---------------------------------------------------------------------------
		call	p7Dsub_4926
		pop		hl
		pop		de
		pop		bc
		ld		a, 0FFh
		or		a
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_47B5:
		xor		a
; End of function p7Dsub_47B5


; =============== S U B	R O U T	I N E =======================================


Page7D_2B83:
		push	af
		push	bc
		push	de
		push	hl
		push	ix
		call	NZIf83Plus
		jr		nz, p7Dloc_47D9
		cp		1
		jr		z, p7Dloc_47D1
		cp		3
		jr		nz, p7Dloc_47D9
		call	p7Dsub_4243
		call	p7Dsub_4253
		jr		p7Dloc_47DC
; ---------------------------------------------------------------------------

p7Dloc_47D1:
		call	p7Dsub_4274
		call	p7Dsub_4253
		jr		p7Dloc_47DC
; ---------------------------------------------------------------------------

p7Dloc_47D9:
		; Page7D_2B83+11j
		call	p7Dsub_4287

p7Dloc_47DC:
		; Page7D_2B83+21j
		pop		ix
		pop		hl
		pop		de
		pop		bc
		pop		af
		ret
; End of function Page7D_2B83


; =============== S U B	R O U T	I N E =======================================


p7Dsub_47E3:
		push	hl
		push	bc
		push	de
		push	af
		call	p7Dsub_47B5
		ld		de, 700h
		call	p7Dsub_777E
		call	p7Dsub_4574
		push	hl
		call	p7Dsub_4894
		ld		de, 700h
		call	p7Dsub_777E
		call	p7Dsub_4574
		pop		de
		push	hl
		push	de
		call	p7Dsub_762A
		push	hl
		push	bc
		call	p7Dsub_484E
		inc		ix
		pop		bc
		pop		hl
		push	ix
		call	p7Dsub_4442
		add		hl, bc
		call	p7Dsub_7700
		ld		de, 810h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_4825
		call	p7Dsub_484E
		jr		p7Dloc_483E
; ---------------------------------------------------------------------------

p7Dloc_4825:
		ld		hl, appID
		ld		a, 0FFh
		ld		b, 5

p7Dloc_482C:
		ld		(hl), a
		inc		hl
		djnz	p7Dloc_482C
		ld		hl, OP6
		ld		(hl), 1
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8069h
; ---------------------------------------------------------------------------
		call	p7Dsub_764E
		push	hl
		pop		ix

p7Dloc_483E:
		push	ix
		pop		bc
		pop		ix
		pop		hl
		pop		de
		push	bc
		call	p7Dsub_4D5E
		inc		ix
		jp		p7Dloc_5156
; End of function p7Dsub_47E3


; =============== S U B	R O U T	I N E =======================================


p7Dsub_484E:
		ld		d, c
		set		4, d
		ld		e, 7
		ld		(appID), de
		ld		de, 838Fh
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		ld		hl, OP6
		ld		(hl), 1
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8069h
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_486C
		dec		ix

p7Dloc_486C:
		call	p7Dsub_764E
		push	hl
		pop		ix
		ret
; End of function p7Dsub_484E


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4873:
		push	hl
		push	af
		push	de
		push	af
		ld		de, 100h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Dh
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_488F
		pop		af
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		call	p7Dsub_7700
		call	p7Dsub_5CFF
		call	p7Dsub_5D43
		jr		p7Dloc_4890
; ---------------------------------------------------------------------------

p7Dloc_488F:
		pop		af

p7Dloc_4890:
		pop		de
		pop		af
		pop		hl
		ret
; End of function p7Dsub_4873


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4894:
		; Page7D_2B5F+6p ...
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8057h
; End of function p7Dsub_4894


; =============== S U B	R O U T	I N E =======================================


Page7D_2BE9:
		; p7Dsub_4214:p7Dloc_421Dp ...
		push	af
		ld		a, h
		xor		20h ; ' '
		ld		h, a
		pop		af
		ret
; End of function Page7D_2BE9

; ---------------------------------------------------------------------------

Page7D_2CA3:
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	p7Dsub_48B5
		jp		relockFlashBack

; =============== S U B	R O U T	I N E =======================================


p7Dsub_48B5:
		call	Page7D_2B65
		call	p7Dsub_48BC
		ret
; End of function p7Dsub_48B5


; =============== S U B	R O U T	I N E =======================================


p7Dsub_48BC:
		push	ix
		push	hl
		push	de
		push	bc
		push	hl
		push	bc
		push	ix
		pop		hl
		ld		bc, 0C9h ; '�'
		or		a
		sbc		hl, bc
		jp		nc, Page0Call_2541
		add		hl, bc
		ld		bc, 0
		or		a
		sbc		hl, bc
		jp		m, Page0Call_2541
		pop		bc
		pop		hl
		jp		p7Dloc_48EB
; End of function p7Dsub_48BC


; =============== S U B	R O U T	I N E =======================================


p7Dsub_48DE:
		push	ix
		push	hl
		push	de
		push	bc
		call	p7Dsub_521D
		ld		bc, 0Dh
		add		ix, bc

p7Dloc_48EB:
		push	ix
		pop		bc
		sla	c
		add		hl, bc
		call	p7Dsub_4566
		cp		80h
		scf
		jr		z, p7Dloc_4902
		cp		0
		jr		nz, p7Dloc_4902
		call	p7Dsub_4565
		cp		0
p7Dloc_4902:
		pop		bc
		pop		de
		pop		hl
		pop		ix
		ret

SetExecutionPermissionsAndDeleteOldApps:
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	GetFirstInvalidAppPageToB
		ld		a, b
		b_call(_SetFlashLowerBound)
		call	p7Dsub_4926
		jp		relockFlashBack

p7Dsub_4926:
		push	af
		push	bc
		push	hl
		push	de
		push	ix
		ld		a, 0
		ld		(ioFlag), a
		call	p7Dsub_4AC9
		jr		nz, p7Dloc_4939
		call	p7Dloc_4B82
p7Dloc_4939:
		call	p7Dsub_4A5A
		ld		a, (ioFlag)
		cp		0
		jr		z, p7Dloc_498B
		ld		hl, aHaveExpired_
		ld		a, 4Dh
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	p7Dsub_7045
		call	j_newline
		ld		hl, aDeleting___
		ld		a, 4Eh
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	p7Dsub_7045
		call	j_newline
		call	forceSlowSpeed
		ld		b, 5

p7Dloc_496C:
		ld		c, b
		ld		b, 0FFh

p7Dloc_496F:
		ld		a, 0FFh

p7Dloc_4971:
		call	page0_AC4
		dec		a
		jr		nz, p7Dloc_4971
		djnz	p7Dloc_496F
		ld		b, c
		djnz	p7Dloc_496C
		call	restorePreviousSpeed
		call	Page0Call_2E65
		ld		hl, 0
		ld		(curRow), hl
		call	Page0Call_3D05
p7Dloc_498B:
		pop		ix
		pop		de
		pop		hl
		pop		bc
		pop		af
		ret

p7Dsub_4992:
		push	af
		push	bc
		push	de
		push	hl
		call	p7Dsub_4565
		push	af
		and		0F0h ; '�'
		ld		c, a
		pop		af
		xor		c
		ld		(appID), a
		inc		hl
		ld		c, a
		ld		b, 0
		call	p7Dsub_7700
		ld		de, 838Eh
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		call	p7Dsub_6021
		jr		c, p7Dloc_49B7
		call	Page7D_2BE3

p7Dloc_49B7:
		pop		hl
		pop		de
		pop		bc
		pop		af
		ret
; End of function p7Dsub_4992

; ---------------------------------------------------------------------------

p7Dloc_49BC:
		push	bc
		push	af
		call	p7Dsub_4A21
		jr		nz, p7Dloc_49D5
		pop		af
		call	CopyFlashPage
		pop		bc
		push	af
		ld		a, 0
		dec		c
		or		c
		jr		z, p7Dloc_49D3
		pop		af
		inc		a
		jr		p7Dloc_49BC
; ---------------------------------------------------------------------------

p7Dloc_49D3:
		pop		af
		ret
; ---------------------------------------------------------------------------

p7Dloc_49D5:
		pop		bc
		pop		bc
		ret

; =============== S U B	R O U T	I N E =======================================


CopyFlashPage:
		push	hl
		ld		hl, 4000h
		push	af
		call	LoadAIndPaged_Copy
		cp		0FFh
		jr		z, p7Dloc_4A1E
		pop		af
		push	af
		cp		7Eh ; '~'
		jr		z, p7Dloc_4A1E
		cp		7Fh ; ''
		jr		z, p7Dloc_4A1E
		ld		a, b
		cp		7Eh ; '~'
		jr		z, p7Dloc_4A1E
		cp		7Fh ; ''
		jr		z, p7Dloc_4A1E
		pop		af

p7Dloc_49F8:
		push	bc
		ld		bc, 100h
		ld		de, ramStart
		push	hl
		push	de
		push	af
		call	FlashToRam
		pop		af
		pop		de
		pop		hl
		pop		bc
		push	af
		ld		a, b
		ld		bc, 100h
		ex		de, hl
		push	af
		call	p7Dsub_7666
		pop		af
		ex		de, hl
		ld		b, a
		ld		a, 80h ; '�'
		cp		h
		jr		z, p7Dloc_4A1E
		pop		af
		jr		p7Dloc_49F8
; ---------------------------------------------------------------------------

p7Dloc_4A1E:
		; CopyFlashPage+10j ...
		pop		af
		pop		hl
		ret
; End of function CopyFlashPage


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4A21:
		push	hl
		ld		a, 8
		ld		hl, 4000h

p7Dloc_4A27:
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		cp		0FEh ; '�'
		jr		z, p7Dloc_4A3C
		pop		af
		inc		a
		call	p7Dsub_75E1
		jr		nz, p7Dloc_4A27
		ld		a, 0FFh
		bit		7, a
		pop		hl
		ret
; ---------------------------------------------------------------------------

p7Dloc_4A3C:
		pop		bc
		pop		hl
		ret
; End of function p7Dsub_4A21


; =============== S U B	R O U T	I N E =======================================


FindAppNumPages:
		push	hl
		push	af
		ld		hl, 4000h
		ld		de, 8080h
		or		a
		rst		28h
		.dw		80ABh
		ld		c, 0
		jr		nz, p7Dloc_4A57
		inc		hl
		inc		hl
		pop		af
		push	af
		rst		28h
		.dw		8051h
		ld		c, a
p7Dloc_4A57:
		pop		af
		pop		hl
		ret

p7Dsub_4A5A:
		call	p7Dsub_7643
		ld		b, c
		call	GetAppSpaceStartToA

p7Dloc_4A61:
		push	af
		ld		hl, 4000h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		cp		0FFh
		jr		z, p7Dloc_4A77
		cp		0
		jr		z, p7Dloc_4A77
		cp		80h ; '�'
		jr		nz, p7Dloc_4A77
		pop		af
		jr		p7Dloc_4A80
; ---------------------------------------------------------------------------

p7Dloc_4A77:
		pop		af

p7Dloc_4A78:
		dec		a
		djnz	p7Dloc_4A61
		ret
; ---------------------------------------------------------------------------

p7Dloc_4A7C:
		pop		af
		pop		bc
		jr		p7Dloc_4A77
; ---------------------------------------------------------------------------

p7Dloc_4A80:
		push	af
		push	bc
		push	af
		call	j_IsAHLAtValidAppHeader
		jr		nz, p7Dloc_4A7C
		pop		af
		push	af
		call	p7Dsub_5E31
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80A8h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_4AC4
		pop		af
		push	af
		call	p7Dsub_52D9
		jr		c, p7Dloc_4AC4
		jr		z, p7Dloc_4AC4
		pop		af
		push	af
		ld		b, a
		call	GetAppSpaceStartToA
		sub		b
		ld		bc, 0
		ld		c, a
		push	bc
		pop		ix
		call	p7Dsub_48B5
		jr		c, p7Dloc_4AC4
		jr		nz, p7Dloc_4AC4
		ld		a, (ioFlag)
		cp		0
		jr		nz, p7Dloc_4ABF
		call	Page0Call_2C7F
		ld		a, 0FFh
		ld		(ioFlag), a

p7Dloc_4ABF:
		pop		af
		push	af
		call	Page7D_2BE3

p7Dloc_4AC4:
		pop		af
		pop		bc
		pop		af
		jr		p7Dloc_4A78
; End of function p7Dsub_4A5A


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4AC9:
		call	p7Dsub_70D1
		jp		nz, p7Dloc_4B69
		ld		de, 700h
		call	p7Dsub_777E
		call	p7Dsub_4574
		ld		ix, 0

p7Dloc_4ADC:
		ld		de, 710h
		call	p7Dsub_705E
		jp		nz, p7Dloc_4B6E
		push	hl
		call	p7Dsub_4574
		ld		a, c
		ld		(appID+1), a
		ld		de, 838Fh
		call	p7Dsub_424C
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80A8h
; ---------------------------------------------------------------------------
		pop		hl
		push	hl
		jr		z, p7Dloc_4B5F
		ld		de, 740h
		call	p7Dsub_705E
		jr		nz, p7Dloc_4B14
		call	p7Dsub_7700
		call	p7Dsub_50C5
		jr		z, p7Dloc_4B14
		call	p7Dsub_536F
		call	p7Dsub_48DE
		jr		c, p7Dloc_4B14
		jr		z, p7Dloc_4B20

p7Dloc_4B14:
		call	p7Dsub_540C
		jr		z, p7Dloc_4B5F
		pop		hl
		push	hl
		call	p7Dsub_4992
		jr		p7Dloc_4B5F
; ---------------------------------------------------------------------------

p7Dloc_4B20:
		ld		a, (ioFlag)
		cp		0
		jr		nz, p7Dloc_4B3D
		pop		de
		push	de
		push	hl
		call	p7Dsub_4B73
		call	p7Dsub_6021
		jr		c, p7Dloc_4B51
		pop		hl
		pop		de
		push	de
		call	Page0Call_2C7F
		ld		a, 0FFh
		ld		(ioFlag), a

p7Dloc_4B3D:
		pop		de
		push	de
		push	hl
		call	p7Dsub_4B73
		call	p7Dsub_6021
		jr		c, p7Dloc_4B51
		call	Page0Call_2C8B
		call	j_newline
		call	Page7D_2BE3

p7Dloc_4B51:
		pop		hl
		pop		de
		ex		de, hl
		push	de
		call	p7Dsub_4574
		pop		de
		add		hl, bc
		inc		ix
		jp		p7Dloc_4ADC
; ---------------------------------------------------------------------------

p7Dloc_4B5F:
		pop		hl
		call	p7Dsub_4574
		add		hl, bc
		inc		ix
		jp		p7Dloc_4ADC
; ---------------------------------------------------------------------------

p7Dloc_4B69:
		ld		a, 0FFh
		bit		7, a
		ret
; ---------------------------------------------------------------------------

p7Dloc_4B6E:
		ld		a, 0
		bit		7, a
		ret
; End of function p7Dsub_4AC9


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4B73:
		ex		de, hl
		call	p7Dsub_4574
		ld		a, c
		ld		(appID), a
		ld		de, 838Eh
		call	p7Dsub_424C
		ret
; End of function p7Dsub_4B73

; ---------------------------------------------------------------------------

p7Dloc_4B82:
		call	p7Dsub_70D1
		ld		de, 800h
		call	p7Dsub_777E
		call	p7Dsub_4574

p7Dloc_4B8E:
		ld		de, 810h
		call	p7Dsub_705E
		jp		nz, locret_4C0B
		push	hl
		ld		de, 840h
		call	p7Dsub_705E
		jr		nz, p7Dloc_4BC9
		call	p7Dsub_7700
		call	p7Dsub_50C5
		jr		z, p7Dloc_4BE4
		call	p7Dsub_536F
		call	p7Dsub_48DE
		jr		c, p7Dloc_4BC9
		jr		nz, p7Dloc_4BE4
		ld		a, (ioFlag)
		cp		0
		jr		nz, p7Dloc_4BC9
		call	Page0Call_2C7F
		ld		a, 0FFh
		ld		(ioFlag), a
		pop		de
		push	de
		call	Page0Call_2C85
		call	j_newline

p7Dloc_4BC9:
		pop		de
		ex		de, hl
		push	hl
		call	p7Dsub_4574
		ld		de, 8484h
		ld		(OP2), bc
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8066h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_4BE4
		rst		28h
; ---------------------------------------------------------------------------
		.dw		802Ah
; ---------------------------------------------------------------------------

p7Dloc_4BE4:
		pop		de
		ex		de, hl
		push	hl
		call	p7Dsub_4574
		ld		de, 8484h
		ld		(OP2), bc
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8066h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_4C01
		inc		ix
		call	p7Dsub_4C0C

p7Dloc_4C01:
		pop		hl
		call	p7Dsub_4574
		add		hl, bc
		inc		ix
		jp		p7Dloc_4B8E
; ---------------------------------------------------------------------------

locret_4C0B:
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_4C0C:
		ld		de, 700h
		call	p7Dsub_777E
		call	p7Dsub_4574

p7Dloc_4C15:
		ld		de, 710h
		call	p7Dsub_705E
		jr		nz, p7Dloc_4C70
		push	hl
		ld		de, 740h
		call	p7Dsub_705E
		jr		nz, p7Dloc_4C38
		call	p7Dsub_7700
		call	p7Dsub_50C5
		jr		z, p7Dloc_4C38
		call	p7Dsub_536F
		call	p7Dsub_48DE
		jr		c, p7Dloc_4C38
		jr		z, p7Dloc_4C3B

p7Dloc_4C38:
		pop		hl
		jr		p7Dloc_4C68
; ---------------------------------------------------------------------------

p7Dloc_4C3B:
		ld		a, (ioFlag)
		cp		0
		jr		nz, p7Dloc_4C55
		pop		de
		push	de
		push	hl
		call	p7Dsub_6021
		jr		c, p7Dloc_4C66
		pop		hl
		pop		de
		push	de
		call	Page0Call_2C7F
		ld		a, 0FFh
		ld		(ioFlag), a

p7Dloc_4C55:
		pop		de
		push	de
		push	hl
		call	p7Dsub_6021
		jr		c, p7Dloc_4C66
		call	Page0Call_2C8B
		call	j_newline
		call	Page7D_2BE3

p7Dloc_4C66:
		pop		hl
		pop		de

p7Dloc_4C68:
		call	p7Dsub_4574
		add		hl, bc
		inc		ix
		jr		p7Dloc_4C15
; ---------------------------------------------------------------------------

p7Dloc_4C70:
		dec		ix
		ret
; End of function p7Dsub_4C0C


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4C73:
		push	bc
		push	de
		push	hl
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ld		(OP2), a
		ex		de, hl
		pop		af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ld		bc, (OP2)
		cp		c
		pop		hl
		pop		de
		pop		bc
		ret
; End of function p7Dsub_4C73


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4C8B:
		push	hl
		push	de
		push	bc
		push	af
		call	p7Dsub_4F62
		call	p7Dloc_4D38
		call	p7Dsub_4CAE
		call	p7Dsub_521D
		ld		bc, 0Dh
		sla	c
		call	p7Dsub_7700
		ld		de, tempSwapArea
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		pop		af
		pop		bc
		pop		de
		pop		hl
		ret
; End of function p7Dsub_4C8B


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4CAE:
		call	p7Dsub_70D1
		jr		nz, p7Dloc_4CF7
		ld		de, 800h
		call	p7Dsub_777E
		jr		nz, p7Dloc_4CF7
		call	p7Dsub_4574
		push	hl
		call	p7Dsub_4894
		ld		de, 800h
		call	p7Dsub_777E
		jp		nz, p7Dloc_4D36
		call	p7Dsub_4574
		pop		de
		ex		de, hl
		inc		ix

p7Dloc_4CD2:
		push	hl

p7Dloc_4CD3:
		call	p7Dsub_4F95
		jr		nz, p7Dloc_4CDD
		call	p7Dsub_4F10
		jr		p7Dloc_4D1D
; ---------------------------------------------------------------------------

p7Dloc_4CDD:
		push	de
		push	ix
		ld		de, 810h
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		add		hl, bc
		call	p7Dsub_705E
		pop		ix
		pop		de

p7Dloc_4CF0:
		call	nz, p7Dsub_4E44
		jr		nz, p7Dloc_4D1D
		jr		p7Dloc_4CD3
; ---------------------------------------------------------------------------

p7Dloc_4CF7:
		call	p7Dsub_4894
		ld		de, 800h
		call	p7Dsub_777E
		jr		nz, locret_4D35
		inc		ix
		call	p7Dsub_4574

p7Dloc_4D07:
		ld		de, 810h
		call	p7Dsub_705E
		jr		nz, locret_4D35
		push	hl
		ex		de, hl
		call	p7Dsub_4E44
		pop		hl
		call	p7Dsub_4574
		add		hl, bc
		inc		ix
		jr		p7Dloc_4D07
; ---------------------------------------------------------------------------

p7Dloc_4D1D:
		pop		hl
		ex		de, hl
		push	de
		call	p7Dsub_7700
		ld		de, 810h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		add		hl, bc
		call	p7Dsub_705E
		pop		de
		inc		ix
		jr		nz, locret_4D35
		ex		de, hl
		jr		p7Dloc_4CD2
; ---------------------------------------------------------------------------

locret_4D35:
		ret
; ---------------------------------------------------------------------------

p7Dloc_4D36:
		pop		hl
		ret
; End of function p7Dsub_4CAE

; ---------------------------------------------------------------------------

p7Dloc_4D38:
		call	p7Dsub_70D1
		jr		nz, p7Dloc_4D82
		ld		de, 700h
		call	p7Dsub_777E
		jr		nz, p7Dloc_4D82
		call	p7Dsub_4574
		push	hl
		call	p7Dsub_4894
		ld		de, 700h
		call	p7Dsub_777E
		jp		nz, p7Dloc_4DCB
		call	p7Dsub_4574
		pop		de
		ex		de, hl
		ld		ix, 0Dh

; =============== S U B	R O U T	I N E =======================================


p7Dsub_4D5E:

		push	hl

p7Dloc_4D5F:
		call	p7Dsub_4F6E
		call	z, p7Dsub_4EBD
		jr		z, p7Dloc_4DAF
		push	de
		push	ix
		ld		de, 710h
		ld		a, 7Eh ; '~'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		add		hl, bc
		call	p7Dsub_705E
		pop		ix
		pop		de
		call	nz, p7Dsub_4DCD
		jr		nz, p7Dloc_4DAF
		jr		p7Dloc_4D5F
; End of function p7Dsub_4D5E

; ---------------------------------------------------------------------------

p7Dloc_4D80:
		jr		p7Dsub_4D5E
; ---------------------------------------------------------------------------

p7Dloc_4D82:
		ld		ix, 0Ch
		call	p7Dsub_4894
		ld		de, 700h
		call	p7Dsub_777E
		jp		nz, locret_4DCA
		inc		ix
		call	p7Dsub_4574

p7Dloc_4D97:
		ld		de, 710h
		call	p7Dsub_705E
		jr		nz, p7Dloc_4DC8
		push	hl
		ex		de, hl
		call	p7Dsub_4DCD
		pop		hl
		call	p7Dsub_4574
		or		a
		adc	hl, bc
		inc		ix
		jr		p7Dloc_4D97
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_4DCD

p7Dloc_4DAF:
		pop		hl
		ex		de, hl
		push	de
		ld		a, 7Eh ; '~'
		ld		de, 710h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc
		call	p7Dsub_705E
		pop		de
		jr		nz, locret_4DCA
		ex		de, hl
		inc		ix
		jr		p7Dloc_4D80
; END OF FUNCTION CHUNK	FOR p7Dsub_4DCD
; ---------------------------------------------------------------------------

p7Dloc_4DC8:
		dec		ix
; START	OF FUNCTION CHUNK FOR p7Dsub_4DCD

locret_4DCA:
		ret
; END OF FUNCTION CHUNK	FOR p7Dsub_4DCD
; ---------------------------------------------------------------------------

p7Dloc_4DCB:
		pop		hl
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_4DCD:




		push	bc
		push	hl
		push	de
		push	ix

p7Dloc_4DD2:
		res		7, (iy+25h)
		ex		de, hl
		push	hl
		ld		a, 7Eh ; '~'
		ld		de, 740h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_4DE6
		set		7, (iy+25h)

p7Dloc_4DE6:
		pop		hl
		ld		a, 7Eh ; '~'
		ld		de, 760h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_4E01
		bit		7, (iy+25h)
		jr		z, p7Dloc_4DFC
		ld		de, 0
		jr		p7Dloc_4E27
; ---------------------------------------------------------------------------

p7Dloc_4DFC:
		ld		de, 80h	; '�'
		jr		p7Dloc_4E27
; ---------------------------------------------------------------------------

p7Dloc_4E01:
		ld		a, c
		or		b
		ld		a, 0
		jr		z, p7Dloc_4E0A
		call	p7Dsub_4566

p7Dloc_4E0A:
		push	af
		ld		b, 9
		sub		b
		jr		c, p7Dloc_4E20
		pop		af
		ld		b, 8
		sub		b
		call	p7Dsub_4E9B
		ld		d, a
		ld		a, 8
		call	p7Dsub_4E9B
		ld		e, a
		jr		p7Dloc_4E27
; ---------------------------------------------------------------------------

p7Dloc_4E20:
		ld		d, 0
		pop		af
		call	p7Dsub_4E9B
		ld		e, a

p7Dloc_4E27:
		ld		hl, tempSwapArea
		push	ix
		pop		bc
		sla	c
		ld		b, 0
		or		a
		adc	hl, bc
		ld		(hl), e
		inc		hl
		ld		(hl), d
		ld		a, 0FFh
		or		a
		res		7, (iy+25h)
		pop		ix
		pop		de
		pop		hl
		pop		bc
		ret
; End of function p7Dsub_4DCD


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4E44:
		; p7Dsub_4CAE+63p
		push	af
		push	bc
		push	hl
		push	de
		push	ix
		ex		de, hl
		ld		a, 7Eh ; '~'
		ld		de, 860h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_4E5A
		ld		de, 80h	; '�'
		jr		p7Dloc_4E80
; ---------------------------------------------------------------------------

p7Dloc_4E5A:
		ld		a, c
		or		b
		ld		a, 0
		jr		z, p7Dloc_4E63
		call	p7Dsub_4566

p7Dloc_4E63:
		push	af
		ld		b, 9
		sub		b
		jr		c, p7Dloc_4E79
		pop		af
		ld		b, 8
		sub		b
		call	p7Dsub_4E9B
		ld		d, a
		ld		a, 8
		call	p7Dsub_4E9B
		ld		e, a
		jr		p7Dloc_4E80
; ---------------------------------------------------------------------------

p7Dloc_4E79:
		ld		d, 0
		pop		af
		call	p7Dsub_4E9B
		ld		e, a

p7Dloc_4E80:
		ld		hl, tempSwapArea
		push	ix
		pop		bc
		sla	c
		ld		b, 0
		or		a
		adc	hl, bc
		ld		(hl), e
		inc		hl
		ld		(hl), d
		ld		a, 0FFh
		bit		7, a
		pop		ix
		pop		de
		pop		hl
		pop		bc
		pop		af
		ret
; End of function p7Dsub_4E44


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4E9B:
		push	bc
		ld		c, 11h
		sub		c
		jp		nc, p7Dloc_4EB9
		or		a
		adc	a, c
		cp		0
		jr		z, p7Dloc_4EB9
		cp		1
		jr		z, p7Dloc_4EBB
		ld		b, a
		dec		b
		ld		a, 2

p7Dloc_4EB0:
		sla	a
		djnz	p7Dloc_4EB0
		ld		b, 1
		sub		b
		jr		p7Dloc_4EBB
; ---------------------------------------------------------------------------

p7Dloc_4EB9:
		ld		a, 0

p7Dloc_4EBB:
		pop		bc
		ret
; End of function p7Dsub_4E9B


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4EBD:
		; p7Dsub_4F10:p7Dloc_4F47p
		push	af
		push	hl
		push	de
		push	ix
		ld		de, 710h
		call	p7Dsub_4ECE
		pop		ix
		pop		de
		pop		hl
		pop		af
		ret
; End of function p7Dsub_4EBD


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4ECE:
		call	p7Dsub_705E
		call	p7Dsub_4574
		ld		de, 838Fh
		call	p7Dsub_424C
		push	hl
		ld		hl, OP6
		ld		(hl), 1
		pop		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8069h
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_4EE8
		dec		ix

p7Dloc_4EE8:
		call	p7Dsub_764E
		push	hl
		pop		ix
		push	ix
		pop		bc
		sla	c
		call	p7Dsub_521D
		or		a
		adc	hl, bc
		ld		a, 7Eh ; '~'

p7Dloc_4EFB:
		ld		de, tempSwapArea
		ex		de, hl
		pop		bc
		push	bc
		sla	c
		ld		b, 0
		or		a
		adc	hl, bc
		ex		de, hl
		ld		bc, 2
		call	FlashToRam
		ret
; End of function p7Dsub_4ECE


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4F10:
		push	af
		push	hl
		push	de
		push	ix
		ld		de, 810h
		call	p7Dsub_4ECE
		ld		bc, (appID+1)
		ld		b, 0
		ld		a, c
		push	af
		and		0F0h ; '�'
		ld		c, a
		pop		af
		xor		c
		ld		c, a
		ld		(OP2), bc

p7Dloc_4F2D:
		ld		hl, 838Fh
		ld		de, 8484h
		ldir
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8066h
; ---------------------------------------------------------------------------
		pop		ix
		jr		nz, p7Dloc_4F5E
		inc		ix
		ld		de, 700h
		call	p7Dsub_777E
		call	p7Dsub_4574

p7Dloc_4F47:
		call	p7Dsub_4EBD
		inc		ix
		ld		a, 7Eh ; '~'
		ld		de, 710h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc
		call	p7Dsub_705E
		jr		z, p7Dloc_4F47
		dec		ix

p7Dloc_4F5E:
		pop		de
		pop		hl
		pop		af
		ret
; End of function p7Dsub_4F10


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4F62:
		ld		hl, tempSwapArea
		ld		a, 0FFh
		ld		b, 0E8h	; '�'

p7Dloc_4F69:
		ld		(hl), a
		inc		hl
		djnz	p7Dloc_4F69
		ret
; End of function p7Dsub_4F62


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4F6E:
		push	hl
		push	de
		push	bc
		push	ix
		push	de
		ld		a, 7Eh ; '~'
		ld		de, 710h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		pop		de
		push	hl
		push	bc
		ex		de, hl
		ld		a, 7Eh ; '~'
		ld		de, 710h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		pop		de
		ld		a, e
		pop		de
		cp		c
		jr		nz, p7Dloc_4FE9
		ld		a, c
		or		b
		jr		z, p7Dloc_4FEF
		jp		p7Dloc_4FB9
; End of function p7Dsub_4F6E


; =============== S U B	R O U T	I N E =======================================


p7Dsub_4F95:
		push	hl
		push	de
		push	bc
		push	ix
		push	de
		ld		a, 7Eh ; '~'
		ld		de, 810h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		pop		de
		push	hl
		push	bc
		ex		de, hl
		ld		a, 7Eh ; '~'
		ld		de, 810h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		pop		de
		ld		a, e
		pop		de
		cp		c
		jr		nz, p7Dloc_4FE9
		ld		a, c
		or		b
		jr		z, p7Dloc_4FEF

p7Dloc_4FB9:
		ld		b, c

p7Dloc_4FBA:
		ld		a, 7Eh ; '~'
		call	p7Dsub_4C73
		jr		nz, p7Dloc_4FE9
		inc		hl
		inc		de
		djnz	p7Dloc_4FBA
		call	p7Dsub_4565
		and		0F0h ; '�'
		cp		10h
		jr		z, p7Dloc_4FEF
		cp		0
		jr		z, p7Dloc_4FEF
		dec		hl
		inc		de
		push	de
		call	p7Dsub_4574
		pop		de
		ex		de, hl
		push	bc
		push	de
		call	p7Dloc_4575
		pop		de
		ex		de, hl
		ld		a, c
		pop		bc
		cp		c
		jr		nz, p7Dloc_4FE9
		ld		b, c
		jr		p7Dloc_4FBA
; ---------------------------------------------------------------------------

p7Dloc_4FE9:
		ld		a, 0FFh
		bit		7, a
		jr		p7Dloc_4FF3
; ---------------------------------------------------------------------------

p7Dloc_4FEF:
		ld		a, 0
		bit		7, a

p7Dloc_4FF3:
		pop		ix
		pop		bc
		pop		de
		pop		hl
		ret
; End of function p7Dsub_4F95

; ---------------------------------------------------------------------------

p7Dloc_4FF9:
		push	af
		push	de
		push	hl
		push	bc
		push	af
		push	hl
		push	af
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc
		pop		af
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc
		pop		de
		or		a
		sbc		hl, de
		push	hl
		pop		bc
		ex		de, hl
		pop		af
		ld		de, tempSwapArea
		push	bc
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		pop		bc
		ld		a, 7Eh ; '~'
		call	p7Dsub_4894
		push	hl
		push	hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8060h
; ---------------------------------------------------------------------------
		pop		hl
		ex		de, hl
		ld		hl, tempSwapArea
		ld		a, 7Eh ; '~'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		ld		de, 320h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_503E
		rst		28h
; ---------------------------------------------------------------------------
		.dw		802Ah
; ---------------------------------------------------------------------------

p7Dloc_503E:
		pop		hl
; START	OF FUNCTION CHUNK FOR p7Dsub_5083

p7Dloc_503F:
		scf

p7Dloc_5040:
		ld		a, 7Eh ; '~'
		push	af
		push	af
		push	hl
		push	hl
		push	af
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc
		pop		af
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc
		pop		de
		or		a
		sbc		hl, de
		push	hl
		pop		bc
		pop		hl
		pop		af
		push	bc
		push	hl
		call	p7Dsub_521D
		ld		bc, 0E8h ; '�'
		ld		a, 7Eh ; '~'
		ld		de, tempSwapArea
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		pop		de
		pop		bc
		ld		a, d
		xor		20h ; ' '
		ld		d, a
		call	p7Dsub_430E
		jp		nz, p7Dloc_46C1
		pop		af
		call	c, p7Dsub_4926
		pop		bc
		pop		hl
		pop		de
		pop		af
		ret
; END OF FUNCTION CHUNK	FOR p7Dsub_5083

; =============== S U B	R O U T	I N E =======================================


p7Dsub_5083:




		push	af
		push	de
		push	hl
		push	bc
		jp		p7Dloc_503F
; End of function p7Dsub_5083


; =============== S U B	R O U T	I N E =======================================


p7Dsub_508A:
		push	af
		push	de
		push	hl
		push	bc
		call	p7Dsub_4894
		ld		de, 320h
		call	p7Dsub_777E
		push	hl
		ld		de, 320h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_50A3
		rst		28h
; ---------------------------------------------------------------------------
		.dw		802Ah
; ---------------------------------------------------------------------------

p7Dloc_50A3:
		pop		hl
		scf
		ccf
		jr		p7Dloc_5040
; End of function p7Dsub_508A


; =============== S U B	R O U T	I N E =======================================


p7Dsub_50A8:
		push	af
		push	bc
		push	hl
		push	de
		call	p7Dsub_4894
		ld		de, 320h
		call	p7Dsub_777E
		call	p7Dsub_4574
		ld		a, 7Eh ; '~'
		call	p7Dsub_50C5
		call	z, p7Dsub_508A
		pop		de
		pop		hl
		pop		bc
		pop		af
		ret
; End of function p7Dsub_50A8


; =============== S U B	R O U T	I N E =======================================


p7Dsub_50C5:
		push	ix
		push	hl
		push	de
		push	af
		push	hl
		ld		de, 320h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_5119
		call	p7Dsub_4574
		ex		de, hl
		pop		hl
		inc		hl
		inc		de
		pop		af
		ld		b, a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		push	af
		and		0F0h ; '�'
		ld		c, a
		pop		af
		xor		c
		push	af
		ex		de, hl
		call	p7Dsub_4566
		ld		c, a
		pop		af
		sub		c
		jr		z, p7Dloc_50F3
		jr		nc, p7Dloc_511B
		jr		c, p7Dloc_5113

p7Dloc_50F3:
		ld		a, b
		inc		de
		inc		hl
		ld		b, c
		ex		de, hl

p7Dloc_50F8:
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		push	af
		ex		de, hl
		call	p7Dsub_4566
		ld		c, a
		pop		af
		sub		c
		jr		z, p7Dloc_510A
		jr		nc, p7Dloc_511A
		jr		c, p7Dloc_5112

p7Dloc_510A:
		pop		af
		inc		de
		inc		hl
		ex		de, hl
		djnz	p7Dloc_50F8
		jr		p7Dloc_5113
; ---------------------------------------------------------------------------

p7Dloc_5112:
		pop		af

p7Dloc_5113:
		ld		a, 0FFh
		bit		7, a
		jr		p7Dloc_511F
; ---------------------------------------------------------------------------

p7Dloc_5119:
		pop		af

p7Dloc_511A:
		pop		af

p7Dloc_511B:
		ld		a, 0
		bit		7, a

p7Dloc_511F:
		pop		de
		pop		hl
		pop		ix
		ret
; End of function p7Dsub_50C5


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5124:
		push	hl
		push	bc
		push	de
		push	af
		call	p7Dsub_47B5
		call	p7Dsub_762A
		call	p7Dsub_484E
		inc		ix
		push	ix
		call	p7Dsub_4894
		ld		de, 700h
		call	p7Dsub_777E
		call	p7Dsub_4574

p7Dloc_5141:
		ld		de, 710h
		call	p7Dsub_705E
		jr		nz, p7Dloc_5156
		ex		de, hl
		call	p7Dsub_4DCD
		ex		de, hl
		inc		ix
		call	p7Dsub_4574
		add		hl, bc
		jr		p7Dloc_5141
; ---------------------------------------------------------------------------

p7Dloc_5156:
		ld		hl, tempSwapArea
		push	ix
		pop		bc
		sla	c
		add		hl, bc
		pop		de
		push	hl
		sla	e
		call	p7Dsub_521D
		add		hl, de
		push	hl
		ld		a, c
		sub		e
		jr		nc, p7Dloc_516F
		ld		a, e
		ld		e, c
		sub		e

p7Dloc_516F:
		ld		c, a
		ld		hl, 0C8h ; '�'
		sbc		hl, de
		sbc		hl, bc
		push	hl
		pop		bc
		pop		hl
		pop		de
		ld		a, 7Eh ; '~'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		pop		af
		pop		de
		pop		bc
		pop		hl
		ret
; End of function p7Dsub_5124


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5185:
		push	bc
		push	hl
		call	p7Dsub_521D
		pop		de
		ex		de, hl
		or		a
		sbc		hl, de
		ex		de, hl
		ld		hl, tempSwapArea
		add		hl, de
		ld		a, (unk_9C20)
		call	Page7D_2B83
		pop		bc
		ld		(hl), b
		ret
; End of function p7Dsub_5185


; =============== S U B	R O U T	I N E =======================================


p7Dsub_519D:
		push	af
		push	bc
		push	hl
		call	p7Dsub_51DB
		call	p7Dsub_7BCC
		ld		c, a
		call	p7Dsub_4566
		push	af
		or		c
		ld		b, a
		pop		af
		and		c
		jr		nz, p7Dloc_51BB
		call	p7Dsub_5185
		ld		a, 5
		call	Page7D_2B5F
		jr		p7Dloc_51BF
; ---------------------------------------------------------------------------

p7Dloc_51BB:
		ex		de, hl
		call	p7Dsub_456D

p7Dloc_51BF:
		pop		hl
		pop		bc
		pop		af
		ret
; End of function p7Dsub_519D


; =============== S U B	R O U T	I N E =======================================


p7Dsub_51C3:
		push	af
		push	bc
		push	hl
		call	p7Dsub_51DB
		call	p7Dsub_7BCC
		cpl
		ld		c, a
		call	p7Dsub_4566
		and		c
		ld		b, a
		ex		de, hl
		call	p7Dsub_456D
		pop		hl
		pop		bc
		pop		af
		ret
; End of function p7Dsub_51C3


; =============== S U B	R O U T	I N E =======================================


p7Dsub_51DB:
		push	de
		push	af
		ld		b, a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80A8h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_51ED
		call	GetAppSpaceStartToA
		sub		b
		inc		a
		ld		c, a
		ld		b, 0
		jr		p7Dloc_5202
; ---------------------------------------------------------------------------

p7Dloc_51ED:
		push	hl
		ld		hl, OP6
		ld		(hl), 0
		pop		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8069h
; ---------------------------------------------------------------------------
		inc		ix
		push	ix
		pop		hl
		call	p7Dsub_7643
		add		hl, bc
		push	hl
		pop		bc

p7Dloc_5202:
		push	bc
		call	Page7D_2B7D
		sra	c
		sra	c
		sra	c
		or		a
		adc	hl, bc
		pop		bc
		ld		a, c
		and		7
		ld		c, a
		pop		af
		pop		de
		ret
; End of function p7Dsub_51DB


; =============== S U B	R O U T	I N E =======================================


Page7D_2B7D:
		push	bc
		ld		bc, 1FE0h
		jr		p7Dloc_5221
; End of function Page7D_2B7D


; =============== S U B	R O U T	I N E =======================================


p7Dsub_521D:
		push	bc
		ld		bc, 1F18h

p7Dloc_5221:
		; p7Dsub_522B+4j ...
		push	ix
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8057h
; ---------------------------------------------------------------------------
		add		hl, bc
		pop		ix
		pop		bc
		ret
; End of function p7Dsub_521D


; =============== S U B	R O U T	I N E =======================================


p7Dsub_522B:
		push	bc
		ld		bc, 1DEAh
		jr		p7Dloc_5221
; End of function p7Dsub_522B


; =============== S U B	R O U T	I N E =======================================


Page7D_2B65:
		call	NZIf83Plus
		jr		nz, p7Dsub_521D
; End of function Page7D_2B65


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5236:
		push	bc
		ld		bc, 1E50h
		jr		p7Dloc_5221
; End of function p7Dsub_5236


; =============== S U B	R O U T	I N E =======================================


p7Dsub_523C:
		push	bc
		ld		bc, 1FE0h
		jr		p7Dloc_5221
; End of function p7Dsub_523C


; =============== S U B	R O U T	I N E =======================================


FindSwapSector:
		push	hl
		push	bc
		push	ix
		ld		a, (OP1)
		push	af
		ld		a, 8

p7Dloc_524C:
		push	af
		ld		hl, 4000h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		cp		0FEh ; '�'
		jr		z, p7Dloc_527B
		pop		af
		add		a, 4
		call	p7Dsub_75E1
		jr		c, p7Dloc_524C
		ld		a, 8

p7Dloc_5261:
		push	af
		ld		hl, 4000h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		cp		0FFh
		jr		z, p7Dloc_5278
		pop		af
		add		a, 4
		call	p7Dsub_75E1
		jr		c, p7Dloc_5261
		ld		a, 8
		jr		p7Dloc_5279
; ---------------------------------------------------------------------------

p7Dloc_5278:
		pop		af

p7Dloc_5279:
		jr		p7Dloc_527C
; ---------------------------------------------------------------------------

p7Dloc_527B:
		pop		af

p7Dloc_527C:
		ld		b, a
		pop		af
		ld		(OP1), a
		ld		a, b
		pop		ix
		pop		bc
		pop		hl
		ret
; End of function FindSwapSector


; =============== S U B	R O U T	I N E =======================================


Page7D_2C3D:
		push	af
		push	hl
		push	bc
		push	de
		ld		b, 0FEh	; '�'
		ld		de, 4000h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		pop		de
		pop		bc
		pop		hl
		pop		af
		ret
; End of function Page7D_2C3D

; ---------------------------------------------------------------------------

Page7D_2C1F:
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8066h
; ---------------------------------------------------------------------------
		jr		nz, locret_52D8
		ld		a, 7Eh ; '~'

p7Dloc_529F:
		ld		(appSearchPage), a
		push	hl
		push	hl
		ld		a, (appSearchPage)
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc
		inc		hl
		ld		a, (appSearchPage)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc
		pop		de
		sbc		hl, de
		push	hl
		pop		bc
		call	p7Dsub_4894
		ex		de, hl
		pop		hl

p7Dloc_52C2:
		push	bc
		ld		a, (appSearchPage)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ld		b, a
		push	hl
		call	p7Dsub_456D
		pop		hl
		pop		bc
		dec		bc
		ld		a, b
		or		c
		jr		z, locret_52D8
		inc		hl
		jr		p7Dloc_52C2
; ---------------------------------------------------------------------------

locret_52D8:
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_52D9:
		ld		de, 8050h
		ld		hl, 4000h
		push	af
		or		a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_52ED
		pop		af
		call	p7Dsub_50C5
		scf
		ccf
		ret
; ---------------------------------------------------------------------------

p7Dloc_52ED:
		pop		af
		scf
		ret
; End of function p7Dsub_52D9

; ---------------------------------------------------------------------------

Page7D_2C9D:
		ld		de, 8050h
		push	de
		jp		p7Dloc_52F7

p7Dloc_52F7:
		ld		hl, 4000h
		pop		de
		push	af
		or		a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_5338
		pop		af
		ld		(Abackup), a
		ld		a, i
		di
		push	af
		ld		a, (Abackup)
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	p7Dsub_50C5
		call	p7Dsub_6006
		call	relockFlashBack
		ld		(Abackup), a
		pop		af
		jp		po, p7Dloc_532F
		ei

p7Dloc_532F:
		ld		a, (Abackup)
		call	p7Dsub_6011
		scf
		ccf
		ret
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_533B

p7Dloc_5338:
		pop		af
		scf
		ret
; END OF FUNCTION CHUNK	FOR p7Dsub_533B

; =============== S U B	R O U T	I N E =======================================


p7Dsub_533B:



		push	af
		call	p7Dsub_6021
		jr		c, p7Dloc_5338
		ld		hl, 4000h
		ld		de, 320h
		pop		af
		push	af
		or		a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_5338
		pop		af
		push	af
		push	hl
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		call	p7Dsub_50C5
		jr		nz, p7Dloc_5362
		pop		hl
		pop		af
		push	af
		push	hl
		call	p7Dloc_4FF9

p7Dloc_5362:
		pop		hl
		pop		af
		ret
; End of function p7Dsub_533B


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5365:
		push	ix
		push	hl
		push	de
		push	bc
		call	Page7D_2B65
		jr		p7Dloc_537C
; End of function p7Dsub_5365


; =============== S U B	R O U T	I N E =======================================


p7Dsub_536F:
		push	ix
		push	hl
		push	de
		push	bc
		call	p7Dsub_521D
		ld		bc, 0Dh
		add		ix, bc

p7Dloc_537C:
		push	ix
		pop		bc
		sla	c
		or		a
		adc	hl, bc
		push	hl
		call	p7Dsub_4566
		cp		80h ; '�'
		jr		z, p7Dloc_53AC
		push	af
		call	p7Dsub_4565
		cp		0
		pop		bc
		jr		z, p7Dloc_5399
		srl	a
		jr		p7Dloc_539B
; ---------------------------------------------------------------------------

p7Dloc_5399:
		srl	b

p7Dloc_539B:
		pop		de
		ld		c, a
		push	bc
		call	p7Dsub_456D
		pop		bc
		ld		b, c
		call	p7Dsub_456D
		pop		bc
		pop		de
		pop		hl
		pop		ix
		ret
; ---------------------------------------------------------------------------

p7Dloc_53AC:
		pop		de
		pop		bc
		pop		de
		pop		hl
		pop		ix
		ret
; End of function p7Dsub_536F


; =============== S U B	R O U T	I N E =======================================


p7Dsub_53B3:
		ld		(Abackup), a
		ld		a, i
		di
		push	af
		ld		a, (Abackup)
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	Page7D_2B59

p7Dloc_53D1:
		call	p7Dsub_6006
		call	relockFlashBack
		ld		(Abackup), a
		pop		af
		jp		po, p7Dloc_53DF
		ei

p7Dloc_53DF:
		ld		a, (Abackup)
		jp		p7Dsub_6011
; End of function p7Dsub_53B3


; =============== S U B	R O U T	I N E =======================================


Page7D_2B59:
		push	de
		push	hl
		push	bc
		push	ix
		ld		b, a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80A8h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_53FA
		call	GetAppSpaceStartToA
		sub		b
		inc		a
		ld		c, a
		ld		b, 0
		jr		p7Dloc_541E
; ---------------------------------------------------------------------------

p7Dloc_53FA:
		ld		hl, OP6
		ld		(hl), 0
		ld		a, (appSearchPage)
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8069h
; ---------------------------------------------------------------------------
		pop		af
		ld		(appSearchPage), a
		jr		p7Dloc_5411
; End of function Page7D_2B59


; =============== S U B	R O U T	I N E =======================================


p7Dsub_540C:
		push	de
		push	hl
		push	bc
		push	ix

p7Dloc_5411:
		inc		ix
		push	ix
		pop		hl
		call	p7Dsub_7643
		or		a
		adc	hl, bc
		push	hl
		pop		bc

p7Dloc_541E:
		push	bc
		call	Page7D_2B7D
		sra	c
		sra	c
		sra	c
		or		a
		adc	hl, bc
		pop		bc
		ld		a, c
		and		7
		call	p7Dsub_7BCC
		ld		c, a
		call	p7Dsub_4566
		and		c
		pop		ix
		pop		bc
		pop		hl
		pop		de
		ret
; End of function p7Dsub_540C

; ---------------------------------------------------------------------------

p7Dloc_543D:
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		ld		b, a
		ld		de, 8060h
		ld		hl, 4000h
		or		a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_549D
		call	GetAppSpaceStartToA
		ld		c, b
		sub		c
		ld		bc, 0
		ld		c, a
		sla	c
		call	Page7D_2B65
		or		a
		adc	hl, bc
		ld		a, 7Eh ; '~'
		ld		de, OP1
		ld		bc, 2
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		ld		a, (OP1)
		ld		bc, 0

p7Dloc_547D:
		cp		0
		jr		z, p7Dloc_5486
		srl	a
		inc		c
		jr		p7Dloc_547D
; ---------------------------------------------------------------------------

p7Dloc_5486:
		ld		a, (OP1+1)

p7Dloc_5489:
		cp		0
		jr		z, p7Dloc_5492
		srl	a
		inc		c
		jr		p7Dloc_5489
; ---------------------------------------------------------------------------

p7Dloc_5492:
		ld		a, c
		ld		(OP1), a
		ld		a, 0
		ld		(OP1+1), a
		bit		7, a

p7Dloc_549D:
		jp		relockFlashBack
; ---------------------------------------------------------------------------

p7Dloc_54A0:
		ld		b, a
		ld		de, 8050h
		ld		hl, 4000h
		or		a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		nz, locret_54BE
		ld		a, b
		push	af
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		pop		af
		ld		de, OP1
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		ld		a, 0
		bit		7, a

locret_54BE:
		ret
; ---------------------------------------------------------------------------
		push	hl
		ld		de, 8020h
		ld		hl, 4000h
		ld		a, 7Ah ; 'z'
		or		a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		ld		a, 7Ah ; 'z'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ld		d, a
		ld		a, 7Ah ; 'z'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ld		e, a
		pop		hl
		ret
; ---------------------------------------------------------------------------

Page7D_3C63:
		ld		(Abackup), a
		ld		a, i
		di
		push	af
		ld		a, (Abackup)
		push	hl
		push	de
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		ld		de, 510h
		push	de
		jr		p7Dloc_54FD

p7Dloc_54FD:
		call	p7Dsub_70D1
		jr		nz, p7Dloc_551F
		ld		de, 500h
		call	p7Dsub_777E
		jr		nz, p7Dloc_551F
		call	p7Dsub_4574
		ld		a, 7Eh ; '~'
		pop		de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_5520
		ld		de, tempSwapArea
		ld		b, c
		push	bc
		ld		a, 7Eh ; '~'
		call	p7Dsub_761F

p7Dloc_551F:
		pop		bc

p7Dloc_5520:
		pop		de
		pop		hl
		jp		p7Dloc_53D1

; =============== S U B	R O U T	I N E =======================================


p7Dsub_5525:
		push	af
		ld		hl, 4000h
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		_LoadAIndPaged
; ---------------------------------------------------------------------------
		call	p7Dsub_75FD
		jp		nz, p7Dloc_55C8
		inc		hl
		pop		af
		call	p7Dsub_761F
		ld		bc, 4000h
		or		a
		sbc		hl, bc
		push	hl
		push	af
		ld		hl, 4000h
		ld		de, 8080h
		or		a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		inc		hl
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------

p7Dloc_5555:				; DATA XREF: seg001:76C0w
		dec		a
		or		a
		jr		z, p7Dloc_5574
		ld		c, a
		pop		af
		sub		c
		push	af
		ld		hl, (unk_83A1)
		call	p7Dsub_57C5
		ld		b, c

p7Dloc_5564:
		push	bc
		ld		bc, 4000h
		or		a
		sbc		hl, bc
		pop		bc
		djnz	p7Dloc_5564
		call	p7Dsub_57C5
		ld		(unk_83A1), hl

p7Dloc_5574:
		ld		hl, (unk_83A1)
		call	p7Dsub_57C5
		push	hl
		pop		bc
		ld		hl, 4000h
		or		a
		adc	hl, bc
		pop		af
		pop		bc
		or		a
		adc	hl, bc
		push	af

p7Dloc_5588:
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		cp		2
		jr		nz, p7Dloc_55C8
		pop		af
		push	hl
		push	af
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		and		0F0h ; '�'
		cp		20h ; ' '
		jr		z, p7Dloc_55A8
		pop		af
		pop		hl
		push	af
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc
		jr		p7Dloc_5588
; ---------------------------------------------------------------------------

p7Dloc_55A8:
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		dec		hl
		inc		bc
		ld		de, tempSwapArea

p7Dloc_55B2:
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ld		(de), a
		inc		hl
		inc		de
		dec		bc
		ld		a, c
		or		b
		jr		nz, p7Dloc_55B2
		pop		af
		pop		hl
		ld		b, a
		ld		a, 0
		bit		7, a
		ld		a, b
		ret
; ---------------------------------------------------------------------------

p7Dloc_55C8:
		pop		af
		ld		a, 0FFh
		bit		7, a
		ret
; End of function p7Dsub_5525


; =============== S U B	R O U T	I N E =======================================


p7Dsub_55CE:
		inc		hl
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc

p7Dloc_55D6:
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		cp		2
		jr		nz, p7Dloc_5609
		inc		hl
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		and		0F0h ; '�'
		cp		0
		jr		z, p7Dloc_55F5
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc
		jr		p7Dloc_55D6
; ---------------------------------------------------------------------------

p7Dloc_55F5:
		pop		af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		dec		hl
		inc		bc
		ld		de, tempSwapArea
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		ld		b, c
		ld		c, 0
		ld		a, 0
		bit		7, a
		ret
; ---------------------------------------------------------------------------

p7Dloc_5609:
		pop		af
		ret
; End of function p7Dsub_55CE

; ---------------------------------------------------------------------------

p7Dloc_560B:

		push	de
		push	hl
		push	bc
		rst		28h
; ---------------------------------------------------------------------------
		.dw		807Eh
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_5640
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8057h
; ---------------------------------------------------------------------------
		ld		a, 7Eh ; '~'
		ld		de, 410h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_5640
		call	p7Dsub_4574
		ld		a, 7Eh ; '~'
		ld		de, 849Eh
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		ld		a, 0
		bit		7, a

p7Dloc_5640:
		pop		bc
		pop		hl
		pop		de
		jp		relockFlashBack
; ---------------------------------------------------------------------------

Page7D_2B95:
		call	Page0Call_23DE
		jr		nc, p7Dloc_5650
		call	Page0Call_23E3
		jr		p7Dloc_565A
; ---------------------------------------------------------------------------

p7Dloc_5650:
		call	p7Dloc_560B
		jr		nz, p7Dloc_5695
		call	Page7D_2C31
		jr		nz, p7Dloc_5695

p7Dloc_565A:
		ld		a, 1
		call	j_IncLstSize
		push	de
		push	hl
		call	p7Dloc_560B
		jr		nz, p7Dloc_5689
		call	OP1Set0
		ld		de, OP1M
		ld		hl, OP4
		ld		c, 7
		ld		b, 0
		ldir
		pop		hl
		pop		de
		push	de
		call	j_AdrLEle
		ex		de, hl
		ld		hl, OP1
		ld		a, (hl)
		call	mov9B2
		pop		hl
		ld		a, 0
		bit		7, a
		ret
; ---------------------------------------------------------------------------

p7Dloc_5689:
		pop		hl
		pop		hl
		push	bc
		push	de
		push	hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		807Eh
; ---------------------------------------------------------------------------
		pop		hl
		pop		de
		pop		bc
		ret
; ---------------------------------------------------------------------------

p7Dloc_5695:
		push	bc
		push	de
		push	hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		807Eh
; ---------------------------------------------------------------------------
		pop		hl
		pop		de
		pop		bc
		ex		de, hl
		ret

; =============== S U B	R O U T	I N E =======================================


Page7D_2C31:
		push	bc
		push	hl
		push	de
		call	Page0Call_23DE
		ex		de, hl
		ld		c, (hl)
		inc		hl
		ld		b, (hl)
		dec		hl
		ex		de, hl
		ld		a, b
		or		c
		jr		z, p7Dloc_56D6
		ld		hl, 1

p7Dloc_56B3:
		push	de
		push	hl
		push	bc
		call	Page0Call_3B07
		ld		de, OP4
		ld		hl, OP2M
		ld		b, 7

p7Dloc_56C1:
		ld		a, (de)
		cp		(hl)
		jr		nz, p7Dloc_56CB
		inc		de
		inc		hl
		djnz	p7Dloc_56C1
		jr		p7Dloc_56DA
; ---------------------------------------------------------------------------

p7Dloc_56CB:
		pop		bc
		pop		hl
		pop		de
		inc		hl
		dec		bc
		ld		a, c
		or		b
		jr		z, p7Dloc_56D6
		jr		p7Dloc_56B3
; ---------------------------------------------------------------------------

p7Dloc_56D6:
		; Page7D_2C31+32j
		pop		de
		pop		hl
		pop		bc
		ret
; ---------------------------------------------------------------------------

p7Dloc_56DA:
		ld		a, 0FFh
		bit		7, a
		pop		bc
		pop		hl
		pop		hl
		pop		de
		pop		hl
		pop		bc
		ret
; End of function Page7D_2C31

; ---------------------------------------------------------------------------

Page7D_2C2B:
		push	hl
		push	de
		push	bc
		push	af
		ld		hl, 4000h
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		call	p7Dsub_75FD
		jr		nz, p7Dloc_5737
		inc		hl
		pop		af
		call	p7Dsub_761F
		ld		hl, (unk_839F)
		push	hl
		ld		hl, (unk_83A1)
		push	hl
		push	af
		call	p7Dsub_5525
		push	hl
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		or		a
		adc	hl, bc
		pop		bc
		or		a
		sbc		hl, bc
		pop		af
		pop		bc
		ld		(unk_83A1), bc
		pop		bc
		ld		(unk_839F), bc
		push	af
		push	hl
		ld		hl, 4000h
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ld		bc, 4000h
		or		a
		sbc		hl, bc
		push	hl
		pop		bc
		call	p7Dsub_573C
		pop		bc
		inc		bc
		inc		bc
		call	p7Dsub_573C

p7Dloc_5737:
		pop		af
		pop		bc
		pop		de
		pop		hl
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_573C:
		ld		hl, (unk_83A1)
		call	p7Dsub_57C5
		or		a
		adc	hl, bc
		call	p7Dsub_57C5
		ld		(unk_83A1), hl
		ret		nc
		ld		hl, (unk_839F)
		inc		h
		jr		nz, p7Dloc_5753
		inc		l

p7Dloc_5753:
		ld		(unk_839F), hl
		ret
; End of function p7Dsub_573C


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5757:
		push	hl
		push	de
		push	bc
		push	af
		inc		hl
		ld		a, (hl)
		call	p7Dsub_75FD
		jr		nz, p7Dloc_5768

p7Dloc_5762:
		inc		hl
		ld		a, (hl)
		ld		(de), a
		inc		de
		djnz	p7Dloc_5762

p7Dloc_5768:
		pop		af
		pop		bc
		pop		de
		pop		hl
		ret
; End of function p7Dsub_5757


; =============== S U B	R O U T	I N E =======================================


p7Dsub_576D:
		push	af
		ld		a, 1
		call	Page7D_2B83
		ld		b, a
		call	GetAppSpaceStartToA
		sub		b
		ld		b, 0
		ld		c, a
		ld		hl, tempSwapArea
		sla	c
		add		hl, bc
		ld		a, 0FFh
		ld		(hl), a
		inc		hl
		ld		(hl), a
		ld		a, 1
		call	Page7D_2B5F
		pop		af
		ret
; End of function p7Dsub_576D


; =============== S U B	R O U T	I N E =======================================


p7Dsub_578D:
		push	af
		ld		a, (unk_83A4)
		or		a
		jr		z, p7Dloc_57C3
		ld		hl, (unk_83A1)
		call	p7Dsub_57C5
		ld		a, h
		or		l
		jr		nz, p7Dloc_57B2
		ld		hl, (unk_839F)
		ld		a, h
		or		l
		jr		z, p7Dloc_57C3
		call	p7Dsub_57C5
		dec		hl
		call	p7Dsub_57C5
		ld		(unk_839F), hl
		ld		hl, 0

p7Dloc_57B2:
		dec		hl
		call	p7Dsub_57C5
		ld		(unk_83A1), hl
		ld		hl, (unk_839F)
		ld		a, l
		or		h
		jr		nz, p7Dloc_57C3
		ld		hl, (unk_83A1)

p7Dloc_57C3:
		pop		af
		ret
; End of function p7Dsub_578D


; =============== S U B	R O U T	I N E =======================================


p7Dsub_57C5:
		push	af
		ld		a, l
		ld		l, h
		ld		h, a
		pop		af
		ret
; End of function p7Dsub_57C5

; ---------------------------------------------------------------------------

Page7D_2B9B:
		push	bc
		push	de
		call	p7Dsub_5980
		jp		z, p7Dloc_5973
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8057h
; ---------------------------------------------------------------------------
		push	hl
		push	hl
		pop		bc
		rst		28h
; ---------------------------------------------------------------------------
		.dw		802Dh
; ---------------------------------------------------------------------------
		or		a
		sbc		hl, bc
		dec		hl
		ld		(appInfo), hl
		push	hl
		pop		bc
		pop		hl
		push	hl
		call	p7Dsub_4565
		dec		hl
		cp		0FFh
		jp		z, p7Dloc_5972
		cp		0
		jp		z, JErrorNo
		call	p7Dsub_42D3
		call	p7Dsub_5980
		jp		z, p7Dloc_5972
		pop		de
		inc		de
		ex		de, hl
		call	p7Dsub_597A
		ld		(OP2), a
		call	p7Dsub_40A6
		or		a
		ex		de, hl
		adc	hl, bc
		push	hl
		ld		de, 0A20h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_5832
		ld		a, h
		and		0Fh
		or		40h ; '@'
		ld		h, a
		call	p7Dsub_597A
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------

p7Dloc_5823:
		ld		b, 0
		push	bc
		call	p7Dsub_597A
		ex		de, hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		ex		de, hl
		pop		bc
		dec		c
		jr		nz, p7Dloc_5823

p7Dloc_5832:
		call	p7Dsub_5980
		jp		z, p7Dloc_5972
		ld		hl, 4000h
		ld		a, 7Ah ; 'z'
		ld		de, 8070h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		inc		hl
		ld		a, 7Ah ; 'z'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ld		bc, 4000h
		or		a
		sbc		hl, bc
		push	hl
		pop		bc
		ld		de, ramStart
		ld		hl, 4000h
		ld		a, 7Ah ; 'z'
		push	bc
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		pop		bc
		pop		de
		ld		hl, ramStart
		call	p7Dsub_597A
		push	bc
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		pop		bc
		push	de
		ld		hl, (appInfo)
		or		a
		adc	hl, bc
		ld		(appInfo), hl
		call	p7Dsub_75F5

p7Dloc_5877:
		call	ZeroOP1
		call	p7Dsub_638B
		call	OP2ToOP1
		jr		c, p7Dloc_58AD
		call	p7Dloc_61A4
		pop		de
		ld		bc, 4000h
		or		a
		sbc		hl, bc
		push	hl
		pop		bc
		or		a
		ld		hl, (appInfo)
		adc	hl, bc
		ld		(appInfo), hl
		ld		hl, 4000h
		push	af
		call	p7Dsub_597A
		ld		(OP2), a
		pop		af
		call	p7Dloc_40A9
		or		a
		ex		de, hl
		adc	hl, bc
		ex		de, hl
		push	de
		jr		p7Dloc_5877
; ---------------------------------------------------------------------------

p7Dloc_58AD:
		pop		de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		808Dh
; ---------------------------------------------------------------------------
		ld		hl, 4000h
		push	hl
		ld		hl, 0
		ld		(unk_839F), hl
		ld		hl, (appInfo)
		call	p7Dsub_57C5
		ld		(unk_83A1), hl
		pop		hl
		ld		a, 1
		ld		(unk_83A4), a

p7Dloc_58CA:
		ld		a, 1
		ld		(unk_83A3), a
		call	p7Dsub_597A
		ld		de, ramStart
		ld		bc, 1
		push	hl
		call	FlashToRam
		call	p7Dsub_5E0A
		call	p7Dsub_578D
		ld		a, h
		or		l
		pop		hl
		inc		hl
		jr		nz, p7Dloc_58CA
		inc		hl
		inc		hl
		push	hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8018h
; ---------------------------------------------------------------------------
		ld		hl, 0D02h
		ld		(OP1), hl
		ld		hl, OP1
		pop		de
		push	de
		dec		de
		dec		de
		ld		bc, 2
		call	p7Dsub_597A
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		call	p7Dsub_5980
		jp		z, p7Dloc_5972
		ld		de, 0A20h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		call	p7Dsub_4574
		inc		bc
		dec		hl
		ld		de, ramStart
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		ld		de, bigInteger1
		ld		b, 0
		ld		a, (unk_8291)
		ld		c, a
		ld		hl, 8291h
		inc		bc
		ldir
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80C0h
; ---------------------------------------------------------------------------
		pop		de
		ld		hl, OP1
		ld		b, 0
		ld		a, (hl)
		ld		c, a
		inc		bc
		call	p7Dsub_597A
		push	bc
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		ld		hl, (appInfo)
		pop		bc
		inc		bc
		inc		bc
		or		a
		adc	hl, bc
		ld		(unk_839F), hl
		call	p7Dsub_597A
		ld		(OP2), a
		call	p7Dsub_7700
		push	de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8057h
; ---------------------------------------------------------------------------
		ld		bc, 1D00h
		add		hl, bc
		pop		de
		ld		bc, 300h
		call	p7Dsub_40A6
		ld		hl, (unk_839F)
		ld		bc, 300h
		add		hl, bc
		ld		(unk_839F), hl
		ld		hl, 4000h
		xor		a
		pop		de
		pop		bc
		ret
; ---------------------------------------------------------------------------

p7Dloc_5972:
		pop		hl

p7Dloc_5973:
		pop		de
		pop		bc
		ld		a, 0FFh
		bit		7, a
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_597A:
		call	FindSwapSector
		inc		a
		inc		a
		ret
; End of function p7Dsub_597A


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5980:
		set		batteriesGood, (iy+batteryFlags)
		in		a, (2)
		bit		0, a
		ret		nz
		res		batteriesGood, (iy+batteryFlags)
		ret
; End of function p7Dsub_5980


; =============== S U B	R O U T	I N E =======================================


p7Dsub_598E:
		push	bc
		ld		de, 847Ch
		ld		b, 5

p7Dloc_5994:
		call	DivHLBy10
		add		a, 30h ; '0'
		ld		(de), a
		dec		de
		djnz	p7Dloc_5994
		sub		a
		ld		(OP1+4+1), a
		ex		de, hl
		ld		a, 30h ; '0'
		ld		b, 4

p7Dloc_59A6:
		inc		hl
		cp		(hl)
		jr		nz, p7Dloc_59AE
		ld		(hl), 20h ; ' '
		djnz	p7Dloc_59A6

p7Dloc_59AE:
		pop		bc
		call	j_VPutS
		ret
; End of function p7Dsub_598E

; ---------------------------------------------------------------------------

p7Dloc_59B3:
		push	af
		ld		de, 0E10h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80B1h
; ---------------------------------------------------------------------------
		ld		de, 18h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80B1h
; ---------------------------------------------------------------------------
		ld		hl, (OP1M)
		call	p7Dsub_57C5
		ld		de, 16Dh
		rst		28h
; ---------------------------------------------------------------------------
		.dw		804Bh
; ---------------------------------------------------------------------------
		push	de
		pop		hl
		ld		bc, 7CDh
		or		a
		adc	hl, bc
		call	p7Dsub_5A68
		or		a
		ld		hl, (OP1M)
		call	p7Dsub_57C5
		sbc		hl, bc
		call	p7Dsub_57C5
		ld		(OP1M), hl
		call	p7Dsub_57C5
		ld		de, 16Dh
		rst		28h
; ---------------------------------------------------------------------------
		.dw		804Bh
; ---------------------------------------------------------------------------
		push	de
		pop		hl
		ld		bc, 7CDh
		or		a
		adc	hl, bc
		push	hl
		ld		(tempSwapArea), hl
		ld		a, e
		ld		de, 16Dh
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8045h
; ---------------------------------------------------------------------------
		push	hl
		pop		bc
		ld		hl, (OP1M)
		call	p7Dsub_57C5
		or		a
		sbc		hl, bc
		ld		bc, 0

p7Dloc_5A10:
		push	hl
		ld		a, 2
		cp		c
		jr		nz, p7Dloc_5A26
		ld		hl, (tempSwapArea)
		call	p7Dsub_5AA5
		jr		nz, p7Dloc_5A26
		ld		hl, end_of_7D_table
		ld		e, (hl)
		inc		hl
		ld		d, (hl)
		jr		p7Dloc_5A31
; ---------------------------------------------------------------------------

p7Dloc_5A26:
		or		a
		ld		hl, start_of_7D_table
		adc	hl, bc
		adc	hl, bc
		ld		e, (hl)
		inc		hl
		ld		d, (hl)

p7Dloc_5A31:
		or		a
		pop		hl
		push	hl
		sbc		hl, de
		jr		c, p7Dloc_5A3C
		pop		hl
		inc		bc
		jr		p7Dloc_5A10
; ---------------------------------------------------------------------------

p7Dloc_5A3C:
		pop		hl
		push	hl
		dec		bc
		ld		a, 2
		cp		c
		jr		nz, p7Dloc_5A54
		ld		hl, (tempSwapArea)
		call	p7Dsub_5AA5
		jr		nz, p7Dloc_5A54
		ld		hl, end_of_7D_table
		ld		e, (hl)
		inc		hl
		ld		d, (hl)
		jr		p7Dloc_5A5F
; ---------------------------------------------------------------------------

p7Dloc_5A54:
		ld		hl, start_of_7D_table
		or		a
		adc	hl, bc
		adc	hl, bc
		ld		e, (hl)
		inc		hl
		ld		d, (hl)

p7Dloc_5A5F:
		pop		hl
		or		a
		sbc		hl, de
		pop		de
		inc		hl
		inc		bc
		pop		af
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_5A68:
		push	af
		push	hl
		push	de
		push	hl
		ld		bc, 7CDh
		or		a
		sbc		hl, bc
		pop		hl
		ret		c
		jr		z, p7Dloc_5A77
		dec		hl

p7Dloc_5A77:
		push	hl
		ld		de, 4
		rst		28h
; ---------------------------------------------------------------------------
		.dw		804Bh
; ---------------------------------------------------------------------------
		pop		hl
		push	de
		push	hl
		ld		de, 64h	; 'd'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		804Bh
; ---------------------------------------------------------------------------
		pop		hl
		push	de
		ld		de, 190h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		804Bh
; ---------------------------------------------------------------------------
		pop		bc
		pop		hl
		push	de
		or		a
		sbc		hl, bc
		pop		bc
		or		a
		adc	hl, bc
		ld		bc, 1E4h
		or		a
		sbc		hl, bc
		push	hl
		pop		bc
		pop		de
		pop		hl
		pop		af
		ret
; End of function p7Dsub_5A68


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5AA5:
		push	hl
		ld		de, 4
		rst		28h
; ---------------------------------------------------------------------------
		.dw		804Bh
; ---------------------------------------------------------------------------
		ld		a, l
		or		h
		jr		nz, p7Dloc_5ACA
		pop		hl
		push	hl
		ld		de, 64h	; 'd'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		804Bh
; ---------------------------------------------------------------------------
		ld		a, l
		or		h
		jr		nz, p7Dloc_5AC6
		pop		hl
		push	hl
		ld		de, 190h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		804Bh
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_5ACA

p7Dloc_5AC6:
		ld		a, 0
		bit		7, a

p7Dloc_5ACA:
		pop		hl
		ret
; End of function p7Dsub_5AA5

; ---------------------------------------------------------------------------

Page7D_2BA7:
		push	hl
		push	bc
		push	de
		push	af
		ld		de, ramStart
		ld		bc, 100h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		pop		af
		pop		de
		pop		bc
		pop		hl
		ret
; ---------------------------------------------------------------------------

Page7D_2C07:
		push	hl
		push	bc
		push	af
		call	j_ClrScrnFull
		call	j_HomeUp
		ld		hl, aIdlist
		ld		a, 3Dh ; '='
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	p7Dsub_7045
		call	Page0Call_23DE
		jr		c, p7Dloc_5B0D
		ld		a, (de)
		ld		hl, (curRow+1)
		ld		bc, 5
		adc	hl, bc
		ld		(curRow+1), hl
		ld		l, a
		ld		h, 0
		call	j_DispHL

p7Dloc_5B0D:
		pop		af
		pop		bc
		pop		hl
		ret
; ---------------------------------------------------------------------------

Page7D_2E53:
		call	Page0Call_23DE
		jr		c, locret_5B2E
		push	af
		ld		a, (de)
		ld		l, a
		inc		de
		ld		a, (de)
		ld		h, a
		dec		de
		ld		a, l
		or		h
		jr		z, p7Dloc_5B2A
		pop		af
		ld		bc, 1
		call	j_dellistel
		jr		Page7D_2E53
; ---------------------------------------------------------------------------

p7Dloc_5B2A:
		pop		af
		call	Page0Call_23D4

locret_5B2E:
		ret
; ---------------------------------------------------------------------------

Page7D_2BBF:
		push	af
		ld		de, 0A10h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_5B49
		call	p7Dsub_4574
		ld		de, OP2
		ld		b, c
		ld		a, 7Eh ; '~'
		call	p7Dsub_761F
		pop		af
		call	p7Dsub_5B4D
		ret
; ---------------------------------------------------------------------------

p7Dloc_5B49:
		pop		af
		scf
		ccf
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_5B4D:
		push	bc
		push	de
		call	p7Dsub_7656
		ld		hl, 4003h
		ld		(appSearchPage), a

p7Dloc_5B58:
		push	hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		cp		3
		jr		z, p7Dloc_5B67
		cp		0FFh
		jr		z, p7Dloc_5BA8
		pop		hl
		jr		p7Dloc_5BC2
; ---------------------------------------------------------------------------

p7Dloc_5B67:
		ld		a, (appSearchPage)
		call	p7Dloc_442C
		push	bc
		push	de
		ld		hl, OP2
		pop		de
		pop		bc
		jr		nz, p7Dloc_5BC2
		ld		b, c

p7Dloc_5B77:
		ld		a, (hl)
		ld		c, a
		ex		de, hl
		ld		a, (appSearchPage)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ex		de, hl
		cp		c
		jr		nz, p7Dloc_5B8E
		inc		de
		inc		hl
		djnz	p7Dloc_5B77
		pop		hl
		ld		a, (appSearchPage)
		jr		p7Dloc_5BC6
; ---------------------------------------------------------------------------

p7Dloc_5B8E:
		pop		hl
		inc		hl
		ld		a, (appSearchPage)
		push	de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		pop		de
		or		a
		adc	hl, bc
		inc		hl
		ld		a, (appSearchPage)
		push	de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		pop		de
		adc	hl, bc
		jr		p7Dloc_5B58
; ---------------------------------------------------------------------------

p7Dloc_5BA8:
		pop		hl
		ld		a, (appSearchPage)
		inc		a
		ld		(appSearchPage), a
		call	NZIf83Plus
		jr		nz, p7Dloc_5BB9
		cp		6Ch ; 'l'
		jr		p7Dloc_5BBB
; ---------------------------------------------------------------------------

p7Dloc_5BB9:
		cp		18h

p7Dloc_5BBB:
		jr		z, p7Dloc_5BC2
		ld		hl, 4000h
		jr		p7Dloc_5B58
; ---------------------------------------------------------------------------

p7Dloc_5BC2:
		scf
		ccf
		jr		p7Dloc_5BC7
; ---------------------------------------------------------------------------

p7Dloc_5BC6:
		scf

p7Dloc_5BC7:
		pop		de
		pop		bc
		ret
; End of function p7Dsub_5B4D

; ---------------------------------------------------------------------------

Page7D_2BC5:
		push	de
		push	bc
		push	hl
		ld		(appSearchPage), a
		call	p7Dsub_4894
		call	p7Dsub_457C
		ld		a, (appSearchPage)
		pop		hl
		call	p7Dloc_529F
		pop		bc
		pop		de
		ret
; ---------------------------------------------------------------------------

Page7D_3C51:
		ld		(Abackup), a
		ld		a, i
		di
		push	af
		ld		a, (Abackup)
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		push	de
		push	bc

p7Dloc_5BFD:
		ld		de, 410h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_5C0A
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80AEh
; ---------------------------------------------------------------------------
		jr		p7Dloc_5BFD
; ---------------------------------------------------------------------------

p7Dloc_5C0A:
		call	p7Dsub_4574
		ld		de, OP2
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ld		(de), a
		inc		de
		call	p7Dsub_4565
		ld		(de), a
		ld		hl, OP2
		pop		bc
		pop		de
		call	relockFlashBack
		ld		(Abackup), a
		pop		af
		jp		po, p7Dloc_5C29
		ei

p7Dloc_5C29:
		ld		a, (Abackup)
		ret
; ---------------------------------------------------------------------------

p7Dloc_5C2D:
		ld		hl, 4000h
		ld		de, 8090h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		ret
; ---------------------------------------------------------------------------

Page7D_2C19:
		push	hl
		call	p7Dsub_7656
		ld		hl, 4000h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		cp		0
		pop		hl
		ret
; ---------------------------------------------------------------------------

Page7D_2BD7:
		push	de
		push	bc
		push	af
		push	hl
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		ld		de, 4000h
		ld		b, 0
		call	p7Dsub_7656
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80C6h
; ---------------------------------------------------------------------------
		pop		hl
		push	hl
		ld		b, l
		call	p7Dsub_7656
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80C6h
; ---------------------------------------------------------------------------
		pop		hl
		ld		b, h
		call	p7Dsub_7656
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80C6h
; ---------------------------------------------------------------------------
		pop		af
		pop		bc
		pop		de
		jp		relockFlashBack
; ---------------------------------------------------------------------------

Page7D_3C4B:
		push	hl

p7Dloc_5C7D:
		ld		a, (ix+0)
		push	bc
		call	p7Dsub_5C8E
		pop		bc
		inc		ix
		djnz	p7Dloc_5C7D
		call	p7Dsub_6503
		pop		hl
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_5C8E:
		ld		a, (ix+0)
		push	af
		and		0F0h ; '�'
		srl	a
		srl	a
		srl	a
		srl	a
		ld		b, 2

p7Dloc_5C9E:
		push	af
		sub		0Ah
		jr		c, p7Dloc_5CB2
		pop		af
		add		a, 37h ; '7'
		ld		(hl), a
		inc		hl
		dec		b
		ld		a, b
		or		b
		jr		z, p7Dloc_5CC1
		pop		af
		and		0Fh
		jr		p7Dloc_5C9E
; ---------------------------------------------------------------------------

p7Dloc_5CB2:
		pop		af
		add		a, 30h ; '0'
		ld		(hl), a
		inc		hl
		dec		b
		ld		a, b
		or		b
		jr		z, p7Dloc_5CC1
		pop		af
		and		0Fh
		jr		p7Dloc_5C9E
; ---------------------------------------------------------------------------

p7Dloc_5CC1:
		ld		a, 0
		ld		(hl), a
		ret
; End of function p7Dsub_5C8E

; ---------------------------------------------------------------------------

Page7D_3C57:
		push	hl
		push	bc
		push	de
		ld		a, (hl)
		push	af
		and		0F0h ; '�'
		srl	a
		srl	a
		srl	a
		srl	a
		ld		b, 2

p7Dloc_5CD6:
		push	af
		sub		0Ah
		jr		c, p7Dloc_5CEB
		pop		af
		add		a, 37h ; '7'
		call	j_VPutMap
		dec		b
		ld		a, b
		or		b
		jr		z, p7Dloc_5CFB
		pop		af
		and		0Fh
		jr		p7Dloc_5CD6
; ---------------------------------------------------------------------------

p7Dloc_5CEB:
		pop		af
		add		a, 30h ; '0'
		call	j_VPutMap
		dec		b
		ld		a, b
		or		b
		jr		z, p7Dloc_5CFB
		pop		af
		and		0Fh
		jr		p7Dloc_5CD6
; ---------------------------------------------------------------------------

p7Dloc_5CFB:
		pop		de
		pop		bc
		pop		hl
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_5CFF:
		push	af
		push	bc
		push	hl
		push	de
		push	af
		ld		a, c
		or		b
		jr		z, p7Dloc_5D18
		ld		de, MD5Buffer

p7Dloc_5D0B:
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		ld		(de), a
		inc		de
		inc		hl
		dec		bc
		ld		a, c
		or		b
		jr		nz, p7Dloc_5D0B

p7Dloc_5D18:
		pop		af
		pop		de
		pop		hl
		pop		bc
		pop		af
		ret
; End of function p7Dsub_5CFF


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5D1E:
		push	bc
		push	de
		push	af
		ld		b, a
		ld		a, 0
		or		c
		jr		z, p7Dloc_5D3D
		ld		a, b
		ld		de, MD5Buffer
		ld		b, c
		ld		hl, 0
		ld		a, (de)
		ld		l, a
		dec		b
		ld		a, b
		or		b
		jr		z, p7Dloc_5D3F
		inc		de
		ld		a, l
		ld		h, a
		ld		a, (de)
		ld		h, a
		jr		p7Dloc_5D3F
; ---------------------------------------------------------------------------

p7Dloc_5D3D:
		ld		h, a
		ld		l, a

p7Dloc_5D3F:
		pop		af
		pop		de
		pop		bc
		ret
; End of function p7Dsub_5D1E


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5D43:
		push	hl
		push	de
		push	af
		ld		b, a
		ld		a, 0
		or		c
		jr		z, p7Dloc_5D62
		ld		a, b
		ld		hl, MD5Buffer
		ld		e, c
		ld		bc, 0
		ld		a, (hl)
		ld		c, a
		dec		e
		ld		a, e
		or		e
		jr		z, p7Dloc_5D64
		inc		hl
		ld		a, c
		ld		b, a
		ld		a, (hl)
		ld		c, a
		jr		p7Dloc_5D64
; ---------------------------------------------------------------------------

p7Dloc_5D62:
		ld		b, a
		ld		c, a

p7Dloc_5D64:
		pop		af
		pop		de
		pop		hl
		ret
; End of function p7Dsub_5D43


; =============== S U B	R O U T	I N E =======================================


Page7D_2E41:
		push	af
		push	hl
		call	GetFirstInvalidAppPageToB
		ld		e, b
		ld		d, 0
		push	de
		inc		b
		ld		c, 0
		ld		a, 8

p7Dloc_5D76:
		cp		b
		jr		z, p7Dloc_5DC2
		jr		nc, p7Dloc_5DC0
		push	bc
		ld		hl, 4000h
		push	af
		call	LoadAIndPaged_Copy
		cp		0FEh ; '�'
		jr		nz, p7Dloc_5D8D
		pop		af
		add		a, 4

p7Dloc_5D8A:
		pop		bc
		jr		p7Dloc_5D76
; ---------------------------------------------------------------------------

p7Dloc_5D8D:
		cp		0FFh
		jr		z, p7Dloc_5D9F
		pop		af
		pop		bc
		pop		de
		push	af
		ld		a, c
		add		a, d
		ld		d, a
		pop		af
		push	de
		ld		c, 0
		push	bc
		push	af
		inc		hl

p7Dloc_5D9F:
		pop		af
		ld		c, 0FFh
		call	Page7D_2B6B
		ld		bc, 4000h
		or		a
		sbc		hl, bc
		jr		nz, p7Dloc_5DB0
		pop		bc
		inc		c
		push	bc

p7Dloc_5DB0:
		; Page7D_2E41+56j
		inc		a
		pop		bc
		cp		b
		jr		z, p7Dloc_5DC2
		push	bc
		call	p7Dsub_67EC
		jr		z, p7Dloc_5D8A
		pop		bc
		inc		c
		push	bc
		jr		p7Dloc_5DB0
; ---------------------------------------------------------------------------

p7Dloc_5DC0:
		xor		a
		ld		c, a

p7Dloc_5DC2:
		; Page7D_2E41+4Bj
		ld		b, c
		pop		de
		pop		hl
		pop		af
		ret
; End of function Page7D_2E41


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5DC7:
		call	Page7D_2E41
		ld		c, e
		push	bc
		push	de
		ld		a, 1
		ld		hl, ramStart
		ld		de, 8080h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		inc		hl
		ld		a, 1
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ld		a, (hl)
		pop		de
		ld		e, d
		ld		d, a
		pop		bc
		sub		b
		ret
; End of function p7Dsub_5DC7

; ---------------------------------------------------------------------------

Page7D_2BEF:
		push	hl
		push	bc
		push	de
		push	hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		802Dh
; ---------------------------------------------------------------------------
		ex		de, hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8057h
; ---------------------------------------------------------------------------
		ex		de, hl
		or		a
		sbc		hl, de
		ex		de, hl
		ld		hl, 1F18h
		call	NZIf83Plus
		jr		nz, p7Dloc_5E00
		ld		hl, 1DEAh

p7Dloc_5E00:
		or		a
		sbc		hl, de
		pop		bc
		sbc		hl, bc
		pop		de
		pop		bc
		pop		hl
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_5E0A:
		; p7Dsub_7240:p7Dloc_739Bp
		ld		a, (unk_83A3)
		ld		b, a
		ld		c, 0
		or		c
		jr		z, p7Dloc_5E23
		ld		hl, ramStart

p7Dloc_5E16:
		push	bc
		push	hl
		ld		bc, 1
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8090h
; ---------------------------------------------------------------------------
		pop		hl
		inc		hl
		pop		bc
		djnz	p7Dloc_5E16

p7Dloc_5E23:
		ld		a, 0
		ld		(unk_83A3), a
		ret
; End of function p7Dsub_5E0A

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR Page7D_2C97

p7Dloc_5E29:
		; p7Dsub_5E59+9j
		ld		a, 0Ch
		call	Page0Call_2C49
		jp		JErrorNo
; END OF FUNCTION CHUNK	FOR Page7D_2C97

; =============== S U B	R O U T	I N E =======================================


p7Dsub_5E31:
		ld		hl, 4000h
; End of function p7Dsub_5E31


; =============== S U B	R O U T	I N E =======================================


Page7D_2C97:
		; p7Dsub_7240+1FBp ...



		push	af
		ld		de, 8010h
		push	af
		or		a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jp		nz, p7Dloc_5E29
		inc		hl
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ld		de, appID
		ld		a, 7
		ld		(de), a
		ld		de, 838Fh
		ld		(appID+1), bc
		pop		af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		pop		af
		ret
; End of function Page7D_2C97


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5E59:
		push	af
		ld		de, 8010h
		push	af
		or		a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jp		nz, p7Dloc_5E29
		inc		hl
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ld		de, 838Eh
		ld		(appID), bc
		pop		af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		pop		af
		ret
; End of function p7Dsub_5E59


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5E78:
		ld		b, a
		call	GetAppSpaceStartToA
		sub		b
		ld		b, 0
		ld		c, a
		push	bc
		pop		ix
		call	p7Dsub_48B5
		jr		c, locret_5E8F
		jr		z, locret_5E8F
		push	af
		call	p7Dsub_5365
		pop		af

locret_5E8F:
		ret
; End of function p7Dsub_5E78


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5E90:
		push	af
		push	af
		ld		a, 1
		or		a
		ld		hl, ramStart
		ld		de, 8060h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_5EB5
		ld		hl, ramStart
		ld		de, 8050h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_5EB0
		ld		de, 80h	; '�'
		jr		p7Dloc_5EDD
; ---------------------------------------------------------------------------

p7Dloc_5EB0:
		ld		de, 0
		jr		p7Dloc_5EDD
; ---------------------------------------------------------------------------

p7Dloc_5EB5:
		inc		hl
		ld		a, 1
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ld		a, 1
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		push	af
		ld		b, 9
		sub		b
		jr		c, p7Dloc_5ED6
		pop		af
		ld		b, 8
		sub		b
		call	p7Dsub_4E9B
		ld		d, a
		ld		a, 8
		call	p7Dsub_4E9B
		ld		e, a
		jr		p7Dloc_5EDD
; ---------------------------------------------------------------------------

p7Dloc_5ED6:
		ld		d, 0
		pop		af
		call	p7Dsub_4E9B
		ld		e, a

p7Dloc_5EDD:
		pop		af
		ld		b, a
		call	GetAppSpaceStartToA
		sub		b
		ld		bc, 0
		ld		c, a
		call	Page7D_2B65
		sla	c
		add		hl, bc
		ld		b, e
		ex		de, hl
		push	hl
		call	p7Dsub_456D
		pop		hl
		ex		de, hl
		ld		b, d
		ex		de, hl
		call	p7Dsub_456D
		pop		af
		ret
; End of function p7Dsub_5E90


; =============== S U B	R O U T	I N E =======================================


p7Dsub_5EFC:
		push	hl
		push	bc
		push	de
		push	hl
		pop		de
		ld		b, a
		ld		c, 8
		sub		c
		jr		c, p7Dloc_5F25
		call	GetAppSpaceStartToA
		inc		a
		ld		c, a
		ld		a, b
		sub		c
		jr		nc, p7Dloc_5F25
		ld		bc, 4000h
		or		a
		sbc		hl, bc
		jr		c, p7Dloc_5F25
		push	de
		pop		hl
		or		a
		ld		bc, ramStart
		sbc		hl, bc
		jr		nc, p7Dloc_5F25
		or		a
		jr		p7Dloc_5F26
; ---------------------------------------------------------------------------

p7Dloc_5F25:
		scf

p7Dloc_5F26:
		pop		de
		pop		bc
		pop		hl
		ret
; End of function p7Dsub_5EFC

; ---------------------------------------------------------------------------

Page7D_2BF5:
		push	hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8057h
; ---------------------------------------------------------------------------
		ld		de, 0A10h
		call	p7Dsub_777E
		jp		z, JError
		pop		hl
		ld		de, 0A10h
		call	p7Dsub_777E
		jp		nz, JError
		ex		de, hl
		push	de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		802Dh
; ---------------------------------------------------------------------------
		pop		de
		ld		bc, 2
		ex		de, hl

p7Dloc_5F4B:
		push	bc
		call	p7Dsub_4566
		ld		b, a
		push	hl
		call	p7Dsub_456D
		pop		hl
		call	p7Dsub_4565
		ld		b, a
		push	hl
		call	p7Dsub_456D
		pop		hl
		push	de
		push	hl
		call	p7Dloc_4575
		pop		de
		push	bc
		push	hl
		sbc		hl, de
		ld		b, l
		dec		b
		pop		hl
		ld		a, 0
		cp		b
		jr		z, p7Dloc_5F74

p7Dloc_5F70:
		inc		a
		dec		hl
		djnz	p7Dloc_5F70

p7Dloc_5F74:
		pop		bc
		pop		de
		or		a
		adc	a, c
		ld		c, a
		ld		a, 7Eh ; '~'
		push	de
		push	bc
		ld		de, MD5Buffer
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		push	hl
		ld		hl, MD5Buffer
		call	p7Dsub_5F9F
		pop		hl
		pop		bc
		pop		de
		push	hl
		ld		hl, MD5Buffer
		ld		a, 7Eh ; '~'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		pop		hl
		pop		bc
		dec		c
		ld		a, c
		cp		0
		jr		nz, p7Dloc_5F4B
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_5F9F:
		push	hl
		ld		a, (hl)
		cp		0
		jr		nz, p7Dloc_5FBD
		push	hl
		ld		d, (hl)
		inc		hl
		ld		e, (hl)
		push	de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80C3h
; ---------------------------------------------------------------------------
		push	de
		pop		bc
		pop		de
		ex		de, hl
		ld		h, b
		ld		a, l
		and		0Fh
		or		a
		adc	a, c
		ld		l, a
		ex		de, hl
		pop		hl
		ld		(hl), e
		inc		hl
		ld		(hl), d

p7Dloc_5FBD:
		pop		hl
		ret
; End of function p7Dsub_5F9F

; ---------------------------------------------------------------------------
start_of_7D_table:
		.db		0
		.db		0
		.db		1Fh
		.db		0
		.db		3Bh	; ;
		.db		0
		.db		5Ah	; Z
		.db		0
		.db		78h	; x
		.db		0
		.db		97h	; �
		.db		0
		.db		0B5h	; �
		.db		0
		.db		0D4h	; �
		.db		0
		.db		0F3h	; �
		.db		0
		.db		11h
		.db		1
		.db		30h	; 0
		.db		1
		.db		4Eh	; N
		.db		1
		.db		0FFh
		.db		0FFh
end_of_7D_table:
		.db		3Ch	; <
		.db		0

; =============== S U B	R O U T	I N E =======================================


relockFlashBack:
		push	af
		xor		a
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		or		a
		jp		nz, 0
		pop		af
		ret
; End of function relockFlashBack


; =============== S U B	R O U T	I N E =======================================


Page7D_3E0D:
		ld		(Abackup), a
		ld		a, i
		di
		push	af
		ld		a, (Abackup)
		call	relockFlashBack
		ld		(Abackup), a
		pop		af
		jp		po, p7Dloc_6002
		ei

p7Dloc_6002:
		ld		a, (Abackup)
		ret
; End of function Page7D_3E0D


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6006:
		; p7Dsub_53B3:p7Dloc_53D1p
		push	af
		push	bc
		push	af
		pop		bc
		ld		a, c
		ld		(unk_83EA), a
		pop		bc
		pop		af
		ret
; End of function p7Dsub_6006


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6011:
		ld		(unk_83EC), a
		push	bc
		ld		b, a
		ld		a, (unk_83EA)
		ld		c, a
		push	bc
		pop		af
		pop		bc
		ld		a, (unk_83EC)
		ret
; End of function p7Dsub_6011


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6021:
		call	p7Dsub_75F5

p7Dloc_6024:
		ld		a, (appID)
		ld		c, a
		ld		b, 0
		ld		hl, 838Eh
		ld		de, ramStart
		ld		(de), a
		inc		de
		ldir
		call	p7Dsub_607A
		push	af
		ld		a, (ramStart)
		ld		c, a
		ld		b, 0
		ld		hl, 8001h
		ld		de, appID
		ld		(de), a
		inc		de
		ldir
		pop		af
		ret		c
		call	p7Dsub_6067
		jr		nz, p7Dloc_6053
		or		a
		jp		p7Dloc_61A4
; ---------------------------------------------------------------------------

p7Dloc_6053:
		push	af
		ld		a, (ramStart)
		ld		c, a
		ld		b, 0
		ld		hl, 8001h
		ld		de, appID
		ld		(de), a
		inc		de
		ldir
		pop		af
		jr		p7Dloc_6024
; End of function p7Dsub_6021


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6067:
		ld		de, OP2
		ld		hl, appID
		ld		a, (de)
		ld		c, (hl)
		cp		c
		ret		nz
		ld		b, c

p7Dloc_6072:
		inc		hl
		inc		de
		ld		a, (de)
		cp		(hl)
		ret		nz
		djnz	p7Dloc_6072
		ret
; End of function p7Dsub_6067


; =============== S U B	R O U T	I N E =======================================


p7Dsub_607A:
		ld		de, appSearchPage
		ld		a, (de)
		or		a
		jr		z, locret_60E4
		dec		a
		ld		(de), a
		cp		7
		jr		nz, p7Dloc_608A
		scf
		jr		locret_60E4
; ---------------------------------------------------------------------------

p7Dloc_608A:
		ld		a, (appSearchPage)
		ld		hl, 4000h
		call	j_IsAHLAtValidAppHeader
		jr		nz, p7Dsub_607A
		ld		de, 8010h
		or		a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		nz, p7Dsub_607A
		ld		a, (appSearchPage)
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ld		a, (appSearchPage)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		or		a
		jr		z, p7Dsub_607A
		inc		a
		jr		z, p7Dsub_607A
		ld		a, (appSearchPage)
		push	hl
		push	bc
		call	p7Dsub_5E31
		call	Page7D_2B59
		jr		z, p7Dloc_60C2
		pop		bc
		pop		hl
		jr		p7Dsub_607A
; ---------------------------------------------------------------------------

p7Dloc_60C2:
		call	ZeroOP2
		pop		bc
		pop		hl
		ld		a, b
		or		a
		jr		nz, p7Dloc_60D2
		xor		a
		ld		a, c
		ld		e, 9
		sub		e
		jr		c, p7Dloc_60D5

p7Dloc_60D2:
		ld		bc, 8

p7Dloc_60D5:
		ld		a, c
		ld		(OP2), a
		ld		a, (appSearchPage)
		ld		de, 8484h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		scf
		ccf

locret_60E4:
		ret
; End of function p7Dsub_607A

; ---------------------------------------------------------------------------

FindAppUp:
		ld		a, 1
		jr		p7Dloc_60EA
; ---------------------------------------------------------------------------

FindAppDn:
		xor		a

p7Dloc_60EA:
		ld		bc, 0
		push	bc
		call	OP1ToOP3
		push	af
		ld		a, (unk_9C87)
		cp		69h ; 'i'
		call	nz, p7Dsub_7BA4
		call	p7Dsub_75F5
		pop		af

p7Dloc_60FE:
		push	af
		call	p7Dsub_6388
		pop		hl
		ld		a, h
		jr		c, p7Dloc_6140
		push	af
		ld		a, (unk_9C87)
		cp		69h ; 'i'
		ld		a, (appSearchPage)
		call	nz, p7Dsub_7BAF
		pop		af
		call	p7Dsub_6172
		jr		c, p7Dloc_612E
		bit		3, c
		jr		nz, p7Dloc_60FE
		pop		bc
		inc		b
		push	bc
		bit		0, a
		jr		nz, p7Dloc_60FE
		bit		1, a
		jr		z, p7Dloc_6163
		call	p7Dloc_6177
		jr		c, p7Dloc_6165
		jr		p7Dloc_60FE
; ---------------------------------------------------------------------------

p7Dloc_612E:
		pop		bc
		inc		c
		push	bc
		bit		0, a
		jr		z, p7Dloc_60FE
		bit		1, a
		jr		z, p7Dloc_6163
		call	p7Dloc_6177
		jr		c, p7Dloc_60FE
		jr		p7Dloc_6165
; ---------------------------------------------------------------------------

p7Dloc_6140:
		call	OP3ToOP1
		res		0, a
		sub		2
		pop		bc
		push	af
		ld		a, (OP3+9)
		ld		d, a
		xor		a
		ld		(OP3+9), a
		ld		(OP1+9), a
		ld		a, (unk_9C87)
		cp		1
		ld		a, 69h ; 'i'
		jr		nz, p7Dloc_615E
		xor		a

p7Dloc_615E:
		ld		(unk_9C87), a
		pop		af
		ret
; ---------------------------------------------------------------------------

p7Dloc_6163:
		set		1, a

p7Dloc_6165:
		call	OP2ToOP3
		push	af
		ld		a, (appSearchPage)
		ld		(OP3+9), a
		pop		af
		jr		p7Dloc_60FE

; =============== S U B	R O U T	I N E =======================================


p7Dsub_6172:
		ld		de, 8480h
		jr		p7Dloc_617A
; ---------------------------------------------------------------------------

p7Dloc_6177:
		ld		de, 8496h

p7Dloc_617A:
		push	af
		ld		hl, 848Bh
		ld		b, 8
		call	j_CmpSyms
		pop		hl
		ld		a, h
		ret
; End of function p7Dsub_6172


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6186:
		call	p7Dsub_75F5

p7Dloc_6189:
		call	p7Dsub_638B
		ret		c
		call	p7Dsub_6172
		bit		3, c
		jr		z, p7Dloc_6189
		jr		p7Dloc_61A4
; ---------------------------------------------------------------------------

FindApp:
		call	p7Dsub_75F5

p7Dloc_6199:
		call	p7Dsub_6388
		ret		c
		call	p7Dsub_6172
		bit		3, c
		jr		z, p7Dloc_6199

p7Dloc_61A4:
		ld		a, (appSearchPage)
		or		a
		push	bc
		ld		de, 8070h
		ld		hl, 4000h
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		pop		af
		inc		hl
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		pop		af
		pop		bc
		ret
; End of function p7Dsub_6186

; ---------------------------------------------------------------------------

p7Dloc_61BC:
		call	j_ForceFullScreen
		res		textEraseBelow, (iy+textFlags)
		push	af
		call	j_ClrLCD
		pop		af
		push	af
		ld		hl, 4000h
		ld		de, 8040h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		inc		hl
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		pop		af
		push	af
		call	p7Dsub_5CFF
		ld		hl, MD5Buffer
		or		a
		adc	hl, bc
		ld		(hl), 0
		ld		a, 24h ; '$'
		sub		c
		ld		l, a
		ld		h, 5
		ld		(penCol), hl
		ld		hl, MD5Buffer
		call	j_VPutS
		bit		localizeHookActive, (iy+hookflags3)
		jr		z, p7Dloc_6201
		ld		a, 50h ; 'P'
		call	j_call_character_hook
		jr		z, p7Dloc_620C

p7Dloc_6201:
		ld		hl, aCCopyright1998-2
		ld		de, tempSwapArea
		ld		bc, 19h
		ldir

p7Dloc_620C:
		ld		hl, tempSwapArea
		call	p7Dsub_62B3
		ld		hl, aTexasInstrumentsInc-2
		call	p7Dsub_62B3
		pop		af
		push	af
		call	p7Dloc_54A0
		jr		nz, p7Dloc_6270
		pop		af
		push	af
		call	Page7D_2C9D
		jr		z, p7Dloc_6237
		ld		hl, aExpiredOn-2
		ld		a, 51h ; 'Q'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	p7Dsub_62B3
		jr		p7Dloc_6246
; ---------------------------------------------------------------------------

p7Dloc_6237:
		ld		hl, aExpirationDate-2
		ld		a, 52h ; 'R'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	p7Dsub_62B3

p7Dloc_6246:
		pop		af
		push	af
		call	p7Dloc_54A0
		call	p7Dloc_59B3
		push	de
		push	hl
		push	bc
		pop		hl
		call	p7Dsub_598E
		ld		a, (p7Dloc_6385)
		call	j_VPutMap
		pop		hl
		call	p7Dsub_598E
		ld		a, (p7Dloc_6385)
		call	j_VPutMap
		pop		hl
		call	p7Dsub_598E
		pop		af
		push	af
		call	Page7D_2C9D
		jr		z, p7Dloc_629B

p7Dloc_6270:
		pop		af
		push	af
		call	p7Dloc_543D
		jr		nz, p7Dloc_629B
		ld		hl, aTrialsRemaining-2
		ld		a, 53h ; 'S'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	p7Dsub_62B3
		ld		a, (OP1)
		ld		hl, OP1
		call	p7Dsub_650D
		ld		a, (OP1)
		call	j_VPutMap
		ld		a, (OP1+1)
		call	j_VPutMap

p7Dloc_629B:
		pop		af
		ld		hl, aPressAnyKey___-2
		ld		a, 54h ; 'T'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	p7Dsub_62B3
		ei
		call	j_getkey
		call	Page0Call_3837
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_62B3:
		push	hl
		call	ldHLind
		ld		(penCol), hl
		pop		hl
		inc		hl
		inc		hl
		call	j_VPutS
		ret
; End of function p7Dsub_62B3

; ---------------------------------------------------------------------------

Page7D_2CAF:
		call	Page0Call_2E65
		ld		hl, progToEdit
		ld		de, 8479h
		call	Mov8B
		xor		a
		call	FindApp
		jr		c, p7Dloc_6345
		push	hl
		push	af
		call	FillBasePageTable
		call	j_RunIndicOff
		di
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		pop		af
		push	af
		call	p7Dsub_5E31
		call	Page7D_2B59
		jr		nz, p7Dloc_631D
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80A8h
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_6305
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8096h
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_6348

p7Dloc_6305:
		pop		af
		push	af
		ld		hl, 4000h
		call	p7Dsub_5E59
		call	p7Dsub_52D9
		jr		c, p7Dloc_6314
		jr		z, p7Dloc_6348

p7Dloc_6314:
		pop		af
		push	af
		call	p7Dsub_5E78
		jr		c, p7Dloc_6348
		jr		nz, p7Dloc_6348

p7Dloc_631D:
		pop		af
		pop		hl
		push	af
		call	p7Dsub_5E31
		call	Chk_Batt_Low
		jr		z, p7Dloc_6344
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80A8h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_6332
		pop		af
		push	af
		call	p7Dsub_576D

p7Dloc_6332:
		pop		af
		call	Page7D_2BE3
		call	Page0Call_2E65
		call	j_ClrScrn
		ld		hl, 0
		ld		(curRow), hl
		jr		p7Dloc_6345
; ---------------------------------------------------------------------------

p7Dloc_6344:
		pop		af

p7Dloc_6345:
		jp		Page0Call_2539
; ---------------------------------------------------------------------------

p7Dloc_6348:
		pop		af
		ld		(appPage), a
		call	p7Dsub_6FC0
		jp		nz, Page0Call_2555
		call	NZIf83Plus
		call	z, p7Dsub_6FF9
		ld		a, (appPage)
		call	p7Dloc_5C2D
		jr		z, p7Dloc_6366
		ld		a, (appPage)
		call	p7Dloc_61BC

p7Dloc_6366:
		call	relockFlashBack
		ld		a, (appPage)
		pop		hl
		ei
		ret
; ---------------------------------------------------------------------------
		.dw		0D14h
aCCopyright1998:.asc '(c) Copyright 1998',0
; ---------------------------------------------------------------------------

p7Dloc_6384:
		nop

p7Dloc_6385:				; DATA XREF: seg001:6255r seg001:625Fr
		cpl
		nop
		nop

; =============== S U B	R O U T	I N E =======================================


p7Dsub_6388:
		; p7Dsub_6186:p7Dloc_6199p
		scf
		jr		p7Dloc_638D
; End of function p7Dsub_6388


; =============== S U B	R O U T	I N E =======================================


p7Dsub_638B:
		; p7Dsub_6186:p7Dloc_6189p ...
		scf
		ccf

p7Dloc_638D:
		push	af

p7Dloc_638E:
		ld		de, appSearchPage
		ld		a, (de)
		dec		a
		ld		(de), a
		cp		7
		jr		nz, p7Dloc_639B
		pop		af
		scf
		ret
; ---------------------------------------------------------------------------

p7Dloc_639B:
		ld		a, (unk_9C87)
		cp		69h ; 'i'
		jr		nz, p7Dloc_63C8
		ld		a, (appSearchPage)
		call	p7Dsub_7BB5
		jr		z, p7Dloc_638E
		ld		a, (appSearchPage)
		ld		hl, 4000h

p7Dloc_63B0:
		ld		de, 8040h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		z, p7Dloc_63BF

p7Dloc_63B8:
		ld		a, 1
		ld		(unk_9C87), a
		jr		p7Dloc_638E
; ---------------------------------------------------------------------------

p7Dloc_63BF:
		inc		hl
		ld		a, (appSearchPage)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		jr		p7Dloc_6407
; ---------------------------------------------------------------------------

p7Dloc_63C8:
		ld		a, (de)
		ld		hl, 4000h
		call	j_IsAHLAtValidAppHeader
		jr		nz, p7Dloc_638E
		ld		de, 8040h
		or		a
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_638E
		inc		hl
		ld		a, (appSearchPage)
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		pop		af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		or		a
		jr		z, p7Dloc_638E
		inc		a
		jr		z, p7Dloc_638E
		ld		a, (appSearchPage)
		push	hl
		push	bc
		call	p7Dsub_5E31
		pop		bc
		pop		hl
		pop		af
		push	af
		ld		a, (appSearchPage)
		jr		nc, p7Dloc_6402
		call	p7Dsub_53B3
		jr		p7Dloc_6405
; ---------------------------------------------------------------------------

p7Dloc_6402:
		call	Page7D_2B59

p7Dloc_6405:
		jr		nz, p7Dloc_638E

p7Dloc_6407:
		pop		af
		push	hl
		push	bc
		call	ZeroOP2
		pop		bc
		pop		hl
		ld		a, b
		or		a
		jr		nz, p7Dloc_6419
		ld		a, c
		ld		e, 9
		sub		e
		jr		c, p7Dloc_641C

p7Dloc_6419:
		ld		bc, 8

p7Dloc_641C:
		ld		de, 8484h
		ld		a, (appSearchPage)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		scf
		ccf
		ret
; End of function p7Dsub_638B


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6428:
		push	hl
		push	bc
		push	de
		call	p7Dsub_6186
		jr		c, p7Dloc_6468
		ld		(appInfo+1), a
		call	p7Dsub_7CB2
		jr		z, p7Dloc_6462
		call	p7Dsub_7124
		jr		z, p7Dloc_644E
		call	OP1ToOP4
		ld		a, 14h
		ld		(OP4), a
		rst		18h
		call	relockFlashBack
		call	Page0Call_2C67
		jr		p7Dloc_646B
; ---------------------------------------------------------------------------

p7Dloc_644E:
		ld		de, 5
		ld		a, 2
		ld		(unk_867E), a
		call	Page0Call_2C4F
		call	Page0Call_2C6D
		ld		a, (appInfo)
		or		a
		jr		nz, p7Dloc_6468

p7Dloc_6462:
		ld		a, (appInfo+1)
		call	Page7D_2BE3

p7Dloc_6468:
		call	relockFlashBack

p7Dloc_646B:
		pop		de
		pop		bc
		pop		hl
		ret
; End of function p7Dsub_6428

; ---------------------------------------------------------------------------

Page7D_3EE5:
		push	hl
		push	de
		push	bc
		push	af
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		ld		hl, 4000h
		call	p7Dsub_4566
		cp		0
		jr		z, p7Dloc_64AE
		ld		hl, 6000h
		call	p7Dsub_4566
		cp		0
		jr		z, p7Dloc_64AE
		cp		8Fh ; '�'
		jr		z, p7Dloc_64A6
		ld		hl, 4000h
		call	p7Dsub_4566
		cp		8Fh ; '�'
		jr		z, p7Dloc_64A6

p7Dloc_64A6:
		ld		b, 0
		ex		de, hl
		call	p7Dsub_456D
		jr		p7Dloc_64CE
; ---------------------------------------------------------------------------

p7Dloc_64AE:
		ld		a, h
		xor		20h ; ' '
		ld		h, a
		call	p7Dsub_4566
		cp		8Fh ; '�'
		jr		z, p7Dloc_64C0
		cp		0
		jp		z, p7Dloc_64E1
		jr		p7Dloc_64CE
; ---------------------------------------------------------------------------

p7Dloc_64C0:
		push	hl
		ld		a, h
		xor		20h ; ' '
		ld		h, a
		call	p7Dsub_457C
		pop		de
		ld		b, 0
		call	p7Dsub_456D

p7Dloc_64CE:
		pop		af
		cp		0Fh
		jr		nz, p7Dloc_64D8
		call	Page0Call_2B8F
		jr		p7Dloc_64DB
; ---------------------------------------------------------------------------

p7Dloc_64D8:
		call	Page0Call_2B89

p7Dloc_64DB:
		pop		bc
		pop		de
		pop		hl
		jp		relockFlashBack
; ---------------------------------------------------------------------------

p7Dloc_64E1:
		ld		hl, 4001h
		ld		de, 6001h

p7Dloc_64E7:
		call	p7Dsub_4566
		cp		0
		jr		z, p7Dloc_64F2
		cp		0FFh
		jr		nz, p7Dloc_64F6

p7Dloc_64F2:
		inc		hl
		ex		de, hl
		jr		p7Dloc_64E7
; ---------------------------------------------------------------------------

p7Dloc_64F6:
		ld		a, h
		xor		20h ; ' '
		and		0F0h ; '�'
		ld		h, a
		xor		a
		ld		l, a
		call	p7Dsub_457C
		jr		p7Dloc_64CE

; =============== S U B	R O U T	I N E =======================================


p7Dsub_6503:
		ld		a, d
		or		a
		jr		nz, p7Dloc_650A
		call	p7Dsub_651E

p7Dloc_650A:
		xor		a
		ld		(hl), a
		ret
; End of function p7Dsub_6503


; =============== S U B	R O U T	I N E =======================================


p7Dsub_650D:
		call	Page0Call_32E5
		call	p7Dsub_6523
		jr		z, p7Dloc_6519
		add		a, 30h ; '0'
		ld		(hl), a
		inc		hl

p7Dloc_6519:
		ld		a, b
		call	p7Dsub_6523
		ret		z
; End of function p7Dsub_650D


; =============== S U B	R O U T	I N E =======================================


p7Dsub_651E:
		add		a, 30h ; '0'
		ld		(hl), a
		inc		hl
		ret
; End of function p7Dsub_651E


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6523:
		or		a
		jr		z, p7Dloc_6529
		ld		d, 1
		ret
; ---------------------------------------------------------------------------

p7Dloc_6529:
		ld		e, a
		ld		a, d
		or		a
		ld		a, e
		ret
; End of function p7Dsub_6523


; =============== S U B	R O U T	I N E =======================================


p7Dsub_652E:
		push	af
		push	bc
		push	de
		ld		hl, (unk_83A1)
		call	p7Dsub_57C5
		or		a
		adc	hl, de
		call	p7Dsub_57C5
		ld		(unk_83A1), hl
		jr		nc, p7Dloc_654C
		ld		hl, (unk_839F)
		inc		h
		jr		nz, p7Dloc_6549
		inc		l

p7Dloc_6549:
		ld		(unk_839F), hl

p7Dloc_654C:
		pop		de
		pop		bc
		pop		af
		ret
; End of function p7Dsub_652E


; =============== S U B	R O U T	I N E =======================================


Page7D_2CDF:
		; Page7D_2B6B+32p ...
		push	de
		ld		de, 1
		call	Page7D_2CC7
		pop		de
		ret
; End of function Page7D_2CDF


; =============== S U B	R O U T	I N E =======================================


Page7D_2CC7:
		; p7Dsub_662F+58p	...
		push	af
		push	bc
		push	de
		push	de
		ex		de, hl
		ld		de, 4000h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		804Bh
; ---------------------------------------------------------------------------
		ld		a, (arcPage)
		add		a, e
		ld		(arcPage), a
		ld		a, e
		ld		de, 4000h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8045h
; ---------------------------------------------------------------------------
		push	hl
		pop		bc
		pop		hl
		or		a
		sbc		hl, bc
		push	hl
		pop		bc
		ld		hl, (arcPtr)
		or		a
		adc	hl, bc
		bit		7, h
		jr		z, p7Dloc_6591
		ld		a, (arcPage)
		inc		a
		ld		(arcPage), a
		ld		bc, 4000h
		or		a
		sbc		hl, bc

p7Dloc_6591:
		ld		(arcPtr), hl
		pop		de
		pop		bc
		pop		af
		ret
; End of function Page7D_2CC7


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6598:
		push	af
		push	bc
		push	hl
		ld		hl, arcPage
		jr		p7Dloc_65A6
; ---------------------------------------------------------------------------

p7Dloc_65A0:
		push	af
		push	bc
		push	hl
		ld		hl, 839Fh

p7Dloc_65A6:
		xor		a
		ld		b, 4

p7Dloc_65A9:
		ld		(hl), a
		inc		hl
		djnz	p7Dloc_65A9
		pop		hl
		pop		bc
		pop		af
		ret
; End of function p7Dsub_6598

; ---------------------------------------------------------------------------

ArcChk:
		push	af
		push	hl
		bit		6, (iy+24h)
		jr		nz, p7Dloc_65F2
		call	p7Dloc_65A0
		ld		(Abackup), a
		ld		a, i
		di
		push	af
		ld		a, (Abackup)
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	Page7D_2C0D
		call	relockFlashBack
		ld		(Abackup), a
		pop		af
		jp		po, p7Dloc_65E5
		ei

p7Dloc_65E5:
		ld		a, (Abackup)
		ld		de, 9C96h
		call	p7Dsub_6621
		set		6, (iy+24h)

p7Dloc_65F2:
		bit		7, (iy+24h)
		jr		nz, p7Dloc_6608
		call	p7Dloc_65A0
		call	p7Dsub_662F
		ld		de, 9C9Ah
		call	p7Dsub_6621
		set		7, (iy+24h)

p7Dloc_6608:
		ld		hl, 9C9Ah
		call	p7Dsub_6626
		ld		de, 83A2h
		ld		hl, 9C99h
		ld		b, 4
		or		a

p7Dloc_6617:
		ld		a, (de)
		adc	a, (hl)
		ld		(de), a
		dec		hl
		dec		de
		djnz	p7Dloc_6617
		pop		hl
		pop		af
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_6621:
		ld		hl, 839Fh
		jr		p7Dloc_6629
; End of function p7Dsub_6621


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6626:
		ld		de, 839Fh

p7Dloc_6629:
		ld		bc, 4
		ldir
		ret
; End of function p7Dsub_6626


; =============== S U B	R O U T	I N E =======================================


p7Dsub_662F:
		call	GetFirstInvalidAppPageToB
		inc		b
		ld		a, 8
		ld		de, 0

p7Dloc_6638:
		call	p7Dsub_7BD4
		cp		b
		ret		nc
		ld		hl, 4000h
		push	af
		call	LoadAIndPaged_Copy
		cp		0FEh ; '�'
		jr		z, p7Dloc_6664
		cp		0FFh
		jr		nz, p7Dloc_665C
		pop		af
		push	af
		call	Page7D_2B71
		call	p7Dsub_652E
		ld		de, 1
		call	p7Dsub_652E
		jr		p7Dloc_6664
; ---------------------------------------------------------------------------

p7Dloc_665C:
		cp		0F0h ; '�'
		jr		z, p7Dloc_6669
		pop		af
		inc		a
		jr		p7Dloc_6638
; ---------------------------------------------------------------------------

p7Dloc_6664:
		pop		af
		add		a, 4
		jr		p7Dloc_6638
; ---------------------------------------------------------------------------

p7Dloc_6669:
		inc		hl
		pop		af
		push	af

p7Dloc_666C:
		push	af
		push	hl
		ld		c, 0F0h	; '�'
		push	bc
		call	Page7D_2B6B
		push	bc
		pop		de
		pop		bc
		jr		z, p7Dloc_6696
		inc		sp
		inc		sp
		inc		sp
		inc		sp
		ld		(arcPage), a
		ld		(arcPtr), hl
		inc		de
		inc		de
		inc		de
		push	de
		call	Page7D_2CC7
		pop		de
		call	p7Dsub_652E
		ld		a, (arcPage)
		ld		hl, (arcPtr)
		jr		p7Dloc_666C
; ---------------------------------------------------------------------------

p7Dloc_6696:
		pop		hl
		pop		af
		ld		c, 0FFh
		push	bc
		call	Page7D_2B6B
		pop		bc
		jr		z, p7Dloc_66A7
		call	Page7D_2B71
		call	p7Dsub_652E

p7Dloc_66A7:
		jr		p7Dloc_6664
; End of function p7Dsub_662F


; =============== S U B	R O U T	I N E =======================================


p7Dsub_66A9:
		push	af
		push	bc
		push	hl
		ld		bc, (freeArcBlock)
		or		a
		sbc		hl, bc
		jr		c, p7Dloc_66BB
		or		a
		adc	hl, bc
		ld		(freeArcBlock), hl

p7Dloc_66BB:
		pop		hl
		pop		bc
		pop		af
		ret
; End of function p7Dsub_66A9

; ---------------------------------------------------------------------------

Page7D_2EB3:
		push	bc
		push	de
		ld		a, (OP1)
		push	af
		push	bc
		ld		bc, 0
		ld		(freeArcBlock), bc
		call	GetFirstInvalidAppPageToB
		ld		a, b
		ld		(unk_83FF), a
		pop		bc
		ld		a, 8

p7Dloc_66D7:
		push	af
		ld		hl, 4000h
		call	LoadAIndPaged_Copy
		cp		0FEh ; '�'
		jr		nz, p7Dloc_66E7

p7Dloc_66E2:
		pop		af
		add		a, 3
		jr		p7Dloc_66F0
; ---------------------------------------------------------------------------

p7Dloc_66E7:
		cp		0F0h ; '�'
		jr		z, p7Dloc_66FB
		cp		0FFh
		jr		z, p7Dloc_6711
		pop		af

p7Dloc_66F0:
		push	hl
		ld		hl, 83FFh
		cp		(hl)
		pop		hl
		jr		nc, p7Dloc_672F
		inc		a
		jr		p7Dloc_66D7
; ---------------------------------------------------------------------------

p7Dloc_66FB:
		pop		af
		push	af
		push	bc
		ld		c, 0FFh
		ld		(arcPage), a
		ld		(arcPtr), hl
		call	Page7D_2CDF
		call	Page7D_2B6B
		pop		bc
		jr		z, p7Dloc_66E2
		pop		de
		push	af

p7Dloc_6711:
		pop		af
		ld		(tempSwapArea), hl
		push	bc
		push	af
		ld		a, (unk_83FF)
		ld		b, a
		inc		b
		pop		af
		call	Page7D_2B71
		ex		de, hl
		pop		bc
		or		a
		call	p7Dsub_66A9
		sbc		hl, bc
		ld		hl, (tempSwapArea)
		jr		nc, p7Dloc_6733
		jr		p7Dloc_66F0
; ---------------------------------------------------------------------------

p7Dloc_672F:
		ld		a, 0FFh
		add		a, 10h

p7Dloc_6733:
		pop		bc
		ld		c, a
		ld		a, b
		ld		(OP1), a
		ld		a, c
		pop		de
		pop		bc
		ret

; =============== S U B	R O U T	I N E =======================================


Page7D_2B71:
		push	hl
		push	bc
		push	af
		push	hl
		pop		de
		ld		hl, 7FFFh
		or		a
		sbc		hl, de

p7Dloc_6748:
		ex		de, hl
		inc		a
		call	p7Dsub_67EC
		jr		z, p7Dloc_6765
		cp		b
		jr		nc, p7Dloc_6765
		ld		hl, 4000h
		push	af
		call	LoadAIndPaged_Copy
		cp		0FFh
		jr		nz, p7Dloc_6764
		ld		hl, 4000h
		add		hl, de
		pop		af
		jr		p7Dloc_6748
; ---------------------------------------------------------------------------

p7Dloc_6764:
		pop		af

p7Dloc_6765:
		; Page7D_2B71+13j
		pop		af
		pop		bc
		pop		hl
		ret
; End of function Page7D_2B71


; =============== S U B	R O U T	I N E =======================================


Page7D_2B6B:
		; p7Dsub_662F+42p	...
		call	p7Dsub_6598
		ld		(arcPage), a
		ld		(arcPtr), hl
		push	bc
		push	hl
		push	af
		or		3
		ld		b, 15h
		call	NZIf83Plus
		jr		nz, p7Dloc_6780
		ld		b, 69h ; 'i'

p7Dloc_6780:
		cp		b
		jr		c, p7Dloc_6784
		ld		a, b

p7Dloc_6784:
		ld		(unk_8390), a
		pop		af
		pop		hl
		pop		bc

p7Dloc_678A:
		push	bc
		ld		a, (arcPage)
		call	LoadAIndPaged_Copy
		cp		c
		jr		z, p7Dloc_67C8
		cp		0FFh
		jr		z, p7Dloc_67C2
		ld		(arcPtr), hl
		call	Page7D_2CDF
		ld		a, (arcPage)
		call	LoadAIndPaged_Copy
		ld		e, a
		call	Page7D_2CDF
		ld		a, (arcPage)
		call	LoadAIndPaged_Copy
		ld		d, a
		inc		de
		call	Page7D_2CC7
		ld		a, (unk_8390)
		ld		b, a
		ld		a, (arcPage)
		cp		b
		jr		c, p7Dloc_67BF
		jr		nz, p7Dloc_67C2

p7Dloc_67BF:
		pop		bc
		jr		p7Dloc_678A
; ---------------------------------------------------------------------------

p7Dloc_67C2:
		; Page7D_2B6B+54j
		xor		a
		ld		a, (arcPage)
		pop		bc
		ret
; ---------------------------------------------------------------------------

p7Dloc_67C8:
		pop		bc
		ld		a, (arcPage)
		push	af
		push	hl
		ld		(arcPtr), hl
		call	Page7D_2CDF
		ld		a, (arcPage)
		call	LoadAIndPaged_Copy
		ld		c, a
		ld		a, (arcPage)
		call	Page7D_2CDF
		ld		a, (arcPage)
		call	LoadAIndPaged_Copy
		ld		b, a
		pop		hl
		pop		af
		or		a
		ret
; End of function Page7D_2B6B


; =============== S U B	R O U T	I N E =======================================


p7Dsub_67EC:
		; Page7D_2B71+Dp
		push	bc
		ld		b, a
		and		3
		ld		a, b
		jr		z, p7Dloc_67FE
		call	NZIf83Plus
		jr		nz, p7Dloc_67FC
		cp		6Ah ; 'j'
		jr		p7Dloc_67FE
; ---------------------------------------------------------------------------

p7Dloc_67FC:
		cp		16h

p7Dloc_67FE:
		pop		bc
		ret
; End of function p7Dsub_67EC


; =============== S U B	R O U T	I N E =======================================


GetFirstInvalidAppPageToB:
		push	af
		push	hl
		push	de
		call	GetAppSpaceStartToA
		ld		hl, 4000h
-:		push	af
		call	LoadAIndPaged_Copy
		cp		80h
		jr		z, {+}
		cp		0
		jr		nz, {++}
+:		pop		af
		push	af
		call	j_IsAHLAtValidAppHeader
		jr		nz, {++}
		call	FindAppNumPages
		ld		a, c
		or		c
		jr		z, {++}
		pop		af
		sub		c
		jr		{-}
++:		pop		af
		ld		b, a
		pop		de
		pop		hl
		pop		af
		ret

Page7D_2EBF:
		res		7, (iy+24h)
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		ld		a, (arcInfo)
		ld		hl, (arcInfo+1)
		call	p7Dsub_69E8
		ld		de, (unk_83F3)
		ld		bc, (unk_83F9)
		call	Page7D_2C43
		jp		c, Page0Call_2541
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		ld		de, (arcInfo+1)
		ld		a, (arcInfo)
		ld		b, 0F0h	; '�'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		ld		de, (unk_83F3)
		ld		(arcInfo+1), de
		ld		a, 0
		ld		(arcInfo), a
		ld		hl, (unk_83F1)
		call	Page0Call_2EDD
		jp		relockFlashBack
; ---------------------------------------------------------------------------

Page7D_2D03:
		res		7, (iy+24h)
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		ex		de, hl
		jp		p7Dloc_692E

; =============== S U B	R O U T	I N E =======================================


Page7D_2EAD:
		res		7, (iy+24h)
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		ld		a, (arcInfo)
		ld		hl, (arcInfo+1)
		call	p7Dsub_69D4
		jr		nz, p7Dloc_68D2
		ld		b, 0F0h	; '�'
		ld		a, (arcInfo)
		ld		de, (arcInfo+1)
		call	p7Dsub_6F82
		jp		c, Page0Call_2541
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		ld		hl, (arcInfo+1)
		inc		hl
		ld		(arcInfo+1), hl
		jr		p7Dloc_68D6
; ---------------------------------------------------------------------------

p7Dloc_68D2:
		ld		de, (arcInfo+1)

p7Dloc_68D6:
		ld		b, 0FEh	; '�'
		ld		a, (arcInfo)
		ld		(unk_8404), a
		ld		(unk_8402), de
		call	p7Dsub_6F82
		jp		c, Page0Call_2541
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		ld		a, (arcInfo)
		ld		de, (unk_8402)
		ld		(arcPage), a
		ld		(arcPtr), de
		call	Page7D_2CDF
		ld		a, (arcPage)
		ld		de, (arcPtr)
		ld		hl, 83F9h
		ld		bc, 2
		call	Page7D_2C43
		jp		c, Page0Call_2541
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		ld		de, 2
		call	Page7D_2CC7
		ld		a, (unk_8404)
		ld		(arcInfo), a
		ld		de, (arcPtr)
		ld		hl, (unk_83F1)
		call	Page0Call_2EDD
		ld		a, (arcPage)
		ld		(arcInfo), a

p7Dloc_692E:
		ld		hl, (unk_83F1)
		ld		bc, (unk_83F5)
		push	de
		ld		de, OP1
		ld		b, c

p7Dloc_693A:
		ld		a, (hl)
		ld		(de), a
		inc		de
		dec		hl
		djnz	p7Dloc_693A
		pop		de
		ld		a, (arcInfo)
		ld		bc, (unk_83F5)
		ld		hl, OP1
		res		7, (hl)
		ld		(arcPtr), de
		ld		(arcPage), a
		call	Page7D_2C43
		jp		c, Page0Call_2541
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		ld		de, (unk_83F5)
		call	Page7D_2CC7
		ld		a, (arcPage)
		ld		(arcInfo), a
		ld		de, (arcPtr)
		ld		(unk_83FB), de
		bit		noDataWrite, (iy+groupFlags)
		res		noDataWrite, (iy+groupFlags)
		jr		nz, p7Dloc_69D1
		ld		a, (arcInfo)
		ld		hl, (unk_83F3)
		bit		writeSizeBytesOnly, (iy+groupFlags)
		ld		bc, 2
		jr		nz, p7Dloc_698F
		ld		bc, (unk_83F7)

p7Dloc_698F:
		ld		(arcPtr), de
		ld		(arcPage), a
		call	Page7D_2C43
		jp		c, Page0Call_2541
		call	p7Dsub_7666
		bit		writeSizeBytesOnly, (iy+groupFlags)
		ld		de, 2
		jr		nz, p7Dloc_69AC
		ld		de, (unk_83F7)

p7Dloc_69AC:
		call	Page7D_2CC7
		ld		a, (arcPage)
		ld		(arcInfo), a
		ld		de, (arcPtr)
		bit		noCompletionByte, (iy+groupFlags)
		jr		nz, p7Dloc_69D1
		ld		de, (unk_8402)
		ld		b, 0FCh	; '�'
		ld		a, (unk_8404)
		call	p7Dsub_6F82
		jp		c, Page0Call_2541
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------

p7Dloc_69D1:
		; Page7D_2EAD+126j
		jp		relockFlashBack
; End of function Page7D_2EAD


; =============== S U B	R O U T	I N E =======================================


p7Dsub_69D4:
		; p7Dsub_7CDA+39p
		push	hl
		ld		bc, 4000h
		or		a
		sbc		hl, bc
		pop		hl
		jr		z, p7Dloc_69DF
		ret		nc

p7Dloc_69DF:
		ld		b, a
		and		3
		ld		a, b
		ret
; End of function p7Dsub_69D4

; ---------------------------------------------------------------------------

Page7D_3267:
		call	p7Dsub_69E8
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_69E8:

		call	p7Dsub_6A07
		push	af
		push	hl
		push	af
		call	LoadAIndPaged_Copy
		ld		e, a
		pop		af
		inc		hl
		call	Page0Call_23FC
		jr		nc, p7Dloc_69FA
		inc		a

p7Dloc_69FA:
		call	LoadAIndPaged_Copy
		ld		d, a
		push	de
		pop		bc
		pop		hl
		pop		af
		ret
; End of function p7Dsub_69E8

; ---------------------------------------------------------------------------

Page7D_2F85:
		call	p7Dsub_6A07
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_6A07:

		inc		hl
		inc		hl
		inc		hl
		call	Page0Call_23FC
		jr		nc, Page7D_2CD3
		inc		a

Page7D_2CD3:
		push	af
		call	LoadAIndPaged_Copy
		and		1Fh
		or		a
		call	Page0Call_23F6
		jr		nc, p7Dloc_6A21
		ld		d, a
		pop		af
		inc		a
		push	af
		ld		a, d

p7Dloc_6A21:
		ld		de, 3
		call	page0_17B3
		jr		z, p7Dloc_6A3D
		call	IS_A_LSTorCLST
		jr		z, p7Dloc_6A3D
		pop		af
		ld		(arcPage), a
		call	LoadAIndPaged_Copy
		cp		5Dh ; ']'
		ld		a, (arcPage)
		jr		nz, p7Dloc_6A45
		push	af

p7Dloc_6A3D:
		pop		af
		push	af
		call	LoadAIndPaged_Copy
		ld		e, a
		pop		af
		inc		e

p7Dloc_6A45:
		ld		(arcPage), a
		ld		(arcPtr), hl
		call	Page7D_2CC7
		ld		a, (arcPage)
		ld		hl, (arcPtr)
		ret
; End of function p7Dsub_6A07

; ---------------------------------------------------------------------------

Page7D_2D3F:
		call	GetFirstInvalidAppPageToB
		call	GetAppSpaceStartToA
		cp		b
		jr		c, p7Dloc_6A6D
		jr		z, p7Dloc_6A6D

p7Dloc_6A60:
		push	bc
		call	DeleteApp
		pop		bc
		ld		a, (appSearchPage+1)
		cp		b
		jr		c, p7Dloc_6A6D
		jr		nz, p7Dloc_6A60

p7Dloc_6A6D:
		res		2, (iy+25h)
		ld		a, 4
		call	Page0Call_2EB9
		ret
; ---------------------------------------------------------------------------

Page7D_2D33:
		call	j_RunIndicOn
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		ld		a, 8
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8084h
; ---------------------------------------------------------------------------
		ld		a, 8
		ld		de, 4000h
		ld		b, 0FEh	; '�'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		ld		a, 0Ch

p7Dloc_6A9C:
		push	af
		call	p7Dsub_7BD4
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8084h
; ---------------------------------------------------------------------------
		pop		af
		add		a, 4

p7Dloc_6AA8:				; DATA XREF: seg001:76B7w seg001:76C9w
		call	p7Dsub_75E1
		jr		c, p7Dloc_6A9C
		ld		hl, tempSwapArea
		ld		b, 0E8h	; '�'

p7Dloc_6AB2:
		ld		a, 0FFh
		ld		(hl), a
		inc		hl
		djnz	p7Dloc_6AB2
		ld		a, 0FEh	; '�'
		ld		hl, 836Dh
		ld		(hl), a
		call	NZIf83Plus
		jr		z, p7Dloc_6AC9
		ld		a, 7Fh ; ''
		ld		hl, 836Eh
		ld		(hl), a

p7Dloc_6AC9:
		ld		a, 0
		call	Page7D_2B5F
		jp		relockFlashBack
; ---------------------------------------------------------------------------

Page7D_2D45:
		res		6, (iy+24h)
		res		7, (iy+24h)
		res		4, (iy+26h)
		ld		a, 8

p7Dloc_6ADF:
		push	af
		ld		hl, 4000h
		call	LoadAIndPaged_Copy
		cp		0FEh ; '�'
		jr		nz, p7Dloc_6AF3

p7Dloc_6AEA:
		pop		af
		push	bc
		ld		c, 3
		add		a, c
		pop		bc
		push	af
		jr		p7Dloc_6AFB
; ---------------------------------------------------------------------------

p7Dloc_6AF3:
		cp		0F0h ; '�'
		jr		z, p7Dloc_6B07
		cp		0FFh
		jr		z, p7Dloc_6AEA

p7Dloc_6AFB:
		pop		af
		push	hl
		call	GetFirstInvalidAppPageToB
		cp		b
		pop		hl
		jr		nc, locret_6B35
		inc		a
		jr		p7Dloc_6ADF
; ---------------------------------------------------------------------------

p7Dloc_6B07:
		pop		af
		push	af
		ld		(arcPage), a
		ld		(arcPtr), hl
		call	Page7D_2CDF

p7Dloc_6B12:
		ld		c, 0FCh	; '�'
		call	Page7D_2B6B
		jr		z, p7Dloc_6AEA
		ld		(arcPage), a
		ld		(arcPtr), hl
		push	bc
		call	Page0Call_2FC7
		pop		de
		inc		de
		inc		de
		ld		(arcPage), a
		ld		(arcPtr), hl
		inc		de
		call	Page7D_2CC7
		ld		a, (arcPage)
		jr		p7Dloc_6B12
; ---------------------------------------------------------------------------

locret_6B35:
		ret

LoadAIndPaged_Copy:
		push	hl
		push	bc
		push	de
		ld		bc, 1
		ld		de, flashByte1
		call	FlashToRam
		ld		a, (flashByte1)
		pop		de
		pop		bc
		pop		hl
		ret

FlashToRam:
		call	NZIf83Plus
		jr		z, p7Dloc_6B50
		and		1Fh

p7Dloc_6B50:
		push	ix
		ld		ix, FlashToRamPrivilegedCopy
		call	p7Dsub_6B87
		pop		ix
		ret
; End of function FlashToRam

FlashToRamPrivilegedCopy:
		.dw		29h
		ld		(flashByte2), a
		in		a, (6)
		push	af
		ld		a, (flashByte2)
		out		(6), a
		bit		7, h
		jr		nz, p7Dloc_6B83

p7Dloc_6B6D:
		bit		7, h
		jr		z, p7Dloc_6B79
		in		a, (6)
		inc		a
		out		(6), a
		ld		hl, 4000h

p7Dloc_6B79:
		ldi
		ld		a, b
		or		c
		jr		nz, p7Dloc_6B6D

p7Dloc_6B7F:
		pop		af
		out		(6), a
		ret
p7Dloc_6B83:
		ldir
		jr		p7Dloc_6B7F

; =============== S U B	R O U T	I N E =======================================


p7Dsub_6B87:
		; p7Dsub_7666+11p
		call	p7Dsub_6BB0
		push	bc
		push	de
		push	hl
		push	ix
		pop		hl
		ld		c, (hl)
		inc		hl
		ld		b, (hl)
		inc		hl
		ld		de, ramCode
		push	de
		ldir
		pop		ix
		pop		hl
		pop		de
		pop		bc
		call	p7Dsub_6BAD
		push	af
		ld		a, (unk_82A2)
		bit		2, a
		jr		z, p7Dloc_6BAB
		ei

p7Dloc_6BAB:
		pop		af
		ret
; End of function p7Dsub_6B87


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6BAD:
		jp		ramCode
; End of function p7Dsub_6BAD


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6BB0:
		push	af
		push	bc
		ld		a, i
		push	af
		di
		pop		bc
		ld		a, c
		ld		(unk_82A2), a
		pop		bc
		pop		af
		ret
; End of function p7Dsub_6BB0

; ---------------------------------------------------------------------------

Page7D_3E25:
		res		7, (iy+24h)
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		ld		a, b
		ld		b, 0F0h	; '�'
		call	p7Dsub_6F82
		jp		c, Page0Call_2541
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		jp		relockFlashBack
; ---------------------------------------------------------------------------

Page7D_2D39:
		res		7, (iy+24h)
		ld		a, 8

p7Dloc_6BE8:
		push	af
		ld		hl, 4000h
		call	LoadAIndPaged_Copy
		cp		0FEh ; '�'
		jr		nz, p7Dloc_6BF9

p7Dloc_6BF3:
		pop		af
		add		a, 3
		push	af
		jr		p7Dloc_6C01
; ---------------------------------------------------------------------------

p7Dloc_6BF9:
		cp		0F0h ; '�'
		jr		z, p7Dloc_6C0E
		cp		0FFh
		jr		z, p7Dloc_6BF3

p7Dloc_6C01:
		pop		af
		push	hl
		call	GetFirstInvalidAppPageToB
		cp		b
		pop		hl
		jp		nc, p7Dloc_6CAB
		inc		a
		jr		p7Dloc_6BE8
; ---------------------------------------------------------------------------

p7Dloc_6C0E:
		pop		af
		push	af
		ld		(arcPage), a
		ld		(arcPtr), hl
		call	Page7D_2CDF

p7Dloc_6C19:
		ld		c, 0FCh	; '�'
		call	Page7D_2B6B
		jr		z, p7Dloc_6BF3
		ld		(arcPage), a
		ld		(arcPtr), hl
		ld		(unk_8404), a
		ld		(unk_8402), hl
		ld		de, 3
		call	Page7D_2CC7
		ld		a, (arcPage)
		push	bc
		push	af
		call	LoadAIndPaged_Copy
		and		1Fh
		ld		(OP1), a
		call	page0_17B3
		jr		z, p7Dloc_6C49
		call	IS_A_LSTorCLST
		jr		nz, p7Dloc_6C6A

p7Dloc_6C49:
		or		a
		call	Page0Call_23F6
		jr		nc, p7Dloc_6C52
		pop		af
		inc		a
		push	af

p7Dloc_6C52:
		pop		af
		push	af
		call	LoadAIndPaged_Copy
		ld		c, a
		ld		b, 0
		pop		af
		ld		(arcPage), a
		ld		(arcPtr), hl
		call	Page7D_2CDF
		ld		a, (arcPage)
		push	af
		jr		p7Dloc_6C76
; ---------------------------------------------------------------------------

p7Dloc_6C6A:
		or		a
		call	Page0Call_23F6
		jr		nc, p7Dloc_6C73
		pop		af
		inc		a
		push	af

p7Dloc_6C73:
		ld		bc, 3

p7Dloc_6C76:
		ld		de, 8479h
		push	hl
		ld		a, (OP1)
		push	af
		call	ZeroOP1
		pop		af
		ld		(OP1), a
		pop		hl
		pop		af
		call	FlashToRam
		call	ChkFindSym
		call	page0_1F31
		pop		de
		inc		de
		inc		de
		ld		a, (unk_8404)
		ld		hl, (unk_8402)
		ld		(arcPage), a
		ld		(arcPtr), hl
		call	Page7D_2CC7
		call	Page7D_2CDF
		ld		a, (arcPage)
		jp		p7Dloc_6C19
; ---------------------------------------------------------------------------

p7Dloc_6CAB:
		res		2, (iy+25h)
		ld		a, 3
		call	Page0Call_2EB9
		ret

; =============== S U B	R O U T	I N E =======================================


Page7D_2C13:

		ld		hl, 8697h
		call	NZIf83Plus
		jr		z, p7Dloc_6CC4
		ld		c, a
		ld		b, 0
		add		hl, bc
		set		7, (hl)
		ret
; ---------------------------------------------------------------------------

p7Dloc_6CC4:
		ld		b, a
		call	Page0Call_2DB1
		or		(hl)
		ld		(hl), a
		ret
; End of function Page7D_2C13


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6CCB:
		ld		(arcPage), a
		ld		(arcPtr), hl
		ld		de, 3
		call	Page7D_2CC7
		call	ZeroOP1
		ld		a, (arcPage)
		ld		hl, (arcPtr)
		call	LoadAIndPaged_Copy
		ld		(OP1), a
		call	Page0Call_23F6
		jr		nc, p7Dloc_6CF2
		ld		a, (arcPage)
		inc		a
		ld		(arcPage), a

p7Dloc_6CF2:
		ld		(arcPtr), hl
		ld		a, (OP1)
		ld		b, 3
		call	page0_17B3
		jr		z, p7Dloc_6D11
		call	IS_A_LSTorCLST
		jr		z, p7Dloc_6D11
		ld		a, (arcPage)
		call	LoadAIndPaged_Copy
		cp		5Dh ; ']'
		ld		a, (arcPage)
		jr		nz, p7Dloc_6D21

p7Dloc_6D11:
		ld		a, (arcPage)
		ld		hl, (arcPtr)
		call	LoadAIndPaged_Copy
		ld		b, a
		ld		a, (arcPage)
		call	Page7D_2CDF

p7Dloc_6D21:
		ld		de, 8479h

p7Dloc_6D24:
		ld		a, (arcPage)
		ld		hl, (arcPtr)
		push	bc
		call	LoadAIndPaged_Copy
		pop		bc
		ld		(de), a
		inc		de
		call	Page7D_2CDF
		djnz	p7Dloc_6D24
		ret
; End of function p7Dsub_6CCB

; ---------------------------------------------------------------------------

Page7D_2B77:
		push	bc
		push	hl
		push	de
		push	af
		ld		(arcInfo), a
		ld		(arcInfo+1), hl
		ld		a, b
		ld		(unk_83F1), a
		ld		(unk_83F1+1), de
		ld		(unk_8404), a
		ld		(unk_8402), de
		ld		a, (arcInfo)
		ld		hl, (arcInfo+1)
		call	p7Dsub_6CCB
		ld		a, (OP1)
		and		1Fh
		push	af
		ld		a, (arcInfo)
		ld		hl, (arcInfo+1)
		ld		(arcPage), a
		ld		(arcPtr), hl
		call	Page7D_2CDF
		ld		a, (arcPage)
		call	LoadAIndPaged_Copy
		ld		c, a
		call	Page7D_2CDF
		ld		a, (arcPage)
		call	LoadAIndPaged_Copy
		ld		b, a
		call	Page7D_2CDF
		push	bc
		ld		a, (arcPage)
		ld		(arcInfo), a
		ld		(arcInfo+1), hl
		ld		a, (unk_83F1)
		ld		de, (unk_83F1+1)
		ld		(arcPage), a
		ld		(arcPtr), de
		ld		b, 0FEh	; '�'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		call	Page7D_2CDF
		ld		a, (arcPage)
		ld		de, (arcPtr)
		pop		bc
		push	bc
		ld		b, c
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		call	Page7D_2CDF
		ld		a, (arcPage)
		ld		de, (arcPtr)
		pop		bc
		push	bc
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		call	Page7D_2CDF
		ld		a, (arcPage)
		ld		de, (arcPtr)
		ld		(unk_83F1), a
		ld		(unk_83F1+1), de
		ld		a, (arcInfo)
		ld		hl, (arcInfo+1)
		ld		(arcPage), a
		ld		(arcPtr), hl
		ld		de, 83FDh
		ld		bc, 3
		call	FlashToRam
		ld		de, 6
		call	Page7D_2CC7
		ld		a, (arcPage)
		ld		hl, (arcPtr)
		ld		(arcInfo), a
		ld		(arcInfo+1), hl
		ld		a, (unk_83F1)
		ld		de, (unk_83F1+1)
		ld		(arcPage), a
		ld		(arcPtr), de
		ld		hl, 83FDh
		ld		bc, 3
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		ld		de, 3
		call	Page7D_2CC7
		ld		a, (arcPage)
		ld		de, (arcPtr)
		ld		hl, 8402h
		ld		bc, 3
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		ld		de, 3
		call	Page7D_2CC7
		ld		a, (arcPage)
		ld		de, (arcPtr)
		ld		(unk_83F1), a
		ld		(unk_83F1+1), de
		pop		hl
		ld		bc, 6
		or		a
		sbc		hl, bc
		push	hl
		pop		bc

p7Dloc_6E40:
		ld		hl, 0
		ld		(unk_83F3+1), hl
		ld		de, ramStart

p7Dloc_6E49:
		push	bc
		ld		a, (arcInfo)
		ld		b, a
		ld		hl, (arcInfo+1)
		call	LoadCIndPaged
		ld		a, c
		ld		(de), a
		inc		de
		inc		hl
		bit		7, h
		jr		z, p7Dloc_6E60
		inc		b
		ld		hl, 4000h

p7Dloc_6E60:
		call	p7Dsub_6ECE
		ld		a, b
		ld		(arcInfo), a
		ld		(arcInfo+1), hl
		pop		bc
		dec		bc
		ld		a, b
		or		c
		jr		z, p7Dloc_6EA7
		call	p7Dsub_6ED5
		jr		z, p7Dloc_6E77
		jr		p7Dloc_6E49
; ---------------------------------------------------------------------------

p7Dloc_6E77:
		push	bc
		ld		hl, ramStart
		ld		de, (unk_83F1+1)
		ld		a, (unk_83F1)
		ld		(arcPtr), de
		ld		(arcPage), a
		ld		bc, (unk_83F3+1)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		ld		de, (unk_83F3+1)
		call	Page7D_2CC7
		ld		a, (arcPage)
		ld		hl, (arcPtr)
		ld		(unk_83F1), a
		ld		(unk_83F1+1), hl
		pop		bc
		jp		p7Dloc_6E40
; ---------------------------------------------------------------------------

p7Dloc_6EA7:
		ld		hl, ramStart
		ld		de, (unk_83F1+1)
		ld		a, (unk_83F1)
		ld		bc, (unk_83F3+1)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		ld		a, (unk_8404)
		ld		de, (unk_8402)
		ld		b, 0FCh	; '�'
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		pop		af
		ld		(OP1), a
		pop		af
		pop		de
		pop		hl
		pop		bc
		ret
; ---------------------------------------------------------------------------
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_6ECE:
		push	hl
		ld		hl, 83F4h
		inc		(hl)
		pop		hl
		ret
; End of function p7Dsub_6ECE


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6ED5:
		ld		a, (unk_83F3+1)
		cp		0FFh
		ret
; End of function p7Dsub_6ED5


; =============== S U B	R O U T	I N E =======================================


Page7D_2C0D:
		call	GetAppSpaceStartToA

p7Dloc_6EDE:
		; Page7D_2C0D+75j
		call	p7Dsub_7BD4
		call	GetFirstInvalidAppPageToB
		cp		b
		jr		c, locret_6F53
		jr		z, locret_6F53
		ld		hl, 4000h
		push	af
		call	LoadAIndPaged_Copy
		cp		0
		jr		nz, p7Dloc_6F0A
		pop		af
		push	af
		call	FindAppNumPages
		ld		a, c
		or		c
		jr		z, p7Dloc_6F52
		ld		b, c
		ld		de, 4000h

p7Dloc_6F01:
		call	p7Dsub_652E
		djnz	p7Dloc_6F01

p7Dloc_6F06:
		pop		af
		sub		c
		jr		p7Dloc_6EDE
; ---------------------------------------------------------------------------

p7Dloc_6F0A:
		cp		80h ; '�'
		jr		nz, p7Dloc_6F52
		pop		af
		push	af
		call	j_IsAHLAtValidAppHeader
		jr		nz, p7Dloc_6F52
		pop		af
		push	af
		call	Page7D_2C97
		call	Page7D_2B59
		jr		z, p7Dloc_6F43
		pop		af
		push	af
		call	FindAppNumPages
		ld		a, c
		or		c
		jr		z, p7Dloc_6F52
		ld		b, c

p7Dloc_6F29:
		pop		af
		push	af
		push	bc
		ld		de, 4000h
		ld		b, 0
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		ld		de, 4000h
		call	p7Dsub_652E
		pop		bc
		dec		b
		jr		z, p7Dloc_6F4E
		pop		af
		dec		a
		push	af
		jr		p7Dloc_6F29
; ---------------------------------------------------------------------------

p7Dloc_6F43:
		pop		af
		push	af
		call	FindAppNumPages
		ld		a, c
		or		a
		jr		z, p7Dloc_6F52
		jr		p7Dloc_6F06
; ---------------------------------------------------------------------------

p7Dloc_6F4E:
		pop		af
		dec		a
		jr		p7Dloc_6EDE
; ---------------------------------------------------------------------------

p7Dloc_6F52:
		; Page7D_2C0D+31j ...
		pop		af

locret_6F53:
		; Page7D_2C0D+Cj
		ret
; End of function Page7D_2C0D


; =============== S U B	R O U T	I N E =======================================


Page7D_2C43:
		; Page7D_2EAD+72p ...
		push	hl
		push	de
		push	bc
		cp		8
		jp		c, p7Dloc_6F7D
		push	af
		ld		a, (OP1)
		push	af
		call	GetFirstInvalidAppPageToB
		pop		af
		ld		(OP1), a
		pop		af
		cp		b
		jr		z, p7Dloc_6F6E
		jr		nc, p7Dloc_6F7D

p7Dloc_6F6E:
		ld		bc, 4000h
		sbc		hl, bc
		jr		c, p7Dloc_6F7D
		ex		de, hl
		or		a
		sbc		hl, bc
		jr		c, p7Dloc_6F7D
		jr		p7Dloc_6F7E
; ---------------------------------------------------------------------------

p7Dloc_6F7D:
		; Page7D_2C43+18j ...
		scf

p7Dloc_6F7E:
		pop		bc
		pop		de
		pop		hl
		ret
; End of function Page7D_2C43


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6F82:
		; Page7D_2EAD+4Bp ...
		push	hl
		push	de
		push	bc
		cp		8
		jp		c, p7Dloc_6FA7
		push	af
		ld		a, (OP1)
		push	af
		call	GetFirstInvalidAppPageToB
		pop		af
		ld		(OP1), a
		pop		af
		cp		b
		jr		z, p7Dloc_6F9C
		jr		nc, p7Dloc_6FA7

p7Dloc_6F9C:
		ld		bc, 4000h
		ex		de, hl
		or		a
		sbc		hl, bc
		jr		c, p7Dloc_6FA7
		jr		p7Dloc_6FA8
; ---------------------------------------------------------------------------

p7Dloc_6FA7:
		scf

p7Dloc_6FA8:
		pop		bc
		pop		de
		pop		hl
		ret
; End of function p7Dsub_6F82


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6FAC:
		; DeleteApp+11p
		push	hl
		push	bc
		call	p7Dsub_75E1
		jr		nc, p7Dloc_6FBD
		call	GetFirstInvalidAppPageToB
		cp		b
		jr		c, p7Dloc_6FBA
		or		a

p7Dloc_6FBA:
		pop		bc
		pop		hl
		ret
; ---------------------------------------------------------------------------

p7Dloc_6FBD:
		scf
		jr		p7Dloc_6FBA
; End of function p7Dsub_6FAC


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6FC0:
		push	hl
		push	bc
		push	de
		ld		hl, 4000h
		ld		de, 80C0h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_6FF4
		inc		hl
		ld		a, (appPage)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ld		a, (appPage)
		call	p7Dsub_5CFF
		call	GetBaseVer
		ld		b, a
		ld		a, (MD5Buffer)
		cp		b
		jr		z, p7Dloc_6FE9
		jr		c, p7Dloc_6FF4
		jr		p7Dloc_6FF5
; ---------------------------------------------------------------------------

p7Dloc_6FE9:
		call	GetBaseVer
		ld		a, (unk_83A6)
		cp		b
		jr		z, p7Dloc_6FF4
		jr		nc, p7Dloc_6FF5

p7Dloc_6FF4:
		xor		a

p7Dloc_6FF5:
		pop		de
		pop		bc
		pop		hl
		ret
; End of function p7Dsub_6FC0


; =============== S U B	R O U T	I N E =======================================


p7Dsub_6FF9:
		push	hl
		push	bc
		push	de
		bit		5, (iy+24h)
		jr		nz, p7Dloc_701F
		ld		a, (appPage)
		ld		hl, 4000h
		ld		de, 80A0h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jr		nz, p7Dloc_7024
		inc		hl
		ld		a, (appPage)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ld		a, b
		or		c
		jr		z, p7Dloc_7024
		ld		a, (hl)
		or		a
		jr		z, p7Dloc_7024

p7Dloc_701F:
		call	SetFastSpeed
		jr		p7Dloc_7027
; ---------------------------------------------------------------------------

p7Dloc_7024:
		call	SetSlowSpeed

p7Dloc_7027:
		pop		de
		pop		bc
		pop		hl
		ret
; End of function p7Dsub_6FF9

; ---------------------------------------------------------------------------
aDeleting___:	.asc 'Deleting...',0
aHaveExpired_:	.asc 'Have Expired.',0

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7045:
		push	bc
		push	af
		ld		a, (winBtm)
		ld		b, a

p7Dloc_704B:
		ld		a, (hl)
		inc		hl
		or		a
		scf
		jr		z, p7Dloc_705A
		call	j_PutC
		ld		a, (curRow)
		cp		b
		jr		c, p7Dloc_704B

p7Dloc_705A:
		pop		bc
		ld		a, b
		pop		bc
		ret
; End of function p7Dsub_7045


; =============== S U B	R O U T	I N E =======================================


p7Dsub_705E:
		ld		a, 7Eh ; '~'
; End of function p7Dsub_705E


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7060:

		push	ix

p7Dloc_7062:
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		cp		d
		jr		nz, p7Dloc_709E
		inc		hl
		pop		af
		push	af
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		and		0F0h ; '�'
		cp		e
		jr		nz, p7Dloc_7078
		pop		af
		dec		hl
		jr		p7Dloc_70A2
; ---------------------------------------------------------------------------

p7Dloc_7078:
		pop		af
		push	af
		push	de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		pop		de
		add		hl, bc
		ld		(arcInfo), hl
		pop		af
		push	af
		push	hl
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8051h
; ---------------------------------------------------------------------------
		and		0F0h ; '�'
		cp		e
		jr		z, p7Dloc_7093
		cp		10h
		jr		z, p7Dloc_7097

p7Dloc_7093:
		pop		hl
		pop		af
		jr		p7Dloc_7062
; ---------------------------------------------------------------------------

p7Dloc_7097:
		pop		hl
		ld		hl, (arcInfo)
		ld		a, 1
		or		a

p7Dloc_709E:
		pop		bc
		pop		ix
		ret
; ---------------------------------------------------------------------------

p7Dloc_70A2:
		ld		a, 0
		bit		7, a
		pop		ix
		ret
; End of function p7Dsub_7060

; ---------------------------------------------------------------------------

Page7D_2CF7:
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	Page0Call_240A
		ld		e, (hl)
		dec		hl
		ld		d, (hl)
		dec		hl
		ld		a, (hl)
		ld		b, 0FCh	; '�'
		call	Page7D_2C43
		jp		c, Page0Call_2541
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8021h
; ---------------------------------------------------------------------------
		call	Page7D_3E0D
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_70D1:
		ld		de, 300h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8027h
; ---------------------------------------------------------------------------
		ret
; End of function p7Dsub_70D1

; ---------------------------------------------------------------------------
aCert_Revision:	.asc 'Cert. Revision #',0
; ---------------------------------------------------------------------------

Page7D_3C5D:
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	p7Dsub_70D1
		jp		nz, relockFlashBack
		push	hl
		ld		hl, aCert_Revision
		ld		de, OP1
		ld		bc, 12h

p7Dloc_710A:
		ld		a, (hl)
		ld		(de), a
		inc		hl
		inc		de
		djnz	p7Dloc_710A
		ld		hl, OP1
		call	j_VPutS
		ld		a, 7Eh ; '~'
		pop		hl
		call	p7Dsub_4873
		push	bc
		pop		hl
		call	p7Dsub_598E
		jp		relockFlashBack

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7124:
		ld		a, (header)
		cp		23h ; '#'
		ret
; End of function p7Dsub_7124

; ---------------------------------------------------------------------------

Page7D_2BB3:
		ld		bc, (unk_8685)
		sub		c
		ld		hl, (unk_8683)
		push	af
		ld		a, (unk_8434)
		sub		c
		call	p7Dsub_5EFC
		jr		c, p7Dloc_7150
		pop		af
		ld		bc, (ioData)
		push	hl
		push	bc
		push	af
		ld		h, 9
		call	j_Send4BytePacket
		pop		af
		pop		bc
		pop		hl
		call	p7Dsub_7240
		ret
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_7240

p7Dloc_7150:
		; p7Dsub_7240:p7Dloc_74EDj ...
		call	relockFlashBack
		call	p7Dsub_7124
		push	af
		jr		z, p7Dloc_715C
		call	popErrorHandleR

p7Dloc_715C:
		pop		af
		push	af
		jr		z, p7Dloc_7166
		ld		hl, Page0Call_2C79
		call	pushErrorHandleR

p7Dloc_7166:
		call	j_HomeUp
		ld		a, 0Bh
		call	Page0Call_2C49
		pop		af
		jr		z, p7Dloc_7174
		call	popErrorHandleR

p7Dloc_7174:
		call	Page0Call_3D05
		jp		Page0Call_2541
; END OF FUNCTION CHUNK	FOR p7Dsub_7240

; =============== S U B	R O U T	I N E =======================================


p7Dsub_717A:

		ld		hl, ramStart
		ld		de, 81AFh
		jr		p7Dloc_7188
; End of function p7Dsub_717A


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7182:
		; p7Dsub_7240+1EDp ...
		ld		hl, 81AFh
		ld		de, ramStart

p7Dloc_7188:
		ld		bc, 80h	; '�'
		ldir
		ret
; End of function p7Dsub_7182

; ---------------------------------------------------------------------------

WriteToFlash:
		cp		0
		jr		z, p7Dloc_71B3
		cp		1
		jp		z, Page7D_2BDD
		cp		2
		jp		z, p7Dloc_7E57
		cp		3
		jp		z, p7Dloc_7E31
		cp		4
		jp		z, p7Dsub_7D67
		cp		5
		jp		z, p7Dloc_7E8D
		cp		6
		jp		z, p7Dloc_7E91
		jp		ErrInvalid
; ---------------------------------------------------------------------------

p7Dloc_71B3:
		push	ix
		ld		a, (ramCodeEnd)
		or		a
		ld		a, e
		jr		nz, p7Dloc_71D9
		push	hl
		push	bc
		call	p7Dsub_7B72
		pop		bc
		pop		hl
		or		a
		jp		z, Page7D_2BB9
		push	hl
		ld		de, 4000h
		sbc		hl, de
		jp		nz, Page0Call_2541
		ld		hl, 7Fh	; ''
		sbc		hl, bc
		jp		nc, Page0Call_2541
		pop		hl

p7Dloc_71D9:
		push	af
		ld		(appSearchPage+1), a
		call	p7Dsub_5EFC
		jp		c, Page0Call_2541
		push	hl
		ld		de, 4080h
		sbc		hl, de
		pop		hl
		jr		nc, p7Dloc_71FD
		ld		a, (ramCodeEnd)
		or		a
		jr		z, p7Dloc_71FD
		ld		a, (unk_8434)
		ld		e, a
		ld		a, (appSearchPage+1)
		cp		e
		jp		z, Page0Call_2541

p7Dloc_71FD:
		xor		a
		ld		(appInfo), a
		ld		(unk_843B), hl
		ld		(unk_8439), bc
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		res		6, (iy+24h)
		res		7, (iy+24h)
		xor		a
		ld		(unk_9C87), a

p7Dloc_7225:
		push	bc
		ld		a, (unk_83A4)
		cp		0
		jr		z, p7Dloc_7234
		ld		a, (unk_83A3)
		inc		a
		ld		(unk_83A3), a

p7Dloc_7234:
		call	p7Dsub_7CBB
		pop		bc
		dec		bc
		ld		a, b
		or		c
		jr		nz, p7Dloc_7225
		jp		p7Dloc_739B

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7240:








		push	ix
		push	af
		ld		(appSearchPage+1), a
		xor		a
		ld		(sndRecState), a
		ex		de, hl
		ld		(unk_843B), de
		push	bc
		call	j_Get4Bytes
		pop		bc
		ld		hl, ioFlag
		ld		a, (unk_8675)
		cp		15h
		jp		nz, p7Dloc_733F
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		ld		hl, (unk_8676)
		or		a
		sbc		hl, bc
		jp		nz, p7Dloc_733F
		res		6, (iy+24h)
		res		7, (iy+24h)
		xor		a
		ld		(unk_9C87), a
		ld		bc, (unk_8676)
		ld		de, 0
		ld		(unk_8678), de
		ld		a, c
		or		b
		jp		z, p7Dloc_7363
		ld		hl, ramStart
		ld		(unk_8439), bc

p7Dloc_729C:
		call	CHKERRBREAK
		jp		z, p7Dloc_7345
		jp		JErrorNo
; End of function p7Dsub_7240

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_7BEA

Page7D_2BB9:
		; p7Dsub_7240+1C0j ...
		call	p7Dsub_733B
		call	relockFlashBack
		call	p7Dsub_7124
		push	af
		jr		z, p7Dloc_72B4
		call	popErrorHandleR

p7Dloc_72B4:
		pop		af
		push	af
		jr		z, p7Dloc_72BE
		ld		hl, Page0Call_2C79
		call	pushErrorHandleR

p7Dloc_72BE:
		call	j_HomeUp
		ld		a, 1
		call	Page0Call_2C49
		pop		af
		jr		z, p7Dloc_72CC
		call	popErrorHandleR

p7Dloc_72CC:
		call	Page0Call_3D05
		jp		ErrMemory
; END OF FUNCTION CHUNK	FOR p7Dsub_7BEA
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_7240

p7Dloc_72D2:
		call	p7Dsub_733B
		call	relockFlashBack
		call	p7Dsub_7124
		push	af
		jr		z, p7Dloc_72E1
		call	popErrorHandleR

p7Dloc_72E1:
		pop		af
		push	af
		jr		z, p7Dloc_72EB
		ld		hl, Page0Call_2C79
		call	pushErrorHandleR

p7Dloc_72EB:
		call	j_HomeUp
		ld		a, 7
		call	Page0Call_2C49
		pop		af
		jr		z, p7Dloc_72F9
		call	popErrorHandleR

p7Dloc_72F9:
		call	j_ReceiveAck
		call	Page0Call_3D05
		jp		Page0Call_2539
; ---------------------------------------------------------------------------

p7Dloc_7302:
		call	p7Dsub_733B
		call	relockFlashBack
		call	p7Dsub_7124
		push	af
		jr		z, p7Dloc_7311
		call	popErrorHandleR

p7Dloc_7311:
		pop		af
		push	af
		jr		z, p7Dloc_731B
		ld		hl, Page0Call_2C79
		call	pushErrorHandleR

p7Dloc_731B:
		call	j_HomeUp
		ld		a, 9
		call	Page0Call_2C49
		pop		af
		jr		z, p7Dloc_7329
		call	popErrorHandleR

p7Dloc_7329:
		call	Page0Call_3D05
		jp		Page0Call_253D
; END OF FUNCTION CHUNK	FOR p7Dsub_7240
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_75B8

p7Dloc_732F:
		call	p7Dsub_733B
		call	Page0Call_2C49
		ret
; END OF FUNCTION CHUNK	FOR p7Dsub_75B8
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_7240

p7Dloc_7336:
		ld		h, 36h ; '6'
		jp		Page0Call_2C73
; END OF FUNCTION CHUNK	FOR p7Dsub_7240

; =============== S U B	R O U T	I N E =======================================


p7Dsub_733B:
		; p7Dsub_7240:p7Dloc_72D2p ...
		call	p7Dsub_7CB2
		ret		nz

p7Dloc_733F:
		call	relockFlashBack
		jp		JErrorNo
; End of function p7Dsub_733B

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_7240

p7Dloc_7345:
		push	bc
		call	j_RecAByteIO
		ld		(hl), a
		call	p7Dsub_7CA5
		inc		hl
		ex		de, hl
		ld		b, 0
		ld		hl, (unk_8678)
		add		hl, bc
		ld		(unk_8678), hl
		ex		de, hl
		call	p7Dsub_7CBB
		pop		bc
		dec		bc
		ld		a, b
		or		c
		jp		nz, p7Dloc_729C

p7Dloc_7363:
		call	j_RecAByteIO
		push	af
		call	j_RecAByteIO
		ld		b, a
		pop		af
		ld		c, a
		in		a, (2)
		and		80h ; '�'
		jr		z, p7Dloc_738A
		in		a, (20h)
		and		1
		jr		z, p7Dloc_738A
		xor		a
		out		(20h), a
		ld		de, 0FEh ; '�'

p7Dloc_737F:
		dec		de
		ld		a, d
		or		e
		jr		nz, p7Dloc_737F
		ld		a, 1
		out		(20h), a
		jr		p7Dloc_7392
; ---------------------------------------------------------------------------

p7Dloc_738A:
		; p7Dsub_7240+137j
		ld		de, 100h

p7Dloc_738D:
		dec		de
		ld		a, d
		or		e
		jr		nz, p7Dloc_738D

p7Dloc_7392:
		ld		hl, (unk_8678)
		or		a
		sbc		hl, bc
		jp		nz, p7Dloc_75A5

p7Dloc_739B:
		call	p7Dsub_5E0A
		ld		a, (ramCodeEnd)
		cp		0
		jp		nz, p7Dloc_74BC
		ld		de, (unk_843B)
		push	de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8063h
; ---------------------------------------------------------------------------
		pop		de
		ld		(unk_843B), de
		jp		nz, p7Dloc_72D2
		ld		a, 1
		ld		de, 8050h
		call	p7Dsub_7060
		jr		nz, p7Dloc_73C6
		call	p7Dsub_50C5
		jp		nz, p7Dloc_7302

p7Dloc_73C6:
		call	p7Dsub_75B8
		ld		a, (appInfo)
		cp		0
		jp		nz, p7Dloc_75B4
		di
		ld		hl, (curRow)
		push	hl
		call	j_newline
		ld		a, (ioFlag)
		push	af
		call	p7Dsub_717A
		res		2, (iy+25h)
		call	Chk_Batt_Low
		jp		z, ErrInvalid
		ld		a, 0
		ld		b, 0
		call	Page0Call_2EB9
		call	p7Dsub_7182
		pop		af
		pop		hl
		ld		(curRow), hl
		ld		(ioFlag), a
		call	p7Dsub_7B72
		or		a
		jp		z, Page7D_2BB9
		push	af
		call	p7Dsub_7BEA
		jr		c, p7Dloc_740C

p7Dloc_7409:
		jp		nz, Page7D_2BB9

p7Dloc_740C:
		xor		a
		cp		d
		jp		z, ErrInvalid
		push	de
		call	FindSwapSector
		cp		8
		jr		z, p7Dloc_7430
		add		a, 4
		ld		b, a
		ld		a, c
		sub		d
		cp		b
		jr		nc, p7Dloc_7430
		ld		a, 5
		call	Page0Call_2EB9
		call	FindSwapSector
		cp		8
		jr		nz, p7Dloc_7409
		call	p7Dsub_7182

p7Dloc_7430:
		; p7Dsub_7240+1DFj
		ld		a, (appSearchPage)
		call	Page7D_2C13
		ld		a, 1
		ld		hl, ramStart
		call	Page7D_2C97
		call	p7Dsub_7CB2
		jr		z, p7Dloc_7453
		ld		a, 19h
		ld		(sndRecState), a
		call	Page0Call_2E23
		call	Page0Call_2DE7
		di
		xor		a
		ld		(sndRecState), a

p7Dloc_7453:
		pop		de
		pop		af
		push	de
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	p7Dsub_519D
		call	p7Dsub_5E90
		ld		hl, ramStart
		call	p7Dsub_5757
		ld		hl, (unk_83A1)
		call	p7Dsub_57C5
		push	hl
		ld		a, 1
		ld		hl, ramStart
		push	hl
		inc		hl
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		pop		bc
		sbc		hl, bc
		push	hl
		pop		bc
		ld		hl, (unk_8439)
		sbc		hl, bc
		push	hl
		pop		bc
		pop		hl
		sbc		hl, bc
		call	p7Dsub_57C5
		ld		(unk_83A1), hl
		jr		c, p7Dloc_749D
		jr		nz, p7Dloc_74F0

p7Dloc_749D:
		ld		hl, (unk_839F)
		call	p7Dsub_57C5
		dec		hl
		call	p7Dsub_57C5
		ld		(unk_839F), hl
		ld		a, l
		or		h
		jr		nz, p7Dloc_74BA
		ld		hl, (unk_83A1)
		ld		a, l
		or		h
		jr		nz, p7Dloc_74BA
		ld		a, 0
		ld		(unk_83A4), a

p7Dloc_74BA:
		; p7Dsub_7240+273j
		jr		p7Dloc_74F0
; ---------------------------------------------------------------------------

p7Dloc_74BC:
		push	de
		call	p7Dsub_7CB2
		jr		nz, p7Dloc_74F0
		ld		a, (appSearchPage+1)
		call	p7Dsub_7CCF
		call	p7Dsub_4566
		cp		0FEh ; '�'
		jr		nz, p7Dloc_74ED
		call	p7Dsub_4565
		cp		0BFh ; '�'
		jr		nz, p7Dloc_74ED
		call	p7Dsub_4565
		ld		b, a
		ld		a, (appSearchPage+1)
		cp		b
		jr		z, p7Dloc_74F0
		jr		nc, p7Dloc_74ED
		call	p7Dsub_4565
		ld		b, a
		ld		a, (appSearchPage+1)
		inc		b
		cp		b
		jr		nc, p7Dloc_74F0

p7Dloc_74ED:
		; p7Dsub_7240+294j ...
		jp		p7Dloc_7150
; ---------------------------------------------------------------------------

p7Dloc_74F0:
		; p7Dsub_7240:p7Dloc_74BAj ...
		ld		bc, (unk_8439)
		ld		hl, ramStart
		ld		de, (unk_843B)
		ld		a, (appSearchPage+1)
		bit		7, d
		jp		nz, p7Dloc_7150
		bit		6, d
		jp		z, p7Dloc_7150
		cp		8
		jp		c, p7Dloc_7150
		call	p7Dsub_75E1
		jp		nc, p7Dloc_7150
		call	p7Dsub_756F
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		call	p7Dsub_7CB2
		jr		z, p7Dloc_752A
		call	relockFlashBack
		call	j_SendAck

p7Dloc_7524:
		pop		de

p7Dloc_7525:
		pop		af
		pop		ix
		xor		a
		ret
; ---------------------------------------------------------------------------

p7Dloc_752A:
		ld		a, (ramCodeEnd)
		or		a
		jr		z, p7Dloc_7535
		call	relockFlashBack
		jr		p7Dloc_7524
; ---------------------------------------------------------------------------

p7Dloc_7535:
		call	p7Dsub_7CCF
		pop		de
		push	hl
		push	de
		ld		b, 4

p7Dloc_753D:
		call	p7Dsub_4566
		cp		0FFh
		jr		nz, p7Dloc_7549
		inc		hl
		djnz	p7Dloc_753D
		jr		p7Dloc_754C
; ---------------------------------------------------------------------------

p7Dloc_7549:
		call	Page7D_2BAD

p7Dloc_754C:
		ld		hl, 0BFFEh
		ld		(OP1+1), hl
		ld		a, (appSearchPage)
		ld		(OP1+3), a
		pop		de
		sub		d
		ld		(OP1+4), a
		ld		bc, 4
		ld		hl, 8479h
		call	p7Dsub_7700
		pop		de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		call	relockFlashBack
		jr		p7Dloc_7525
; END OF FUNCTION CHUNK	FOR p7Dsub_7240

; =============== S U B	R O U T	I N E =======================================


p7Dsub_756F:
		ld		h, d
		ld		l, e
		dec		hl
		add		hl, bc
		bit		7, h
		jr		z, p7Dloc_75A1
		ld		hl, ramStart
		ld		de, (unk_843B)
		or		a
		sbc		hl, de
		ld		b, h
		ld		c, l
		ld		hl, ramStart
		push	bc
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		pop		bc
		ld		a, (appSearchPage+1)
		dec		a
		ld		hl, (unk_8439)
		or		a
		sbc		hl, bc
		push	bc
		ld		b, h
		ld		c, l
		pop		de
		ld		hl, ramStart
		add		hl, de
		ld		de, 4000h
		ret
; ---------------------------------------------------------------------------

p7Dloc_75A1:
		ld		hl, ramStart
		ret
; End of function p7Dsub_756F

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_7240

p7Dloc_75A5:
		ld		hl, (unk_8439)
		push	hl
		ld		h, 5Ah ; 'Z'
		call	j_Send4BytePacket
		jp		p7Dloc_7336
; END OF FUNCTION CHUNK	FOR p7Dsub_7240
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_75B8

p7Dloc_75B1:
		jp		p7Dloc_732F
; END OF FUNCTION CHUNK	FOR p7Dsub_75B8
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p7Dsub_7240

p7Dloc_75B4:

		pop		af
		pop		ix
		ret
; END OF FUNCTION CHUNK	FOR p7Dsub_7240

; =============== S U B	R O U T	I N E =======================================


p7Dsub_75B8:




		call	ZeroOP1
		ld		a, 1
		or		a
		ld		hl, ramStart
		ld		de, 8040h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jp		nz, p7Dloc_75B1
		inc		hl
		ld		a, 1
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ld		de, 8479h
		ldir
		ld		a, (appSearchPage+1)
		push	af
		call	p7Dsub_6428
		pop		af
		ld		(appSearchPage+1), a
		ret
; End of function p7Dsub_75B8


; =============== S U B	R O U T	I N E =======================================


p7Dsub_75E1:
		; FindSwapSector+18p ...
		call	NZIf83Plus
		jr		nz, p7Dloc_75E9
		cp		6Ah ; 'j'
		ret

p7Dloc_75E9:
		cp		16h
		ret

GetAppSpaceStartToA:
		ld		a, 15h
		call	NZIf83Plus
		ret		nz
		ld		a, 69h
		ret

p7Dsub_75F5:
		call	GetAppSpaceStartToA
		inc		a
		ld		(appSearchPage), a
		ret
; End of function p7Dsub_75F5


; =============== S U B	R O U T	I N E =======================================


p7Dsub_75FD:
		ld		de, 839Fh
		and		0Fh
		cp		0Fh
		jr		nz, p7Dloc_7609
		ld		b, 4
		ret
; ---------------------------------------------------------------------------

p7Dloc_7609:
		cp		0Eh
		jr		nz, p7Dloc_7612
		ld		b, 2
		xor		a
		jr		p7Dloc_761A
; ---------------------------------------------------------------------------

p7Dloc_7612:
		cp		0Dh
		ret		nz
		ld		b, 1
		xor		a
		ld		(de), a
		inc		de

p7Dloc_761A:
		ld		(de), a
		inc		de
		ld		(de), a
		inc		de
		ret
; End of function p7Dsub_75FD


; =============== S U B	R O U T	I N E =======================================


p7Dsub_761F:
		push	af
		call	LoadAIndPaged_Copy
		ld		(de), a
		inc		de
		inc		hl
		pop		af
		djnz	p7Dsub_761F
		ret
; End of function p7Dsub_761F


; =============== S U B	R O U T	I N E =======================================


p7Dsub_762A:
		call	p7Dsub_7634
		ld		de, 610h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8030h
; ---------------------------------------------------------------------------
		ret
; End of function p7Dsub_762A


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7634:
		call	p7Dsub_4894
		ld		de, 600h
		call	p7Dsub_777E
		call	p7Dsub_4574
		ld		a, 7Eh ; '~'
		ret
; End of function p7Dsub_7634


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7643:
		ld		bc, 0Dh
		call	NZIf83Plus
		ret		nz
		ld		bc, 61h	; 'a'
		ret
; End of function p7Dsub_7643


; =============== S U B	R O U T	I N E =======================================


p7Dsub_764E:
		; p7Dsub_484E:p7Dloc_486Cp ...
		push	ix
		pop		hl
		ld		bc, 0Dh
		add		hl, bc
		ret
; End of function p7Dsub_764E


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7656:
		ld		a, 16h
		call	NZIf83Plus
		ret		nz
		ld		a, 6Ah ; 'j'
		ret
; End of function p7Dsub_7656

; ---------------------------------------------------------------------------
		ld		hl, OP1
		ld		(hl), b

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7663:
		ld		bc, 1
; End of function p7Dsub_7663


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7666:
		; CopyFlashPage+38p ...
		res		1, (iy+25h)
		call	NZIf83Plus
		jr		z, p7Dloc_7671
		and		1Fh

p7Dloc_7671:
		push	ix
		ld		ix, WriteFlashPrivilegedCopy
		call	p7Dsub_6B87
		pop		ix
		ret
; End of function p7Dsub_7666

WriteFlashPrivilegedCopy:
		.dw		81h
		ld		(flashByte2), a
		in		a, (6)
		push	af
		ld		a, (flashByte2)
		out		(6), a
		bit		7, h
		jr		nz, p7Dloc_7692
		set		1, (iy+25h)

p7Dloc_7692:
		bit		1, (iy+25h)
		push	hl
		jr		nz, p7Dloc_76AD
		ld		hl, 7FFFh
		or		a
		sbc		hl, de
		jr		nc, p7Dloc_76AD
		in		a, (6)
		inc		a
		cp		7Eh ; '~'
		jr		z, p7Dloc_76AA
		out		(6), a

p7Dloc_76AA:
		ld		de, 4000h

p7Dloc_76AD:
		pop		hl
		in		a, (6)
		push	af
		ld		a, 2
		out		(6), a
		ld		a, 0AAh	; '�'
		ld		(p7Dloc_6AA8+2), a
		ld		a, 1
		out		(6), a
		ld		a, 55h ; 'U'
		ld		(p7Dloc_5555), a
		ld		a, 2
		out		(6), a
		ld		a, 0A0h	; '�'
		ld		(p7Dloc_6AA8+2), a
		pop		af
		out		(6), a
		ld		a, (hl)
		ld		a, (hl)
		ld		(de), a

p7Dloc_76D2:
		ld		a, (de)
		push	af
		xor		(hl)
		and		80h ; '�'
		jr		z, p7Dloc_76E6
		pop		af
		bit		5, a
		jr		z, p7Dloc_76D2
		ld		a, (de)
		xor		(hl)
		and		80h ; '�'
		jr		nz, p7Dloc_76F8
		jr		p7Dloc_76E7
; ---------------------------------------------------------------------------

p7Dloc_76E6:
		pop		af

p7Dloc_76E7:
		inc		de
		inc		hl
		dec		bc
		ld		a, b
		or		c
		jr		nz, p7Dloc_7692
		dec		de
		ld		a, 0F0h	; '�'
		ld		(de), a
		inc		de
		pop		af
		out		(6), a
		xor		a
		ret
; ---------------------------------------------------------------------------

p7Dloc_76F8:
		ld		a, 0F0h	; '�'
		ld		(de), a
		pop		af
		out		(6), a
		or		a
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7700:
		in		a, (2)
		and		80h ; '�'
		ld		a, 1Eh
		ret		z
		ld		a, 7Eh ; '~'
		ret
; End of function p7Dsub_7700

; ---------------------------------------------------------------------------

Page7D_2C25:
		push	af
		inc		a
		ld		(appSearchPage), a
		call	p7Dsub_638B
		ld		a, 14h
		ld		(OP1), a
		ld		bc, 8
		ld		hl, 8484h
		ld		de, 8479h
		ldir
		pop		af
		ret
; ---------------------------------------------------------------------------

Page7D_2BDD:
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		ld		a, (unk_8434)
		nop
		call	p7Dsub_43F6
		jr		nz, ret8
		ld		a, (unk_8434)
		ld		hl, 4000h
		call	p7Dsub_5E59
		call	p7Dsub_52D9
		jp		c, p7Dloc_774F
		jr		nz, ret9

p7Dloc_774F:
		ld		a, (unk_8434)
		ld		hl, 4000h
		call	Page7D_2C97
		call	p7Dsub_51C3
		ld		a, (unk_8434)
		ld		hl, 4000h
		call	p7Dsub_5E59
		call	p7Dsub_533B
		call	GetFirstInvalidAppPageToB
		ld		a, b
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80CFh
; ---------------------------------------------------------------------------
		ld		a, 0FFh
		ld		(ioFlag), a
		call	relockFlashBack
		xor		a
		ret
; ---------------------------------------------------------------------------

ret9:
		ld		a, 9
		ret
; ---------------------------------------------------------------------------

ret8:
		ld		a, 8
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_777E:
		call	p7Dsub_7700
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Dh
; ---------------------------------------------------------------------------
		ret
; End of function p7Dsub_777E

; ---------------------------------------------------------------------------
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8063h
; ---------------------------------------------------------------------------
		jp		nz, p7Dloc_7813
		ld		a, 1
		ld		de, 8050h
		call	p7Dsub_7060
		jr		nz, p7Dloc_779B
		call	p7Dsub_50C5
		jp		nz, p7Dloc_7810

p7Dloc_779B:
		call	p7Dsub_7B41
		ld		a, (appInfo)
		cp		0
		jp		nz, p7Dloc_75B4
		di
		ld		a, (ioFlag)
		push	af
		call	p7Dsub_717A
		ld		a, 0
		ld		b, 0
		res		2, (iy+25h)
		call	Page0Call_2EB9
		call	p7Dsub_7182
		pop		af
		ld		(ioFlag), a
		call	p7Dsub_7B72
		or		a
		jp		z, p7Dloc_780D
		push	af
		call	p7Dsub_7BEA
		jr		c, p7Dloc_77D2
		jr		z, p7Dloc_77D2

p7Dloc_77CF:
		jp		p7Dloc_780D
; ---------------------------------------------------------------------------

p7Dloc_77D2:
		call	FindSwapSector
		cp		8
		jr		z, p7Dloc_77F0
		add		a, 4
		ld		b, a
		ld		a, c
		sub		d
		cp		b
		jr		nc, p7Dloc_77F0
		ld		a, 5
		call	Page0Call_2EB9
		call	FindSwapSector
		cp		8
		jr		nz, p7Dloc_77CF
		call	p7Dsub_7182

p7Dloc_77F0:
		ld		a, (appSearchPage)
		call	Page7D_2C13
		ld		a, 1
		ld		hl, ramStart
		call	Page7D_2C97
		ld		a, 19h
		ld		(sndRecState), a
		pop		af
		push	af
		di
		xor		a
		ld		(sndRecState), a
		pop		af
		ret
; ---------------------------------------------------------------------------
		ret
; ---------------------------------------------------------------------------

p7Dloc_780D:

		jp		ErrMemory
; ---------------------------------------------------------------------------

p7Dloc_7810:
		jp		Page0Call_253D
; ---------------------------------------------------------------------------

p7Dloc_7813:
		jp		Page0Call_2539
; ---------------------------------------------------------------------------
		call	popErrorHandleR
		ld		a, 23h ; '#'
		ld		(errNo), a
		or		1
		ret
; ---------------------------------------------------------------------------
		push	af
		ld		(unk_8439), a
		call	p7Dsub_5525
		ld		b, a
		pop		af
		sub		b
		ld		de, 4000h
		push	hl
		or		a
		jr		z, p7Dloc_7855
		push	af

p7Dloc_7833:
		ld		hl, 4000h
		ld		bc, 4000h
		call	p7Dsub_7865
		pop		af
		dec		a
		or		a
		jr		z, p7Dloc_784B
		push	af
		ld		a, (unk_8439)
		dec		a
		ld		(unk_8439), a
		jr		p7Dloc_7833
; ---------------------------------------------------------------------------

p7Dloc_784B:
		ld		hl, 4000h
		ld		a, (unk_8439)
		dec		a
		ld		(unk_8439), a

p7Dloc_7855:
		pop		hl
		ld		de, 4000h
		or		a
		sbc		hl, de
		push	hl
		pop		bc
		ld		hl, 4000h
		call	p7Dsub_7865
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7865:
		push	hl
		push	bc
		ld		a, (unk_8439)
		ld		de, ramStart
		ld		bc, 100h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8054h
; ---------------------------------------------------------------------------
		pop		bc
		ld		hl, 100h
		or		a
		sbc		hl, bc
		jr		nc, p7Dloc_7882
		push	bc
		ld		bc, 100h
		jr		p7Dloc_7883
; ---------------------------------------------------------------------------

p7Dloc_7882:
		push	bc

p7Dloc_7883:
		ld		hl, ramStart
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8090h
; ---------------------------------------------------------------------------
		ex		de, hl
		pop		hl
		ld		bc, 100h
		or		a
		sbc		hl, bc
		push	hl
		pop		bc
		ex		de, hl
		jr		z, p7Dloc_78A1
		jr		c, p7Dloc_78A1
		pop		hl
		push	bc
		ld		de, 100h
		add		hl, de
		pop		bc
		jr		p7Dsub_7865
; ---------------------------------------------------------------------------

p7Dloc_78A1:
		pop		hl
		ret
; End of function p7Dsub_7865


; =============== S U B	R O U T	I N E =======================================


p7Dsub_78A3:
		push	af
		push	hl
		push	bc
		ld		b, 8

p7Dloc_78A8:
		ld		c, a
		xor		e
		rr	d
		rr	e
		and		1
		jr		z, p7Dloc_78BA
		ld		a, 8
		xor		e
		ld		e, a
		ld		a, 84h ; '�'
		xor		d
		ld		d, a

p7Dloc_78BA:
		ld		a, c
		rra
		djnz	p7Dloc_78A8
		pop		bc
		pop		hl
		pop		af
		ret
; End of function p7Dsub_78A3


; =============== S U B	R O U T	I N E =======================================


p7Dsub_78C2:
		push	hl
		push	bc
		push	af
		ld		de, 0FFFFh
		ld		a, b
		or		c
		jr		z, p7Dloc_78F1

p7Dloc_78CC:
		ld		a, (hl)
		inc		hl
		push	af
		push	hl
		push	bc
		ld		b, 8

p7Dloc_78D3:
		ld		c, a
		xor		e
		rr	d
		rr	e
		and		1
		jr		z, p7Dloc_78E5
		ld		a, 8
		xor		e
		ld		e, a
		ld		a, 84h ; '�'
		xor		d
		ld		d, a

p7Dloc_78E5:
		ld		a, c
		rra
		djnz	p7Dloc_78D3
		pop		bc
		pop		hl
		pop		af
		dec		bc
		ld		a, b
		or		c
		jr		nz, p7Dloc_78CC

p7Dloc_78F1:
		pop		af
		pop		bc
		pop		hl
		ret
; End of function p7Dsub_78C2


; =============== S U B	R O U T	I N E =======================================


p7Dsub_78F5:
		; p7Dsub_794D+6p ...
		push	hl
		push	de
		push	bc
		ld		hl, p7Dloc_790F
		call	APP_PUSH_ERRORH
		call	j_RecAByteIO
		ld		l, a
		call	APP_POP_ERRORH
		bit		onInterrupt, (iy+onFlags)
		jr		nz, p7Dloc_790F
		xor		a
		ld		a, l
		jr		p7Dloc_7911
; ---------------------------------------------------------------------------

p7Dloc_790F:
		or		0FFh

p7Dloc_7911:
		pop		bc
		pop		de
		pop		hl
		ret
; End of function p7Dsub_78F5


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7915:
		push	hl
		push	bc
		push	af
		ld		de, 0
		ld		a, b
		or		c
		jr		z, p7Dloc_792D

p7Dloc_791F:
		call	p7Dsub_78F5
		jr		nz, p7Dloc_792D
		ld		(hl), a
		inc		hl
		inc		de
		dec		bc
		ld		a, b
		or		c
		jr		nz, p7Dloc_791F
		xor		a

p7Dloc_792D:
		pop		bc
		ld		a, b
		pop		bc
		pop		hl
		ret
; End of function p7Dsub_7915


; =============== S U B	R O U T	I N E =======================================


LinkStatus:
		push	bc
		push	af
		call	NZIf83Plus
		jr		z, p7Dloc_7945
		in		a, (0)
		and		3
		jr		z, p7Dloc_7949
		cp		3
		jr		z, p7Dloc_7949
		jr		p7Dloc_7949
; ---------------------------------------------------------------------------

p7Dloc_7945:
		in		a, (9)
		and		58h ; 'X'

p7Dloc_7949:
		; LinkStatus+Fj ...
		pop		bc
		ld		a, b
		pop		bc
		ret
; End of function LinkStatus


; =============== S U B	R O U T	I N E =======================================


p7Dsub_794D:
		push	af

p7Dloc_794E:
		call	LinkStatus
		jr		z, p7Dloc_795A
		call	p7Dsub_78F5
		jr		nz, p7Dloc_795A
		jr		p7Dloc_794E
; ---------------------------------------------------------------------------

p7Dloc_795A:
		pop		af
		ret
; End of function p7Dsub_794D


; =============== S U B	R O U T	I N E =======================================


p7Dsub_795C:
		push	ix
		ld		ix, 0
		add		ix, sp
		push	hl
		push	de
		push	af
		push	af
		push	af
		ld		de, 0FFFFh
		call	p7Dsub_78F5
		jp		nz, p7Dloc_79F0
		call	p7Dsub_78F5
		jr		nz, p7Dloc_79F0
		call	p7Dsub_78A3
		ld		h, a
		call	p7Dsub_78F5
		jr		nz, p7Dloc_79F0
		call	p7Dsub_78A3
		ld		l, a
		ld		(ix+0F9h), h
		ld		(ix+0F8h), l
		call	p7Dsub_78F5
		jr		nz, p7Dloc_79F0
		call	p7Dsub_78A3
		ld		h, a
		call	p7Dsub_78F5
		jr		nz, p7Dloc_79F0
		call	p7Dsub_78A3
		ld		l, a
		ld		(ix+0FBh), h
		ld		(ix+0FAh), l
		call	p7Dsub_78F5
		jr		nz, p7Dloc_79F0
		ld		h, a
		call	p7Dsub_78F5
		jr		nz, p7Dloc_79F0
		ld		l, a
		and		a
		sbc		hl, de
		jr		nz, p7Dloc_79F0
		ld		d, (ix+0FBh)
		ld		e, (ix+0FAh)
		ld		a, d
		or		e
		jr		z, p7Dloc_79F5
		ld		h, (ix+0FDh)
		ld		l, (ix+0FCh)
		and		a
		sbc		hl, de
		jr		c, p7Dloc_79F0
		ld		h, (ix+0FFh)
		ld		l, (ix+0FEh)
		ld		b, (ix+0FBh)
		ld		c, (ix+0FAh)
		call	p7Dsub_7915
		jr		nz, p7Dloc_79F0
		call	p7Dsub_78C2
		call	p7Dsub_78F5
		jr		nz, p7Dloc_79F0
		ld		h, a
		call	p7Dsub_78F5
		jr		nz, p7Dloc_79F0
		ld		l, a
		and		a
		sbc		hl, de
		jr		nz, p7Dloc_79F0
		xor		a
		jr		p7Dloc_79F5
; ---------------------------------------------------------------------------

p7Dloc_79F0:
		call	p7Dsub_794D
		or		0FFh

p7Dloc_79F5:
		pop		bc
		ld		a, b
		pop		bc
		pop		de
		pop		hl
		pop		hl
		pop		ix
		ret
; End of function p7Dsub_795C

; ---------------------------------------------------------------------------
		push	ix
		ld		ix, 0
		add		ix, sp
		push	hl
		push	de
		push	af
		push	af
		push	af
		push	af
		ld		b, 0
		ld		a, c
		or		a
		jr		z, p7Dloc_7A17
		dec		c
		cp		33h ; '3'
		jr		c, p7Dloc_7A19

p7Dloc_7A17:
		ld		c, 32h ; '2'

p7Dloc_7A19:
		ld		(ix+0F7h), b
		ld		(ix+0F6h), c
		call	p7Dsub_7A8D
		jr		nz, p7Dloc_7A52
		ld		h, (ix+0FFh)
		ld		l, (ix+0FEh)
		ld		d, (ix+0FDh)
		ld		e, (ix+0FCh)
		call	p7Dsub_795C
		ld		(ix+0FBh), d
		ld		(ix+0FAh), e
		ld		(ix+0F9h), b
		ld		(ix+0F8h), c
		jr		z, p7Dloc_7A59
		ld		b, (ix+0F7h)
		ld		c, (ix+0F6h)
		bit		onInterrupt, (iy+onFlags)
		jr		nz, p7Dloc_7A52
		dec		bc
		ld		a, b
		or		c
		jr		nz, p7Dloc_7A19

p7Dloc_7A52:
		call	p7Dsub_7A85
		or		0FFh
		jr		p7Dloc_7A5D
; ---------------------------------------------------------------------------

p7Dloc_7A59:
		call	p7Dsub_7A75
		xor		a

p7Dloc_7A5D:
		pop		bc
		ld		a, b
		pop		bc
		pop		bc
		pop		de
		pop		hl
		pop		hl
		pop		ix
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7A67:
		push	hl
		push	de
		ld		hl, 0
		ld		de, 0
		call	p7Dsub_7AD0
		pop		de
		pop		hl
		ret
; End of function p7Dsub_7A67


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7A75:
		push	bc
		ld		b, 1
		call	p7Dsub_7A67
		pop		bc
		ret
; End of function p7Dsub_7A75

; ---------------------------------------------------------------------------
		push	bc
		ld		b, 2
		call	p7Dsub_7A67
		pop		bc
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7A85:
		push	bc
		ld		b, 4
		call	p7Dsub_7A67
		pop		bc
		ret
; End of function p7Dsub_7A85


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7A8D:
		bit		onInterrupt, (iy+onFlags)
		res		onInterrupt, (iy+onFlags)
		ret
; End of function p7Dsub_7A8D


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7A96:
		push	hl
		push	de
		push	bc
		push	af
		ld		hl, p7Dloc_7AAF
		call	APP_PUSH_ERRORH
		call	j_SendAByte
		call	APP_POP_ERRORH
		bit		onInterrupt, (iy+onFlags)
		jr		nz, p7Dloc_7AAF
		xor		a
		jr		p7Dloc_7AB1
; ---------------------------------------------------------------------------

p7Dloc_7AAF:
		or		0FFh

p7Dloc_7AB1:
		pop		bc
		ld		a, b
		pop		bc
		pop		de
		pop		hl
		ret
; End of function p7Dsub_7A96


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7AB7:
		push	hl
		push	bc
		push	af
		ld		a, b
		or		c
		jr		z, p7Dloc_7ACB

p7Dloc_7ABE:
		ld		a, (hl)
		call	p7Dsub_7A96
		jr		nz, p7Dloc_7ACB
		inc		hl
		dec		bc
		ld		a, b
		or		c
		jr		nz, p7Dloc_7ABE
		xor		a

p7Dloc_7ACB:
		pop		bc
		ld		a, b
		pop		bc
		pop		hl
		ret
; End of function p7Dsub_7AB7


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7AD0:
		push	ix
		ld		ix, 0
		add		ix, sp
		push	hl
		push	de
		push	bc
		push	af
		ld		de, 0FFFFh
		ld		a, 5Bh ; '['
		call	p7Dsub_7A96
		jr		nz, p7Dloc_7B37
		ld		a, b
		call	p7Dsub_78A3
		call	p7Dsub_7A96
		jr		nz, p7Dloc_7B37
		ld		a, c
		call	p7Dsub_78A3
		call	p7Dsub_7A96
		jr		nz, p7Dloc_7B37
		ld		b, (ix+0FDh)
		ld		c, (ix+0FCh)
		ld		a, b
		call	p7Dsub_78A3
		call	p7Dsub_7A96
		jr		nz, p7Dloc_7B37
		ld		a, c
		call	p7Dsub_78A3
		call	p7Dsub_7A96
		jr		nz, p7Dloc_7B37
		ld		a, d
		call	p7Dsub_7A96
		jr		nz, p7Dloc_7B37
		ld		a, e
		call	p7Dsub_7A96
		jr		nz, p7Dloc_7B37
		ld		a, b
		or		c
		jr		z, p7Dloc_7B34
		call	p7Dsub_78C2
		call	p7Dsub_7AB7
		jr		nz, p7Dloc_7B37
		ld		a, d
		call	p7Dsub_7A96
		jr		nz, p7Dloc_7B37
		ld		a, e
		call	p7Dsub_7A96
		jr		nz, p7Dloc_7B37

p7Dloc_7B34:
		xor		a
		jr		p7Dloc_7B39
; ---------------------------------------------------------------------------

p7Dloc_7B37:
		or		0FFh

p7Dloc_7B39:
		pop		bc
		ld		a, b
		pop		bc
		pop		de
		pop		hl
		pop		ix
		ret
; End of function p7Dsub_7AD0


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7B41:
		call	ZeroOP1
		ld		a, 1
		or		a
		ld		hl, ramStart
		ld		de, 8040h
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8075h
; ---------------------------------------------------------------------------
		jp		nz, p7Dloc_75B1
		inc		hl
		ld		a, 1
		rst		28h
; ---------------------------------------------------------------------------
		.dw		805Ah
; ---------------------------------------------------------------------------
		ld		de, 8479h
		ldir
		ld		hl, (appSearchPage)
		push	hl
		call	p7Dsub_6186
		jr		c, p7Dloc_7B6D
		ld		(appInfo+1), a
		call	Page7D_2BE3

p7Dloc_7B6D:
		pop		hl
		ld		(appSearchPage), hl
		ret
; End of function p7Dsub_7B41


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7B72:
		; p7Dsub_7240+1BCp ...
		call	GetAppSpaceStartToA

p7Dloc_7B75:
		ld		hl, 4000h
		push	af
		call	LoadAIndPaged_Copy
		cp		80h ; '�'
		jr		z, p7Dloc_7B84
		cp		0
		jr		nz, p7Dloc_7B9C

p7Dloc_7B84:
		pop		af
		call	j_IsAHLAtValidAppHeader
		jr		nz, p7Dloc_7B9A
		call	FindAppNumPages
		ld		b, a
		ld		a, c
		or		a
		jr		z, p7Dloc_7B98
		ld		a, b
		sub		c
		cp		8
		jr		nc, p7Dloc_7B75

p7Dloc_7B98:
		xor		a
		ret
; ---------------------------------------------------------------------------

p7Dloc_7B9A:
		cp		a
		ret
; ---------------------------------------------------------------------------

p7Dloc_7B9C:
		cp		0FFh
		pop		bc
		ld		a, b
		jr		nz, p7Dloc_7B9A
		or		a
		ret
; End of function p7Dsub_7B72


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7BA4:
		xor		a
		ld		b, 0Eh
		ld		hl, 9C88h

p7Dloc_7BAA:
		ld		(hl), a
		inc		hl
		djnz	p7Dloc_7BAA
		ret
; End of function p7Dsub_7BA4


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7BAF:
		call	p7Dsub_7BBA
		or		(hl)
		ld		(hl), a
		ret
; End of function p7Dsub_7BAF


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7BB5:
		call	p7Dsub_7BBA
		and		(hl)
		ret
; End of function p7Dsub_7BB5


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7BBA:
		sub		8
		ld		hl, 9C88h
		ld		c, a
		ld		b, 0
		sra	c
		sra	c
		sra	c
		add		hl, bc
		and		7
		ld		c, a
; End of function p7Dsub_7BBA


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7BCC:
		ld		b, c
		ld		a, 80h ; '�'
		inc		b

p7Dloc_7BD0:
		rlca
		djnz	p7Dloc_7BD0
		ret
; End of function p7Dsub_7BCC


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7BD4:

		bit		indicRun, (iy+indicFlags)
		ret		z
		push	af
		push	bc
		push	de
		push	hl
		ld		a, 1
		ld		(indicCounter), a
		call	HandleRunIndicator
		pop		hl
		pop		de
		pop		bc
		pop		af
		ret
; End of function p7Dsub_7BD4


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7BEA:




		ld		(appSearchPage+1), a
		ld		(appSearchPage), a
		ld		(unk_8434), a
		call	p7Dsub_5DC7
		ret		c
		ret		z
		ld		a, e
		or		a
		jp		z, Page7D_2BB9
		ld		a, 6
		call	Page0Call_2EB9
		jp		z, Page7D_2BB9
		call	p7Dsub_7182
		ld		a, (unk_8434)
		call	p7Dsub_5DC7
		ret
; End of function p7Dsub_7BEA

; ---------------------------------------------------------------------------

SetExecutionPermissions:
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	GetFirstInvalidAppPageToB
		ld		a, b
		b_call(_SetFlashLowerBound)
		jp		relockFlashBack

DoNothing2:
		ret

		jp		nz, p7Dloc_7C2E
p7Dloc_7C2E:
		call	popErrorHandleR
		ld		a, 23h ; '#'
		ld		(errNo), a
		pop		hl
		ld		(freeRAM), hl
		call	p7Dsub_7C64
		jr		z, p7Dloc_7C4D
		call	OP4ToOP1
		call	ChkFindSym
		call	nc, DelVarArc
		call	relockFlashBack
		jr		p7Dloc_7C61
; ---------------------------------------------------------------------------

p7Dloc_7C4D:
		call	ChkFindSym
		ex		de, hl
		ld		bc, (freeRAM)
		dec		bc
		dec		bc
		ld		(hl), c
		inc		hl
		ld		(hl), b
		dec		hl
		ex		de, hl
		ld		a, 3
		call	DELVARIO

p7Dloc_7C61:
		or		1
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7C64:
		push	hl
		ld		hl, ioNewData
		bit		7, (hl)
		pop		hl
		ret
; End of function p7Dsub_7C64

; ---------------------------------------------------------------------------
		call	page0_17B0
		jr		z, p7Dloc_7C7D
		call	ISO1NONTEMPLST
		jr		nz, p7Dloc_7C84
		push	bc
		call	CMPPRGNAMLEN
		inc		a
		jr		p7Dloc_7C81
; ---------------------------------------------------------------------------

p7Dloc_7C7D:
		push	bc
		call	CMPPRGNAMLEN

p7Dloc_7C81:
		pop		bc
		or		a
		ret
; ---------------------------------------------------------------------------

p7Dloc_7C84:
		xor		a
		scf
		ret
; ---------------------------------------------------------------------------
		push	hl
		ld		hl, (unk_83F7)
		or		a
		sbc		hl, bc
		jp		c, ErrMemory
		ld		(unk_83F7), hl
		pop		hl
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7C96:
		call	NZIf83Plus
		jr		nz, p7Dloc_7CA0
		and		7Fh ; ''
		cp		6Ah ; 'j'
		ret
; ---------------------------------------------------------------------------

p7Dloc_7CA0:
		and		1Fh
		cp		16h
		ret
; End of function p7Dsub_7C96


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7CA5:
		ld		a, (unk_83A4)
		or		a
		ret		z
		ld		a, (unk_83A3)
		inc		a
		ld		(unk_83A3), a
		ret
; End of function p7Dsub_7CA5


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7CB2:
		push	bc
		ld		b, a
		ld		a, (sndRecState)
		inc		a
		ld		a, b
		pop		bc
		ret
; End of function p7Dsub_7CB2


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7CBB:
		; p7Dsub_7240+119p
		ld		a, (ramCodeEnd)
		cp		0
		ret		z
		push	hl
		call	p7Dsub_578D
		ld		a, l
		or		h
		pop		hl
		ret		nz
		ld		a, 0
		ld		(unk_83A4), a
		ret
; End of function p7Dsub_7CBB


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7CCF:
		; p7Dsub_7240:p7Dloc_7535p ...
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8057h
; End of function p7Dsub_7CCF

; ---------------------------------------------------------------------------
		call	Page7D_2BE9
		ld		de, 1DE2h
		add		hl, de
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7CDA:
		push	af
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	Page0Call_2ECB
		call	p7Dsub_7CCF
		push	hl
		ld		b, 8

p7Dloc_7CF5:
		call	p7Dsub_4566
		cp		0FFh
		jr		nz, p7Dloc_7D01
		inc		hl
		djnz	p7Dloc_7CF5
		jr		p7Dloc_7D04
; ---------------------------------------------------------------------------

p7Dloc_7D01:
		call	Page7D_2BAD

p7Dloc_7D04:
		ld		hl, 7FFEh
		ld		(OP1+1), hl
		ld		a, (arcInfo)
		ld		(OP1+3), a
		ld		hl, (arcInfo+1)
		call	p7Dsub_69D4
		jr		nz, p7Dloc_7D19
		inc		hl

p7Dloc_7D19:
		inc		hl
		inc		hl
		inc		hl
		ld		de, (unk_83F5)
		add		hl, de
		ld		(OP1+4), hl
		ld		(iMathPtr5), hl
		ld		de, (unk_83F7)
		bit		7, d
		jr		z, p7Dloc_7D33
		inc		a
		inc		a
		res		7, d

p7Dloc_7D33:
		bit		6, d
		jr		z, p7Dloc_7D3A
		inc		a
		res		6, d

p7Dloc_7D3A:
		add		hl, de
		bit		7, h
		jr		z, p7Dloc_7D44
		inc		a
		res		7, h
		set		6, h

p7Dloc_7D44:
		ld		(OP1+6), a
		ld		(OP1+7), hl
		ld		bc, 8
		ld		hl, 8479h
		call	p7Dsub_7700
		pop		de
		rst		28h
; ---------------------------------------------------------------------------
		.dw		8087h
; ---------------------------------------------------------------------------
		call	relockFlashBack
		set		noDataWrite, (iy+groupFlags)
		call	Page7D_2EAD
		pop		af
		ld		hl, (unk_83F1)
		ld		(hl), a
		ret
; End of function p7Dsub_7CDA


; =============== S U B	R O U T	I N E =======================================


p7Dsub_7D67:
		ld		a, (pagedCount)
		or		a
		ret		z
		push	bc
		push	de
		push	hl
		ld		c, a
		xor		a
		ld		(pagedCount), a
		ld		hl, pagedBuf
		ld		(pagedGetPtr), hl
		ld		de, (iMathPtr5)
		ld		a, (arcInfo)
		push	de
		ld		(Abackup), a
		ld		a, i
		di
		push	af
		ld		a, (Abackup)
		push	af
		ld		a, 1
		nop
		di
		nop
		nop
		im	1
		di
		out		(14h), a
		di
		call	checkForFlashTrickery
		pop		af
		call	p7Dsub_7C96
		jr		nc, p7Dloc_7E0D
		cp		8
		jr		c, p7Dloc_7E0D
		call	p7Dsub_7CCF
		call	p7Dsub_4566
		cp		0FEh ; '�'
		jr		nz, p7Dloc_7E0D
		call	p7Dsub_4565
		cp		7Fh ; ''
		jr		nz, p7Dloc_7E0D
		call	p7Dsub_4565
		ld		b, a
		ld		a, (arcInfo)
		cp		b
		jr		c, p7Dloc_7E0D
		jr		nz, p7Dloc_7DD3
		call	p7Dsub_455C
		push	hl
		ld		hl, (iMathPtr5)
		call	CpHLDE
		ex		de, hl
		pop		hl
		jr		c, p7Dloc_7E0D
		jr		p7Dloc_7DD9
; ---------------------------------------------------------------------------

p7Dloc_7DD3:
		ld		de, (iMathPtr5)
		inc		hl
		inc		hl

p7Dloc_7DD9:
		ld		a, (arcInfo)
		ld		b, 0
		ex		de, hl
		add		hl, bc
		call	Page0Call_23FC
		jr		nc, p7Dloc_7DE6
		inc		a

p7Dloc_7DE6:
		ld		b, a
		ex		de, hl
		call	p7Dsub_4565
		cp		b
		jr		c, p7Dloc_7E0D
		jr		nz, p7Dloc_7DFC
		push	de
		call	p7Dsub_455C
		pop		hl
		dec		hl
		call	CpHLDE
		ex		de, hl
		jr		nc, p7Dloc_7E0D

p7Dloc_7DFC:
		ld		de, (iMathPtr5)
		ld		hl, pagedBuf
		ld		b, 0
		ld		a, (arcInfo)
		rst		28h
; ---------------------------------------------------------------------------
		.dw		80C9h
; ---------------------------------------------------------------------------
		jr		p7Dloc_7E0E
; ---------------------------------------------------------------------------

p7Dloc_7E0D:
		nop

p7Dloc_7E0E:
		call	relockFlashBack
		ld		(Abackup), a
		pop		af
		jp		po, p7Dloc_7E19
		ei

p7Dloc_7E19:
		ld		a, (Abackup)
		ld		(iMathPtr5), de
		pop		hl
		or		a
		sbc		hl, de
		jr		c, p7Dloc_7E2D
		ld		a, (arcInfo)
		inc		a
		ld		(arcInfo), a

p7Dloc_7E2D:
		pop		hl
		pop		de
		pop		bc
		ret
; End of function p7Dsub_7D67

; ---------------------------------------------------------------------------

p7Dloc_7E31:
		ld		a, (hl)
		inc		hl
		push	hl
		push	bc
		call	p7Dsub_7E40
		pop		bc
		pop		hl
		dec		bc
		ld		a, c
		or		b
		jr		nz, p7Dloc_7E31
		ret

; =============== S U B	R O U T	I N E =======================================


p7Dsub_7E40:
		push	hl
		ld		hl, (pagedGetPtr)
		ld		(hl), a
		inc		hl
		ld		(pagedGetPtr), hl
		pop		hl
		ld		a, (pagedCount)
		inc		a
		ld		(pagedCount), a
		cp		10h
		call	z, p7Dsub_7D67
		ret
; End of function p7Dsub_7E40

; ---------------------------------------------------------------------------

p7Dloc_7E57:
		dec		hl
		dec		hl
		ld		a, (hl)
		inc		hl
		inc		hl
		cp		4
		jr		c, p7Dloc_7E66
		call	DelVarArc
		jp		Page0Call_2555
; ---------------------------------------------------------------------------

p7Dloc_7E66:
		ld		a, (OP1+1)
		cp		24h ; '$'
		jp		z, Page0Call_24B5
		call	Page0Call_2EE9
		jp		z, Page0Call_24B5
		ld		a, (hl)
		push	af
		and		1Fh
		ld		(hl), a
		call	Page0Call_2ED1
		pop		af
		call	p7Dsub_7CDA
		xor		a
		ld		(pagedCount), a
		push	hl
		ld		hl, pagedBuf
		ld		(pagedGetPtr), hl
		pop		hl
		ret
p7Dloc_7E8D:
		call	Page0Call_2C91
		ret
p7Dloc_7E91:
		call	page0_1F38
		ret