source/page06/initial.asm
author brandonlw
Tue, 20 May 2014 02:59:10 -0400
changeset 41 9ef17625274f
parent 39 4651e87022c7
child 43 486c42a314bc
permissions -rw-r--r--
Finished _newContext and other page 0 cleanup. Still lots left to go...

p06loc_4000:
aProgram:	.asc 'PROGRAM',0
; ---------------------------------------------------------------------------

InitProgramCreateContext:
		ld		hl, aProgram
		ld		a, 56h ; 'V'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		ld		de, OP3
		call	Mov8B
		call	Mov8B
		set		prgmEdit, (iy+prgmFlags)

Page06_30F9:
		set		grfSplitOverride, (iy+sGrFlags)
		ld		hl, p06loc_403E
		call	AppInit
		call	j_ClrScrn
		call	Page0Call_3711
		call	j_NamePrompt2
		ld		hl, 84CFh
		ld		(editTail), hl
		ld		(editBtm), hl
		ret
p06loc_403E:
		.dw		p06loc_404B
		.dw		p06loc_4289
		.dw		p06loc_4296
		.dw		p06loc_4286
		.dw		p06loc_4286
		.dw		p06loc_428C
		.db		0Eh
p06loc_404B:
		cp		27h ; '''
		jr		nz, p06loc_405B
		ld		a, (mcxCurApp)
		cp		59h ; 'Y'
		ret		nz
		call	p06sub_4296
		jp		j_InitGroupContext
; ---------------------------------------------------------------------------

p06loc_405B:
		cp		5
		jp		z, p06loc_408A
		cp		6
		jp		z, p06loc_408A
		cp		9
		jr		nz, p06loc_407D
		call	DispHead
		call	j_EraseEOL
		call	BufClear
		ld		hl, nameBuff
		call	ZeroOP
		res		textInsMode, (iy+textFlags)
		ret
; ---------------------------------------------------------------------------

p06loc_407D:
		jp		jpromptcursor

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


p06sub_4080:
		ld		hl, (editCursor)
		ld		de, nameBuff
		or		a
		sbc		hl, de
		ret
; End of function p06sub_4080

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

p06loc_408A:
		call	CursorDown
		ld		hl, nameBuff
		ld		de, 8479h
		call	Mov11B
		call	p06sub_4080
		ret		z
		ld		a, (OP1+1)
		cp		41h ; 'A'
		jr		c, p06loc_40A5
		cp		5Ch ; '\'
		jr		c, p06loc_40A8

p06loc_40A5:
		jp		ErrSyntax
; ---------------------------------------------------------------------------

p06loc_40A8:
		ld		a, l
		push	af
		ld		a, 8
		sub		l
		jr		z, p06loc_40B9
		ld		hl, 8481h
		ld		e, a
		ld		d, 0
		sbc		hl, de
		ld		(hl), 0

p06loc_40B9:
		ld		a, (mcxCurApp)
		cp		59h ; 'Y'
		jr		nz, p06loc_40CA
		pop		af
		call	FindGroupSym
		jp		nc, Page0Call_24B9
		jp		Page0Call_30C9
; ---------------------------------------------------------------------------

p06loc_40CA:
		pop		af
		call	FINDPROGSYM
		jr		c, p06loc_40DD
		cp		6
		jp		z, ErrSyntax
		call	Page0Call_2415
		call	OP1ToOP4
		jr		p06loc_40EC
; ---------------------------------------------------------------------------

p06loc_40DD:
		ld		hl, ErrMemory_NoGoTo
		call	pushErrorHandleR
		ld		hl, 0
		call	CreateProg
		call	popErrorHandleR

p06loc_40EC:
		ld		de, progToEdit
		ld		hl, 849Ah
		call	Mov8B
		set		promptEdit, (iy+promptFlags)
		ld		a, 46h ; 'F'
		ld		(mcxCurApp), a

InitProgramEditorContext:
		res		cmdExec, (iy+cmdFlags)
		set		grfSplitOverride, (iy+sGrFlags)
		ld		hl, p06loc_4172
		call	AppInit
		set		prgmEdit, (iy+prgmFlags)
		call	j_ClrScrn
		ld		hl, p06loc_4000
		ld		a, 56h ; 'V'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		ld		de, OP3
		call	Mov8B
		call	Mov8B
		call	Page0Call_3711
		ld		hl, 84BEh
		rst		20h
		call	FINDPROGSYM
		jp		c, ErrUndefined
		cp		6
		jp		z, ErrSyntax
		call	Page0Call_2415
		call	CanAlphIns
		ld		(editSym), hl
		call	p06sub_483D
		call	j_ClrWindow
		ld		hl, 700h
		ld		(curRow), hl
		call	DisplayColonChar
		call	j_nameToOP1
		ld		hl, 8479h
		call	j_PutPS
		call	j_HomeUp
		call	DisplayColonChar
		bit		promptEdit, (iy+promptFlags)
		jr		nz, p06loc_416B
		call	cursorToOffset
		ret
; ---------------------------------------------------------------------------

p06loc_416B:
		res		promptEdit, (iy+promptFlags)
		jp		DispEOW
p06loc_4172:
		.dw		p06loc_417F
		.dw		p06loc_4289
		.dw		p06loc_42A3
		.dw		p06loc_4286
		.dw		p06loc_427F
		.dw		p06loc_428D
		.db		0Eh
p06loc_417F:
		cp		5
		jr		nz, p06loc_41A3
		call	CancelAlpha
		bit		textInsMode, (iy+textFlags)
		jr		nz, p06loc_419E

p06loc_418C:
		call	BufRight
		jr		z, p06loc_419E
		push	de
		call	PutTokString
		pop		de
		call	page0_17C7
		jr		nz, p06loc_418C
		jp		DispEOW
; ---------------------------------------------------------------------------

p06loc_419E:
		ld		a, 5
		jp		InsDisp
; ---------------------------------------------------------------------------

p06loc_41A3:
		jp		c, jpromptcursor
		cp		7
		jr		nz, p06loc_41BB
		bit		prgmEdit, (iy+prgmFlags)
		jp		z, cursorUp
		ld		b, 6

p06loc_41B3:
		push	bc
		call	cursorUp
		pop		bc
		djnz	p06loc_41B3
		ret
; ---------------------------------------------------------------------------

p06loc_41BB:
		cp		8
		jr		nz, p06loc_41D0
		bit		prgmEdit, (iy+prgmFlags)
		jp		z, CursorDown
		ld		b, 6

p06loc_41C8:
		push	bc
		call	CursorDown
		pop		bc
		djnz	p06loc_41C8
		ret
; ---------------------------------------------------------------------------

p06loc_41D0:
		cp		0Eh
		jp		z, JcursorFirst
		cp		0Fh
		jp		z, JcursorLast
		cp		0Bh
		jp		z, Page06_369F
		cp		21h ; '!'
		jr		nz, p06loc_41E9
		call	CursorLeft
		ret		z
		jr		p06loc_41ED
; ---------------------------------------------------------------------------

p06loc_41E9:
		cp		0Ah
		jr		nz, p06loc_41F7

p06loc_41ED:
		res		textInsMode, (iy+textFlags)
		call	BufDelete
		jp		DispEOW
; ---------------------------------------------------------------------------

p06loc_41F7:
		cp		0Dh
		jr		nz, p06loc_4212
		call	p06sub_4216
		call	CanAlphIns
		call	GETLASTENTRY
		ld		a, 5
		call	rclToQueue
		set		textInsMode, (iy+textFlags)
		set		enableQueue, (iy+rclFlag)
		ret
; ---------------------------------------------------------------------------

p06loc_4212:
		cp		9
		jr		nz, p06loc_422A

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


p06sub_4216:
		call	p06sub_42CC

p06loc_4219:
		call	BUFPEEK
		jp		z, DispEOW
		call	page0_17C7
		jp		z, DispEOW
		call	BufDelete
		jr		p06loc_4219
; End of function p06sub_4216

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

p06loc_422A:
		cp		0Ch
		jr		nz, p06loc_423A
		ld		hl, (editSym)
		ld		a, (hl)
		and		0E0h ; '�'
		or		9
		ld		(hl), a
		jp		j_RCLREGEQ_CALL
; ---------------------------------------------------------------------------

p06loc_423A:
		cp		5Ah ; 'Z'
		ret		c
		call	page0_1808
		jp		z, j_initNamePrompt2
		call	InsDisp
		bit		enableQueue, (iy+rclFlag)
		ret		z
		ld		hl, (rclQueue)
		ld		de, (editCursor)
		or		a
		sbc		hl, de
		ret		z
		ld		c, l
		ld		b, h
		push	bc
		ld		hl, (rclQueue)
		dec		hl
		ld		de, (editTail)
		dec		de
		lddr
		inc		de
		ld		(editTail), de
		pop		bc

p06loc_426A:
		ld		hl, (editTail)
		call	isPtrHLA2ByteTok
		jr		nz, p06loc_4273
		dec		bc

p06loc_4273:
		call	cursorRight
		dec		bc
		ld		a, c
		or		b
		jr		nz, p06loc_426A
		jp		DispEOW
; ---------------------------------------------------------------------------
		ret
p06loc_427F:
		bit		2, (iy+29h)
		call	nz, j_AppSetup
p06loc_4286:
		jp		j_rstrShadow
p06loc_4289:
		jp		j_saveShadow
p06loc_428C:
		ret
p06loc_428D:
		jp		nc, j_shrinkWindow
		call	j_rstrUnderMenu
		jp		DispEOW

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

p06loc_4296:
p06sub_4296:
		res		grfSplitOverride, (iy+sGrFlags)
		res		prgmEdit, (iy+prgmFlags)
		res		promptEdit, (iy+promptFlags)
		ret
p06loc_42A3:
		res		grfSplitOverride, (iy+sGrFlags)
		res		prgmEdit, (iy+prgmFlags)
		call	CanAlphIns
		bit		editOpen, (iy+editFlags)
		ret		z
		ld		hl, (editSym)
		ld		(hl), 5
		call	CloseEditEqu
		ld		de, (iMathPtr1)
		ld		b, 0
		call	Page06_3519
		ld		hl, (editSym)
		call	Page0Call_240B
		ld		(hl), a
		ret

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


p06sub_42CC:
		call	BufLeft
		jr		z, p06loc_42DE
		call	page0_17C7
		jr		z, p06loc_42DB
		call	j_putbPAT
		jr		p06sub_42CC
; ---------------------------------------------------------------------------

p06loc_42DB:
		call	BufRight

p06loc_42DE:
		ld		hl, curCol
		dec		(hl)
		call	DisplayColonChar
		ret
; End of function p06sub_42CC


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


Page06_3519:
		push	de
		push	bc
		call	SetupPagedPtr
		call	PagedGet
		ld		e, a
		call	PagedGet
		ld		d, a
		ld		b, 0
		jr		p06loc_42FB
; ---------------------------------------------------------------------------

p06loc_42F7:
		call	PagedGet
		dec		de

p06loc_42FB:
		; Page06_3519+29j ...
		ld		a, d
		or		e
		jr		nz, p06loc_4304

p06loc_42FF:
		ld		a, b
		or		a
		pop		bc
		pop		de
		ret
; ---------------------------------------------------------------------------

p06loc_4304:
		call	PagedGet
		cp		0EFh ; '�'
		jr		z, p06loc_4338
		dec		de
		call	isA2ByteTok
		jr		nz, p06loc_42FB
		cp		0BBh ; '�'
		jr		nz, p06loc_42F7
		call	PagedGet
		dec		de
		cp		68h ; 'h'
		jr		c, p06loc_42FB
		ld		c, 1
		call	p06sub_433C
		cp		0CFh ; '�'
		jr		c, p06loc_42FB
		ld		c, 2
		call	p06sub_433C
		cp		0DBh ; '�'
		jr		c, p06loc_42FB
		ld		c, 3
		call	p06sub_433C
		cp		0F6h ; '�'
		jr		c, p06loc_42FB

p06loc_4338:
		ld		b, 0FFh
		jr		p06loc_42FF
; End of function Page06_3519


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


p06sub_433C:
		; Page06_3519+42p ...
		push	af
		ld		a, b
		cp		c
		jr		nc, p06loc_4342
		ld		b, c

p06loc_4342:
		pop		af
		ret
; End of function p06sub_433C


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


BufLeft:
		call	IsAtTop
		ret		z
		dec		hl
		call	page0_191D
		ld		d, 0
		jr		z, p06sub_4369
		push	hl
		dec		hl
		call	isPtrHLA2ByteTok
		pop		hl
		jr		nz, p06sub_4369
		push	hl
		call	p06sub_4369
		pop		hl
		dec		hl
		ld		a, e
		push	af
		call	p06sub_4369
		ld		d, e
		pop		af
		ld		e, a
		or		1
		ret
; End of function BufLeft


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


p06sub_4369:
		ld		e, (hl)
		ld		(editCursor), hl
		ld		hl, (editTail)
		dec		hl
		ld		(hl), e
		ld		(editTail), hl
		or		1
		ret
; End of function p06sub_4369


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


BufRight:
		; p06sub_42CC:p06loc_42DBp ...
		ld		hl, (editTail)
		ld		de, (editBtm)
		call	CpHLDE
		ret		z
		call	isPtrHLA2ByteTok
		ld		d, 0
		jr		nz, p06sub_4391
		push	hl
		call	p06sub_4391
		pop		hl
		ld		d, e
		inc		hl
; End of function BufRight


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


p06sub_4391:
		ld		e, (hl)
		inc		hl
		ld		(editTail), hl
		ld		hl, (editCursor)
		ld		(hl), e
		inc		hl
		ld		(editCursor), hl
		or		1
		ret
; End of function p06sub_4391


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


bufInsert:
		push	de
		call	isEditFull
		pop		bc
		ret		z
		ld		a, b
		or		a
		jr		z, p06loc_43B6
		inc		hl
		call	p06sub_44C1
		ret		z
		ld		(hl), c
		dec		hl
		ld		(hl), b
		inc		hl
		jr		p06loc_43B7
; ---------------------------------------------------------------------------

p06loc_43B6:
		ld		(hl), c

p06loc_43B7:
		inc		hl
		ld		(editCursor), hl
		or		1
		ret
; End of function bufInsert


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


bufQueueChar:
		push	de
		push	hl
		push	af
		ld		hl, (rclQueue)
		ld		de, (editTail)
		call	CpHLDE
		pop		de
		jr		z, p06loc_43D6
		ld		(hl), d
		inc		hl
		ld		(rclQueue), hl
		or		a
		jr		p06loc_43D7
; ---------------------------------------------------------------------------

p06loc_43D6:
		scf

p06loc_43D7:
		pop		hl
		pop		de
		ret
; End of function bufQueueChar


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


p06sub_43DA:
		ld		hl, (rclQueue)
		ld		de, (editTail)

p06loc_43E1:
		call	CpHLDE
		jr		z, p06loc_43EF
		ld		a, (bc)
		inc		bc
		or		a
		jr		z, p06loc_43F0
		ld		(hl), a
		inc		hl
		jr		p06loc_43E1
; ---------------------------------------------------------------------------

p06loc_43EF:
		scf

p06loc_43F0:
		ld		(rclQueue), hl
		ret
; End of function p06sub_43DA


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


BufReplace:
		push	de
		ld		hl, (editCursor)
		ld		de, (editBtm)
		call	CpHLDE
		pop		de
		ret		z
		push	hl
		push	de
		call	BUFPEEK
		pop		de
		pop		hl
		push	af
		ld		a, d
		or		a
		jr		z, p06loc_4434
		pop		af
		jr		c, p06loc_4431
		push	de
		push	hl
		ld		hl, (editTail)
		ld		de, (editBtm)
		call	CpHLDE
		jr		nz, p06loc_4427
		ld		hl, (editCursor)
		inc		hl
		call	p06sub_44C1
		jr		p06loc_442A
; ---------------------------------------------------------------------------

p06loc_4427:
		call	isEditFull

p06loc_442A:
		pop		hl
		pop		de
		jr		nz, p06loc_4430
		xor		a
		ret
; ---------------------------------------------------------------------------

p06loc_4430:
		xor		a

p06loc_4431:
		push	af
		ld		(hl), d
		inc		hl

p06loc_4434:
		ld		(hl), e
		inc		hl
		ld		(editCursor), hl
		call	p06sub_444C
		pop		af
		call	c, BufDelete
		or		1
		ret
; End of function BufReplace


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


BufDelete:
		call	BUFPEEK
		push	af
		call	p06sub_444C
		pop		af
		ret		nc
; End of function BufDelete


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


p06sub_444C:
		; BufDelete+4p
		ld		hl, (editTail)
		ld		de, (editBtm)
		call	CpHLDE
		ret		z
		inc		hl
		ld		(editTail), hl
		ret
; End of function p06sub_444C


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


BUFPEEK:
		; BufReplace+Fp ...
		ld		hl, (editTail)
; End of function BUFPEEK


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


BUFPEEK1:
		ld		de, (editBtm)
; End of function BUFPEEK1


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


BUFPEEK2:
		; stringwidth:p06loc_72F3p
		call	CpHLDE
		ret		z

BUFPEEK3:
		; rclToQueue+F5p
		ld		d, 0
		ld		e, (hl)
		call	isPtrHLA2ByteTok
		ld		a, e
		ret		nz
		ld		d, a
		or		1
		ld		a, d
		inc		hl
		ld		e, (hl)
		scf
		ret
; End of function BUFPEEK2


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


BufToBtm:
		ld		hl, (editBtm)
		ld		de, (editTail)
		or		a
		sbc		hl, de
		ret		z
		ld		c, l
		ld		b, h
		ld		hl, (editCursor)
		ex		de, hl
		ldir
		ld		(editTail), hl
		ld		(editCursor), de
		ret
; End of function BufToBtm


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


setupEditEqu:
		rst		10h
; End of function setupEditEqu


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


p06sub_4493:
		call	p06sub_4815
		ld		hl, (iMathPtr2)
		call	p06sub_4829
; End of function p06sub_4493


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


BufToTop:
		ld		hl, (editCursor)
		ld		de, (editTop)
		or		a
		sbc		hl, de
		ret		z
		ld		c, l
		ld		b, h
		ld		hl, (editCursor)
		dec		hl
		ld		de, (editTail)
		dec		de
		lddr
		inc		hl
		ld		(editCursor), hl
		inc		de
		ld		(editTail), de
		ret
; End of function BufToTop


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


isEditFull:
		; BufReplace:p06loc_4427p
		ld		hl, (editCursor)
; End of function isEditFull


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


p06sub_44C1:
		; BufReplace+2Ep
		ld		de, (editTail)
		jp		CpHLDE
; End of function p06sub_44C1


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


BufClear:

		ld		hl, (editTop)
		ld		(editCursor), hl
		ld		hl, (editBtm)
		ld		(editTail), hl
		ret
; End of function BufClear

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR Page06_2FF1

JcursorFirst:
		; Page06_2FF1+120j
		res		textScrolled, (iy+textFlags)

p06loc_44D9:
		; Page06_2FF1-2817j
		call	CursorLeft
		call	IsAtTop
		ret		z
		call	GetPrevTok
		jr		z, p06loc_44D9
		ld		a, e
		cp		3Fh ; '?'
		jr		nz, p06loc_44D9
		ret
; ---------------------------------------------------------------------------

JcursorLast:
		; Page06_2FF1+125j
		res		textScrolled, (iy+textFlags)

p06loc_44EF:
		; Page06_2FF1-2805j
		call	cursorRight
		call	BUFPEEK
		jr		c, p06loc_44EF
		ret		z
		cp		3Fh ; '?'
		jr		nz, p06loc_44EF
		ret
; END OF FUNCTION CHUNK	FOR Page06_2FF1

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


CursorLeft:
		; Page06_2FF1:p06loc_44D9p ...
		res		textInsMode, (iy+textFlags)
; End of function CursorLeft


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


p06sub_4501:
		push	bc
		push	de
		push	hl
		call	BufLeft
		jr		z, p06loc_4585
		push	af
		res		textScrolled, (iy+textFlags)
		bit		1, (iy+2Ah)
		jr		z, p06loc_452E
		ld		a, (unk_8198)
		push	af
		call	j_BCALL_4CF9
		pop		af
		bit		textScrolled, (iy+textFlags)
		push	af
		ld		hl, 8198h
		cp		(hl)
		call	nz, j_BCALL_4D05
		pop		af
		call	nz, j_BCALL_4D02
		jr		p06loc_4538
; ---------------------------------------------------------------------------

p06loc_452E:
		call	j_putbPAT
		bit		textScrolled, (iy+textFlags)
		call	nz, p06sub_473C

p06loc_4538:
		pop		af
		jr		p06loc_4585
; End of function p06sub_4501


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


cursorRight:
		; Page06_2FF1:p06loc_44EFp ...
		res		textInsMode, (iy+textFlags)
; End of function cursorRight


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


p06sub_453F:
		push	bc
		push	de
		push	hl
		call	BufRight
		jr		z, p06loc_4585
		res		textScrolled, (iy+textFlags)
		set		6, (iy+2Ah)
		call	PutTokString
		bit		1, (iy+2Ah)
		jr		z, p06loc_4572
		call	BUFPEEK
		jr		z, p06loc_4572
		call	j_SGetTokString
		inc		hl
		ld		a, (hl)
		call	j_LoadPattern
		ld		a, (hl)
		dec		a
		ld		hl, penCol
		add		a, (hl)
		ld		hl, SmallEditColumnRight
		cp		(hl)
		call	nc, j_BCALL_4D14

p06loc_4572:
		ld		hl, (curRow)
		push	hl
		res		6, (iy+2Ah)
		bit		textScrolled, (iy+textFlags)
		call	nz, p06sub_4589
		pop		hl
		ld		(curRow), hl

p06loc_4585:
		pop		hl
		pop		de
		pop		bc
		ret
; End of function p06sub_453F


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


p06sub_4589:
		bit		1, (iy+2Ah)
		jr		z, p06loc_45A4
		ld		a, (unk_8198)
		push	af
		ld		hl, (penCol)
		push	hl
		call	j_BCALL_4D20
		pop		hl
		ld		(penCol), hl
		pop		hl
		ld		a, h
		ld		(unk_8198), a
		ret
; ---------------------------------------------------------------------------

p06loc_45A4:
		call	p06sub_7200
		ret
; End of function p06sub_4589


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


cursorUp:
		xor		a
		push	af
		res		textScrolled, (iy+textFlags)
		ld		de, (editTop)
		ld		bc, (curRow)
		inc		b

p06loc_45B7:
		call	CursorLeft
		ld		hl, (editCursor)
		ld		a, (curRow)
		cp		c
		jr		nz, p06loc_45D0
		bit		textScrolled, (iy+textFlags)
		jr		nz, p06loc_45D0
		pop		af
		push	af
		or		a
		jr		nz, p06loc_45D7
		jr		p06loc_45EC
; ---------------------------------------------------------------------------

p06loc_45D0:
		ld		c, a
		pop		af
		or		a
		ret		nz
		or		1
		push	af

p06loc_45D7:
		ld		a, (curRow+1)
		cp		b
		jr		c, p06loc_45F1
		push	de
		push	hl
		call	GetPrevTok
		pop		hl
		ld		(editCursor), hl
		call	page0_17C7
		pop		de
		jr		z, p06loc_45F1

p06loc_45EC:
		call	CpHLDE
		jr		nz, p06loc_45B7

p06loc_45F1:
		pop		af
		or		a
		ret
; End of function cursorUp


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


CursorDown:

		xor		a
		push	af
		res		textScrolled, (iy+textFlags)
		ld		de, (editBtm)
		ld		bc, (curRow)

p06loc_4602:
		call	cursorRight
		ld		hl, (editTail)
		ld		a, (curRow)
		cp		c
		jr		nz, p06loc_461B
		bit		textScrolled, (iy+textFlags)
		jr		nz, p06loc_461B
		pop		af
		push	af
		or		a
		jr		nz, p06loc_4622
		jr		p06loc_462D
; ---------------------------------------------------------------------------

p06loc_461B:
		; CursorDown+1Ej
		ld		c, a
		pop		af
		or		a
		ret		nz
		or		1
		push	af

p06loc_4622:
		ld		a, (curRow+1)
		cp		b
		jr		nc, p06loc_4632
		ld		a, (hl)
		cp		3Fh ; '?'
		jr		z, p06loc_4632

p06loc_462D:
		call	CpHLDE
		jr		nz, p06loc_4602

p06loc_4632:
		; CursorDown+37j
		pop		af
		or		a
		ret
; End of function CursorDown


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


GoToErr:

		call	BufToTop
		ld		bc, (errOffset)
		ld		hl, (editCursor)
		add		hl, bc

p06loc_4640:
		ld		de, (editCursor)
		call	CpHLDE
		ret		z
		ret		c
		push	hl
		call	BufRight
		pop		hl
		ret		z
		push	hl
		call	PutTokString
		pop		hl
		jr		p06loc_4640
; End of function GoToErr


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


cursorToOffset:



		call	GoToErr
		jp		DispEOW
; End of function cursorToOffset

; ---------------------------------------------------------------------------
		push	af

p06loc_465D:
		ld		a, (hl)
		inc		hl
		or		a
		jr		z, p06loc_466F
		push	hl
		call	bufInsert
		pop		hl
		jr		z, p06loc_466F
		ld		a, c
		call	j_PutC
		jr		p06loc_465D
; ---------------------------------------------------------------------------

p06loc_466F:
		pop		af
		ret

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


InsDisp:
		call	j_ConvKeyToTok
		push	de
		ld		hl, (editTail)
		ld		de, (editBtm)
		call	CpHLDE
		pop		de
		push	af
		push	de
		bit		textInsMode, (iy+textFlags)
		jr		nz, p06loc_46D2
		call	BUFPEEK
		jr		c, p06loc_4693
		jr		z, p06loc_4693
		cp		3Fh ; '?'
		jr		z, p06loc_46D2

p06loc_4693:
		pop		de
		push	de
		call	BufReplace
		jr		z, p06loc_46DB

p06loc_469A:
		pop		de
		bit		1, (iy+2Ah)
		jr		z, p06loc_46C2
		pop		af
		push	af
		call	j_BCALL_4D0B
		pop		af
		ret		z
		call	j_BCALL_4D05
		call	j_BCALL_4CF3
		ld		a, (unk_81A0)
		dec		a
		ld		hl, penCol
		add		a, (hl)
		ld		hl, SmallEditColumnRight
		cp		(hl)
		ret		c
		call	p06sub_453F
		call	p06sub_4501
		ret
; ---------------------------------------------------------------------------

p06loc_46C2:
		pop		af
		push	af
		call	j_putcCheckScrolL
		pop		af
		ret		z
		ld		a, (mcxCurApp)
		cp		49h ; 'I'
		ret		z
		jp		DispEOW
; ---------------------------------------------------------------------------

p06loc_46D2:
		pop		de
		push	de
		call	bufInsert
		jr		z, p06loc_46DB
		jr		p06loc_469A
; ---------------------------------------------------------------------------

p06loc_46DB:
		pop		de
		pop		af
		ret
; End of function InsDisp

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

FDISPBOL1:
		call	IsAtTop
		jr		z, FDISPBOL
		dec		hl
		call	page0_191D
		ld		d, 0
		jr		z, p06loc_46F4
		push	hl
		dec		hl
		call	isPtrHLA2ByteTok
		pop		hl
		jr		nz, p06loc_46F4
		dec		hl

p06loc_46F4:
		ex		de, hl
		ld		hl, (curRow)
		push	hl
		ex		de, hl
		jr		p06loc_4703
; ---------------------------------------------------------------------------

FDISPBOL:
		ld		hl, (curRow)
		push	hl
		ld		hl, (editCursor)

p06loc_4703:
		ld		a, (appFlagsAddr)
		push	af
		res		appAutoScroll, (iy+appFlags)

p06loc_470B:
		call	page0_191D
		ccf
		jr		z, p06loc_4732
		dec		hl
		call	page0_191D
		ld		d, 0
		ld		e, (hl)
		jr		z, p06loc_471E
		inc		hl
		call	GetPrevTok

p06loc_471E:
		or		1
		call	j_PUTBPATBUF2
		jr		c, p06loc_470B
		call	Page0Call_37A7
		ld		a, 0CEh	; '�'
		call	j_PutC
		set		0, (iy+0Eh)
		or		a

p06loc_4732:
		pop		bc
		ld		a, b
		ld		(appFlagsAddr), a
		pop		hl
		ld		(curRow), hl
		ret

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


p06sub_473C:
		ld		hl, (curRow)
		push	hl
		ld		hl, (editCursor)
		ld		de, (editTop)
		ld		a, (appFlagsAddr)
		push	af
		res		appAutoScroll, (iy+appFlags)

p06loc_474F:
		call	CpHLDE
		jr		nz, p06loc_4785
		sub		a
		ld		(curRow+1), a
		ld		a, (mcxCurApp)
		cp		49h ; 'I'
		jr		nz, p06loc_4767
		ld		a, (unk_9813)
		call	p06sub_72AF
		jr		p06loc_478C
; ---------------------------------------------------------------------------

p06loc_4767:
		cp		54h ; 'T'
		jr		nz, p06loc_4770
		call	p06sub_6192
		jr		p06loc_478C
; ---------------------------------------------------------------------------

p06loc_4770:
		cp		46h ; 'F'
		jr		nz, p06loc_4779
		call	DisplayColonChar
		jr		p06loc_478C
; ---------------------------------------------------------------------------

p06loc_4779:
		cp		50h ; 'P'
		jr		nz, p06loc_478C
		ld		hl, ioPrompt
		call	j_PutS
		jr		p06loc_478C
; ---------------------------------------------------------------------------

p06loc_4785:
		push	de
		call	j_PUTBPATBUF
		pop		de
		jr		c, p06loc_474F

p06loc_478C:
		pop		af
		ld		(appFlagsAddr), a
		pop		hl
		ld		(curRow), hl
		ret
; End of function p06sub_473C

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR cursorToOffset

DispEOW:
		bit		1, (iy+2Ah)
		jr		z, p06loc_479F
		call	j_BCALL_4D05
		ret
; ---------------------------------------------------------------------------

p06loc_479F:
		ld		hl, (curRow)
		push	hl
		ld		hl, (editTail)
		ld		a, (appFlagsAddr)
		push	af
		res		appAutoScroll, (iy+appFlags)

p06loc_47AE:
		call	BUFPEEK1
		jr		z, p06loc_47C4
		inc		hl
		push	hl
		call	PutTokString
		ld		a, (curRow)
		ld		hl, winBtm
		cp		(hl)
		pop		hl
		jr		c, p06loc_47AE
		jr		p06loc_47C8
; ---------------------------------------------------------------------------

p06loc_47C4:
		call	j_EraseEOW2
		scf

p06loc_47C8:
		pop		de
		ld		(iy+0Dh), d
		pop		hl
		ld		(curRow), hl
		ret
; END OF FUNCTION CHUNK	FOR cursorToOffset

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


DispHead:
		call	BufLeft
		ret		z
		call	j_putbPAT
		jr		DispHead
; End of function DispHead


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


DispTail:
		call	BufRight
		ret		z
		call	PutTokString
		jr		DispTail
; End of function DispTail


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


PutTokString:
		bit		1, (iy+2Ah)
		jr		z, p06loc_47ED
		call	j_BCALL_4D08
		ret
; ---------------------------------------------------------------------------

p06loc_47ED:
		call	j_GETTOKSTRING
		call	j_PutPS
		ret
; End of function PutTokString

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

setupEditCmd:
		call	last_entry_to_OP1
		call	FINDPROGSYM
		call	p06sub_4493
		ld		bc, (cmdCursor)
		ld		a, c
		or		b
		ret		z
		ld		hl, (editTail)
		ld		de, (editTop)
		ldir
		ld		(editCursor), de
		ld		(editTail), hl
		ret

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


p06sub_4815:
		; SetEmptyEditPtrp
		call	j_EditProg
		set		editOpen, (iy+editFlags)
		ld		hl, (iMathPtr1)
		inc		hl
		inc		hl
		ld		(editTop), hl
		ret
; End of function p06sub_4815

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

setEmptyEditEqu:
		rst		10h

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


SetEmptyEditPtr:
		call	p06sub_4815
; End of function SetEmptyEditPtr


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


p06sub_4829:
		ld		(editCursor), hl
		ex		de, hl
		ld		hl, (iMathPtr3)
		call	CpHLDE
		jr		nc, p06loc_4836
		ex		de, hl

p06loc_4836:
		ld		(editBtm), hl
		ld		(editTail), hl
		ret
; End of function p06sub_4829


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


p06sub_483D:

		call	p06sub_4493
		call	BufToTop
		ret
; End of function p06sub_483D


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


CloseEditEqu:
		bit		editOpen, (iy+editFlags)
		ret		z
		call	BufToBtm
		ld		hl, (editCursor)
		ld		(iMathPtr2), hl
		ld		de, (editTop)
		or		a
		sbc		hl, de
		ex		de, hl
		ld		hl, (iMathPtr1)
		ld		(hl), e
		inc		hl
		ld		(hl), d
		call	j_CloseProg
		res		editOpen, (iy+editFlags)
		ret
; End of function CloseEditEqu

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR Page06_2FF1

Page06_369F:
		ld		a, (unk_89F5)
		xor		10h
		ld		(unk_89F5), a
		ret
; END OF FUNCTION CHUNK	FOR Page06_2FF1

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


GetPrevTok:
		; cursorUp+37p	...
		dec		hl
		push	hl
		dec		hl
		call	isPtrHLA2ByteTok
		pop		hl
		ld		d, 0
		ld		e, (hl)
		ret		nz
		dec		hl
		ld		d, (hl)
		ret
; End of function GetPrevTok

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

jpromptcursor:

		cp		2
		jp		z, CursorLeft
		cp		1
		jp		z, cursorRight
		cp		0Eh
		jr		z, p06loc_488F
		cp		3

p06loc_488F:
		jp		z, cursorUp
		cp		0Fh
		jr		z, p06loc_4898
		cp		4

p06loc_4898:
		jp		z, CursorDown
		cp		0Bh
		jr		z, Page06_369F
		cp		0Ah
		jr		nz, p06loc_48AE

p06loc_48A3:
		res		textInsMode, (iy+textFlags)
		call	BufDelete
		call	j_DispEOL
		ret
; ---------------------------------------------------------------------------

p06loc_48AE:
		cp		21h ; '!'
		jr		nz, p06loc_48B8
		call	CursorLeft
		ret		z
		jr		p06loc_48A3
; ---------------------------------------------------------------------------

p06loc_48B8:
		cp		7Fh ; ''
		ret		c
		push	af
		call	j_ConvKeyToTok
		pop		bc
		ld		a, d
		or		a
		jr		z, p06loc_48F9
		push	af
		ld		a, (mcxCurApp)
		cp		43h ; 'C'
		jr		z, p06loc_48F3
		bit		5, (iy+1Eh)
		jr		nz, p06loc_48F3
		cp		55h ; 'U'
		jr		z, p06loc_48F3
		cp		56h ; 'V'
		jr		z, p06loc_48DC
		pop		af
		ret
; ---------------------------------------------------------------------------

p06loc_48DC:
		pop		af
		bit		5, (iy+1Ch)
		jr		z, p06loc_48E8
		cp		5Ch ; '\'
		ret		nz
		jr		p06loc_491D
; ---------------------------------------------------------------------------

p06loc_48E8:
		bit		6, (iy+1Ch)
		jr		z, p06loc_48F4
		cp		5Eh ; '^'
		ret		nz
		jr		p06loc_491D
; ---------------------------------------------------------------------------

p06loc_48F3:
		pop		af

p06loc_48F4:
		cp		5Dh ; ']'
		ret		nz
		jr		p06loc_491D
; ---------------------------------------------------------------------------

p06loc_48F9:
		cp		5Fh ; '_'
		ret		z
		ld		a, (mcxCurApp)
		cp		56h ; 'V'
		jr		nz, p06loc_490D
		bit		5, (iy+1Ch)
		ret		nz
		bit		6, (iy+1Ch)
		ret		nz

p06loc_490D:
		ld		a, e
		cp		41h ; 'A'
		jr		c, p06loc_4917
		cp		5Ch ; '\'
		jr		c, p06loc_491D
		ret
; ---------------------------------------------------------------------------

p06loc_4917:
		cp		3Ah ; ':'
		ret		nc
		cp		30h ; '0'
		ret		c

p06loc_491D:
		ld		a, b
		ld		hl, (editTop)
		ld		de, nameBuff
		or		a
		sbc		hl, de
		jp		z, j_fClear
		jp		InsDisp
; ---------------------------------------------------------------------------

Page06_30B7:
		push	af
		ld		hl, p06loc_496A
		ld		bc, 11h
		cp		0FEh ; '�'
		jr		z, p06loc_495B
		ld		hl, p06loc_497B
		ld		c, 2
		cp		0FCh ; '�'
		jr		z, p06loc_495B
		ld		c, 1
		ld		hl, p06loc_497D
		cp		0FBh ; '�'
		jr		z, p06loc_495B
		pop		af
		ld		hl, p06loc_497E
		ld		c, 9
		cpir
		ret		nz

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


p06sub_4953:
		push	af
		ld		a, 0C5h	; '�'
		call	InsDisp
		pop		af
		ret
; End of function p06sub_4953

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

p06loc_495B:
		ld		a, (keyExtend)
		cpir
		jr		nz, p06loc_4968
		call	p06sub_4953
		ld		(keyExtend), a

p06loc_4968:
		pop		af
		ret
p06loc_496A:
		.db		28h ; (
		.db		18h
		.db		0Ah
		.db		0Eh
		.db		0Ch
		.db		0Fh
		.db		0Dh
		.db		0Bh
		.db		16h
		.db		11h
		.db		12h
		.db		10h
		.db		15h
		.db		23h ; #
		.db		22h ; "
		.db		24h ; $
		.db		3Bh ; ;
p06loc_497B:
		.db		37h ; 7
		.db		36h ; 6
p06loc_497D:
		.db		0Ch
p06loc_497E:
		.db		0C3h ; +
		.db		8Ah ; è
		.db		0B6h ; ¦
		.db		0BDh ; +
		.db		80h ; Ç
		.db		81h ; ü
		.db		82h ; é
		.db		83h ; â
		.db		84h ; ä

GetKeyRetOff:
		set		appRetKeyOff, (iy+APIFlg)

getkey:
		res		kOffPressed, (iy+APIFlg)
		ld		a, (iy+33h)
		ld		(bpSave), a

p06loc_4995:
		res		linkAssistError, (iy+dBKeyFlags)
		res		5, (iy+3Dh)
		in		a, (2)
		and		80h ; '�'
		jr		z, p06loc_49BE
		bit		silentLinkActive, (iy+silentLinkFlags)
		jr		z, p06loc_49BA
		in		a, (9)
		and		99h ; '�'
		jr		z, p06loc_49B6
		and		19h
		jp		nz, p06loc_4A59
		jr		p06loc_49BE
; ---------------------------------------------------------------------------

p06loc_49B6:
		res		silentLinkActive, (iy+silentLinkFlags)

p06loc_49BA:
		ld		a, 80h ; '�'
		out		(8), a

p06loc_49BE:
		set		ignoreBPLink, (iy+hookflags1)
		ld		a, 1Ah
		bit		getCSCHookActive, (iy+hookflags2)
		jr		z, p06loc_49CE
		call	j_getkeyhook
		ret		z

p06loc_49CE:
		call	p06sub_4C89
		call	j_showCursor
		set		apdRunning, (iy+apdFlags)

p06loc_49D8:

		call	GetCSC
		bit		kOffPressed, (iy+APIFlg)
		jr		z, p06loc_49E7
		res		kOffPressed, (iy+APIFlg)
		ld		a, 0FFh

p06loc_49E7:
		bit		getCSCHookActive, (iy+hookflags2)
		jr		z, p06loc_49F4
		ld		b, a
		ld		a, 1Bh
		call	j_getkeyhook
		ret		z

p06loc_49F4:
		or		a
		jp		nz, p06loc_4AA0
		call	IsOnInterruptSet
		jr		z, p06loc_4A10

SetupDBusMem:
		ld		a, (iy+dBKeyFlags)
		and		0F0h
		ld		(iy+dBKeyFlags), a
		xor		a
		ld		(unk_9CB1), a
		ld		(unk_9CB0), a
		ld		(unk_9CAF), a
		ret
; ---------------------------------------------------------------------------

p06loc_4A10:
		res		secondTimerCompleted, (iy+hookflags1)
		set		secondTimerEnabled, (iy+interruptFlags)

p06loc_4A18:
		call	HandleLinkKeyActivity
		bit		secondTimerActive, (iy+timerFlags)
		jr		nz, p06loc_4A18
		bit		secondTimerCompleted, (iy+hookflags1)
		jr		nz, p06loc_4A10
		in		a, (2)
		and		80h ; '�'
		jr		z, p06loc_4A39
		ld		a, (unk_9CAF)
		or		a
		jr		nz, p06loc_4A59
		bit		silentLinkActive, (iy+silentLinkFlags)
		jr		nz, p06loc_4A47

p06loc_4A39:
		in		a, (0)
		and		3
		cp		3
		jr		p06loc_4A59
; ---------------------------------------------------------------------------
		in		a, (2)
		and		80h ; '�'
		jr		z, p06loc_4A59

p06loc_4A47:
		in		a, (9)
		bit		6, a
		jr		z, p06loc_4A57
		push	af
		xor		a
		ld		(unk_9CB0), a
		pop		af
		set		linkAssistError, (iy+dBKeyFlags)

p06loc_4A57:
		and		19h

p06loc_4A59:
		jr		nz, p06loc_4A81
		ld		a, (unk_9CB1)
		or		a

p06loc_4A5F:
		jp		z, p06loc_49D8
		dec		a
		ld		(unk_9CB1), a
		jp		nz, p06loc_49D8
		ld		a, (unk_9CB0)
		or		a
		jp		z, p06loc_49D8
		call	Page0Call_3051
		or		a
		jr		z, p06loc_4A5F
		ld		a, 0Ah
		ld		(unk_9CB1), a
		set		0, (iy+1Dh)
		jr		p06loc_4A8E
; ---------------------------------------------------------------------------

p06loc_4A81:
		ld		hl, 9CB0h
		ld		(hl), 0
		ld		hl, kbdKey
		ld		(hl), 0
		call	j_keyscnlnk

p06loc_4A8E:
		ld		a, (kbdKey)
		or		a
		jp		z, p06loc_4995

p06loc_4A95:
		ld		hl, bpSave
		bit		3, (hl)
		ret		nz
		res		ignoreBPLink, (iy+hookflags1)
		ret
; ---------------------------------------------------------------------------

p06loc_4AA0:
		push	af
		xor		a
		ld		(unk_9CB1), a
		ld		(unk_9CB0), a
		bit		enableKeyEcho, (iy+hookflags1)
		jr		z, p06loc_4ABB
		ld		a, (mcxMain)
		cp		41h ; 'A'
		jr		z, p06loc_4ABB
		pop		af
		call	j_SendGetkeyPress
		jr		p06loc_4ABC
; ---------------------------------------------------------------------------

p06loc_4ABB:
		pop		af

p06loc_4ABC:
		cp		0FFh
		jr		nz, p06loc_4ACF
		res		shift2nd, (iy+shiftFlags)
		ld		a, 3Fh ; '?'
		bit		appRetKeyOff, (iy+APIFlg)
		jr		nz, p06loc_4A95
		jp		PowerOff
; ---------------------------------------------------------------------------

p06loc_4ACF:
		set		0, (iy+1Dh)
		bit		kbdKeyPress, (iy+kbdFlags)
		jr		z, p06loc_4AEC
		res		0, (iy+1Dh)
		res		apdRunning, (iy+apdFlags)
		res		kbdKeyPress, (iy+kbdFlags)
		res		2, (iy+25h)
		call	ApdSetup

p06loc_4AEC:
		bit		shift2nd, (iy+shiftFlags)
		jr		nz, p06loc_4B61
		bit		shiftAlpha, (iy+shiftFlags)
		jp		nz, p06loc_4C1D
		cp		36h ; '6'
		jr		nz, p06loc_4B08
		set		shift2nd, (iy+shiftFlags)
		set		6, (iy+1Fh)
		jp		p06loc_49BE
; ---------------------------------------------------------------------------

p06loc_4B08:
		cp		30h ; '0'
		jr		nz, p06loc_4B1B
		set		7, (iy+1Fh)
		set		shiftAlpha, (iy+shiftFlags)
		res		shiftLwrAlph, (iy+shiftFlags)
		jp		p06loc_49BE
; ---------------------------------------------------------------------------

p06loc_4B1B:

		ld		l, a
		ld		h, 0
		ld		de, p06loc_7E7C-1
		add		hl, de

p06loc_4B22:
		ld		a, (MenuCurrent)
		cp		0
		ld		a, (hl)
		jr		nz, p06loc_4B5A
		ld		a, (mcxCurApp)
		cp		54h ; 'T'
		jr		z, p06loc_4B33
		cp		53h ; 'S'

p06loc_4B33:
		ld		a, (hl)
		jr		z, p06loc_4B3E
		cp		6
		jr		nz, p06loc_4B3E
		ld		a, 5
		jr		p06loc_4B5A
; ---------------------------------------------------------------------------

p06loc_4B3E:
		bit		prgmEdit, (iy+prgmFlags)
		jr		nz, p06loc_4B5A
		ld		a, (mcxCurApp)
		cp		43h ; 'C'
		ld		a, (hl)
		jr		z, p06loc_4B5A
		cp		7
		jr		nz, p06loc_4B54
		ld		a, 3
		jr		p06loc_4B5A
; ---------------------------------------------------------------------------

p06loc_4B54:
		cp		8
		jr		nz, p06loc_4B5A
		ld		a, 4

p06loc_4B5A:
		or		a
		jp		nz, p06loc_4A95

p06loc_4B5E:
		jp		p06loc_49BE
; ---------------------------------------------------------------------------

p06loc_4B61:
		res		shift2nd, (iy+shiftFlags)
		bit		saIndic, (iy+newIndicFlags)
		jr		z, p06loc_4B74
		push	af
		call	j_restoreTR
		res		saIndic, (iy+newIndicFlags)
		pop		af

p06loc_4B74:
		cp		36h ; '6'
		jr		z, p06loc_4B88
		cp		30h ; '0'
		jr		nz, p06loc_4B8E
		set		shiftALock, (iy+shiftFlags)
		set		shiftAlpha, (iy+shiftFlags)
		set		7, (iy+1Fh)

p06loc_4B88:
		res		6, (iy+1Fh)
		jr		p06loc_4B5E
; ---------------------------------------------------------------------------

p06loc_4B8E:
		ld		b, 32h ; '2'

p06loc_4B90:
		ld		hl, contrast
		cp		4
		jr		nz, p06loc_4B9F
		ld		a, (hl)
		cp		27h ; '''
		jr		nc, p06loc_4BB8
		inc		a
		jr		p06loc_4BA8
; ---------------------------------------------------------------------------

p06loc_4B9F:
		cp		1
		jr		nz, p06loc_4C18
		ld		a, (hl)
		or		a
		jr		z, p06loc_4BB8
		dec		a

p06loc_4BA8:
		ld		(hl), a
		add		a, 18h
		or		0C0h ; '�'
		di
		call	lcd_busy
		out		(10h), a
		ei
		ld		hl, 8442h
		ld		(hl), b

p06loc_4BB8:
		set		apdRunning, (iy+apdFlags)
		call	j_saveTR
		ld		hl, (curRow)
		push	hl
		ld		hl, 0F00h
		ld		(curRow), hl
		ld		l, (iy+5)
		ld		h, (iy+0Dh)
		push	hl
		ld		a, (unk_89F2)
		push	af
		set		textInverse, (iy+textFlags)
		res		appTextSave, (iy+appFlags)
		ld		a, (contrast)
		ld		e, a
		ld		d, 0
		ld		hl, p06loc_4D5E
		add		hl, de
		ld		a, (hl)
		di
		call	j_PutMap
		ei
		pop		af
		ld		(unk_89F2), a
		pop		hl
		ld		(iy+0Dh), h
		ld		(iy+5),	l
		pop		hl
		ld		(curRow), hl

p06loc_4BFB:
		call	HandleLinkKeyActivity
		bit		kbdSCR, (iy+kbdFlags)
		jr		z, p06loc_4BFB
		call	GetCSC
		ld		b, 0Ah
		cp		1
		jr		z, p06loc_4B90
		cp		4
		jp		z, p06loc_4B90
		call	j_restoreTR
		jp		p06loc_49E7
; ---------------------------------------------------------------------------

p06loc_4C18:
		add		a, 38h ; '8'

p06loc_4C1A:
		jp		p06loc_4B1B
; ---------------------------------------------------------------------------

p06loc_4C1D:
		cp		30h ; '0'
		jr		nz, p06loc_4C3D
		bit		lwrCaseActive, (iy+appLwrCaseFlag)
		jr		z, p06loc_4C33
		bit		shiftLwrAlph, (iy+shiftFlags)
		jr		nz, p06loc_4C33
		set		shiftLwrAlph, (iy+shiftFlags)
		jr		p06loc_4C3A
; ---------------------------------------------------------------------------

p06loc_4C33:
		res		7, (iy+1Fh)
		call	CancelAlpha

p06loc_4C3A:
		jp		p06loc_49BE
; ---------------------------------------------------------------------------

p06loc_4C3D:
		cp		36h ; '6'
		jr		nz, p06loc_4C4B
		set		6, (iy+1Fh)
		set		shift2nd, (iy+shiftFlags)
		jr		p06loc_4C3A
; ---------------------------------------------------------------------------

p06loc_4C4B:
		call	CanAlphIns_UnlessAlphaLock
		bit		shiftAlpha, (iy+shiftFlags)
		jp		nz, p06loc_4C64
		bit		saIndic, (iy+newIndicFlags)
		jr		z, p06loc_4C64
		push	af
		call	j_restoreTR
		res		saIndic, (iy+newIndicFlags)
		pop		af

p06loc_4C64:
		add		a, 70h ; 'p'
		bit		shiftLwrAlph, (iy+shiftFlags)
		jr		z, p06loc_4C1A
		add		a, 38h ; '8'
		ld		l, a
		ld		h, 0
		ld		de, p06loc_7E7C-1
		add		hl, de
		ld		a, (hl)
		cp		0E2h ; '�'
		jr		c, p06loc_4C86
		cp		0FCh ; '�'
		jr		nc, p06loc_4C86
		ld		(keyExtend), a
		ld		a, 0FCh	; '�'
		jp		p06loc_4A95
; ---------------------------------------------------------------------------

p06loc_4C86:
		jp		p06loc_4B22

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


p06sub_4C89:
		bit		extraIndic, (iy+newIndicFlags)
		ret		nz
		bit		curAble, (iy+curFlags)
		jr		z, p06loc_4CAD
		bit		appCurGraphic, (iy+appFlags)
		jr		nz, p06loc_4CAD
		bit		appCurWord, (iy+appFlags)
		jr		nz, p06loc_4CAD

canIndic:
		bit		saIndic, (iy+newIndicFlags)
		ret		z
		call	j_restoreTR
		res		saIndic, (iy+newIndicFlags)
		ret
; ---------------------------------------------------------------------------

p06loc_4CAD:
		bit		saIndic, (iy+newIndicFlags)
		jr		z, p06loc_4CC0
		call	p06sub_4CFC
		jr		nz, p06loc_4CCB
		call	j_restoreTR
		res		saIndic, (iy+newIndicFlags)
		ret
; ---------------------------------------------------------------------------

p06loc_4CC0:
		call	p06sub_4CFC
		ret		z
		set		saIndic, (iy+newIndicFlags)
		call	j_saveTR

p06loc_4CCB:
		ld		hl, (curRow)
		push	hl
		ld		hl, 0F00h
		ld		(curRow), hl
		ld		l, (iy+5)
		ld		h, (iy+0Dh)
		push	hl
		ld		a, (unk_89F2)
		push	af
		res		appTextSave, (iy+appFlags)
		call	p06sub_4CFC
		di
		call	j_PutMap
		ei
		pop		af
		ld		(unk_89F2), a
		pop		hl
		ld		(iy+0Dh), h
		ld		(iy+5),	l
		pop		hl
		ld		(curRow), hl
		ret
; End of function p06sub_4C89


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


p06sub_4CFC:
		; p06sub_4C89:p06loc_4CC0p ...
		ld		a, 0E1h	; '�'
		ld		h, (iy+12h)
		bit		3, h
		ret		nz
		bit		4, h
		ret		z
		add		a, 2
		bit		5, h
		ret		nz
		dec		a
		ret
; End of function p06sub_4CFC

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

LCD_DRIVERON:
		ld		a, 40h ; '@'
		call	lcd_busy
		out		(10h), a
		ld		a, 5
		call	lcd_busy
		out		(10h), a
		ld		a, 1
		call	lcd_busy
		out		(10h), a
		ld		a, 3
		call	lcd_busy
		out		(10h), a
		call	NZIf83Plus
		jr		z, p06loc_4D43
		ld		b, 0
		rst		28h
		cp		d
		add		a, b
		bit		0, b
		jr		nz, p06loc_4D43
		ld		a, 16h
		call	lcd_busy
		out		(10h), a
		ld		a, 8
		jr		p06loc_4D4C
; ---------------------------------------------------------------------------

p06loc_4D43:
		ld		a, 17h
		call	lcd_busy
		out		(10h), a
		ld		a, 0Bh

p06loc_4D4C:
		call	lcd_busy
		out		(10h), a
		ld		a, (contrast)
		add		a, 18h
		or		0C0h ; '�'
		call	lcd_busy
		out		(10h), a
		ret
p06loc_4D5E:
		.db		30h	; 0
		.db		30h	; 0
		.db		30h	; 0
		.db		30h	; 0
		.db		31h	; 1
		.db		31h	; 1
		.db		31h	; 1
		.db		31h	; 1
		.db		32h	; 2
		.db		32h	; 2
		.db		32h	; 2
		.db		32h	; 2
		.db		33h	; 3
		.db		33h	; 3
		.db		33h	; 3
		.db		33h	; 3
		.db		34h	; 4
		.db		34h	; 4
		.db		34h	; 4
		.db		34h	; 4
		.db		35h	; 5
		.db		35h	; 5
		.db		35h	; 5
		.db		35h	; 5
		.db		36h	; 6
		.db		36h	; 6
		.db		36h	; 6
		.db		36h	; 6
		.db		37h	; 7
		.db		37h	; 7
		.db		37h	; 7
		.db		37h	; 7
		.db		38h	; 8
		.db		38h	; 8
		.db		38h	; 8
		.db		38h	; 8
		.db		39h	; 9
		.db		39h	; 9
		.db		39h	; 9
		.db		39h	; 9
; ---------------------------------------------------------------------------

DFMIN2:
		push	af
		push	bc
		call	OP1ToOP6
		bit		3, (iy+7)
		jp		nz, Page0Call_2501
		call	j_SAVEPARSE
		call	PushRealO5
		call	PushRealO4
		ld		hl, 87h	; '�'
		call	AllocFPS1
		call	PushRealO6
		call	SETesTOfps
		call	OP3ToOP1
		call	CPYO1TOES1
		call	CPYO2TOES2
		pop		af
		or		a
		jr		nz, p06loc_4DCF
		call	j_RclX
		call	CPYO1TOES13
		call	cpop1op2
		jr		c, p06loc_4DD5
		call	CPYTO1ES1
		call	CPYTO2ES13
		call	cpop1op2
		jr		c, p06loc_4DD5
		call	CPYTO1ES13
		jr		p06loc_4DEB
; ---------------------------------------------------------------------------

p06loc_4DCF:
		call	FPSub
		call	CkOP1Pos

p06loc_4DD5:
		jp		nz, Page0Call_2505
		call	CkOP1FP0
		jp		z, Page0Call_2505
		ld		hl, p06loc_50D5
		call	page0_D19
		call	CPYTO2ES2
		rst		30h
		call	CPYO1TOES13

p06loc_4DEB:
		call	CPYO1TOES14
		call	Page0Call_2A2F
		call	CPYTO1ES16
		call	j_SAVEDATA
		pop		hl
		ld		(OP3), hl
		set		3, (iy+7)
		ld		hl, p06loc_5099
		call	pushErrorHandleR
		call	OP2Set0
		call	PushRealO2
		call	j_StoOther
		call	CPYTO1ES13
		ld		hl, (OP3)
		push	hl
		pop		af
		push	af
		call	p06sub_5070
		call	CPYO1TOES9
		call	CPYO1TOES10
		call	CPYO1TOES11
		call	OP1Set0
		call	CPYO1TOES7

p06loc_4E29:
		call	CPYTO1ES13
		call	ClrOP1S
		ld		hl, p06loc_50CC
		call	page0_D19
		call	OP1ToOP4
		call	CPYTO1ES17
		call	OP2Set3
		call	fpdiv
		call	OP4ToOP2
		rst		30h
		call	CPYO1TOES5
		call	Times2
		call	CPYO1TOES4
		call	CPYTO1ES1
		call	CPYTO2ES2
		rst		30h
		call	TimesPt5
		call	CPYO1TOES3
		call	CPYTO2ES13
		call	InvSub
		call	ClrOP1S
		call	OP1ToOP4
		call	CPYTO1ES1
		call	CPYTO2ES2
		call	FPSub
		call	TimesPt5
		call	CPYTO2ES4
		call	InvSub
		call	OP4ToOP2
		call	cpop1op2
		jp		nc, p06loc_50A9
		call	CPYTO1ES5
		call	CPYTO2ES7
		call	AbsO1O2Cp
		jp		c, p06loc_4F7F

p06loc_4E8E:
		call	CPYTO1ES13
		call	CPYTO2ES3
		call	cpop1op2
		push	af
		call	c, CPYTO1ES1
		pop		af
		call	nc, CPYTO1ES2
		call	CPYTO2ES13
		call	FPSub
		call	CPYO1TOES7
		ld		hl, p06loc_50D5
		call	page0_D19
		call	CPYO1TOES6

p06loc_4EB1:
		ld		a, (OP1)
		push	af
		call	CPYTO2ES5
		call	AbsO1O2Cp
		jr		c, p06loc_4EC3
		pop		af
		call	CPYTO1ES6
		jr		p06loc_4ECA
; ---------------------------------------------------------------------------

p06loc_4EC3:
		call	CPYTO1ES5
		pop		af
		ld		(OP1), a

p06loc_4ECA:
		call	CPYTO2ES13
		rst		30h
		call	CPYO1TOES12
		call	CPYTO2ES13
		call	cpop1op2
		push	af
		call	CPYTO1ES12
		pop		bc
		pop		af
		push	af
		push	bc
		call	p06sub_5070
		call	CPYO1TOES8
		call	CPYTO2ES9
		call	cpop1op2
		jp		c, p06loc_4F5F
		jp		z, p06loc_4F5F
		call	CPYTO1ES12
		pop		af
		push	af
		call	c, CPYO1TOES2
		pop		af
		call	nc, CPYO1TOES1
		call	CPYTO1ES10
		call	CPYTO2ES8
		call	cpop1op2
		jr		nc, p06loc_4F35
		call	CPYTO1ES14
		call	CPYTO2ES13
		call	cpop1op2
		jr		z, p06loc_4F35
		call	CPYTO1ES11
		call	CPYTO2ES8
		call	cpop1op2
		jr		nc, p06loc_4F50
		call	CPYTO1ES15
		call	CPYTO2ES13
		call	cpop1op2
		jr		z, p06loc_4F50
		call	CPYTO1ES14
		call	CPYTO2ES15
		call	cpop1op2
		jp		nz, p06loc_4E29

p06loc_4F35:
		call	CPYTO1ES14
		call	Page0Call_2A2F
		call	CPYTO1ES10
		call	CPYO1TOES11
		call	CPYTO1ES12
		call	CPYO1TOES14
		call	CPYTO1ES8
		call	CPYO1TOES10
		jp		p06loc_4E29
; ---------------------------------------------------------------------------

p06loc_4F50:
		call	CPYTO1ES12
		call	Page0Call_2A2F
		call	CPYTO1ES8
		call	CPYO1TOES11
		jp		p06loc_4E29
; ---------------------------------------------------------------------------

p06loc_4F5F:
		call	CPYTO1ES13
		pop		af
		push	af
		call	c, CPYO1TOES1
		pop		af
		call	nc, CPYO1TOES2
		ld		hl, (ES)
		ld		de, 0FF70h
		add		hl, de
		ex		de, hl
		ld		hl, 9
		add		hl, de
		ld		bc, 3Fh	; '?'
		ldir
		jp		p06loc_4E29
; ---------------------------------------------------------------------------

p06loc_4F7F:
		call	CPYTO1ES15
		call	CPYTO2ES13
		call	InvSub
		call	OP1ToOP3
		call	CPYTO1ES9
		call	CPYTO2ES10
		call	FPSub
		call	BCALL_4120
		call	FPMult
		call	OP1ToOP6
		call	FPMult
		call	OP1ToOP5
		call	CPYTO1ES1
		call	CPYTO2ES13
		call	InvSub
		call	OP1ToOP3
		call	CPYTO1ES9
		call	CPYTO2ES11
		call	FPSub
		call	BCALL_4120
		call	FPMult
		call	OP1ToOP4
		call	FPMult
		call	OP5ToOP2
		call	InvSub
		call	OP1ToOP5
		call	OP6ToOP1
		call	OP4ToOP2
		call	FPSub
		call	Times2
		call	CkOP1FP0
		jr		z, p06loc_4FEB
		call	CkOP1Pos
		jr		nz, p06loc_4FEB
		ld		a, (OP6)
		xor		80h ; '�'
		ld		(OP6), a

p06loc_4FEB:
		call	ClrOP1S
		call	OP1ToOP6
		call	CPYTO1ES7
		call	CPYTO2ES6
		call	CPYO2TOES7
		call	OP6ToOP2
		call	FPMult
		call	TimesPt5
		call	OP5ToOP2
		call	AbsO1O2Cp
		jp		c, p06loc_4E8E
		jp		z, p06loc_4E8E
		call	CPYTO1ES2
		call	p06sub_50DE
		jp		nc, p06loc_4E8E
		call	CPYTO1ES1
		call	p06sub_50DE
		jp		nc, p06loc_4E8E
		call	OP5ToOP1
		call	OP6ToOP2
		call	fpdiv
		call	CPYO1TOES6
		call	CPYTO2ES13
		rst		30h
		call	CPYO1TOES12
		call	CPYTO2ES2
		call	FPSub
		call	CPYTO2ES4
		call	cpop1op2
		jr		c, p06loc_5053
		call	CPYTO1ES1
		call	CPYTO2ES12
		call	FPSub
		call	CPYTO2ES4
		call	cpop1op2
		jr		nc, p06loc_506A

p06loc_5053:
		call	CPYTO1ES3
		call	CPYTO2ES13
		call	FPSub
		ld		a, (OP1)
		push	af
		call	CPYTO1ES5
		pop		af
		ld		(OP1), a
		jp		p06loc_4EB1
; ---------------------------------------------------------------------------

p06loc_506A:
		call	CPYTO1ES6
		jp		p06loc_4EB1

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


p06sub_5070:
		push	af
		rst		8
		call	CPYTO1ES16
		rst		10h
		ld		hl, OP2
		call	mov9B2
		call	CPYTO1EST
		ld		hl, (pTempCnt)
		push	hl
		call	j_PARSEOFF
		pop		hl
		ld		(pTempCnt), hl
		call	page0_1717
		call	SETesTOfps
		pop		af
		jr		nc, p06loc_5096
		call	InvOP1S

p06loc_5096:
		jp		EOP1NotReal
; End of function p06sub_5070

p06loc_5099:
		res		3, (iy+7)
		call	SETesTOfps
		call	CPYTO1ES16
		call	j_RESTOREDATA
		jp		JErrorNo
; ---------------------------------------------------------------------------

p06loc_50A9:
		res		3, (iy+7)
		pop		af
		call	popErrorHandleR
		call	CPYTO1ES18
		call	j_GETPARSE
		call	CPYTO1ES16
		call	j_RESTOREDATA
		call	CPYTO1EST
		call	markTableDirty
		call	CPYTO1ES13
		ld		de, 0ABh ; '�'
		jp		DeallocFPS1
p06loc_50CC:
		.db		0
		.db		79h	; y
		.db		10h
		.db		0
		.db		0
		.db		0
		.db		0
		.db		0
		.db		0
p06loc_50D5:
		.db		0
		.db		7Fh	; 
		.db		38h	; 8
		.db		19h
		.db		66h	; f
		.db		1
		.db		12h
		.db		50h	; P
		.db		10h

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


p06sub_50DE:
		call	CPYTO2ES13
		call	FPSub
		call	OP6ToOP2
		call	FPMult
		call	OP5ToOP2
		jp		cpop1op2
; End of function p06sub_50DE

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

formDisp:
		sub		a
		ld		(winLeftEdge), a
		call	CkOP1Real
		jr		nz, p06loc_5113
		ld		a, 0Eh
		call	FormBase
		ld		a, c
		cp		11h
		jr		nc, p06loc_510D
		call	p06sub_5C0C
		ld		hl, OP3
		call	j_PutS
		ret
; ---------------------------------------------------------------------------

p06loc_510D:
		call	p06sub_5C7E
		jp		p06loc_5333
; ---------------------------------------------------------------------------

p06loc_5113:
		cp		0Ch
		jr		nz, p06loc_512F
		call	FormDCplx
		ld		a, c
		cp		11h
		jr		nc, p06loc_5129
		call	p06sub_5C0C
		ld		hl, fmtString
		call	j_PutS
		ret
; ---------------------------------------------------------------------------

p06loc_5129:
		call	p06sub_5C7E
		jp		p06loc_5341
; ---------------------------------------------------------------------------

p06loc_512F:
		cp		1
		jr		nz, p06loc_5147
		call	p06sub_5C7E
		call	p06sub_5B20
		ld		a, c
		cp		11h
		jr		nc, p06loc_5144
		ld		a, 10h
		sub		c
		ld		(winCol), a

p06loc_5144:
		jp		p06loc_5350
; ---------------------------------------------------------------------------

p06loc_5147:
		cp		0Dh
		jr		nz, p06loc_515F
		call	p06sub_5C7E
		call	p06sub_5297
		ld		a, c
		cp		11h
		jr		nc, p06loc_515C
		ld		a, 10h
		sub		c
		ld		(winCol), a

p06loc_515C:
		jp		p06loc_53F6
; ---------------------------------------------------------------------------

p06loc_515F:
		cp		2
		jr		nz, p06loc_516F
		call	p06sub_5CA3
		call	p06sub_5B75
		call	p06sub_5C19
		jp		p06loc_549D
; ---------------------------------------------------------------------------

p06loc_516F:
		cp		4
		jr		nz, p06loc_5185
		call	p06sub_5C7E
		call	p06sub_5189
		ld		a, c
		or		a
		jp		z, p06sub_5BC4
		xor		a
		ld		(winCol), a
		jp		p06loc_51DB
; ---------------------------------------------------------------------------

p06loc_5185:
		call	j_DispDone
		ret

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


p06sub_5189:
		ld		hl, 0
		ld		(fmtLeft), hl
		call	FIND_E_UNDEF
		ex		de, hl
		ld		c, (hl)
		inc		hl
		ld		b, (hl)
		inc		hl
		ld		(fmtIndex), bc
		ld		(chkDelPtr1), hl
		ld		(chkDelPtr3), hl
		push	ix
		ld		ix, 0
		add		ix, sp
		dec		sp
		ld		(ix+0FFh), 0

p06loc_51AE:
		ld		a, c
		or		b
		jr		z, p06loc_51D1
		push	hl
		call	BUFPEEK3
		jr		nc, p06loc_51B9
		dec		bc

p06loc_51B9:
		pop		de
		push	bc
		push	hl
		ex		de, hl
		call	j_GET_TOK_STRNG
		ld		a, (ix+0FFh)
		add		a, c
		ld		(ix+0FFh), a
		pop		hl
		pop		bc
		cp		11h
		jr		nc, p06loc_51D1
		inc		hl
		dec		bc
		jr		p06loc_51AE
; ---------------------------------------------------------------------------

p06loc_51D1:
		ld		c, (ix+0FFh)
		ld		b, 0
		ld		sp, ix
		pop		ix
		ret
; End of function p06sub_5189

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

p06loc_51DB:
		call	p06sub_5BC4
		ld		hl, (winLeft)
		ld		de, (fmtLeft)
		call	CpHLDE
		jp		p, p06loc_5220
		ld		hl, (chkDelPtr1)
		dec		hl
		ld		de, (chkDelPtr3)
		or		1
		push	af
		call	CpHLDE
		jr		z, p06loc_5204
		pop		af
		dec		hl
		call	isPtrHLA2ByteTok
		push	af
		jr		z, p06loc_5204
		inc		hl

p06loc_5204:
		ld		(chkDelPtr1), hl
		call	j_GET_TOK_STRNG
		ld		hl, (fmtLeft)
		or		a
		sbc		hl, bc
		ld		(fmtLeft), hl
		ld		hl, (fmtIndex)
		inc		hl
		pop		af
		jr		nz, p06loc_521B
		inc		hl

p06loc_521B:
		ld		(fmtIndex), hl
		jr		p06loc_524E
; ---------------------------------------------------------------------------

p06loc_5220:
		ld		hl, (chkDelPtr1)
		call	j_GET_TOK_STRNG
		ld		hl, (fmtLeft)
		add		hl, bc
		ld		de, (winLeft)
		call	CpHLDE
		jp		p, p06loc_524E
		ld		(fmtLeft), hl
		ld		hl, (chkDelPtr1)
		call	isPtrHLA2ByteTok
		ld		de, (fmtIndex)
		dec		de
		inc		hl
		jr		nz, p06loc_5247
		dec		de
		inc		hl

p06loc_5247:
		ld		(chkDelPtr1), hl
		ld		(fmtIndex), de

p06loc_524E:
		ld		hl, (curRow)
		push	hl
		ld		hl, (chkDelPtr1)
		ld		bc, (fmtIndex)
		push	bc
		push	hl
		call	j_GET_TOK_STRNG
		ld		a, (OP3)
		call	j_wputc
		ld		hl, (winCol)
		ld		de, (fmtLeft)
		add		hl, de
		ld		(winCol), hl
		ld		hl, 848Fh
		jr		p06loc_527C
; ---------------------------------------------------------------------------

p06loc_5274:
		push	bc
		push	hl
		call	j_GET_TOK_STRNG
		ld		hl, OP3

p06loc_527C:
		call	j_wputs
		pop		hl
		pop		bc
		push	af
		call	isPtrHLA2ByteTok
		dec		bc
		inc		hl
		jr		nz, p06loc_528B
		dec		bc
		inc		hl

p06loc_528B:
		pop		af
		jr		c, p06loc_5292
		ld		a, c
		or		b
		jr		nz, p06loc_5274

p06loc_5292:
		pop		hl
		ld		(curRow), hl
		ret

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


p06sub_5297:
		call	p06sub_5B54
		push	ix
		ld		ix, 0
		add		ix, sp
		dec		sp
		ld		(ix+0FFh), 2

p06loc_52A7:
		push	bc
		call	Mov9OP1OP2
		push	hl
		call	FormDCplx
		pop		hl
		inc		c
		ld		a, (ix+0FFh)
		add		a, c
		ld		(ix+0FFh), a
		pop		bc
		cp		11h
		jr		nc, p06loc_52C2
		dec		bc
		ld		a, c
		or		b
		jr		nz, p06loc_52A7

p06loc_52C2:
		ld		c, (ix+0FFh)
		ld		b, 0
		dec		bc
		ld		sp, ix
		pop		ix
		ret
; End of function p06sub_5297

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

formMatrix:
		bit		AnsScroll, (iy+ansFlags)
		ret		z
		bit		2, (iy+0Eh)
		jr		z, p06loc_52E1
		ld		hl, (winAbove)
		dec		hl
		ld		(winAbove), hl
		jr		p06loc_52E6
; ---------------------------------------------------------------------------

p06loc_52E1:
		bit		3, (iy+0Eh)
		ret		z

p06loc_52E6:
		ld		hl, curRow
		inc		(hl)
		jr		p06loc_5322
; ---------------------------------------------------------------------------

wscrollLeft:
		bit		4, (iy+0Eh)
		ret		z
		ld		hl, (winLeft)
		dec		hl
		ld		(winLeft), hl
		jr		p06loc_5322
; ---------------------------------------------------------------------------

wscrollUp:
		bit		2, (iy+0Eh)
		ret		z
		ld		hl, (winAbove)
		dec		hl
		ld		(winAbove), hl
		jr		p06loc_5322
; ---------------------------------------------------------------------------

wscrollDown:
		bit		3, (iy+0Eh)
		ret		z
		ld		hl, (winAbove)
		inc		hl
		ld		(winAbove), hl
		jr		p06loc_5322
; ---------------------------------------------------------------------------

wscrollRight:
		bit		5, (iy+0Eh)
		ret		z
		ld		hl, (winLeft)
		inc		hl
		ld		(winLeft), hl

p06loc_5322:
		sub		a
		ld		(winLeftEdge), a
		call	j_whomeup
		call	j_RclAns
		ld		a, (OP1)
		and		1Fh
		jr		nz, p06loc_533D

p06loc_5333:
		call	p06sub_5BC4
		ld		hl, OP3
		call	j_wputs
		ret
; ---------------------------------------------------------------------------

p06loc_533D:
		cp		0Ch
		jr		nz, p06loc_534B

p06loc_5341:
		call	p06sub_5BC4
		ld		hl, fmtString
		call	j_wputs
		ret
; ---------------------------------------------------------------------------

p06loc_534B:
		cp		1
		jp		nz, p06loc_53EC

p06loc_5350:
		call	p06sub_5BC4
		ld		hl, (winLeft)
		ld		de, (fmtLeft)
		call	CpHLDE
		jp		p, p06loc_5381
		ld		hl, (chkDelPtr1)
		ld		de, 0FFF7h
		add		hl, de
		ld		(chkDelPtr1), hl
		rst		20h
		call	p06sub_55A8
		inc		c
		ld		hl, (fmtLeft)
		or		a
		sbc		hl, bc
		ld		(fmtLeft), hl
		ld		hl, (fmtIndex)
		inc		hl
		ld		(fmtIndex), hl
		jr		p06loc_53AB
; ---------------------------------------------------------------------------

p06loc_5381:
		ld		hl, (chkDelPtr1)
		rst		20h
		call	p06sub_55A8
		inc		c
		ld		hl, (fmtLeft)
		add		hl, bc
		ld		de, (winLeft)
		call	CpHLDE
		jp		p, p06loc_53AB
		ld		(fmtLeft), hl
		ld		hl, (chkDelPtr1)
		ld		de, 9
		add		hl, de
		ld		(chkDelPtr1), hl
		ld		hl, (fmtIndex)
		dec		hl
		ld		(fmtIndex), hl

p06loc_53AB:
		ld		hl, (curRow)
		push	hl
		ld		a, 7Bh ; '{'
		call	j_wputc
		ld		hl, (winCol)
		ld		de, (fmtLeft)
		add		hl, de
		ld		(winCol), hl
		ld		bc, (fmtIndex)
		ld		hl, (chkDelPtr1)
		jr		p06loc_53CD
; ---------------------------------------------------------------------------

p06loc_53C8:
		call	p06sub_5FA2
		jr		c, p06loc_53E7

p06loc_53CD:
		push	bc
		rst		20h
		push	hl
		call	p06sub_55A8
		ld		hl, OP3
		call	j_wputs
		pop		hl
		pop		bc
		jr		c, p06loc_53E7
		dec		bc
		ld		a, c
		or		b
		jr		nz, p06loc_53C8
		ld		a, 7Dh ; '}'
		call	j_wputc

p06loc_53E7:
		pop		hl
		ld		(curRow), hl
		ret
; ---------------------------------------------------------------------------

p06loc_53EC:
		cp		4
		jp		z, p06loc_51DB
		cp		0Dh
		jp		nz, p06loc_5498

p06loc_53F6:
		call	p06sub_5BC4
		ld		hl, (winLeft)
		ld		de, (fmtLeft)
		call	CpHLDE
		jp		p, p06loc_5429
		ld		hl, (chkDelPtr1)
		ld		de, 0FFEEh
		add		hl, de
		ld		(chkDelPtr1), hl
		call	Mov9OP1OP2
		call	FormDCplx
		inc		c
		ld		hl, (fmtLeft)
		or		a
		sbc		hl, bc
		ld		(fmtLeft), hl
		ld		hl, (fmtIndex)
		inc		hl
		ld		(fmtIndex), hl
		jr		p06loc_5455
; ---------------------------------------------------------------------------

p06loc_5429:
		ld		hl, (chkDelPtr1)
		call	Mov9OP1OP2
		call	FormDCplx
		inc		c
		ld		hl, (fmtLeft)
		add		hl, bc
		ld		de, (winLeft)
		call	CpHLDE
		jp		p, p06loc_5455
		ld		(fmtLeft), hl
		ld		hl, (chkDelPtr1)
		ld		de, 12h
		add		hl, de
		ld		(chkDelPtr1), hl
		ld		hl, (fmtIndex)
		dec		hl
		ld		(fmtIndex), hl

p06loc_5455:
		ld		hl, (curRow)
		push	hl
		ld		a, 7Bh ; '{'
		call	j_wputc
		ld		hl, (winCol)
		ld		de, (fmtLeft)
		add		hl, de
		ld		(winCol), hl
		ld		bc, (fmtIndex)
		ld		hl, (chkDelPtr1)
		jr		p06loc_5477
; ---------------------------------------------------------------------------

p06loc_5472:
		call	p06sub_5FA2
		jr		c, p06loc_5493

p06loc_5477:
		push	bc
		call	Mov9OP1OP2
		push	hl
		call	FormDCplx
		ld		hl, fmtString
		call	j_wputs
		pop		hl
		pop		bc
		jr		c, p06loc_5493
		dec		bc
		ld		a, c
		or		b
		jr		nz, p06loc_5472
		ld		a, 7Dh ; '}'
		call	j_wputc

p06loc_5493:
		pop		hl
		ld		(curRow), hl
		ret
; ---------------------------------------------------------------------------

p06loc_5498:
		cp		2
		jp		nz, locret_555C

p06loc_549D:
		push	ix
		ld		ix, 0
		add		ix, sp
		push	hl
		push	hl
		push	hl
		ld		hl, (curRow)
		push	hl
		call	p06sub_555D
		jr		p06loc_54CB
; ---------------------------------------------------------------------------

p06loc_54B1:
		call	p06sub_5FA2
		ld		hl, (winRow)
		inc		hl
		ld		(winRow), hl
		ld		hl, 0
		ld		(winCol), hl
		res		0, (iy+0Eh)
		res		1, (iy+0Eh)
		ld		a, 20h ; ' '

p06loc_54CB:
		call	j_wputc
		jr		c, p06loc_5535
		call	p06sub_5CD6
		ld		b, (ix+0FDh)
		ld		c, 1
		ld		(ix+0FBh), c
		ld		de, (chkDelPtr1)
		call	j_AdrMEle
		ld		a, 0C1h	; '�'
		call	j_wputc
		jr		p06loc_54EE
; ---------------------------------------------------------------------------

p06loc_54E9:
		call	p06sub_5FA2
		jr		c, p06loc_5535

p06loc_54EE:
		rst		20h
		push	hl
		call	p06sub_5CF0
		ld		hl, (winCol)
		add		hl, bc
		ex		de, hl
		ld		hl, (winLeft)
		inc		hl
		call	CpHLDE
		jp		m, p06loc_5509
		ld		(winCol), de
		pop		hl
		jr		p06loc_5523
; ---------------------------------------------------------------------------

p06loc_5509:
		push	bc
		call	p06sub_55A8
		ld		hl, OP3
		call	j_wputs
		pop		de
		pop		hl
		jr		c, p06loc_5535
		ld		a, e
		sub		c
		jr		z, p06loc_5523
		ld		b, a

p06loc_551C:
		call	p06sub_5FA2
		jr		c, p06loc_5535
		djnz	p06loc_551C

p06loc_5523:
		ld		a, (ix+0FBh)
		cp		(ix+0FAh)
		jr		z, p06loc_5530
		inc		(ix+0FBh)
		jr		p06loc_54E9
; ---------------------------------------------------------------------------

p06loc_5530:
		ld		a, 5Dh ; ']'
		call	j_wputc

p06loc_5535:
		ld		a, (ix+0FDh)
		cp		(ix+0FCh)
		jr		z, p06loc_5543
		inc		(ix+0FDh)
		jp		p06loc_54B1
; ---------------------------------------------------------------------------

p06loc_5543:
		ld		a, 5Dh ; ']'
		call	j_wputc
		call	p06sub_5C5B
		ld		hl, winBtm
		inc		(hl)
		set		appAutoScroll, (iy+appFlags)
		pop		hl
		ld		(curRow), hl
		ld		sp, ix
		pop		ix
		ret
; ---------------------------------------------------------------------------

locret_555C:
		ret

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


p06sub_555D:
		call	p06sub_5BC4
		ld		hl, winBtm
		dec		(hl)
		res		appAutoScroll, (iy+appFlags)
		ld		hl, (chkDelPtr1)
		ld		a, (hl)
		inc		hl
		ld		(ix+0FAh), a
		ld		a, (hl)
		inc		hl
		ld		(ix+0FCh), a
		ld		a, 1
		ld		(ix+0FDh), a
		ld		a, 0C1h	; '�'
		ret
; End of function p06sub_555D


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


FormEReal:
		set		fmtEdit, (iy+fmtEditFlags)
		call	p06sub_558C
		call	FormReal
		res		fmtEdit, (iy+fmtEditFlags)
		ret
; End of function FormEReal


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


p06sub_558C:
		ld		b, a
		ld		a, (mcxCurApp)
		cp		53h ; 'S'
		ld		a, b
		ret		nz
		res		fmtEdit, (iy+fmtEditFlags)
		ret
; End of function p06sub_558C

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

formERealTOK:
		set		fmtEdit, (iy+fmtEditFlags)
		call	FormReal
		call	FORMTOTOK
		res		fmtEdit, (iy+fmtEditFlags)
		ret

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


p06sub_55A8:
		ld		a, 13h
; End of function p06sub_55A8


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


FormBase:
		push	ix
		ld		ix, 0
		add		ix, sp
		push	hl
		ld		hl, 0FFD1h
		add		hl, sp
		ld		sp, hl
		ld		l, (ix+0FEh)
		ld		h, (ix+0FFh)
		ld		(ix+0EBh), a
		ld		b, (iy+0Ah)
		call	p06sub_5B09
		ld		(ix+0EDh), a
		ld		b, (iy+0Bh)
		call	p06sub_5B09

BCALL_50AD:
		; FormBase+1EAj
		ld		(ix+0ECh), a
		or		a
		jr		nz, p06loc_55E4
		ld		a, (ix+0EBh)
		call	FormReal
		ld		sp, ix
		pop		ix
		ret
; ---------------------------------------------------------------------------

p06loc_55E1:
		sub		a
		jr		BCALL_50AD
; ---------------------------------------------------------------------------

p06loc_55E4:
		call	p06sub_5797
		cp		4
		jp		nz, p06loc_5654
		call	j_ToFrac
		jr		nc, p06loc_55F6
		call	p06sub_57AE
		jr		p06loc_55E1
; ---------------------------------------------------------------------------

p06loc_55F6:
		sub		a
		call	p06sub_57C9
		ld		l, 0DEh	; '�'
		call	p06sub_57C2
		ld		de, OP1
		call	p06sub_57AA
		call	OP2ToOP1
		ld		a, 10h
		call	FormReal
		call	p06sub_57C0
		ex		de, hl
		ld		hl, OP3
		call	strcopy
		ld		l, 0DEh	; '�'
		call	p06sub_57C2
		rst		20h
		ld		a, 10h
		call	FormReal
		call	p06sub_57DC
		ld		hl, OP3
		add		hl, bc
		ld		(hl), 2Fh ; '/'
		inc		hl
		ld		(hl), 0
		call	p06sub_57C0
		ld		de, OP3
		call	strCat
		call	p06sub_57AE

p06loc_563A:
		ld		hl, OP3

p06loc_563D:
		ld		sp, ix
		pop		ix

StrLength:
		push	af
		push	hl
		ld		bc, 0
		push	bc
		sub		a
		cpir
		pop		hl
		or		a
		sbc		hl, bc
		dec		hl
		ld		c, l
		ld		b, h
		pop		hl
		pop		af
		ret
; ---------------------------------------------------------------------------

p06loc_5654:
		call	ClrOP1S
		rst		8
		call	frac
		call	OP1ToOP4
		call	InvSub
		ld		a, (OP1+1)
		cp		86h ; '�'
		jp		nc, p06loc_5790
		ld		e, a
		ld		a, 8Ch ; '�'
		sub		e
		push	af
		ld		l, 0DEh	; '�'
		call	p06sub_57C2
		ld		de, OP1
		call	p06sub_57AA
		call	OP4ToOP1
		call	j_OP2Set60
		call	FPMult
		rst		8
		call	frac
		call	OP1ToOP4
		call	InvSub
		pop		hl
		dec		h
		dec		h
		ld		a, (OP1+1)
		cp		80h ; '�'
		ld		a, (OP1M)
		jr		nz, p06loc_569D
		call	ShRAcc
		inc		h

p06loc_569D:
		push	hl
		ld		(ix+0D1h), a
		call	OP4ToOP1
		call	j_OP2Set60
		call	FPMult
		ld		a, 0FFh
		call	p06sub_57C9
		ld		a, (OP1+1)
		sub		80h ; '�'
		jr		nc, p06loc_56D9
		add		a, 84h ; '�'
		sub		80h ; '�'
		jr		c, p06loc_56D6
		or		a
		jr		nz, p06loc_56D2
		ld		a, (OP1M)
		add		a, 50h ; 'P'
		daa
		jr		nc, p06loc_56D6
		ld		hl, 10h
		ld		(OP1M), hl
		ld		a, 7Dh ; '}'
		ld		(OP1+1), a

p06loc_56D2:
		ld		a, 4
		jr		p06loc_56E0
; ---------------------------------------------------------------------------

p06loc_56D6:
		; FormBase+11Bj
		call	OP1Set0

p06loc_56D9:
		ld		a, (OP1+1)
		sub		80h ; '�'
		add		a, 5

p06loc_56E0:
		pop		de
		cp		d
		jr		c, p06loc_56E5
		ld		a, d

p06loc_56E5:
		call	FormReal
		ld		hl, (OP3)
		ld		de, 3036h
		or		a
		sbc		hl, de
		ld		a, (ix+0D1h)
		jr		nz, p06loc_5701
		ld		hl, OP3
		ld		(hl), 30h ; '0'
		ld		bc, 1
		add		a, 1
		daa

p06loc_5701:
		ld		hl, OP3
		add		hl, bc
		ld		(hl), 22h ; '"'
		inc		hl
		ld		(hl), 0
		cp		60h ; '`'
		push	af
		jr		nz, p06loc_5710
		xor		a

p06loc_5710:
		ld		hl, OP2
		cp		10h
		jr		c, p06loc_5720
		push	af
		call	ShRAcc
		add		a, 30h ; '0'
		ld		(hl), a
		inc		hl
		pop		af

p06loc_5720:
		and		0Fh
		add		a, 30h ; '0'
		ld		(hl), a
		inc		hl
		ld		(hl), 27h ; '''
		ld		a, (OP3)
		cp		2Eh ; '.'
		jr		nz, p06loc_5733
		inc		hl
		ld		a, 30h ; '0'
		ld		(hl), a

p06loc_5733:
		inc		hl
		ex		de, hl
		ld		hl, OP3
		call	strcopy
		ld		l, 0DEh	; '�'
		call	p06sub_57C2
		push	hl
		rst		20h
		pop		de
		ld		hl, OP2
		call	strcopy
		pop		af
		jr		nz, p06loc_5756
		call	Plus1
		ld		a, (OP1+1)
		cp		88h ; '�'
		jr		z, p06loc_578D

p06loc_5756:
		ld		a, 8
		call	FormReal
		ld		hl, OP3
		add		hl, bc
		ld		(hl), 14h
		inc		hl
		ld		(hl), 0
		ld		l, 0DEh	; '�'
		call	p06sub_57C2
		ld		de, OP3
		call	strCat
		call	p06sub_57B9
		call	CkOP1Pos
		jr		z, p06loc_5787
		ld		hl, 84A1h
		ld		de, 84A2h
		ld		bc, 14h
		lddr
		ld		a, 1Ah
		ld		(OP3), a

p06loc_5787:
		call	p06sub_57DC
		jp		p06loc_563A
; ---------------------------------------------------------------------------

p06loc_578D:
		call	p06sub_57DC

p06loc_5790:
		call	p06sub_57B9
		sub		a
		jp		BCALL_50AD
; End of function FormBase


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


p06sub_5797:
		ld		l, 0F7h	; '�'
		call	p06sub_57C2
		ld		de, OP1
		call	p06sub_57AA
		ld		l, 0EEh	; '�'
		call	p06sub_57C2
		ld		de, OP2
; End of function p06sub_5797


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


p06sub_57AA:
		ex		de, hl
		jp		mov9B2
; End of function p06sub_57AA


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


p06sub_57AE:
		call	p06sub_57B9
		ld		l, 0EEh	; '�'
		call	p06sub_57C2
		jp		Mov9ToOP2
; End of function p06sub_57AE


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


p06sub_57B9:
		; FormBase:p06loc_5790p ...
		ld		l, 0F7h	; '�'
		call	p06sub_57C2
		rst		20h
		ret
; End of function p06sub_57B9


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


p06sub_57C0:
		ld		l, 0D1h	; '�'
; End of function p06sub_57C0


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


p06sub_57C2:
		push	ix
		pop		de
		ld		h, 0FFh
		add		hl, de
		ret
; End of function p06sub_57C2


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


p06sub_57C9:
		; FormBase+102p
		ld		hl, fmtDigits
		ld		b, (hl)
		ld		(ix+0D0h), b
		ld		(hl), a
		ld		a, (unk_89FA)
		ld		(ix+0CFh), a
		ld		(iy+0Ah), 0
		ret
; End of function p06sub_57C9


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


p06sub_57DC:
		; FormBase:p06loc_5787p ...
		ld		a, (ix+0D0h)
		ld		(fmtDigits), a
		ld		a, (ix+0CFh)
		ld		(unk_89FA), a
		ret
; End of function p06sub_57DC

; ---------------------------------------------------------------------------
		jr		nz, p06loc_57EE
		bit		0, c
		ret		z

p06loc_57EE:
		cp		0Ah
		jr		nc, p06loc_57F4
		add		a, 30h ; '0'

p06loc_57F4:
		ld		(de), a
		inc		de
		set		0, c
		ret

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


FormDCplx:
		res		7, (iy+1Bh)
; End of function FormDCplx


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


p06sub_57FD:
		push	ix
		ld		ix, 0
		add		ix, sp
		dec		sp
		call	ckop2pos
		ld		(ix+0FFh), 2Bh ; '+'
		jr		z, p06loc_5813
		ld		(ix+0FFh), 2Dh ; '-'

p06loc_5813:
		bit		7, (iy+0Bh)
		jr		z, p06loc_5837
		ld		hl, OP1
		ld		de, fmtConv
		call	page0_1063
		ld		hl, p06loc_58EC
		call	pushErrorHandleR
		call	j_RToP
		ld		a, 0Ch
		call	page0_15FE
		call	popErrorHandleR
		ld		(ix+0FFh), 0DBh	; '�'

p06loc_5837:
		ld		hl, 0
		ld		(fmtString), hl
		ld		de, fmtString
		call	CkOP2FP0
		jr		nz, p06loc_584B
		call	p06sub_5C4D
		jp		p06loc_58E1
; ---------------------------------------------------------------------------

p06loc_584B:
		call	CkOP1FP0
		jr		nz, p06loc_5860
		ld		a, (ix+0FFh)
		cp		0DBh ; '�'
		jr		z, p06loc_5860
		cp		2Dh ; '-'
		ld		a, 1Ah
		call	z, p06sub_5C48
		jr		p06loc_5881
; ---------------------------------------------------------------------------

p06loc_5860:
		call	p06sub_5C4D
		ld		a, (ix+0FFh)
		cp		0DBh ; '�'
		jr		nz, p06loc_587E
		bit		7, (iy+1Bh)
		jr		z, p06loc_5874
		ld		a, 0BFh	; '�'
		jr		p06loc_587E
; ---------------------------------------------------------------------------

p06loc_5874:
		call	p06sub_5C48
		ld		a, 5Eh ; '^'
		call	p06sub_5C48
		ld		a, 28h ; '('

p06loc_587E:
		call	p06sub_5C48

p06loc_5881:
		push	de
		call	OP1ExOP2
		pop		de
		ld		a, (OP1+1)
		cp		80h ; '�'
		jr		nz, p06loc_58AF
		ld		hl, OP1M
		ld		a, (hl)
		cp		10h
		jr		nz, p06loc_58AF
		ld		b, 6

p06loc_5897:
		inc		hl
		ld		a, (hl)
		or		a
		jr		nz, p06loc_58AF
		djnz	p06loc_5897
		ld		a, (ix+0FFh)
		cp		0DBh ; '�'
		jr		nz, p06loc_58C8
		call	CkOP1Pos
		ld		a, 2Dh ; '-'
		call	nz, p06sub_5C48
		jr		p06loc_58C8
; ---------------------------------------------------------------------------

p06loc_58AF:
		ld		a, (ix+0FFh)
		cp		0DBh ; '�'
		ld		a, (OP1)
		push	af
		call	nz, ClrOP1S
		call	p06sub_55A8
		pop		af
		ld		(OP1), a
		call	OP1ExOP2
		call	p06sub_5C52

p06loc_58C8:
		ld		a, 0D7h	; '�'
		call	p06sub_5C48
		ld		a, (ix+0FFh)
		cp		0DBh ; '�'
		jr		nz, p06loc_58E1
		ld		a, 29h ; ')'
		bit		7, (iy+1Bh)
		jr		z, p06loc_58DE
		ld		a, 11h

p06loc_58DE:
		call	p06sub_5C48

p06loc_58E1:
		ld		a, 0Ch
		ld		(OP1), a
		ld		hl, fmtString
		jp		p06loc_563D
; End of function p06sub_57FD

p06loc_58EC:
		ld		hl, fmtConv
		call	Mov9OP1OP2
		jp		p06loc_5837

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


FormReal:
		push	ix
		ld		ix, 0
		add		ix, sp
		push	hl
		push	hl
		dec		sp
		res		1, (iy+0Ch)
		ld		(ix+0FDh), a
		ld		(ix+0FEh), a
		call	page0_FB5
		call	CkOP1FP0
		call	z, OP1Set0
		call	OP1ToOP5
		sub		a
		bit		fmtEdit, (iy+fmtEditFlags)
		jr		nz, p06loc_5920
		ld		a, (unk_89FA)

p06loc_5920:
		ld		(ix+0FFh), a

p06loc_5923:
		ld		a, (OP1)
		or		a
		jp		p, p06loc_592D
		dec		(ix+0FDh)

p06loc_592D:
		ld		a, (OP1+1)
		bit		0, (ix-1)
		jr		nz, p06loc_5954
		bit		7, a
		jp		nz, p06loc_59DE
		cp		7Dh ; '}'
		jr		c, p06loc_5950

p06loc_593F:
		ld		(OP1+1), a
		cp		7Fh ; ''
		jp		z, p06loc_59DE
		call	page0_12CD
		ld		a, (OP1+1)
		inc		a
		jr		p06loc_593F
; ---------------------------------------------------------------------------

p06loc_5950:
		set		0, (ix-1)

p06loc_5954:
		bit		1, (ix-1)
		jr		z, p06loc_598B
		ld		a, (OP1+1)
		inc		a
		ld		l, a
		ld		h, 0
		ld		a, 3
		call	DivHLByA
		ld		e, a
		ld		a, (OP1+1)
		sub		e
		ld		h, a
		ld		a, e
		add		a, 80h ; '�'
		ld		(OP1+1), a
		jr		p06loc_5991
; ---------------------------------------------------------------------------

p06loc_5974:
		; FormReal+104j ...
		ld		a, (ix+0FEh)
		ld		(ix+0FDh), a
		bit		fmtEdit, (iy+fmtEditFlags)
		jr		nz, p06loc_5987
		bit		fmtEng, (iy+fmtFlags)
		call	nz, OP5ToOP1

p06loc_5987:
		ld		a, 1
		jr		p06loc_5920
; ---------------------------------------------------------------------------

p06loc_598B:
		ld		h, a
		ld		a, 80h ; '�'
		ld		(OP1+1), a

p06loc_5991:
		ld		a, h
		dec		(ix+0FDh)
		add		a, 80h ; '�'
		ld		l, a
		jr		c, p06loc_59A4
		cpl
		inc		a
		dec		(ix+0FDh)
		ld		l, a
		ld		a, 1Ah
		jr		p06loc_59A5
; ---------------------------------------------------------------------------

p06loc_59A4:
		xor		a

p06loc_59A5:
		ld		(ix+0FCh), a
		sub		a
		push	af
		ld		h, 0

p06loc_59AC:
		call	DivHLBy10
		add		a, 30h ; '0'
		push	af
		dec		(ix+0FDh)
		jp		m, ErrOverflow
		ld		a, l
		or		h
		jr		nz, p06loc_59AC
		ld		a, (ix+0FDh)
		or		a
		jr		nz, p06loc_59CA
		pop		af
		pop		af
		ld		a, 0CEh	; '�'
		push	af
		inc		(ix+0FDh)

p06loc_59CA:
		ld		hl, OP6
		ld		(hl), 1Bh
		inc		hl
		ld		a, (ix+0FCh)
		or		a
		jr		z, p06loc_59D8
		ld		(hl), a
		inc		hl

p06loc_59D8:
		pop		af
		ld		(hl), a
		inc		hl
		or		a
		jr		nz, p06loc_59D8

p06loc_59DE:
		ld		a, (OP1+1)
		add		a, 81h ; '�'
		ld		(ix+0FBh), a
		ld		l, a
		ld		(ix+0FBh), l
		bit		fmtEdit, (iy+fmtEditFlags)
		jr		z, p06loc_5A03
		cp		0Fh
		jr		nc, p06loc_5974
		cp		(ix+0FDh)
		jr		z, p06loc_5A6C
		jp		nc, p06loc_5974
		dec		(ix+0FDh)
		ld		l, 0Eh
		jr		p06loc_5A28
; ---------------------------------------------------------------------------

p06loc_5A03:
		cp		0Bh
		jp		nc, p06loc_5974
		cp		(ix+0FDh)
		jr		z, p06loc_5A1D
		jp		nc, p06loc_5974
		dec		(ix+0FDh)
		ld		a, 0Ah
		cp		(ix+0FDh)
		jr		nc, p06loc_5A1D
		ld		(ix+0FDh), a

p06loc_5A1D:
		; FormReal+123j
		ld		a, (fmtDigits)
		or		a
		jp		m, p06loc_5A37
		add		a, (ix+0FBh)
		ld		l, a

p06loc_5A28:
		ld		a, (ix+0FDh)
		cp		l
		jr		c, p06loc_5A37
		ld		(ix+0FDh), l
		bit		fmtEdit, (iy+fmtEditFlags)
		jr		nz, p06loc_5A6C

p06loc_5A37:
		; FormReal+137j
		ld		a, 5
		ld		c, (ix+0FDh)
		sra	c
		jr		c, p06loc_5A42
		ld		a, 50h ; 'P'

p06loc_5A42:
		ld		hl, OP1M
		ld		b, 0
		add		hl, bc
		ld		b, c
		inc		b
		call	ADDPROP
		jr		nc, p06loc_5A6C
		call	page0_11BB
		ld		a, (OP5+1)
		cp		0E3h ; '�'
		jr		z, p06loc_5A6C
		inc		a
		ld		(OP1+1), a
		ld		hl, OP1M
		call	page0_124D
		ld		a, (ix+0FEh)
		ld		(ix+0FDh), a
		jp		p06loc_5923
; ---------------------------------------------------------------------------

p06loc_5A6C:
		; FormReal+140j ...
		ld		c, (ix+0FBh)
		ld		hl, OP1M
		ld		de, OP3
		ld		a, (OP5)
		or		a
		jp		p, p06loc_5A80
		ld		a, 1Ah
		ld		(de), a
		inc		de

p06loc_5A80:
		ld		a, (ix+0FDh)
		or		a
		jr		nz, p06loc_5A8B
		call	p06sub_5AE7
		jr		p06loc_5AAC
; ---------------------------------------------------------------------------

p06loc_5A8B:
		; FormReal+1B5j
		call	p06sub_5AD6
		ld		a, (hl)
		rra
		rra
		rra
		rra
		and		0Fh
		call	p06sub_5AE7
		dec		(ix+0FDh)
		jr		z, p06loc_5AAC
		call	p06sub_5AD6
		ld		a, (hl)
		inc		hl
		and		0Fh
		call	p06sub_5AE7
		dec		(ix+0FDh)
		jr		nz, p06loc_5A8B

p06loc_5AAC:
		; FormReal+1A6j
		ld		de, (OP6+8)
		bit		0, (ix-1)
		jr		z, p06loc_5AC2
		ld		hl, OP6

p06loc_5AB9:
		ld		a, (hl)
		inc		hl
		or		a
		jr		z, p06loc_5AC2
		ld		(de), a
		inc		de
		jr		p06loc_5AB9
; ---------------------------------------------------------------------------

p06loc_5AC2:
		; FormReal+1C7j
		sub		a
		ld		(de), a
		ex		de, hl
		ld		de, OP3
		sbc		hl, de
		ld		c, l
		ld		b, h
		push	bc
		call	OP5ToOP1
		pop		bc
		ld		sp, ix
		pop		ix
		ret
; End of function FormReal


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


p06sub_5AD6:
		; FormReal+1A8p
		ld		a, c
		dec		c
		or		a
		ret		nz
		ld		a, 2Eh ; '.'
		ld		(de), a
		ld		(OP6+8), de
		inc		de
		set		1, (iy+0Ch)
		ret
; End of function p06sub_5AD6


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


p06sub_5AE7:
		; FormReal+1A0p ...
		cp		0Ah
		jr		nc, p06loc_5AED
		add		a, 30h ; '0'

p06loc_5AED:
		ld		(de), a
		inc		de
		bit		1, (iy+0Ch)
		jr		z, p06loc_5B04
		cp		30h ; '0'
		jr		nz, p06loc_5B04
		bit		fmtEdit, (iy+fmtEditFlags)
		ret		nz
		ld		a, (fmtDigits)
		cp		0FFh
		ret		z

p06loc_5B04:
		ld		(OP6+8), de
		ret
; End of function p06sub_5AE7


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


p06sub_5B09:
		ld		a, b
		and		1Ch
		rrca
		rrca
		ld		e, a
		ld		d, 0
		ld		hl, p06loc_5B18
		add		hl, de
		ld		a, (hl)
		or		a
		ret
; End of function p06sub_5B09

p06loc_5B18:
		.db		0
		.db		1
		.db		2
		.db		4
		.db		3
		.db		0
		.db		0
		.db		5

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


p06sub_5B20:
		call	p06sub_5B54
		push	ix
		ld		ix, 0
		add		ix, sp
		dec		sp
		ld		(ix+0FFh), 2

p06loc_5B30:
		push	bc
		rst		20h
		push	hl
		call	p06sub_55A8
		pop		hl
		inc		c
		ld		a, (ix+0FFh)
		add		a, c
		ld		(ix+0FFh), a
		pop		bc
		cp		11h
		jr		nc, p06loc_5B49
		dec		bc
		ld		a, c
		or		b
		jr		nz, p06loc_5B30

p06loc_5B49:
		ld		c, (ix+0FFh)
		ld		b, 0
		dec		c
		ld		sp, ix
		pop		ix
		ret
; End of function p06sub_5B20


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


p06sub_5B54:
		ld		hl, 0
		ld		(fmtLeft), hl
		call	FIND_E_UNDEF
		ex		de, hl
		ld		c, (hl)
		inc		hl
		ld		b, (hl)
		inc		hl
		ld		(fmtIndex), bc
		ld		(chkDelPtr1), hl
		ld		a, c
		or		b
		ret		nz
		ld		hl, 0FFFFh
		ld		(errOffset), hl
		jp		ErrDimension
; End of function p06sub_5B54


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


p06sub_5B75:
		push	ix
		ld		ix, 0
		add		ix, sp
		dec		sp
		call	p06sub_5C22
		ld		hl, (chkDelPtr1)
		inc		hl
		ld		a, (hl)
		inc		hl
		ld		(ix+0FFh), a

p06loc_5B8A:
		ld		de, (fmtMatMem)
		ld		b, c

p06loc_5B8F:
		push	bc
		push	de
		rst		20h
		push	hl
		call	p06sub_55A8
		pop		hl
		pop		de
		ld		a, (de)
		cp		c
		jr		nc, p06loc_5B9E
		ld		a, c
		ld		(de), a

p06loc_5B9E:
		inc		de
		pop		bc
		djnz	p06loc_5B8F
		dec		(ix+0FFh)
		jr		nz, p06loc_5B8A
		ld		(ix+0FFh), c
		ld		hl, 3
		ld		bc, (fmtMatMem)
		ld		d, 0

p06loc_5BB3:
		ld		a, (bc)
		inc		bc
		inc		a
		ld		e, a
		add		hl, de
		dec		(ix+0FFh)
		jr		nz, p06loc_5BB3
		ld		c, l
		ld		b, h
		ld		sp, ix
		pop		ix
		ret
; End of function p06sub_5B75


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


p06sub_5BC4:

		ld		a, (unk_89FE)
		and		0C0h ; '�'
		ld		(unk_89FE), a
		ret
; End of function p06sub_5BC4

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

formScrollUp:
		push	bc
		push	de
		push	hl
		call	j_RclAns
		ld		a, (OP1)
		and		1Fh
		jr		z, p06loc_5C08
		cp		5
		jr		nc, p06loc_5C08
		ld		hl, (winAbove)
		inc		hl
		ld		(winAbove), hl
		ex		de, hl
		ld		hl, 0
		call	CpHLDE
		jp		p, p06loc_5C08
		ld		hl, (curRow)
		push	hl
		set		2, (iy+0Eh)
		ld		hl, (winTop)
		ld		h, 0Fh
		ld		(curRow), hl
		ld		a, 1Eh
		call	j_PutMap
		pop		hl
		ld		(curRow), hl

p06loc_5C08:
		pop		hl
		pop		de
		pop		bc
		ret

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


p06sub_5C0C:
		ld		a, 10h
		sub		c
		ret		z
		ld		b, a
		ld		a, 20h ; ' '

p06loc_5C13:
		call	j_PutC
		djnz	p06loc_5C13
		ret
; End of function p06sub_5C0C


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


p06sub_5C19:
		ld		hl, 0FFF0h
		add		hl, bc
		ret		c
		ld		(winLeft), hl
		ret
; End of function p06sub_5C19


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


p06sub_5C22:
		ld		hl, (chkDelPtr1)
		ld		l, (hl)
		push	hl
		ld		h, 0
		ld		de, 2501h
		ld		(OP1+1), de
		call	CreateStrng
		ld		(fmtMatSym), hl
		inc		de
		inc		de
		ld		(fmtMatMem), de
		set		7, (iy+5)
		pop		bc
		ld		b, c
		sub		a

p06loc_5C43:
		ld		(de), a
		inc		de
		djnz	p06loc_5C43
		ret
; End of function p06sub_5C22


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


p06sub_5C48:
		; p06sub_57FD:p06loc_5874p ...
		ld		(de), a
		inc		de
		sub		a
		ld		(de), a
		ret
; End of function p06sub_5C48


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


p06sub_5C4D:
		; p06sub_57FD:p06loc_5860p
		ld		a, 14h
		call	FormBase
; End of function p06sub_5C4D


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


p06sub_5C52:
		ld		hl, OP3
		ld		de, fmtString
		jp		strCat
; End of function p06sub_5C52


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


p06sub_5C5B:
		bit		2, (iy+0Eh)
		jr		z, p06loc_5C69
		ld		hl, (winTop)
		ld		a, 1Eh
		call	p06sub_5C75

p06loc_5C69:
		bit		3, (iy+0Eh)
		ret		z
		ld		a, (winTop+1)
		dec		a
		ld		l, a
		ld		a, 1Fh
; End of function p06sub_5C5B


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


p06sub_5C75:
		ld		h, 0Fh
		ld		(curRow), hl
		call	j_PutMap
		ret
; End of function p06sub_5C75


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


p06sub_5C7E:

		set		AnsScroll, (iy+ansFlags)
		call	j_newline
		call	j_whomeup
		ld		(winLeft), hl
		sub		a
		ld		(winLeftEdge), a
		ld		a, (curRow)
		dec		a

setwinabove:
		ld		e, a
		ld		d, h
		call	CheckSplitFlag
		jr		z, p06loc_5C9C
		ld		l, 4

p06loc_5C9C:
		or		a
		sbc		hl, de
		ld		(winAbove), hl
		ret
; End of function p06sub_5C7E


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


p06sub_5CA3:
		call	FIND_E_UNDEF
		ex		de, hl
		ld		(chkDelPtr1), hl
		inc		hl
		ld		b, (hl)
		ld		a, (winTop+1)
		ld		hl, winTop
		sub		(hl)
		dec		a
		cp		b
		jr		nc, p06loc_5CB8
		ld		b, a

p06loc_5CB8:
		ld		c, b

p06loc_5CB9:
		call	j_newline
		djnz	p06loc_5CB9
		call	j_whomeup
		set		AnsScroll, (iy+ansFlags)
		ld		(winLeft), hl
		ld		a, (curRow)
		sub		c
		jr		setwinabove
; End of function p06sub_5CA3

; ---------------------------------------------------------------------------
		ld		(ix+0FCh), 2
		ld		(ix+0FDh), 0

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


p06sub_5CD6:
		ld		de, (fmtMatMem)
		ld		(ix+0FEh), e
		ld		(ix+0FFh), d
		ret
; End of function p06sub_5CD6

; ---------------------------------------------------------------------------
		ld		l, (ix+0FEh)
		ld		h, (ix+0FFh)
		ld		(hl), c
		inc		hl
		ld		(ix+0FEh), l
		ld		(ix+0FFh), h
		ret

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


p06sub_5CF0:
		ld		l, (ix+0FEh)
		ld		h, (ix+0FFh)
		ld		c, (hl)
		ld		b, 0
		inc		hl
		ld		(ix+0FEh), l
		ld		(ix+0FFh), h
		ret
; End of function p06sub_5CF0

; ---------------------------------------------------------------------------
		ld		l, (ix+0FCh)
		ld		h, (ix+0FDh)
		add		hl, bc
		ld		(ix+0FCh), l
		ld		(ix+0FDh), h
		ret
; ---------------------------------------------------------------------------

disarmScroll:
		bit		7, (iy+9)
		call	nz, RESETWINTOP
		res		7, (iy+9)
		res		AnsScroll, (iy+ansFlags)
		bit		7, (iy+5)
		ret		z
		ld		hl, (fmtMatSym)
		ld		de, (fmtMatMem)
		dec		de
		dec		de
		call	DelVarNoArc
		res		7, (iy+5)
		ret
; ---------------------------------------------------------------------------

OP1toEdit:
		call	BufClear
		set		fmtEdit, (iy+fmtEditFlags)
		call	p06sub_558C
		ld		hl, (editCursor)
		ld		(rclQueue), hl
		ld		a, (unk_89FA)
		ld		(unk_89FB), a
		ld		a, (OP1)
		and		1Fh
		jr		nz, p06loc_5D56
		call	p06sub_5F45
		jr		p06loc_5D60
; ---------------------------------------------------------------------------

p06loc_5D56:
		cp		0Ch
		jr		nz, p06loc_5D5F
		call	p06sub_5DDF
		jr		p06loc_5D60
; ---------------------------------------------------------------------------

p06loc_5D5F:
		scf

p06loc_5D60:
		res		fmtEdit, (iy+fmtEditFlags)
		ret		c
		ld		hl, (rclQueue)
		ld		(editCursor), hl
		ret
; ---------------------------------------------------------------------------

MinToEdit:
		call	BufClear
		set		fmtEdit, (iy+fmtEditFlags)
		ld		hl, (editCursor)
		ld		(rclQueue), hl
		ld		a, (unk_89FA)
		ld		(unk_89FB), a
		ld		a, 8
		call	bufQueueChar
		ret		c
		call	Page0Call_3723
		ld		de, OP1
		call	mov9B2
		call	p06sub_5F45
		call	Page0Call_3723
		call	j_CMP_NUM_INIT
		cp		1
		jr		z, p06loc_5DAE
		ld		a, 2Bh ; '+'
		call	bufQueueChar
		ret		c
		call	Page0Call_3723
		ex		de, hl
		ld		de, OP1
		call	mov9B2
		call	p06sub_5F45

p06loc_5DAE:
		ld		a, 9
		call	bufQueueChar
		res		fmtEdit, (iy+fmtEditFlags)
		ret		c
		ld		hl, (rclQueue)
		ld		(editCursor), hl
		ret
; ---------------------------------------------------------------------------

rclVarToEdit:
		call	FIND_E_UNDEF

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


rclVarToEditPtR:
		ex		de, hl
; End of function rclVarToEditPtR


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


BCALL_4D3B:
		; p06sub_6464+1Bp	...
		ex		de, hl
		call	BufClear
		ex		de, hl
		set		fmtEdit, (iy+fmtEditFlags)
		call	rclToQueue
		res		fmtEdit, (iy+fmtEditFlags)
		ret		c
		ld		hl, (rclQueue)
		ld		(editCursor), hl
		ret
; End of function BCALL_4D3B


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


RCLENTRYTOEDIT:
		ld		a, 5
		jr		BCALL_4D3B
; End of function RCLENTRYTOEDIT


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


p06sub_5DDF:
		; rclToQueue+23j ...
		set		7, (iy+1Bh)
		ld		a, 2Bh ; '+'
		call	p06sub_57FD
		res		7, (iy+1Bh)
		ld		hl, fmtDigits
		call	p06sub_5F57
		ld		bc, fmtString
		call	p06sub_43DA
		ret
; End of function p06sub_5DDF


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


rclToQueue:
		; BCALL_4D3B+9p ...
		push	af
		ld		de, (editCursor)
		ld		(rclQueue), de
		ld		a, (unk_89FA)
		ld		(unk_89FB), a
		pop		af
		ld		(chkDelPtr1), hl
		and		1Fh
		jr		nz, p06loc_5E14
		rst		20h
		jp		p06sub_5F45
; ---------------------------------------------------------------------------

p06loc_5E14:
		cp		0Ch
		jr		nz, p06loc_5E1E
		rst		20h
		call	Mov9ToOP2
		jr		p06sub_5DDF
; ---------------------------------------------------------------------------

p06loc_5E1E:
		cp		1
		jr		nz, p06loc_5E4E
		ld		a, 8
		call	bufQueueChar
		ret		c
		ld		c, (hl)
		inc		hl
		ld		b, (hl)
		inc		hl
		ld		a, c
		or		b
		jr		z, p06loc_5E48

p06loc_5E30:
		push	bc
		rst		20h
		push	hl
		call	p06sub_5F45
		ld		a, 2Bh ; '+'
		call	bufQueueChar
		pop		hl
		pop		bc
		ret		c
		dec		bc
		ld		a, c
		or		b
		jr		nz, p06loc_5E30
		ld		a, 9
		jp		p06sub_5F93
; ---------------------------------------------------------------------------

p06loc_5E48:
		ld		a, 9
		call	bufQueueChar
		ret
; ---------------------------------------------------------------------------

p06loc_5E4E:
		cp		0Dh
		jr		nz, p06loc_5E81
		ld		a, 8
		call	bufQueueChar
		ret		c
		ld		c, (hl)
		inc		hl
		ld		b, (hl)
		inc		hl
		ld		a, c
		or		b
		jr		z, p06loc_5E7B

p06loc_5E60:
		push	bc
		rst		20h
		call	Mov9ToOP2
		push	hl
		call	p06sub_5DDF
		ld		a, 2Bh ; '+'
		call	bufQueueChar
		pop		hl
		pop		bc
		ret		c
		dec		bc
		ld		a, c
		or		b
		jr		nz, p06loc_5E60
		ld		a, 9
		jp		p06sub_5F93
; ---------------------------------------------------------------------------

p06loc_5E7B:
		ld		a, 9
		call	bufQueueChar
		ret
; ---------------------------------------------------------------------------

p06loc_5E81:
		cp		2
		jr		nz, p06loc_5EC2
		call	p06sub_5F9C
		ret		c
		push	ix
		ld		ix, 0
		add		ix, sp
		dec		sp
		ld		c, (hl)
		inc		hl
		ld		(ix+0FFh), c
		ld		b, (hl)
		inc		hl

p06loc_5E99:
		call	p06sub_5F9C

p06loc_5E9C:
		push	bc
		rst		20h
		push	hl
		call	p06sub_5F45
		ld		a, 2Bh ; '+'
		call	bufQueueChar
		pop		hl
		pop		bc
		jr		c, p06loc_5EBD
		dec		c
		jr		nz, p06loc_5E9C
		ld		a, 7
		call	p06sub_5F93
		ld		c, (ix+0FFh)
		djnz	p06loc_5E99
		ld		a, 7
		call	bufQueueChar

p06loc_5EBD:
		ld		sp, ix
		pop		ix
		ret
; ---------------------------------------------------------------------------

p06loc_5EC2:
		call	equ_or_newequ
		jr		z, p06loc_5ECC
		cp		5
		jp		nz, p06loc_5F1D

p06loc_5ECC:
		ld		hl, (editTop)
		push	hl
		ld		hl, (editBtm)
		push	hl
		ld		hl, (editCursor)
		push	hl
		ld		(editTop), hl
		ld		hl, (editTail)
		push	hl
		ld		(editBtm), hl
		ld		hl, (chkDelPtr1)
		ld		c, (hl)
		inc		hl
		ld		b, (hl)
		inc		hl

p06loc_5EE9:
		ld		a, c
		or		b
		jr		z, p06loc_5F02
		push	bc
		call	BUFPEEK3
		jr		nc, p06loc_5EF6
		pop		bc
		dec		bc
		push	bc

p06loc_5EF6:
		inc		hl
		push	hl
		call	bufInsert
		pop		hl
		pop		bc
		jr		z, p06loc_5F1A
		dec		bc
		jr		p06loc_5EE9
; ---------------------------------------------------------------------------

p06loc_5F02:
		ld		hl, (editCursor)
		ld		(rclQueue), hl
		or		a

p06loc_5F09:
		pop		hl
		ld		(editTail), hl
		pop		hl
		ld		(editCursor), hl
		pop		hl
		ld		(editBtm), hl
		pop		hl
		ld		(editTop), hl
		ret
; ---------------------------------------------------------------------------

p06loc_5F1A:
		scf
		jr		p06loc_5F09
; ---------------------------------------------------------------------------

p06loc_5F1D:
		cp		4
		jr		nz, locret_5F44
		ld		a, 2Ah ; '*'
		bit		cmdExec, (iy+cmdFlags)
		call	z, bufQueueChar
		ld		c, (hl)
		inc		hl
		ld		b, (hl)
		inc		hl

p06loc_5F2E:
		ld		a, c
		or		b
		jr		z, p06loc_5F3B
		ld		a, (hl)
		inc		hl
		call	bufQueueChar
		ret		c
		dec		bc
		jr		p06loc_5F2E
; ---------------------------------------------------------------------------

p06loc_5F3B:
		ld		a, 2Ah ; '*'
		bit		cmdExec, (iy+cmdFlags)
		call	z, bufQueueChar

locret_5F44:
		ret
; End of function rclToQueue


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


p06sub_5F45:
		ld		a, 14h
		call	FormBase
		call	FORMTOTOK
		ld		bc, OP3
		call	p06sub_43DA
		ret
; End of function p06sub_5F45


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


FORMTOTOK:
		ld		hl, 848Dh
; End of function FORMTOTOK


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


p06sub_5F57:
		inc		hl
		ld		a, (hl)
		or		a
		ret		z
		cp		2Eh ; '.'
		jr		nz, p06loc_5F63
		ld		(hl), 3Ah ; ':'
		jr		p06sub_5F57
; ---------------------------------------------------------------------------

p06loc_5F63:
		cp		1Bh
		jr		nz, p06loc_5F6B
		ld		(hl), 3Bh ; ';'
		jr		p06sub_5F57
; ---------------------------------------------------------------------------

p06loc_5F6B:
		cp		20h ; ' '
		jr		nz, p06loc_5F73
		ld		(hl), 29h ; ')'
		jr		p06sub_5F57
; ---------------------------------------------------------------------------

p06loc_5F73:
		cp		1Ah
		jr		nz, p06loc_5F7B
		ld		(hl), 0B0h ; '�'
		jr		p06sub_5F57
; ---------------------------------------------------------------------------

p06loc_5F7B:
		cp		2Bh ; '+'
		jr		nz, p06loc_5F83
		ld		(hl), 70h ; 'p'
		jr		p06sub_5F57
; ---------------------------------------------------------------------------

p06loc_5F83:
		cp		2Dh ; '-'
		jr		nz, p06loc_5F8B
		ld		(hl), 71h ; 'q'
		jr		p06sub_5F57
; ---------------------------------------------------------------------------

p06loc_5F8B:
		cp		0D7h ; '�'
		jr		nz, p06sub_5F57
		ld		(hl), 2Ch ; ','
		jr		p06sub_5F57
; End of function p06sub_5F57


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


p06sub_5F93:
		; rclToQueue+7Fj ...
		push	hl
		ld		hl, (rclQueue)
		dec		hl
		ld		(hl), a
		pop		hl
		or		a
		ret
; End of function p06sub_5F93


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


p06sub_5F9C:
		; rclToQueue:p06loc_5E99p
		ld		a, 6
		call	bufQueueChar
		ret
; End of function p06sub_5F9C


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


p06sub_5FA2:

		ld		a, 20h ; ' '
		call	j_wputc
		ret
; End of function p06sub_5FA2

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

DISP_INTERVAL:
		ld		hl, 8BEAh
		rst		20h
		call	Mov9ToOP2
		ld		hl, 28h	; '('
		ld		(fmtString), hl
		ld		a, 6
		call	FormBase
		call	p06sub_5C52
		ld		a, 2Ch ; ','
		call	p06sub_5C48
		call	OP1ExOP2
		ld		a, 6
		call	FormBase
		call	OP1ExOP2
		call	p06sub_5C52
		ld		a, 29h ; ')'
		jp		p06sub_5C48
; ---------------------------------------------------------------------------

DisplstName:
		ld		a, 1
		call	p06sub_6043
		ld		a, (unk_970F)
		add		a, b
		call	p06sub_6055
		call	dispSLstNameHL
		push	bc
		ld		a, (unk_970F)
		add		a, b
		call	Page0Call_3243
		rst		10h
		jr		c, p06loc_6008
		call	IsBZero
		jr		nz, p06loc_6008
		call	GET_FORM_NUM
		or		a
		jr		z, p06loc_6008
		pop		bc
		push	bc
		call	p06sub_6041
		ld		a, 0E0h	; '�'
		res		textInverse, (iy+textFlags)
		call	j_VPutMap

p06loc_6008:
		pop		bc
		ret

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


dispSLstNameHL:
		push	ix
		ld		a, (hl)
		cp		6
		jr		nc, p06loc_601B
		add		a, 81h ; '�'
		push	bc
		ld		b, a
		call	Page0Call_3231
		pop		bc
		jr		p06loc_603E
; ---------------------------------------------------------------------------

p06loc_601B:
		cp		71h ; 'q'
		jp		nz, p06loc_602C
		ld		hl, a_____
		res		textEraseBelow, (iy+textFlags)
		call	j_VPutS
		jr		p06loc_603E
; ---------------------------------------------------------------------------

p06loc_602C:
		ld		de, nameBuff
		push	bc
		ld		bc, 5
		ldir
		pop		bc
		sub		a
		ld		(de), a
		ld		hl, nameBuff
		call	j_VPutS

p06loc_603E:
		; dispSLstNameHL+20j
		pop		ix
		ret
; End of function dispSLstNameHL


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


p06sub_6041:
		ld		a, 16h
; End of function p06sub_6041


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


p06sub_6043:
		bit		0, b
		jr		z, p06loc_604B
		add		a, 20h ; ' '
		jr		p06loc_6051
; ---------------------------------------------------------------------------

p06loc_604B:
		bit		1, b
		jr		z, p06loc_6051
		add		a, 3Eh ; '>'

p06loc_6051:
		ld		(penCol), a
		ret
; End of function p06sub_6043


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


p06sub_6055:
		ld		hl, listName1
		push	de
		ld		e, a
		ld		d, 0
		add		hl, de
		add		hl, de
		add		hl, de
		add		hl, de
		add		hl, de
		pop		de
		ret
; End of function p06sub_6055

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

InitSolverContext:
		set		grfSplitOverride, (iy+sGrFlags)
		set		0, (iy+19h)
		call	RESETWINTOP
		ld		a, 54h ; 'T'
		ld		(mcxCurApp), a
		ld		hl, p06loc_61A8
		call	AppInitEnoughMem50

p06loc_6079:
		ld		a, (kbdKey)
		cp		54h ; 'T'
		jr		nz, p06loc_6084
		set		0, (iy+19h)

p06loc_6084:
		call	p06sub_65EB
		res		1, (iy+19h)
		call	j_ClrScrn
		ld		hl, 0
		ld		(curRow), hl
		bit		0, (iy+19h)
		jp		z, p06loc_681C
		call	p06sub_6802
		res		2, (iy+19h)
		sub		a
		ld		(winTop), a
		call	p06sub_618B
		rst		10h
		jr		c, p06loc_60B5
		and		1Fh
		cp		3
		jr		z, p06loc_60C4
		call	DelVar

p06loc_60B5:
		ld		hl, ErrMemory_NoGoTo
		call	pushErrorHandleR
		ld		hl, 0
		call	CreateEqu
		call	popErrorHandleR

p06loc_60C4:
		call	p06sub_483D
		call	IsEditEmpty
		jr		nz, p06loc_60D8
		call	p06sub_618B
		call	CloseEditEqu
		res		0, (iy+19h)
		jr		p06loc_6126
; ---------------------------------------------------------------------------

p06loc_60D8:
		call	p06sub_7235
		push	af
		res		6, (iy+5)
		call	p06sub_618B
		call	CloseEditEqu
		pop		af
		jr		nc, p06loc_60F0
		ld		a, (curRow+1)
		cp		0Fh
		jr		c, p06loc_60FA

p06loc_60F0:
		ld		a, 0Dh
		ld		(curRow+1), a
		ld		a, 0CEh	; '�'
		call	j_PutC

p06loc_60FA:
		ld		hl, a0
		call	j_PutS
		call	j_newline
		jp		p06loc_6822
p06loc_6106:
		bit		7, (iy+0Ch)
		jr		nz, p06loc_6126
		bit		2, (iy+19h)
		jr		nz, p06loc_6126
		call	page0_166E
		rst		10h
		jp		nc, Page0Call_37F5
		call	j_rstrShadow2
		call	p06sub_645A
		call	j_setNumWindow
		call	j_fdispEOL
		ret
; ---------------------------------------------------------------------------

p06loc_6126:
		ld		hl, p06loc_6AA0
		rst		20h
		call	Mov8B
		ld		hl, OP1
		ld		a, 31h ; '1'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	j_GetK
		set		appAutoScroll, (iy+appFlags)
		set		2, (iy+19h)
		call	j_newline
		call	p06sub_6192
		call	p06sub_618B
		rst		10h
		ld		(editSym), hl
		call	p06sub_483D
		call	Page0Call_37AD
		add		a, 2
		ld		(winLeftEdge), a
		ld		(curRow+1), a
		call	Page0Call_37A7
		call	j_setNumWindow
		ld		hl, (curRow)
		push	hl
		call	p06sub_7200
		call	j_EraseEOW2
		pop		hl
		ld		(curRow), hl
		bit		7, (iy+0Ch)
		ret		z
		res		7, (iy+0Ch)
		call	GoToErr
		ld		hl, (curRow)
		push	hl
		call	p06sub_7200
		pop		hl
		ld		(curRow), hl
		ret

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


p06sub_618B:
		ld		hl, 3Eh	; '>'
		call	page0_1671
		ret
; End of function p06sub_618B


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


p06sub_6192:
		ld		hl, p06loc_6AB0
		call	p06sub_6A94
		ld		a, 19h
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	j_PutS
		ret
; End of function p06sub_6192

p06loc_61A5:
		jp		j_saveShadow
p06loc_61A8:
		.dw		p06loc_61B5
		.dw		p06loc_61A5
		.dw		p06loc_6A5A
		.dw		p06loc_6452
		.dw		p06loc_6106
		.dw		p06loc_6960
		.db		0Ah
p06loc_61B5:
		cp		27h ; '''
		jr		nz, p06loc_61BF
		call	p06sub_6A5A
		jp		InitSolverContext
; ---------------------------------------------------------------------------

p06loc_61BF:
		bit		2, (iy+19h)
		jp		z, p06loc_629A
		cp		6
		jr		z, p06loc_61CE
		cp		5
		jr		nz, p06loc_61E2

p06loc_61CE:
		res		appAutoScroll, (iy+appFlags)
		set		0, (iy+19h)
		call	p06sub_618B
		call	CloseEditEqu
		call	p06sub_65AF
		jp		p06loc_6079
; ---------------------------------------------------------------------------

p06loc_61E2:
		cp		4
		jr		nz, p06loc_61F3
		call	IsAtBtm
		jr		z, p06loc_61CE
		call	Page06_2FF1
		cp		0
		ret		nz
		jr		p06loc_61CE
; ---------------------------------------------------------------------------

p06loc_61F3:
		cp		3
		jr		nz, p06loc_61FB
		call	Page06_2FF1
		ret
; ---------------------------------------------------------------------------

p06loc_61FB:
		cp		9
		jr		nz, p06loc_6218
		call	CanAlphIns
		call	IsEditEmpty
		ret		z

p06loc_6206:
		call	IsAtTop
		jr		z, p06loc_6210
		call	cursorUp
		jr		p06loc_6206
; ---------------------------------------------------------------------------

p06loc_6210:
		call	BufClear
		call	j_EraseEOW2
		jr		Page06_366F
; ---------------------------------------------------------------------------

p06loc_6218:
		cp		21h ; '!'
		jr		nz, p06loc_6222
		call	CursorLeft
		ret		z
		jr		p06loc_6226
; ---------------------------------------------------------------------------

p06loc_6222:
		cp		0Ah
		jr		nz, p06loc_623D

p06loc_6226:
		res		textInsMode, (iy+textFlags)
		call	BufDelete

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


p06sub_622D:
		ld		hl, (curRow)
		push	hl
		call	p06sub_7200
		call	j_EraseEOW2
		pop		hl
		ld		(curRow), hl
		jr		Page06_366F
; End of function p06sub_622D

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

p06loc_623D:
		cp		0Ch
		jp		z, Page06_2FF1
		call	page0_1808
		jp		z, j_initNamePrompt2
		call	Page06_2FF1
		or		a
		ret		z
		cp		5Ah ; 'Z'
		ret		c

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


Page06_366F:
		bit		1, (iy+19h)
		ret		z
		push	af
		res		1, (iy+19h)
		ld		hl, (curRow)
		push	hl
		ld		hl, 1
		ld		a, (mcxCurApp)
		cp		53h ; 'S'
		jr		nz, p06loc_6269
		dec		hl

p06loc_6269:
		ld		(curRow), hl
		ld		a, (winTop+1)
		dec		a
		ld		b, a

p06loc_6271:
		call	j_getcurloc
		ld		a, (hl)
		cp		0D0h ; '�'
		jr		z, p06loc_6289
		cp		0EFh ; '�'
		jr		z, p06loc_6285
		cp		0F0h ; '�'
		jr		nz, p06loc_628E
		ld		a, 1Fh
		jr		p06loc_628B
; ---------------------------------------------------------------------------

p06loc_6285:
		ld		a, 1Eh
		jr		p06loc_628B
; ---------------------------------------------------------------------------

p06loc_6289:
		ld		a, 20h ; ' '

p06loc_628B:
		; Page06_366F+37j
		call	j_PutMap

p06loc_628E:
		ld		hl, curRow
		inc		(hl)
		djnz	p06loc_6271
		pop		hl
		ld		(curRow), hl
		pop		af
		ret
; End of function Page06_366F

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

p06loc_629A:
		cp		4
		jr		z, p06loc_62A2
		cp		5
		jr		nz, p06loc_62FB

p06loc_62A2:
		call	IsEditEmpty
		ret		z
		call	p06sub_6486
		call	p06sub_64CA
		call	p06sub_6589
		jr		nz, p06loc_62D6
		call	page0_1675
		rst		10h
		jp		c, p06loc_633D
		ld		a, (curRow)
		inc		a
		ld		hl, winBtm
		cp		(hl)
		jr		c, p06loc_62D1
		call	Page0Call_37B3
		call	j_scrollUp
		ld		c, 1Eh
		call	p06sub_672A
		ld		hl, curRow
		dec		(hl)

p06loc_62D1:
		call	p06sub_6772
		jr		p06loc_633D
; ---------------------------------------------------------------------------

p06loc_62D6:
		ld		a, (curRow)
		cp		7
		jr		nz, p06loc_62E2
		ld		c, 20h ; ' '
		call	p06sub_673A

p06loc_62E2:
		ld		a, (curRow)
		inc		a
		ld		hl, winBtm
		cp		(hl)
		jr		c, p06loc_62F6
		call	j_scrollUp
		ld		c, 1Eh
		call	p06sub_672A
		jr		p06loc_6333
; ---------------------------------------------------------------------------

p06loc_62F6:
		ld		(curRow), a
		jr		p06loc_6333
; ---------------------------------------------------------------------------

p06loc_62FB:
		cp		3
		jr		nz, p06loc_6340
		call	IsEditEmpty
		ret		z
		call	p06sub_6486
		call	p06sub_64CA
		call	p06sub_6571
		jp		z, p06loc_63FD
		ld		a, (curRow)
		cp		1
		jr		nz, p06loc_631B
		ld		c, 20h ; ' '
		call	p06sub_671A

p06loc_631B:
		ld		a, (curRow)
		dec		a
		ld		hl, winTop
		cp		(hl)
		jp		p, p06loc_6330
		call	j_scrollDown
		ld		c, 1Fh
		call	p06sub_674B
		jr		p06loc_6333
; ---------------------------------------------------------------------------

p06loc_6330:
		ld		(curRow), a

p06loc_6333:
		sub		a
		ld		(curRow+1), a
		ld		hl, (editSym)
		call	p06sub_661F

p06loc_633D:
		jp		p06sub_645A
; ---------------------------------------------------------------------------

p06loc_6340:
		cp		6
		jp		nz, p06loc_63F6
		ld		hl, (editSym)
		call	p06sub_65CB
		ret		z
		call	Page06_366F
		call	p06sub_6486

p06loc_6352:
		call	p06sub_693D
		ld		hl, (editSym)
		ld		a, (hl)
		and		1Fh
		cp		9
		jr		nz, p06loc_637C
		ld		hl, lower
		rst		20h
		ld		hl, upper
		call	page0_BEC
		call	TimesPt5
		ld		de, (editDat)
		ld		hl, OP1
		call	mov9B2
		ld		hl, (editSym)
		ld		a, 0
		ld		(hl), a

p06loc_637C:
		ld		hl, (editDat)
		cp		0
		jr		z, p06loc_639A
		cp		1
		jp		nz, ErrDataType
		ld		e, (hl)
		inc		hl
		ld		d, (hl)
		inc		hl
		push	hl
		ld		hl, 2
		call	CpHLDE
		jp		nz, ErrDimension
		pop		hl
		call	p06sub_6558

p06loc_639A:
		call	p06sub_6558
		call	p06sub_618B
		call	PushOP1
		call	Page0Call_37D1
		call	Page0Call_241E
		res		7, (hl)
		call	PushOP1
		sub		a
		ld		(errNo), a
		call	p06sub_659C
		call	p06sub_65D9
		call	PushOP1
		ld		hl, (editDat)
		ld		de, OP6
		call	mov9B2
		ld		hl, p06loc_641A
		call	pushErrorHandleR
		call	j_ITSOLVERB
		call	CkValidNum
		call	PushOP1
		ld		hl, 9308h
		rst		20h
		call	j_StoOther
		call	j_CleanAll
		call	p06sub_680C
		set		1, (iy+19h)
		call	popErrorHandleR
		call	p06sub_65AF
		call	p06sub_65B6
		call	p06sub_6772
		call	p06sub_64CA
		jp		p06sub_645A
; ---------------------------------------------------------------------------

p06loc_63F6:
		cp		27h ; '''
		jr		nz, p06loc_6407
		call	p06sub_6486

p06loc_63FD:
		call	p06sub_6A8E
		res		0, (iy+19h)
		jp		p06loc_6126
; ---------------------------------------------------------------------------

p06loc_6407:
		bit		enableQueue, (iy+rclFlag)
		jr		nz, p06loc_6410
		cp		8Ah ; '�'
		ret		z

p06loc_6410:
		call	page0_1808
		jp		z, j_initNamePrompt2
		call	j_ProcessBufKeys
		ret
p06loc_641A:
		res		onInterrupt, (iy+onFlags)
		push	af
		call	p06sub_65AF
		call	p06sub_65B6
		pop		af
		cp		86h ; '�'
		jr		z, p06loc_6449
		cp		98h ; '�'
		jr		z, p06loc_643A
		cp		9Ah ; '�'
		jr		z, p06loc_6449
		cp		97h ; '�'
		jr		z, p06loc_6449
		cp		99h ; '�'
		jr		nz, p06loc_644F

p06loc_643A:
		ld		hl, p06loc_641A
		call	pushErrorHandleR
		call	p06sub_680C
		call	popErrorHandleR
		call	p06sub_6772

p06loc_6449:
		call	zero_basic_prog
		call	p06sub_64CA

p06loc_644F:
		jp		JErrorNo
p06loc_6452:
		call	j_rstrShadow2
		bit		editOpen, (iy+editFlags)
		ret		nz

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


p06sub_645A:

		call	Page0Call_37AD
		set		6, (iy+5)
		ld		hl, (editSym)
; End of function p06sub_645A


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


p06sub_6464:
		ld		a, (hl)
		push	af
		dec		hl
		dec		hl
		dec		hl
		ld		e, (hl)
		dec		hl
		ld		d, (hl)
		dec		hl
		ld		a, (hl)
		or		a
		jp		nz, Page0Call_254D
		ld		(editDat), de
		push	de
		call	j_createNumEditBuf
		call	SetEmptyEditPtr
		pop		hl
		pop		af
		call	BCALL_4D3B
		call	BufToTop
		ret
; End of function p06sub_6464


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


p06sub_6486:
		set		6, (iy+5)
		call	CanAlphIns
		ld		hl, (editSym)
		res		7, (hl)
		call	p06sub_64A3
		ld		hl, (editSym)
		call	p06sub_65CB
		jr		z, p06loc_649F
		set		7, (hl)

p06loc_649F:
		call	j_releaseBuffer
		ret
; End of function p06sub_6486


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


p06sub_64A3:
		call	CloseEditEqu
		call	page0_166E
		call	j_ParseInp
		bit		numOP1, (iy+ParsFlag2)
		ret		z
		call	PushOP1
		call	ZeroOP1
		call	Page0Call_37D1
		call	j_StoOther
		call	j_CleanAll
		ld		hl, (editSym)
		call	p06sub_65CB
		ret		nz
		jp		p06sub_6910
; End of function p06sub_64A3


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


p06sub_64CA:
		call	Page0Call_37A7
		call	Page0Call_37D1
		ld		hl, (editSym)
		jp		p06loc_66C4
; End of function p06sub_64CA


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


p06sub_64D6:
		push	de
		ld		a, (hl)
		and		1Fh
		call	Page0Call_2407
		ld		de, 3
		call	page0_17B3
		jr		z, p06loc_64ED
		cp		1
		jr		z, p06loc_64ED
		cp		0Dh
		jr		nz, p06loc_64FA

p06loc_64ED:
		ld		a, (hl)
		cp		72h ; 'r'
		jr		z, p06loc_64FA
		cp		3Ah ; ':'
		jr		z, p06loc_64FA
		ld		e, a
		inc		e
		ld		d, 0

p06loc_64FA:
		or		a
		sbc		hl, de
		ld		de, (unk_982E)
		call	CpHLDE
		pop		de
		ret
; End of function p06sub_64D6


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


p06sub_6506:
		call	p06sub_64D6
		ret		z
		bit		7, (hl)
		jr		z, p06sub_6506
		ret
; End of function p06sub_6506


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


p06sub_650F:
		push	bc
		push	de
		ld		bc, 0
		ex		de, hl
		call	p06sub_652D

p06loc_6518:
		call	CpHLDE
		jr		c, p06loc_6526
		jr		z, p06loc_6526
		ld		c, l
		ld		b, h
		call	p06sub_6506
		jr		nz, p06loc_6518

p06loc_6526:
		ld		a, c
		or		b
		ld		l, c
		ld		h, b
		pop		de
		pop		bc
		ret
; End of function p06sub_650F


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


p06sub_652D:
		ld		hl, symTable

p06loc_6530:
		bit		7, (hl)
		ret		nz
		call	p06sub_64D6
		jr		nz, p06loc_6530
		ret
; End of function p06sub_652D


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


p06sub_6539:
		call	j_HomeUp
		ld		hl, symTable

p06loc_653F:
		bit		7, (hl)
		jr		z, p06loc_654D
		call	p06sub_661F
		call	j_newline
		call	Page0Call_3CCF
		ret		nc

p06loc_654D:
		call	p06sub_64D6
		jr		nz, p06loc_653F
		call	p06sub_6618
		jp		p06sub_6772
; End of function p06sub_6539


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


p06sub_6558:

		push	hl
		rst		20h
		ld		hl, lower
		call	Mov9OP2Cp
		jp		c, ErrBadGuess
		ld		hl, upper
		rst		20h
		pop		hl
		call	Mov9OP2Cp
		push	hl
		jp		c, ErrBadGuess
		pop		hl
		ret
; End of function p06sub_6558


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


p06sub_6571:
		ld		hl, (editSym)
		call	p06sub_65CB
		jr		nz, p06loc_657C
		ld		hl, (unk_982E)

p06loc_657C:
		call	p06sub_650F
		ret		z
		call	p06sub_65CB
		jr		z, p06loc_657C
		ld		(editSym), hl
		ret
; End of function p06sub_6571


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


p06sub_6589:
		ld		hl, (editSym)
		call	p06sub_65CB
		ret		z
		call	p06sub_6506
		call	z, p06sub_6613
		ld		(editSym), hl
		sub		a
		inc		a
		ret
; End of function p06sub_6589


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


p06sub_659C:
		call	PushOP1
		call	Page0Call_37D1
		ld		hl, OP1
		ld		de, 9308h
		call	mov9B2
		call	popOP1
		ret
; End of function p06sub_659C


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


p06sub_65AF:
		call	p06sub_618B
		call	j_PARSESCAN
		ret
; End of function p06sub_65AF


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


p06sub_65B6:
		ld		hl, 9308h
		rst		20h
		call	Page0Call_241E
		call	c, p06sub_6613
		ld		(editSym), hl
		ld		(XOutSym), hl
		ld		(editDat), de
		ret
; End of function p06sub_65B6


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


p06sub_65CB:
		push	hl
		pop		ix
		ld		a, (ix+0FAh)
		cp		3Ah ; ':'
		ret		nz
		ld		a, (ix+0F9h)
		or		a
		ret
; End of function p06sub_65CB


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


p06sub_65D9:
		ld		a, 1
		ld		(OP1), a
		ld		l, 3Ah ; ':'
		ld		h, 0
		ld		(OP1+1), hl
		ld		a, 0
		ld		(OP1+3), a
		ret
; End of function p06sub_65D9


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


p06sub_65EB:
		call	p06sub_6613
		ret		nc
		call	p06sub_65D9
		ld		hl, ErrMemory_NoGoTo
		call	pushErrorHandleR
		ld		hl, 2
		call	CreateRList
		call	popErrorHandleR
		inc		de
		inc		de
		ld		hl, lower
		bit		0, (iy+19h)
		ld		hl, p06loc_694E
		call	mov9B2
		jp		mov9B2
; End of function p06sub_65EB


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


p06sub_6613:
		call	p06sub_65D9
		rst		10h
		ret
; End of function p06sub_6613


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


p06sub_6618:
		; p06sub_6A0F:p06loc_6A40p
		call	p06sub_6613
		sub		a
		ld		(curRow+1), a
; End of function p06sub_6618


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


p06sub_661F:
		push	de
		push	hl
		ld		a, (curRow)
		cp		1
		jr		nz, p06loc_663B
		ex		de, hl
		call	p06sub_652D
		call	CpHLDE
		ex		de, hl
		jr		z, p06loc_665C
		call	p06sub_65CB
		jr		z, p06loc_665C
		ld		a, 1Eh
		jr		p06loc_665E
; ---------------------------------------------------------------------------

p06loc_663B:
		cp		7
		jr		nz, p06loc_665C
		call	p06sub_65CB
		jr		nz, p06loc_6653
		push	hl
		push	de
		call	page0_1675
		rst		10h
		call	p06sub_65D9
		pop		de
		pop		hl
		jr		c, p06loc_665C
		jr		p06loc_6658
; ---------------------------------------------------------------------------

p06loc_6653:
		call	p06sub_6763
		jr		z, p06loc_665C

p06loc_6658:
		ld		a, 1Fh
		jr		p06loc_665E
; ---------------------------------------------------------------------------

p06loc_665C:
		ld		a, 20h ; ' '

p06loc_665E:
		call	j_PutC
		call	p06sub_65CB
		jr		nz, p06loc_6677
		ld		hl, p06loc_6AB7
		call	p06sub_6A94
		ld		a, 17h
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		jr		p06loc_669C
; ---------------------------------------------------------------------------

p06loc_6677:
		call	p06sub_6763
		jr		nz, p06loc_668F
		ld		hl, p06loc_6ABD
		call	p06sub_6A94
		push	af
		ld		a, 18h
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		pop		af
		jr		p06loc_66A7
; ---------------------------------------------------------------------------

p06loc_668F:
		call	j_varnameToOP1hl
		sub		a
		ld		(de), a
		ld		hl, 8479h
		ld		a, (hl)
		cp		62h ; 'b'
		jr		z, p06loc_66AF

p06loc_669C:
		ld		a, (hl)
		cp		5Dh ; ']'
		jr		nz, p06loc_66A7
		inc		hl
		call	j_dispListNameY
		jr		p06loc_66BD
; ---------------------------------------------------------------------------

p06loc_66A7:
		cp		0AAh ; '�'
		jr		z, p06loc_66AF
		cp		5Ch ; '\'
		jr		nz, p06loc_66BA

p06loc_66AF:
		ld		d, a
		inc		hl
		ld		e, (hl)
		call	j_GETTOKSTRING
		call	j_PutPS
		jr		p06loc_66BD
; ---------------------------------------------------------------------------

p06loc_66BA:
		call	j_PutS

p06loc_66BD:
		ld		a, 3Dh ; '='
		call	j_PutC
		pop		hl
		pop		de

p06loc_66C4:
		ld		a, (hl)
		and		1Fh
		cp		9
		ret		z
		push	de
		push	hl
		dec		hl
		dec		hl
		dec		hl
		call	p06sub_66FC
		ld		e, (hl)
		dec		hl
		ld		h, (hl)
		ld		l, e
		call	BCALL_4D3B
		jp		c, ErrMemory_NoGoTo
		call	j_setNumWindow
		call	BufToTop
		call	j_fdispEOL
		pop		hl
		bit		1, (iy+19h)
		jr		z, p06loc_66FA
		ld		de, (XOutSym)
		call	CpHLDE
		jr		nz, p06loc_66FA
		push	hl
		call	p06sub_69DE
		pop		hl

p06loc_66FA:
		pop		de
		ret
; End of function p06sub_661F


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


p06sub_66FC:
		push	de
		push	hl
		ld		hl, (FPS)
		ld		(editTop), hl
		ld		(editCursor), hl
		ex		de, hl
		ld		hl, (OPS)
		ld		(editTail), hl
		ld		(editBtm), hl
		call	CpHLDE
		jp		c, ErrMemory_NoGoTo
		pop		hl
		pop		de
		ret
; End of function p06sub_66FC


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


p06sub_671A:
		ld		a, (unk_8518)
		cp		0EFh ; '�'
		jr		nz, p06loc_6723
		ld		c, 0D0h	; '�'

p06loc_6723:
		ld		a, (winTop)
		call	j_FinsDisp02
		ret
; End of function p06sub_671A


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


p06sub_672A:
		ld		a, (unk_8518)
		cp		20h ; ' '
		jr		z, p06loc_6733
		ld		c, 0EFh	; '�'

p06loc_6733:
		ld		a, (winTop)
		call	j_FinsDisp02
		ret
; End of function p06sub_672A


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


p06sub_673A:
		ld		a, (unk_8578)
		cp		0F0h ; '�'
		jr		nz, p06loc_6743
		ld		c, 0D0h	; '�'

p06loc_6743:
		ld		a, (winTop+1)
		dec		a
		call	j_FinsDisp02
		ret
; End of function p06sub_673A


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


p06sub_674B:
		ld		a, (unk_8578)
		cp		20h ; ' '
		jr		z, p06loc_6754
		ld		c, 0F0h	; '�'

p06loc_6754:
		ld		a, (winTop+1)
		dec		a
		call	j_FinsDisp02
		ret
; End of function p06sub_674B


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


p06sub_675C:
		; p06sub_6A8Ep
		call	p06sub_6613
		call	nc, DelVar
		ret
; End of function p06sub_675C


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


p06sub_6763:
		; p06sub_661F:p06loc_6677p
		push	hl
		pop		ix
		ld		a, (ix+0FAh)
		cp		1
		ret		nz
		ld		a, (ix+0F9h)
		cp		2Ah ; '*'
		ret
; End of function p06sub_6763


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


p06sub_6772:

		call	page0_1675
		rst		10h
		ret		c
		push	de
		ld		hl, (curRow)
		ex		(sp), hl
		push	hl
		call	p06sub_67CA
		jr		z, p06loc_6791
		pop		hl
		ld		a, (unk_8578)
		cp		1Fh
		jr		z, p06loc_67C5
		ld		c, 1Fh
		call	p06sub_674B
		jr		p06loc_67C5
; ---------------------------------------------------------------------------

p06loc_6791:
		ld		a, 20h ; ' '
		bit		1, (iy+19h)
		jr		z, p06loc_679B
		ld		a, 0D0h	; '�'

p06loc_679B:
		call	j_PutC
		ld		hl, p06loc_6ABD
		call	p06sub_6A94
		ld		a, 18h
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	j_PutS
		ld		a, 3Dh ; '='
		call	j_PutC
		pop		hl
		rst		20h
		ld		a, 7
		call	FormEReal
		ld		hl, OP3
		call	j_PutS
		call	j_EraseEOW2

p06loc_67C5:
		pop		hl
		ld		(curRow), hl
		ret
; End of function p06sub_6772


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


p06sub_67CA:
		ld		hl, 101h
		ld		(curRow), hl
		ld		a, (winTop+1)
		dec		a
		ld		b, a

p06loc_67D5:
		call	j_getcurloc
		ld		a, (hl)
		cp		20h ; ' '
		jr		z, p06loc_67FD
		ld		de, p06loc_6ABD
		ex		de, hl
		push	bc
		ld		a, 18h
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		ex		de, hl
		pop		bc

p06loc_67ED:
		ld		a, (de)
		inc		de
		or		a
		jr		z, p06loc_67FD
		cp		(hl)
		inc		hl
		jr		z, p06loc_67ED
		ld		hl, curRow
		inc		(hl)
		djnz	p06loc_67D5
		ret
; ---------------------------------------------------------------------------

p06loc_67FD:
		sub		a
		ld		(curRow+1), a
		ret
; End of function p06sub_67CA


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


p06sub_6802:
		push	hl
		call	page0_1675
		rst		10h
		call	nc, DelVar
		pop		hl
		ret
; End of function p06sub_6802


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


p06sub_680C:
		call	p06sub_618B
		call	j_ParseInp
		call	PushOP1
		call	page0_1675
		call	j_StoOther
		ret
; End of function p06sub_680C

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

p06loc_681C:
		sub		a
		ld		(winTop), a
		jr		p06loc_6832
; ---------------------------------------------------------------------------

p06loc_6822:
		set		2, (iy+19h)
		call	p06sub_65AF
		res		2, (iy+19h)
		call	p06sub_68D0
		jr		p06loc_687F
; ---------------------------------------------------------------------------

p06loc_6832:
		set		2, (iy+19h)
		call	p06sub_65AF
		res		2, (iy+19h)
		call	p06sub_68D0
		call	p06sub_483D
		ld		hl, (editDat)
		ld		a, 3
		call	BCALL_4D3B
		jp		c, ErrMemory_NoGoTo
		call	j_HomeUp
		call	j_setNumWindow
		call	BufToTop
		call	j_wdispEOL
		call	CloseEditEqu
		ld		a, 1
		ld		(winTop), a
		res		2, (iy+19h)
		call	p06sub_6539
		bit		0, (iy+19h)
		jr		z, p06loc_687F
		call	p06sub_68DC
		ld		a, (unk_97A2)
		or		a
		jp		z, p06sub_645A
		call	Page0Call_37AD
		jp		p06loc_6352
; ---------------------------------------------------------------------------

p06loc_687F:
		ld		a, 1
		ld		(winTop), a
		call	p06sub_6539
		set		0, (iy+19h)
		ld		a, 1
		ld		(curRow), a
		call	Page0Call_37AD
		call	p06sub_652D
		call	z, p06sub_6613
		ld		(editSym), hl
		call	p06sub_6464
		set		6, (iy+5)
		ret
; ---------------------------------------------------------------------------
		call	p06sub_65D9
		res		1, (iy+0Eh)
		call	p06sub_6613
		ld		(editSym), hl
		ld		(editDat), de
		call	p06sub_661F
		call	j_RecallEd
		call	p06sub_6613
		push	hl
		call	Page0Call_37AD
		pop		hl
		push	hl
		call	Page0Call_3249
		pop		hl
		ld		a, (hl)
		call	rclVarToEditPtR
		call	j_dispVarVal
		ret

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


p06sub_68D0:
		call	p06sub_618B
		rst		10h
		ld		(editSym), hl
		ld		(editDat), de
		ret
; End of function p06sub_68D0


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


p06sub_68DC:
		call	p06sub_65B6
		ex		de, hl
		ld		a, 1
		ld		(curRow), a
		call	p06sub_652D
		ret		z

p06loc_68E9:
		call	CpHLDE
		ret		z
		call	p06sub_6506
		jr		nz, p06loc_68F4
		ld		l, e
		ld		h, d

p06loc_68F4:
		ld		a, (winTop+1)
		ld		b, a
		ld		a, (curRow)
		inc		a
		cp		b
		jr		nc, p06loc_6904
		ld		(curRow), a
		jr		p06loc_68E9
; ---------------------------------------------------------------------------

p06loc_6904:
		call	j_scrollUp
		sub		a
		ld		(curRow+1), a
		call	p06sub_661F
		jr		p06loc_68E9
; End of function p06sub_68DC


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


p06sub_6910:
		call	p06sub_6613
		ret		c
		and		1Fh
		cp		1
		jr		nz, p06loc_6937
		ex		de, hl
		ld		e, (hl)
		inc		hl
		ld		d, (hl)
		push	hl
		ld		hl, 2
		call	CpHLDE
		jp		nz, ErrDimension
		pop		hl
		inc		hl
		push	hl
		rst		20h
		call	Mov9ToOP2
		call	cpop1op2
		jp		nc, Page0Call_2505
		pop		hl
		ret
; ---------------------------------------------------------------------------

p06loc_6937:
		cp		9
		ret		z
		jp		ErrDataType
; End of function p06sub_6910


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


p06sub_693D:
		call	p06sub_6910
		jr		c, p06loc_6945
		ld		hl, {+}

p06loc_6945:
		ld		de, lower
		call	Mov10B
		jp		Mov10B
; End of function p06sub_693D
p06loc_694E:
+:		.db		80h	; �
		.db		0E3h	; �
		.db		10h
		.db		0
		.db		0
		.db		0
		.db		0
		.db		0
		.db		0
		.db		0
		.db		0E3h	; �
		.db		10h
		.db		0
		.db		0
		.db		0
		.db		0
		.db		0
		.db		0

p06loc_6960:
		jr		c, {+}
		call	j_shrinkWindow2
		ret		m
		bit		2, (iy+19h)
		ret		nz
		ld		c, 1Eh
		call	p06sub_672A
		ret
+:		bit		2, (iy+19h)
		jr		z, p06loc_698B
		res		appAutoScroll, (iy+appFlags)
		ld		hl, (curRow)
		push	hl
		call	p06sub_7200
		pop		hl
		ld		(curRow), hl
		set		appAutoScroll, (iy+appFlags)
		ret
; ---------------------------------------------------------------------------

p06loc_698B:
		bit		editOpen, (iy+editFlags)
		jr		z, p06sub_6A0F
		ld		hl, (editCursor)
		ld		de, (editTop)
		or		a
		sbc		hl, de
		push	hl
		call	CloseEditEqu
		ld		a, (curRow)
		cp		6
		call	z, Page0Call_37B9
		call	p06sub_6A0F
		call	page0_166E
		call	setupEditEqu
		pop		hl
		ld		a, l
		or		h
		jr		z, p06loc_69CE
		ld		c, l
		ld		b, h
		push	hl
		ld		hl, (editTop)
		ld		e, l
		ld		d, h
		add		hl, bc
		ld		(editCursor), hl
		ld		hl, (editTail)
		ldir
		ld		hl, (editTail)
		pop		de
		add		hl, de
		ld		(editTail), hl

p06loc_69CE:
		ld		hl, (editSym)
		ld		de, (XOutSym)
		call	CpHLDE
		ret		nz
		bit		1, (iy+19h)
		ret		z

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


p06sub_69DE:
		ld		a, (curRow)
		cp		1
		jr		nz, p06loc_69F4
		ex		de, hl
		call	p06sub_652D
		call	CpHLDE
		ex		de, hl
		jr		z, p06loc_69FD
		ld		c, 0D0h	; '�'
		jp		p06sub_672A
; ---------------------------------------------------------------------------

p06loc_69F4:
		cp		7
		jr		nz, p06loc_69FD
		ld		c, 0D0h	; '�'
		jp		p06sub_674B
; ---------------------------------------------------------------------------

p06loc_69FD:
		ld		hl, (curRow)
		push	hl
		sub		a
		ld		(curRow+1), a
		ld		a, 0D0h	; '�'
		call	j_PutC
		pop		hl
		ld		(curRow), hl
		ret
; End of function p06sub_69DE


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


p06sub_6A0F:
		ld		hl, (curRow)
		push	hl
		ld		a, (unk_89FE)
		push	af
		ld		hl, 0FFF7h
		add		hl, sp
		ld		sp, hl
		ex		de, hl
		ld		hl, winLeftEdge
		call	mov9B2
		call	j_newline
		ld		hl, (editSym)
		call	p06sub_65CB
		jr		z, p06loc_6A43

p06loc_6A2E:
		call	p06sub_6506
		jr		z, p06loc_6A40
		call	p06sub_661F
		call	j_newline
		call	Page0Call_3CCF
		jr		c, p06loc_6A2E
		jr		p06loc_6A46
; ---------------------------------------------------------------------------

p06loc_6A40:
		call	p06sub_6618

p06loc_6A43:
		call	p06sub_6772

p06loc_6A46:
		ld		hl, 0
		add		hl, sp
		ld		de, winLeftEdge
		call	mov9B2
		ld		sp, hl
		pop		af
		ld		(unk_89FE), a
		pop		hl
		ld		(curRow), hl
		ret
; End of function p06sub_6A0F


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

p06loc_6A5A:
p06sub_6A5A:
		res		grfSplitOverride, (iy+sGrFlags)
		res		1, (iy+19h)
		bit		2, (iy+19h)
		jr		nz, p06loc_6A79
		ld		hl, p06loc_6A74
		call	pushErrorHandleR
		call	p06sub_6486
		call	popErrorHandleR
p06loc_6A74:
		call	j_releaseBuffer
		jr		p06loc_6A7C
; ---------------------------------------------------------------------------

p06loc_6A79:
		call	closeEquField

p06loc_6A7C:
		call	p06sub_675C
		res		2, (iy+19h)
		ld		hl, symTable

p06loc_6A86:
		res		7, (hl)
		call	p06sub_64D6
		jr		nz, p06loc_6A86
		ret
; End of function p06sub_6A5A


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


p06sub_6A8E:
		call	p06sub_675C
		jp		p06sub_6802
; End of function p06sub_6A8E


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


p06sub_6A94:
		ld		de, 8D8Fh
		push	de
		call	mov9B2
		call	mov9B2
		pop		hl
		ret
; End of function p06sub_6A94

p06loc_6AA0:
aEquationSolver:.asc 'EQUATION SOLVER',0
p06loc_6AB0:
aEqn0:		.asc 'eqn:0=',0
p06loc_6AB7:
aBound:		.asc 'bound',0
p06loc_6ABD:
aLeftRt:	.asc 'left-rt',0
; ---------------------------------------------------------------------------

JForceYEqu:
		res		7, (iy+0Ch)
		jr		p06loc_6AD7
; ---------------------------------------------------------------------------

Page06_2FE5:
		jr		p06loc_6AD1
; ---------------------------------------------------------------------------

InitYEqualsContext:
		res		7, (iy+0Ch)

p06loc_6AD1:
		call	RESETWINTOP
		call	j_ClrWindow

p06loc_6AD7:
		call	ResetSplitOverride
		xor		a
		ld		(currLastEntry), a
		bit		yEquHookActive, (iy+hookflags3)
		jr		z, p06loc_6AE9
		ld		a, 0
		call	Page0Call_2FDF

p06loc_6AE9:
		ld		hl, p06loc_6B95
		call	AppInit
		res		0, (iy+13h)
		res		7, (iy+18h)
		call	RESETWINTOP
		sub		a
		ld		(curRow+1), a
		ld		hl, winTop
		inc		(hl)
		ld		hl, unk_100A
		call	IsFuncMode
		jr		nz, p06loc_6B1F
		ld		l, 0Ch
		sla	h
		call	IsParametricMode
		jr		nz, p06loc_6B1F
		ld		l, 6
		sla	h
		call	IsFunctionMode
		jr		nz, p06loc_6B1F
		ld		hl, 8003h

p06loc_6B1F:
		ld		(unk_9812), hl
		ld		a, 1
		call	CheckSplitFlag
		jr		z, p06loc_6B2B
		ld		a, 5

p06loc_6B2B:
		ld		(curRow), a
		call	page0_176F
		call	Page06_2FEB
		call	IsRecursiveMode
		jr		z, p06loc_6B42
		call	Page0Call_3621
		call	j_newline
		call	Page0Call_361B

p06loc_6B42:
		ld		a, (unk_9813)
; START	OF FUNCTION CHUNK FOR p06sub_6BC1

p06loc_6B45:
		call	p06sub_72AF
		call	p06sub_6F72
		call	DISPYEOS
		bit		7, (iy+0Ch)
		ret		z
		ld		a, 3
		call	IsParametricMode
		jr		z, p06loc_6B5D
		inc		a
		jr		p06loc_6B68
; ---------------------------------------------------------------------------

p06loc_6B5D:
		call	IsRecursiveMode
		jr		z, p06loc_6B68
		set		0, (iy+13h)
		add		a, 2

p06loc_6B68:
		ld		(curRow+1), a
		res		7, (iy+0Ch)

p06loc_6B6F:
		ld		a, (unk_9813)
		ld		hl, 9654h
		cp		(hl)
		jr		z, p06loc_6B7D
		call	p06sub_7331
		jr		p06loc_6B6F
; ---------------------------------------------------------------------------

p06loc_6B7D:
		res		0, (iy+13h)
		ld		hl, curCol
		inc		(hl)
		call	GoToErr
		ld		hl, (curRow)
		push	hl
		call	p06sub_7200
		pop		hl
		ld		(curRow), hl
		ret
; END OF FUNCTION CHUNK	FOR p06sub_6BC1
; ---------------------------------------------------------------------------
		ret
p06loc_6B95:
		.dw		p06loc_6BA2
		.dw		p06loc_6F24
		.dw		p06loc_6F27
		.dw		p06loc_6F49
		.dw		p06loc_6F44
		.dw		p06loc_7428
		.db		0Ah
p06loc_6BA2:
		ld		b, a
		ld		a, 6
		bit		yEquHookActive, (iy+hookflags3)
		call	nz, Page0Call_2FDF
		ret		nz
		ld		a, b
		bit		0, (iy+13h)
		jp		nz, p06loc_730E
		bit		7, (iy+18h)
		jp		nz, p06loc_737C
		cp		5
		jp		nz, Page06_2FF1

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


p06sub_6BC1:
		; p06sub_7331+3p ...



		ld		hl, (unk_9812)
		ld		a, h
		inc		a
		and		0Fh
		cp		l
		jr		nz, p06loc_6BD9
		call	IsRecursiveMode
		ret		z
		bit		7, (iy+18h)
		ret		nz
		bit		0, (iy+13h)
		ret		nz

p06loc_6BD9:
		call	IsRecursiveMode
		jr		z, p06loc_6BED
		bit		7, (iy+18h)
		jr		nz, p06loc_6C02
		bit		0, (iy+13h)
		jp		z, p06loc_6D1F
		jr		p06loc_6C02
; ---------------------------------------------------------------------------

p06loc_6BED:
		call	IsParametricMode
		jr		z, p06loc_6C02
		bit		7, (iy+18h)
		jr		z, p06loc_6C02
		ld		hl, (unk_9812)
		ld		a, h
		inc		a
		inc		a
		and		0Fh
		cp		l
		ret		z

p06loc_6C02:
		xor		a
		ld		(currLastEntry), a
		call	DispTail
		call	closeEquField

p06loc_6C0C:
		set		appAutoScroll, (iy+appFlags)
		call	j_newline

p06loc_6C13:
		bit		7, (iy+18h)
		jr		nz, p06loc_6C1F
		bit		0, (iy+13h)
		jr		z, p06loc_6C37

p06loc_6C1F:
		call	IsRecursiveMode
		jr		z, p06loc_6C37
		ld		ix, (unk_9700)
		ld		de, 6
		add		ix, de
		ld		(unk_9700), ix
		call	Page0Call_371D
		call	j_newline

p06loc_6C37:
		ld		hl, (unk_9812)
		inc		h
		ld		a, h
		ld		(unk_9813), a
		jp		p06loc_6B45
; End of function p06sub_6BC1

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

Page06_3669:
		ld		hl, p06loc_6B95
		call	AppInit
		res		0, (iy+13h)
		jr		p06loc_6C0C

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


Page06_2FEB:
		ld		a, 3
		bit		yEquHookActive, (iy+hookflags3)
		call	nz, Page0Call_2FDF
		ret		nz
		ld		hl, 6
		call	CheckSplitFlag
		jr		z, p06loc_6C62
		ld		h, 20h ; ' '

p06loc_6C62:
		ld		(penCol), hl
		ld		hl, aPlot1
		ld		a, 1Ah
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		ld		a, (unk_92D9)
		call	p06sub_6CB2
		ld		hl, 1Eh
		call	CheckSplitFlag
		jr		z, p06loc_6C81
		ld		h, 20h ; ' '

p06loc_6C81:
		ld		(penCol), hl
		ld		hl, aPlot2
		ld		a, 1Bh
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		ld		a, (unk_92EA)
		call	p06sub_6CB2
		ld		hl, 36h	; '6'
		call	CheckSplitFlag
		jr		z, p06loc_6CA0
		ld		h, 20h ; ' '

p06loc_6CA0:
		ld		(penCol), hl
		ld		hl, aPlot3
		ld		a, 1Ch
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		ld		a, (unk_92FB)
; End of function Page06_2FEB


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


p06sub_6CB2:
		; Page06_2FEB+45p
		bit		0, a
		jr		z, p06loc_6CBA
		set		textInverse, (iy+textFlags)

p06loc_6CBA:
		set		textEraseBelow, (iy+textFlags)
		call	j_VPutS
		res		textInverse, (iy+textFlags)
		res		textEraseBelow, (iy+textFlags)
		ret
; End of function p06sub_6CB2

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR Page06_2FF1

p06loc_6CCA:
		call	IsRecursiveMode
		jr		nz, p06loc_6CDD
		ld		a, 4
		bit		yEquHookActive, (iy+hookflags3)
		call	nz, Page0Call_2FDF
		ret		nz
		call	Page0Call_367B
		ret
; ---------------------------------------------------------------------------

p06loc_6CDD:
		call	Page0Call_3615
		call	Page0Call_3789
		jr		nc, p06loc_6CEA
		call	j_setTitle
		jr		p06loc_6CED
; ---------------------------------------------------------------------------

p06loc_6CEA:
		ld		(curRow), a

p06loc_6CED:

		call	j_InitNumVec
		ld		a, 3
		ld		(equ_edit_save), a
		call	Page0Call_372F
		ret
; END OF FUNCTION CHUNK	FOR Page06_2FF1
; ---------------------------------------------------------------------------

Page06_3129:
		call	Page0Call_3615
		jr		p06loc_6CED
; ---------------------------------------------------------------------------
		ret

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


Page06_2FF1:





		cp		4
		jr		nz, p06loc_6D58
		call	IsAtBtm
		jr		nz, p06loc_6D0D
		call	IsRecursiveMode
		jr		nz, p06loc_6D1F

p06loc_6D0D:
		call	CursorDown
		ld		a, 0FFh
		ret		nz
		sub		a
		bit		2, (iy+19h)
		ret		nz
		call	IsRecursiveMode
		jp		z, p06sub_6BC1

p06loc_6D1F:
		; Page06_2FF1+Cj
		xor		a
		ld		(currLastEntry), a
		call	DispTail
		call	closeEquField
		call	zero_basic_prog
		set		appAutoScroll, (iy+appFlags)
		ld		ix, (unk_9700)
		ld		de, 3
		add		ix, de
		ld		(unk_9700), ix
		ld		a, (curRow)
		push	af
		call	j_newline
		pop		af
		ld		hl, curRow
		cp		(hl)
		call	z, Page0Call_371D
		call	Page0Call_3747
		ld		a, 3
		ld		(equ_edit_save), a
		call	j_InitNumVec
		ret
; ---------------------------------------------------------------------------

p06loc_6D58:
		cp		2
		jr		nz, p06loc_6D76
		call	IsAtTop
		jr		z, p06loc_6D65
		call	CursorLeft
		ret
; ---------------------------------------------------------------------------

p06loc_6D65:
		bit		2, (iy+19h)
		ret		nz
		ld		hl, curCol
		dec		(hl)
		set		0, (iy+13h)
		call	CanAlphIns
		ret
; ---------------------------------------------------------------------------

p06loc_6D76:
		cp		1
		jr		nz, p06loc_6D7E
		call	cursorRight
		ret
; ---------------------------------------------------------------------------

p06loc_6D7E:
		cp		3
		jp		nz, p06loc_6E1D
		call	IsAtTop
		jp		nz, cursorUp
		bit		2, (iy+19h)
		ret		nz

p06loc_6D8E:
		xor		a
		ld		(currLastEntry), a
		call	closeEquField
		ld		a, (unk_9813)
		ld		b, a
		and		0Fh
		jp		z, p06loc_6CCA
		ld		a, b
		dec		a
		ld		(unk_9813), a
		call	IsRecursiveMode
		jr		z, p06loc_6DC3
		ld		ix, (unk_9700)
		bit		7, (iy+18h)
		jr		nz, p06loc_6DB8
		bit		0, (iy+13h)
		jr		z, p06loc_6DBF

p06loc_6DB8:
		call	Page0Call_376B
		call	Page0Call_3771
		ret
; ---------------------------------------------------------------------------

p06loc_6DBF:
		call	Page0Call_376B
		ret
; ---------------------------------------------------------------------------

p06loc_6DC3:
		; Page06_2FF1+11Cj
		call	p06sub_6F72
		ld		hl, (editTail)
		ld		de, (editBtm)
		call	p06sub_7107
		inc		de
		sub		a
		ld		hl, (curRow)
		ld		h, a
		ld		a, (curRow+1)
		cp		7
		jr		c, p06loc_6DE5
		sub		3
		ld		(curRow+1), a
		ld		(winLeftEdge), a

p06loc_6DE5:
		sub		a
		sbc		hl, de
		jp		m, p06loc_6DFB
		ld		a, l
		cp		1
		jp		c, p06loc_6DFB
		call	CheckSplitFlag
		jr		z, p06loc_6E10
		ld		a, l
		cp		5
		jr		nc, p06loc_6E10

p06loc_6DFB:
		; Page06_2FF1+EFj
		ld		a, (curRow+1)
		push	af
		call	j_HomeUp
		ld		a, (unk_9813)
		call	p06sub_72AF
		call	DISPYEOS
		pop		af
		ld		(curRow+1), a
		ret
; ---------------------------------------------------------------------------

p06loc_6E10:
		; Page06_2FF1+FAj
		ld		a, l
		ld		(curRow), a
		ret
; ---------------------------------------------------------------------------

Page06_3687:
		ld		hl, p06loc_6B95
		call	AppInit
		jr		p06loc_6DC3
; ---------------------------------------------------------------------------

p06loc_6E1D:
		cp		0Eh
		jp		z, JcursorFirst
		cp		0Fh
		jp		z, JcursorLast
		cp		0Bh
		jp		z, Page06_369F
		cp		21h ; '!'
		jr		nz, p06loc_6E36
		call	CursorLeft
		ret		z
		jr		p06loc_6E3A
; ---------------------------------------------------------------------------

p06loc_6E36:
		cp		0Ah
		jr		nz, p06loc_6E4F

p06loc_6E3A:
		res		textInsMode, (iy+textFlags)
		call	BufDelete
		push	af
		call	nz, SetTblGraphDrawPreserveSmartTest
		call	DISPYEOS
		pop		af
		ret		z
		ld		c, 1
		jp		AutoSelect
; ---------------------------------------------------------------------------

p06loc_6E4F:
		cp		9
		jr		nz, p06loc_6E9A
		call	CanAlphIns
		call	IsEditEmpty
		jr		z, p06loc_6E8D

p06loc_6E5B:
		call	IsAtTop
		jr		z, p06loc_6E65
		call	cursorUp
		jr		p06loc_6E5B
; ---------------------------------------------------------------------------

p06loc_6E65:
		ld		a, (unk_9813)
		call	p06sub_7257
		ld		a, 6
		call	IsRecursiveMode
		jr		nz, p06loc_6E74
		ld		a, 0

p06loc_6E74:
		ld		(hl), a
		ld		hl, (curRow)
		push	hl
		sub		a
		ld		(curRow+1), a
		ld		a, (unk_9813)
		call	p06sub_7285
		pop		hl
		ld		(curRow), hl
		call	BufClear
		call	DISPYEOS

p06loc_6E8D:
		ld		hl, (editSym)
		bit		6, (hl)
		call	nz, SetTblGraphDraw
		ld		c, 0
		jp		AutoSelect
; ---------------------------------------------------------------------------

p06loc_6E9A:
		cp		0Ch
		jr		nz, p06loc_6EB0
		ld		hl, (editSym)
		ld		a, (hl)
		and		1Fh
		ld		(equ_edit_save), a
		ld		a, (hl)
		and		0E0h ; '�'
		or		0Ah
		ld		(hl), a
		jp		j_RCLREGEQ_CALL
; ---------------------------------------------------------------------------

p06loc_6EB0:
		bit		enableQueue, (iy+rclFlag)
		jr		nz, p06loc_6EB9
		cp		8Ah ; '�'
		ret		z

p06loc_6EB9:
		cp		27h ; '''
		jr		nz, p06loc_6EBE
		ret
; ---------------------------------------------------------------------------

p06loc_6EBE:
		cp		0Dh
		jp		nz, p06loc_6EF7
		call	SetTblGraphDrawPreserveSmartTest
		set		cmdVirgin, (iy+cmdFlags)
		call	CanAlphIns

p06loc_6ECD:
		call	IsAtTop
		jr		z, p06loc_6ED7
		call	cursorUp
		jr		p06loc_6ECD
; ---------------------------------------------------------------------------

p06loc_6ED7:
		call	GETLASTENTRY
		call	RCLENTRYTOEDIT
		res		cmdVirgin, (iy+cmdFlags)
		call	BufToTop
		ld		a, (mcxCurApp)
		cp		54h ; 'T'
		jr		nz, p06loc_6EEF
		call	p06sub_622D
		ret
; ---------------------------------------------------------------------------

p06loc_6EEF:
		call	DISPYEOS
		ld		c, 1
		jp		AutoSelect
; ---------------------------------------------------------------------------

p06loc_6EF7:
		cp		5Ah ; 'Z'
		ret		c
		bit		enableQueue, (iy+rclFlag)
		jr		nz, p06loc_6F09
		bit		1, (iy+2Ah)
		jr		nz, p06loc_6F09
		cp		0C6h ; '�'
		ret		z

p06loc_6F09:
		; Page06_2FF1+205j
		call	page0_1808
		jp		z, j_initNamePrompt2
		call	InsDisp
		bit		1, (iy+2Ah)
		ret		nz
		bit		2, (iy+19h)
		ret		nz
		ld		c, 1
		call	AutoSelect
		jp		SetTblGraphDrawPreserveSmartTest
; End of function Page06_2FF1

p06loc_6F24:
		jp		j_saveShadow
p06loc_6F27:
		bit		editOpen, (iy+editFlags)
		ret		z
		ld		hl, (editSym)
		ld		a, (hl)
		and		1Fh
		cp		0Ah
		jr		nz, p06loc_6F40
		ld		a, (hl)
		and		0E0h ; '�'
		ex		de, hl
		ld		hl, equ_edit_save
		or		(hl)
		ex		de, hl
		ld		(hl), a

p06loc_6F40:
		call	closeEquField
		ret
p06loc_6F44:
		xor		a
		ld		(currLastEntry), a
		ret
p06loc_6F49:
		jp		j_rstrShadow

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


p06sub_6F4C:

		ld		a, (unk_9813)
; End of function p06sub_6F4C


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


p06sub_6F4F:
		; p06sub_72AF+23p
		ld		h, a
		ld		l, 5Eh ; '^'
		ld		(OP1+1), hl
		xor		a
		ld		(OP1+3), a
		ld		a, h
		ret
; End of function p06sub_6F4F


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


EditEqu:
		call	p06sub_6F4C
		rst		10h
		ld		(editSym), hl
		call	p06sub_483D
		ret
; End of function EditEqu

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

Page06_3627:
		call	p06sub_6F4C
		rst		10h
		ld		a, 3Dh ; '='
		bit		5, (hl)
		ret		z
		ld		a, 7Fh ; ''
		ret

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


p06sub_6F72:
		; Page06_2FF1:p06loc_6DC3p
		call	EditEqu
		ld		a, 9
		bit		yEquHookActive, (iy+hookflags3)
		call	nz, Page0Call_2FDF
		call	z, Page0Call_37AD
		call	j_setNumWindow
		ret
; End of function p06sub_6F72


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


closeEquField:
		; p06sub_6BC1+48p	...
		call	CanAlphIns
		call	CloseEditEqu
		ret
; End of function closeEquField


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


AutoSelect:
		; Page06_2FF1+198j ...
		ld		hl, (editSym)
		bit		5, (hl)
		jr		nz, p06loc_6F99
		bit		6, (hl)
		jr		z, p06loc_6FA1
		jr		p06loc_6F9D
; ---------------------------------------------------------------------------

p06loc_6F99:
		bit		3, (hl)
		jr		nz, p06loc_6FA1

p06loc_6F9D:
		set		smarter_test, (iy+smartFlags)

p06loc_6FA1:
		; AutoSelect+Fj
		call	p06sub_70A2
		call	p06sub_70CF
		cp		c
		ret		z
		ld		a, 5
		bit		yEquHookActive, (iy+hookflags3)
		call	nz, Page0Call_2FDF
		ret		nz
		call	p06sub_70D8
		ld		hl, (editTop)
		ld		de, (editCursor)
		call	p06sub_7107
		ld		a, 7Fh ; ''
		bit		0, c
		jr		nz, p06loc_6FC8
		ld		a, 3Dh ; '='

p06loc_6FC8:
		ld		c, a
		ld		hl, (curRow)
		push	hl
		push	de
		xor		a
		ld		h, a
		sbc		hl, de
		jp		m, p06loc_6FF6
		call	CheckSplitFlag
		jr		z, p06loc_6FDF
		ld		a, l
		cp		4
		jr		c, p06loc_6FF6

p06loc_6FDF:
		ld		a, (winLeftEdge)
		dec		a
		ld		h, a
		ld		(curRow), hl
		ld		a, 7
		bit		yEquHookActive, (iy+hookflags3)
		call	nz, Page0Call_2FDF
		jr		nz, p06loc_6FF6
		ld		a, c
		call	j_PutMap

p06loc_6FF6:
		; AutoSelect+51j ...
		pop		de
		pop		hl
		push	hl
		ld		(curRow), hl
		ld		a, (mcxCurApp)
		cp		4Ah ; 'J'
		jp		z, p06loc_7097
		call	IsRecursiveMode
		jr		z, p06loc_700C
		push	bc
		jr		p06loc_7045
; ---------------------------------------------------------------------------

p06loc_700C:
		call	IsParametricMode
		jp		z, p06loc_7097
		push	bc
		ld		a, (unk_9813)
		bit		0, a
		jr		z, p06loc_7045
		push	de
		dec		a
		call	p06sub_6F4F
		call	FINDSYM_GET_SIZE
		inc		de
		inc		de
		add		hl, de
		ex		de, hl
		call	p06sub_7107
		inc		de
		pop		hl
		pop		bc
		ex		de, hl
		add		hl, de
		ex		de, hl
		ld		hl, (curRow)
		xor		a
		ld		h, a
		sbc		hl, de
		jp		m, p06loc_7097
		call	CheckSplitFlag
		jr		z, p06loc_7043
		ld		a, l
		cp		4
		jr		c, p06loc_7097

p06loc_7043:
		jr		p06loc_7078
; ---------------------------------------------------------------------------

p06loc_7045:
		; AutoSelect+8Cj
		ld		hl, (editTail)
		ld		de, (editBtm)
		call	stringwidth
		bit		0, (iy+13h)
		jr		z, p06loc_7056
		inc		de

p06loc_7056:
		ld		a, (curRow+1)
		ld		l, a
		ld		h, 0
		add		hl, de
		ld		b, 4

p06loc_705F:
		srl	h
		rr	l
		djnz	p06loc_705F
		pop		bc
		inc		hl
		ex		de, hl
		ld		hl, (curRow)
		xor		a
		ld		h, a
		add		hl, de
		push	hl
		ld		de, 8
		sbc		hl, de
		pop		hl
		jp		p, p06loc_7097

p06loc_7078:

		ld		a, l
		ld		(curRow), a
		ld		a, (winLeftEdge)
		dec		a
		call	IsRecursiveMode
		jr		z, p06loc_7087
		ld		a, 8

p06loc_7087:
		ld		(curRow+1), a
		ld		a, (curRow)
		ld		hl, winTop
		cp		(hl)
		jr		c, p06loc_7097
		ld		a, c
		call	j_PutMap

p06loc_7097:
		; AutoSelect+83j ...
		pop		hl
		ld		(curRow), hl
		ret
; End of function AutoSelect

; ---------------------------------------------------------------------------
		dec		a
		jp		m, p06loc_7097
		jr		p06loc_7078

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


p06sub_70A2:
		call	IsParametricMode
		jr		nz, p06loc_70AE
		call	IsEditEmpty
		ret		nz

p06loc_70AB:
		ld		c, 0
		ret
; ---------------------------------------------------------------------------

p06loc_70AE:
		ld		a, (unk_9813)
		push	af
		push	bc
		xor		1
		ld		(unk_9813), a
		call	p06sub_6F4C
		rst		10h
		ld		(chkDelPtr3), hl
		pop		bc
		pop		af
		ld		(unk_9813), a
		call	p06sub_7100
		jr		z, p06loc_70AB
		call	IsEditEmpty
		jr		z, p06loc_70AB
		ret
; End of function p06sub_70A2


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


p06sub_70CF:
		sub		a
		ld		hl, (editSym)
		bit		5, (hl)
		ret		z
		inc		a
		ret
; End of function p06sub_70CF


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


p06sub_70D8:
		call	SetTblGraphDrawPreserveSmartTest
		ld		hl, (editSym)
		bit		0, c
		jr		nz, p06loc_70F0
		xor		a
		call	j_EQSELUNSEL
		call	IsParametricMode
		ret		z
		ld		hl, (chkDelPtr3)
		xor		a
		jr		p06loc_70FC
; ---------------------------------------------------------------------------

p06loc_70F0:
		scf
		call	j_EQSELUNSEL
		call	IsParametricMode
		ret		z
		ld		hl, (chkDelPtr3)
		scf

p06loc_70FC:
		call	j_EQSELUNSEL
		ret
; End of function p06sub_70D8


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


p06sub_7100:
		ex		de, hl
		ld		a, (hl)
		inc		hl
		or		(hl)
		dec		hl
		ex		de, hl
		ret
; End of function p06sub_7100


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


p06sub_7107:
		; AutoSelect+31p ...
		push	bc
		call	stringwidth
		ld		l, 4
		call	IsParametricMode
		jr		z, p06loc_7115
		inc		l
		jr		p06loc_711C
; ---------------------------------------------------------------------------

p06loc_7115:
		call	IsRecursiveMode
		jr		z, p06loc_711C
		inc		l
		inc		l

p06loc_711C:
		ld		h, 0
		add		hl, de
		ld		b, 4

p06loc_7121:
		srl	h
		rr	l
		djnz	p06loc_7121
		ex		de, hl
		pop		bc
		ret
; End of function p06sub_7107

; ---------------------------------------------------------------------------
		push	hl
		jr		p06loc_7147

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


DISPYEOS:
		; Page06_2FF1+109p ...
		call	IsRecursiveMode
		jr		z, p06loc_7136
		ld		a, (winLeftEdge)
		push	af

p06loc_7136:
		res		appAutoScroll, (iy+appFlags)
		ld		hl, (curRow)
		push	hl
		call	p06sub_7200
		jr		nc, p06loc_7188
		ld		a, (unk_9813)
		push	af

p06loc_7147:
		push	af

p06loc_7148:
		ld		a, (curRow)
		inc		a
		ld		hl, winBtm
		cp		(hl)
		jr		nc, p06loc_7180
		call	j_newline
		call	IsRecursiveMode
		jr		z, p06loc_7165
		call	Page0Call_371D
		call	j_newline
		call	Page0Call_3CCF
		jr		nc, p06loc_7180

p06loc_7165:
		pop		af
		inc		a
		push	af
		ld		(unk_9813), a
		and		0Fh
		ld		hl, 9812h
		cp		(hl)
		jr		nc, p06loc_7180
		pop		af
		push	af
		call	p06sub_72AF
		call	setupdispeq
		call	DispForward
		jr		c, p06loc_7148

p06loc_7180:
		call	j_EraseEOW2
		pop		af
		pop		af
		ld		(unk_9813), a

p06loc_7188:
		pop		hl
		ld		(curRow), hl
		set		appAutoScroll, (iy+appFlags)
		call	IsRecursiveMode
		ret		z
		call	j_setNumWindow
		pop		af
		ld		(winLeftEdge), a
		ret
; End of function DISPYEOS

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

dispNumEOS:
		res		appAutoScroll, (iy+appFlags)
		ld		a, (unk_9813)
		push	af
		push	af
		call	Page0Call_3813
		cp		1Fh
		jr		nz, p06loc_71AF
		pop		af
		dec		a
		push	af

p06loc_71AF:
		ld		a, (curRow)
		inc		a
		ld		hl, winBtm
		cp		(hl)
		jr		nc, p06loc_71F1
		call	j_newline
		call	Page0Call_3CCF
		jr		nc, p06loc_71EE
		pop		af
		inc		a
		push	af
		ld		(unk_9813), a
		and		0Fh
		ld		hl, 9812h
		cp		(hl)
		jr		nc, p06loc_71EE
		pop		af
		push	af
		call	p06sub_72AF
		call	setupdispeq
		call	DispForward
		jr		nc, p06loc_71EE
		ld		a, (curRow)
		cp		7
		jr		z, p06loc_71F1
		call	j_newline
		call	Page0Call_371D
		call	Page0Call_3CCF
		jr		c, p06loc_71AF

p06loc_71EE:
		call	j_EraseEOW2

p06loc_71F1:
		pop		af
		pop		af
		ld		(unk_9813), a
		ret

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


setupdispeq:
		rst		10h
		ex		de, hl
		ld		e, (hl)
		inc		hl
		ld		d, (hl)
		inc		hl
		ex		de, hl
		add		hl, de
		ret
; End of function setupdispeq


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


p06sub_7200:

		ld		hl, (editBtm)
		ld		de, (editTail)

DispForward:
		ld		a, (iy+0Dh)
		push	af
		res		appAutoScroll, (iy+appFlags)
		ex		de, hl

p06loc_7210:
		push	de
		call	BUFPEEK2
		jr		z, p06loc_722B
		inc		hl
		push	hl
		call	j_GETTOKSTRING
		call	j_PutPS
		ld		a, (curRow)
		ld		hl, winBtm
		cp		(hl)
		pop		hl
		pop		de
		jr		nc, p06loc_7230
		jr		p06loc_7210
; ---------------------------------------------------------------------------

p06loc_722B:
		pop		de
		call	j_EraseEOL
		scf

p06loc_7230:
		pop		de
		ld		(iy+0Dh), d
		ret
; End of function p06sub_7200


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


p06sub_7235:
		ld		hl, (editBtm)
		ld		de, (editTail)
		ld		a, (winTop+1)
		push	af
		ld		a, (curRow)
		inc		a
		ld		(winTop+1), a
		call	DispForward
		pop		de
		push	af
		ld		a, d
		ld		(winTop+1), a
		pop		af
		ret		c
		ld		hl, curRow
		dec		(hl)
		ret
; End of function p06sub_7235


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


p06sub_7257:
		; p06sub_7285:p06loc_729Dp ...
		ld		hl, y1LineType
		bit		4, a
		jr		nz, p06loc_7275
		ld		hl, para1LineType
		bit		5, a
		jr		z, p06loc_726B
		and		0Fh
		sra	a
		jr		p06loc_7275
; ---------------------------------------------------------------------------

p06loc_726B:
		ld		hl, polar1LineType
		bit		6, a
		jr		nz, p06loc_7275
		ld		hl, secULineType

p06loc_7275:
		and		0Fh
		ld		d, 0
		ld		e, a
		add		hl, de
		ret
; End of function p06sub_7257


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


p06sub_727C:
		bit		5, a
		ret		z
		bit		0, a
		ret		z
		ld		a, 0FFh
		ret
; End of function p06sub_727C


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


p06sub_7285:
		; p06sub_72AFp ...
		ld		b, a
		ld		a, 2
		bit		yEquHookActive, (iy+hookflags3)
		call	nz, Page0Call_2FDF
		ld		a, b
		ret		nz
		push	af
		call	p06sub_727C
		cp		0FFh
		jr		nz, p06loc_729D
		ld		a, 20h ; ' '
		jr		p06loc_72AA
; ---------------------------------------------------------------------------

p06loc_729D:
		call	p06sub_7257
		ld		a, (mcxCurApp)
		cp		4Ah ; 'J'
		jr		z, p06loc_72AD
		ld		a, 0E8h	; '�'
		add		a, (hl)

p06loc_72AA:
		call	j_PutC

p06loc_72AD:
		pop		af
		ret
; End of function p06sub_7285


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


p06sub_72AF:
		; p06sub_6BC1:p06loc_6B45p ...
		call	p06sub_7285

DispYPrompt2:
		push	af
		ld		e, a
		ld		d, 5Eh ; '^'
		call	j_GETTOKSTRING
		call	j_PutPS
		call	IsRecursiveMode
		jr		z, p06loc_72D0
		ld		a, 28h ; '('
		call	j_PutC
		ld		a, 1
		call	j_PutC
		ld		a, 29h ; ')'
		call	j_PutC

p06loc_72D0:
		pop		af
		push	af
		call	p06sub_6F4F
		rst		10h
		ld		a, 8
		bit		yEquHookActive, (iy+hookflags3)
		call	nz, Page0Call_2FDF
		jr		nz, p06loc_72EC
		ld		a, 7Fh ; ''
		bit		5, (hl)
		jr		nz, p06loc_72E9
		ld		a, 3Dh ; '='

p06loc_72E9:
		call	j_PutC

p06loc_72EC:
		pop		af
		ret
; End of function p06sub_72AF


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


stringwidth:
		; p06sub_7107+1p
		ld		bc, 0
		push	de
		push	bc

p06loc_72F3:
		call	BUFPEEK2
		jr		z, p06loc_730B
		inc		hl
		push	hl
		call	j_GetTokLen
		pop		de
		pop		bc
		ld		l, a
		ld		h, 0
		add		hl, bc
		pop		bc
		push	bc
		push	hl
		ex		de, hl
		ld		d, b
		ld		e, c
		jr		p06loc_72F3
; ---------------------------------------------------------------------------

p06loc_730B:
		pop		de
		pop		af
		ret
; End of function stringwidth

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

p06loc_730E:
		cp		5
		jr		nz, p06loc_7320
		ld		hl, (editSym)
		ld		c, 1
		bit		5, (hl)
		jr		z, p06loc_731C
		dec		c

p06loc_731C:
		call	AutoSelect
		ret
; ---------------------------------------------------------------------------

p06loc_7320:
		cp		1
		jr		nz, p06loc_732D
		res		0, (iy+13h)

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


p06sub_7328:
		ld		hl, curCol
		inc		(hl)
		ret
; End of function p06sub_7328

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

p06loc_732D:
		cp		4
		jr		nz, p06loc_733C

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


p06sub_7331:
		call	p06sub_7328
		call	p06sub_6BC1

p06loc_7337:
		ld		hl, curCol
		dec		(hl)
		ret
; End of function p06sub_7331

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

p06loc_733C:
		cp		3
		jr		nz, p06loc_734F
		ld		a, (unk_9813)
		and		0Fh
		jr		z, p06loc_73A2
		call	p06sub_7328
		call	p06loc_6D8E
		jr		p06loc_7337
; ---------------------------------------------------------------------------

p06loc_734F:
		cp		2
		ret		nz
		ld		a, (unk_9813)
		call	p06sub_727C
		cp		0FFh
		ret		z
		ld		a, 1
		bit		yEquHookActive, (iy+hookflags3)
		call	nz, Page0Call_2FDF
		ret		nz
		set		7, (iy+18h)
		set		textInsMode, (iy+textFlags)
		res		0, (iy+13h)

p06loc_7371:
		ld		a, (curRow+1)
		ld		(unk_96FC), a
		sub		a
		ld		(curRow+1), a
		ret
; ---------------------------------------------------------------------------

p06loc_737C:
		cp		3
		jr		nz, p06loc_73B0
		ld		a, (unk_9813)
		and		0Fh
		jr		z, p06loc_739F
		call	p06sub_7421
		call	p06sub_7328
		call	p06loc_6D8E
		call	IsParametricMode
		call	nz, p06loc_6D8E
		call	p06loc_7337
		set		textInsMode, (iy+textFlags)
		jr		p06loc_7371
; ---------------------------------------------------------------------------

p06loc_739F:
		call	p06sub_7421

p06loc_73A2:
		call	p06sub_7328
		call	p06loc_6D8E
		call	IsRecursiveMode
		ret		z
		call	Page0Call_3765
		ret
; ---------------------------------------------------------------------------

p06loc_73B0:
		cp		4
		jr		nz, p06loc_73CC
		call	p06sub_7421
		call	p06sub_7328
		call	p06sub_6BC1
		call	IsParametricMode
		call	nz, p06sub_6BC1
		call	p06loc_7337
		set		textInsMode, (iy+textFlags)
		jr		p06loc_7371
; ---------------------------------------------------------------------------

p06loc_73CC:
		cp		5
		jr		nz, p06loc_7412
		call	p06sub_6F4C
		rst		10h
		bit		5, (hl)
		jr		z, p06loc_73E3
		call	SetTblGraphDrawPreserveSmartTest
		bit		3, (hl)
		jr		nz, p06loc_73E3
		set		smarter_test, (iy+smartFlags)

p06loc_73E3:
		ld		a, (unk_9813)
		call	p06sub_7257
		ld		a, (hl)
		inc		a
		cp		7
		jr		nz, p06loc_73F2
		sub		a
		jr		p06loc_7406
; ---------------------------------------------------------------------------

p06loc_73F2:
		call	IsFuncMode
		jr		nz, p06loc_7406
		cp		2
		jr		nz, p06loc_7406
		call	IsRecursiveMode
		jr		z, p06loc_7404
		ld		a, 6
		jr		p06loc_7406
; ---------------------------------------------------------------------------

p06loc_7404:
		ld		a, 4

p06loc_7406:
		ld		(hl), a
		ld		a, (unk_9813)
		call	p06sub_7285
		sub		a
		ld		(curRow+1), a
		ret
; ---------------------------------------------------------------------------

p06loc_7412:
		cp		1
		ret		nz
		res		7, (iy+18h)
		set		0, (iy+13h)
		res		textInsMode, (iy+textFlags)

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


p06sub_7421:

		ld		a, (unk_96FC)
		ld		(curRow+1), a
		ret
; End of function p06sub_7421

p06loc_7428:
		ret		nz
		jp		c, DISPYEOS
		ld		a, (curRow)
		add		a, b
		sub		7
		cp		1
		ret		m
		ld		b, a

p06loc_7436:
		call	j_scrollUp
		ld		hl, (winAbove)
		inc		hl
		ld		(winAbove), hl
		ld		hl, curRow
		dec		(hl)
		djnz	p06loc_7436
		ret
; ---------------------------------------------------------------------------

InitModeContext:
		ld		hl, p06loc_75AD
		call	AppInit
		set		grfSplitOverride, (iy+sGrFlags)
		bit		prgmEdit, (iy+prgmFlags)
		call	nz, SaveScreen
		call	p06sub_75C4
		call	p06sub_75D2
		call	j_ClrScrnFull
		ld		hl, p06loc_78FF
		ld		a, 1Eh
; START	OF FUNCTION CHUNK FOR p06sub_7612

p06loc_7466:
		ld		(unk_979F), hl
		ld		(unk_97A1), a
		sub		a
		ld		(unk_97A2), a
		call	p06sub_777A

Page06_2FCD:
		res		saIndic, (iy+newIndicFlags)
		ld		a, (unk_97A1)
		ld		b, a
		ld		de, 0Fh
		ld		ix, (unk_979F)

p06loc_7482:
		or		a
		call	itemName
		add		ix, de
		djnz	p06loc_7482
		ret
p06loc_748B:
		ret

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


SaveScreen:
		call	j_saveShadow2
		ld		a, (iy+0Ch)
		ld		(unk_85E4), a
		ld		a, (iy+0Dh)
		ld		(unk_85E3), a
		res		appCurGraphic, (iy+appFlags)
		res		appTextSave, (iy+appFlags)
		ret
; End of function SaveScreen


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


RETSCREEN:

		res		saIndic, (iy+newIndicFlags)
		push	af
		bit		prgmEdit, (iy+prgmFlags)
		jr		nz, p06loc_74BD
		bit		grfSplit, (iy+sGrFlags)
		jr		z, p06loc_74BD
		ld		a, 4
		ld		(winTop), a
		call	j_GrBufCpy

p06loc_74BD:
		call	j_rstrShadow2

p06loc_74C0:
		ld		a, (unk_85E3)
		ld		(iy+0Dh), a
		ld		a, (unk_85E4)
		ld		(iy+0Ch), a
		pop		af
		ret
; End of function RETSCREEN

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

RetScreenErr:
		res		saIndic, (iy+newIndicFlags)
		push	af
		bit		prgmEdit, (iy+prgmFlags)
		jr		nz, p06loc_74E7
		bit		grfSplit, (iy+sGrFlags)
		jr		z, p06loc_74E7
		ld		a, 4
		ld		(winTop), a
		call	j_GrBufCpy

p06loc_74E7:
		call	j_rstrpartial
		jr		p06loc_74C0

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

p06loc_74EC:
p06sub_74EC:
		res		saIndic, (iy+newIndicFlags)
		call	j_ClrScrnFull
		res		grfSplitOverride, (iy+sGrFlags)
		ld		a, (mcxCurApp)
		cp		4Bh ; 'K'
		jp		z, p06loc_7570
		call	Bit_VertSplit
		jr		z, p06loc_751B
		bit		4, (iy+1Ah)
		jr		nz, p06loc_7527
		set		grfSChanged, (iy+sGrFlags)
		call	SetYOffset
		set		NEED_BUFCPY, (iy+VERTFLAG2)
		set		NEED_RETABLE, (iy+VERTFLAG2)
		jr		p06loc_7524
; ---------------------------------------------------------------------------

p06loc_751B:
		bit		4, (iy+1Ah)
		jr		z, p06loc_7527
		call	SetNorm_Vals

p06loc_7524:
		call	SetTblGraphDraw

p06loc_7527:
		bit		grfSplit, (iy+sGrFlags)
		jr		z, p06loc_753D
		bit		6, (iy+16h)
		ret		nz
		set		grfSChanged, (iy+sGrFlags)
		ld		a, 1
		ld		(CurTableRow), a
		jr		p06loc_7542
; ---------------------------------------------------------------------------

p06loc_753D:
		bit		6, (iy+16h)
		ret		z

p06loc_7542:
		set		2, (iy+15h)

Page06_3831:
		bit		grfSplit, (iy+sGrFlags)
		jr		nz, p06loc_7556
		call	Bit_VertSplit
		jr		nz, p06loc_756D
		call	SetNorm_Vals
		jr		p06loc_756D
; ---------------------------------------------------------------------------

p06loc_7556:
		ld		hl, 4
		ld		(curRow), hl
		ld		a, 4
		ld		(winTop), a
		call	j_ClrTxtShd
		call	j_saveCmdShadow
		ld		hl, p06loc_7E5F
		call	p06sub_7E6C

p06loc_756D:
		jp		SetTblGraphDraw
; ---------------------------------------------------------------------------

p06loc_7570:
		bit		autoFill, (iy+tblFlags)
		jr		z, p06loc_7586
		bit		6, (iy+16h)
		jr		nz, p06loc_758C

Page06_383D:
		ld		a, 0
		ld		(unk_91E0), a
		call	j_zeroTemplate
		jr		p06sub_759E
; ---------------------------------------------------------------------------

p06loc_7586:
		bit		6, (iy+16h)
		jr		nz, p06sub_759E

p06loc_758C:
		bit		autoCalc, (iy+tblFlags)
		jr		nz, p06loc_7599
		bit		6, (iy+11h)
		ret		z
		jr		p06sub_759E
; ---------------------------------------------------------------------------

p06loc_7599:
		bit		6, (iy+11h)
		ret		nz
; End of function p06sub_74EC


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


p06sub_759E:
		set		reTable, (iy+tblFlags)
		ret
; End of function p06sub_759E

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

Page06_2FD9:
		ld		hl, (mcxMain)
		ld		de, p06loc_76BD
		or		a
		sbc		hl, de
		ret
p06loc_75AD:
		.dw		p06loc_76BD
		.dw		p06loc_748B
		.dw		p06loc_74EC
		.dw		p06loc_78FA
		.dw		p06loc_748B
		.dw		p06loc_748B
		.db		42h

; =============== S U B	R O U T	I N E =======================================
p06sub_75BA:
		res		6, (iy+16h)
		bit		autoFill, (iy+tblFlags)
		jr		p06loc_75CC
; End of function p06sub_75BA


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


p06sub_75C4:
		res		6, (iy+16h)
		bit		grfSplit, (iy+sGrFlags)

p06loc_75CC:
		ret		z
		set		6, (iy+16h)
		ret
; End of function p06sub_75C4


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


p06sub_75D2:
		res		4, (iy+1Ah)
		call	Bit_VertSplit
		ret		z
		set		4, (iy+1Ah)
		ret
; End of function p06sub_75D2


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


p06sub_75DF:
		res		6, (iy+11h)
		bit		autoCalc, (iy+tblFlags)
		ret		z
		set		6, (iy+11h)
		ret
; End of function p06sub_75DF

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

InitFormatContext:
		ld		hl, p06loc_7628
		call	AppInit
		set		grfSplitOverride, (iy+sGrFlags)
		bit		prgmEdit, (iy+prgmFlags)
		call	nz, SaveScreen
		call	p06sub_75C4
		call	p06sub_75D2
		call	j_ClrScrnFull
		call	p06sub_7612
		sub		a
		ld		(unk_97A2), a
		call	p06sub_777A
		ret

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


p06sub_7612:



		call	p06sub_7618
		jp		p06loc_7466
; End of function p06sub_7612


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


p06sub_7618:
		ld		hl, p06loc_7AC1
		ld		a, 0Ch
		bit		grfRecurM, (iy+grfModeFlags)
		ret		z
		ld		hl, p06loc_7B75
		ld		a, 11h
		ret
; End of function p06sub_7618

p06loc_7628:
		.dw		p06loc_76BD
		.dw		p06loc_748B
		.dw		p06loc_74EC
		.dw		p06loc_78FA
		.dw		p06loc_748B
		.dw		p06loc_78ED
		.db		42h
; ---------------------------------------------------------------------------

SolveRedisp:
		ld		hl, (curRow)
		push	hl
		call	SolveDisp
		pop		hl
		ld		(curRow), hl
		ret
; ---------------------------------------------------------------------------

Page06_365D:
		ld		hl, p06loc_7628
		call	AppInit

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


SolveDisp:
		ld		hl, p06loc_7CB0
		ld		a, 2
		jp		p06loc_7466
; End of function SolveDisp

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

Page06_3657:
		ld		hl, p06loc_7628
		call	AppInit
		call	p06sub_75BA
		call	p06sub_75DF
		call	Page06_3603
		ret
; ---------------------------------------------------------------------------

Page06_35F7:
		ld		hl, p06loc_7628
		call	AppInit
		call	p06sub_75BA
		call	p06sub_75DF
		bit		prgmEdit, (iy+prgmFlags)
		call	nz, SaveScreen
		call	j_ClrScrn
		ld		hl, p06loc_7E34
		ld		de, OP3
		call	Mov8B
		call	Mov8B
		call	Page0Call_3711
		ld		a, 1
		call	Page06_35FD
		ld		hl, p06loc_7C74
		call	p06loc_76B8
		ret

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


Page06_35FD:
		ld		(curRow), a
		sub		a
		ld		(curRow+1), a
		ld		hl, p06loc_7E45
		ld		a, 15h
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	p06sub_78EF
		ld		hl, p06loc_7E4D
		ld		a, 16h
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		jp		p06sub_7D1E
; End of function Page06_35FD


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


Page06_3603:
		ld		hl, p06loc_7CCE

p06loc_76B8:
		ld		a, 4
		jp		p06loc_7466
; End of function Page06_3603

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

p06loc_76BD:
Page06_3453:
		ld		ix, (unk_97A3)
		ld		b, a
		ld		a, 3
		bit		4, (iy+36h)
		call	nz, Page0Call_3123
		ld		a, b
		cp		5
		jp		nz, p06loc_7757
		bit		prgmEdit, (iy+prgmFlags)
		jr		z, p06loc_7722
		sub		a
		ld		(OP1+1), a
		inc		a
		ld		(OP1), a
		ld		l, (ix+7)
		ld		h, (ix+8)
		ld		a, (hl)
		cp		30h ; '0'
		jr		c, p06loc_7707
		cp		3Ah ; ':'
		jr		nc, p06loc_7707
		ld		hl, 2
		ld		(OP1), hl
		ld		a, 73h ; 's'
		ld		(OP1M), a
		ld		a, (ix+0Dh)
		call	j_ConvKeyToTok
		ld		hl, 847Bh
		call	p06sub_78DB
		jr		p06loc_7713
; ---------------------------------------------------------------------------

p06loc_7707:
		ld		a, (ix+0Eh)
		ld		(keyExtend), a
		ld		a, (ix+0Dh)

p06loc_7710:
		call	p06sub_78C3

p06loc_7713:
		call	RETSCREEN
		call	j_POPCX
		ld		a, (unk_89F5)
		and		10h
		ld		(promptIns), a
		ret
; ---------------------------------------------------------------------------

p06loc_7722:
		call	p06sub_7728
		jp		Page06_2FCD

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


p06sub_7728:



		ld		a, (mcxCurApp)
		cp		45h ; 'E'
		jr		nz, p06loc_7754
		ld		a, (unk_97A2)
		cp		10h
		jr		c, p06loc_7754
		jr		z, p06loc_7748
		cp		12h
		jr		z, p06loc_774C
		cp		11h
		jr		z, p06loc_7750
		cp		13h
		jr		nz, p06loc_7754
		call	j_SetSeqM
		ret
; ---------------------------------------------------------------------------

p06loc_7748:
		call	j_SetFuncM
		ret
; ---------------------------------------------------------------------------

p06loc_774C:
		call	j_SetPolM
		ret
; ---------------------------------------------------------------------------

p06loc_7750:
		call	j_SetParM
		ret
; ---------------------------------------------------------------------------

p06loc_7754:
		jp		p06loc_7869
; End of function p06sub_7728

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

p06loc_7757:
		cp		1
		jr		c, p06loc_7795
		cp		5
		jr		nc, p06loc_7795
		dec		a
		ld		e, a
		ld		d, 0
		add		ix, de
		ld		a, (ix+0)
		ld		(unk_97A2), a
		cp		0FEh ; '�'
		jr		nz, p06sub_777A
		ld		a, (mcxCurApp)
		cp		4Bh ; 'K'
		jp		z, Page0Call_3609
		jp		Page0Call_360F

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


p06sub_777A:

		ld		a, (unk_97A2)
		ld		l, a
		ld		h, 0
		ld		e, l
		ld		d, h
		add		hl, hl
		add		hl, de
		add		hl, hl
		add		hl, hl
		add		hl, de
		add		hl, de
		add		hl, de
		ld		de, (unk_979F)
		add		hl, de
		ld		(unk_97A3), hl
		push	hl
		pop		ix
		ret
; End of function p06sub_777A

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

p06loc_7795:
		cp		9
		jr		nz, p06loc_77A7
		bit		prgmEdit, (iy+prgmFlags)
		jp		z, JForceCmdNoChar

p06loc_77A0:
		call	RETSCREEN
		call	j_POPCX
		ret
; ---------------------------------------------------------------------------

p06loc_77A7:
		cp		27h ; '''
		jr		nz, p06loc_77C8
		call	p06sub_74EC
		ld		a, (mcxCurApp)
		cp		48h ; 'H'
		jp		z, j_InitWindowContext
		cp		57h ; 'W'
		jp		z, InitFormatContext
		cp		4Bh ; 'K'
		jp		z, j_InitTableSetContext
		cp		53h ; 'S'
		jp		z, j_InitTVMContext
		jp		InitModeContext
; ---------------------------------------------------------------------------

p06loc_77C8:
		cp		0ACh ; '�'
		jr		nz, p06loc_77DA
		bit		prgmEdit, (iy+prgmFlags)
		jr		nz, p06loc_77DA
		ld		a, (mcxCurApp)
		cp		45h ; 'E'
		jp		z, Page0Call_3825

p06loc_77DA:
		cp		5Ah ; 'Z'
		jr		nz, p06loc_77E5
		bit		prgmEdit, (iy+prgmFlags)
		jp		nz, p06loc_7710

p06loc_77E5:
		cp		5Ah ; 'Z'
		ret		c
		bit		prgmEdit, (iy+prgmFlags)
		jp		z, JForceCmd
		jp		p06loc_77A0

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


itemName:
		push	bc
		ld		a, (unk_89F5)
		push	af
		ld		l, (ix+4)
		ld		h, (ix+5)
		ld		(curRow), hl
		jr		nc, p06loc_7828
		bit		localizeHookActive, (iy+hookflags3)
		jr		z, p06loc_7815
		ld		a, 0
		ld		h, (ix+0Dh)
		ld		l, (ix+0Eh)
		call	j_call_character_hook
		jr		z, p06loc_7818

p06loc_7815:
		ld		a, (ix+6)

p06loc_7818:
		and		0Fh
		ld		b, a
		set		textInverse, (iy+textFlags)
		ld		a, 20h ; ' '

p06loc_7821:
		call	j_PutC
		djnz	p06loc_7821
		jr		p06loc_7863
; ---------------------------------------------------------------------------

p06loc_7828:
		bit		prgmEdit, (iy+prgmFlags)
		jr		nz, p06loc_7843
		ld		l, (ix+9)
		ld		h, (ix+0Ah)
		ld		a, (hl)
		and		(ix+0Ch)
		cp		(ix+0Bh)
		jr		nz, p06loc_7843
		set		textInverse, (iy+textFlags)
		jr		p06loc_7847
; ---------------------------------------------------------------------------

p06loc_7843:
		set		preClrForMode, (iy+newDispF)

p06loc_7847:
		bit		localizeHookActive, (iy+hookflags3)
		jr		z, p06loc_785A
		ld		a, 1
		ld		h, (ix+0Dh)
		ld		l, (ix+0Eh)
		call	j_call_character_hook
		jr		z, p06loc_7863

p06loc_785A:
		ld		l, (ix+7)
		ld		h, (ix+8)
		call	p06sub_7D1E

p06loc_7863:
		pop		af
		ld		(unk_89F5), a
		pop		bc
		ret
; End of function itemName

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p06sub_7728

p06loc_7869:
		ld		l, (ix+9)
		ld		h, (ix+0Ah)
		ld		a, (mcxCurApp)
		cp		49h ; 'I'
		jp		nz, p06loc_787C
		ld		a, (hl)
		xor		1
		jr		p06loc_78A8
; ---------------------------------------------------------------------------

p06loc_787C:
		ld		a, (ix+0Eh)
		cp		6Fh ; 'o'
		jr		nz, p06loc_7887
		ld		a, 0
		jr		p06loc_788D
; ---------------------------------------------------------------------------

p06loc_7887:
		cp		70h ; 'p'
		jr		nz, p06loc_7898
		ld		a, 6

p06loc_788D:
		ld		b, 19h
		push	hl
		ld		hl, y1LineType

p06loc_7893:
		ld		(hl), a
		inc		hl
		djnz	p06loc_7893
		pop		hl

p06loc_7898:
		ld		a, (hl)
		and		(ix+0Ch)
		cp		(ix+0Bh)
		ret		z
		ld		a, (ix+0Ch)
		cpl
		and		(hl)
		or		(ix+0Bh)

p06loc_78A8:
		ld		(hl), a
		bit		6, (ix+6)
		call	nz, p06sub_759E
		bit		1, (iy+19h)
		call	nz, Page06_366F
		bit		7, (ix+6)
		ret		z
		set		smarter_test, (iy+smartFlags)
		jp		SetGraphDraw
; END OF FUNCTION CHUNK	FOR p06sub_7728

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


p06sub_78C3:
		call	j_ConvKeyToTok
		ld		hl, 1
		ld		(OP1), hl
		ld		hl, OP1M
		ld		a, d
		or		a
		jr		z, p06sub_78DB
		call	p06sub_78EA
		ld		a, 2
		ld		(OP1), a
; End of function p06sub_78C3


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


p06sub_78DB:
		ld		a, e
		ld		(hl), a
		ld		hl, OP1
		ld		a, 5
		call	rclToQueue
		set		enableQueue, (iy+rclFlag)
		ret
; End of function p06sub_78DB


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


p06sub_78EA:
		ld		(hl), a
		inc		hl
		ret
; End of function p06sub_78EA

p06loc_78ED:
		ret		c
		ret

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


p06sub_78EF:
		call	p06sub_7D1E
		ld		hl, curRow
		inc		(hl)
		sub		a
		inc		hl
		ld		(hl), a
		ret
; End of function p06sub_78EF

p06loc_78FA:
		ld		c, 0
		jp		JForceCmd
p06loc_78FF:
		.db		1
		.db		0
		.db		0
		.db		3
		.db		0
		.db		0
		.db		6
		.dw		aNormal
		.dw		89FAh
		.db		0
		.db		3
		.db		0FEh	; �
		.db		4Fh	; O
		.db		2
		.db		0
		.db		1
		.db		3
		.db		0
		.db		7
		.db		3
		.dw		aSci
		.dw		89FAh
		.db		1
		.db		3
		.db		0FEh	; �
		.db		50h	; P
		.db		2
		.db		1
		.db		2
		.db		3
		.db		0
		.db		0Bh
		.db		3
		.dw		aEng
		.dw		89FAh
		.db		3
		.db		3
		.db		0FEh	; �
		.db		51h	; Q
		.db		4
		.db		3
		.db		0
		.db		0Eh
		.db		1
		.db		0
		.db		5
		.dw		aFloat
		.dw		fmtDigits
		.db		0FFh
		.db		0FFh
		.db		0FEh	; �
		.db		52h	; R
		.db		5
		.db		3
		.db		0
		.db		0Eh
		.db		1
		.db		6
		.db		1
		.dw		a0_06
		.dw		fmtDigits
		.db		0
		.db		0FFh
		.db		8Eh	; �
		.db		0
		.db		6
		.db		4
		.db		0
		.db		0Eh
		.db		1
		.db		7
		.db		1
		.dw		a1_06
		.dw		fmtDigits
		.db		1
		.db		0FFh
		.db		8Fh	; �
		.db		0
		.db		7
		.db		5
		.db		0
		.db		0Eh
		.db		1
		.db		8
		.db		1
		.dw		a2_06
		.dw		fmtDigits
		.db		2
		.db		0FFh
		.db		90h	; �
		.db		0
		.db		8
		.db		6
		.db		0
		.db		0Eh
		.db		1
		.db		9
		.db		1
		.dw		a3_06
		.dw		fmtDigits
		.db		3
		.db		0FFh
		.db		91h	; �
		.db		0
		.db		9
		.db		7
		.db		0
		.db		0Eh
		.db		1
		.db		0Ah
		.db		1
		.dw		a4_06
		.dw		fmtDigits
		.db		4
		.db		0FFh
		.db		92h	; �
		.db		0
		.db		0Ah
		.db		8
		.db		0
		.db		0Eh
		.db		1
		.db		0Bh
		.db		1
		.dw		a5_06
		.dw		fmtDigits
		.db		5
		.db		0FFh
		.db		93h	; �
		.db		0
		.db		0Bh
		.db		9
		.db		0
		.db		0Eh
		.db		1
		.db		0Ch
		.db		1
		.dw		a6_06
		.dw		fmtDigits
		.db		6
		.db		0FFh
		.db		94h	; �
		.db		0
		.db		0Ch
		.db		0Ah
		.db		0
		.db		0Eh
		.db		1
		.db		0Dh
		.db		1
		.dw		a7_06
		.dw		fmtDigits
		.db		7
		.db		0FFh
		.db		95h	; �
		.db		0
		.db		0Dh
		.db		0Bh
		.db		0
		.db		0Eh
		.db		1
		.db		0Eh
		.db		1
		.dw		a8_06
		.dw		fmtDigits
		.db		8
		.db		0FFh
		.db		96h	; �
		.db		0
		.db		0Dh
		.db		0Ch
		.db		0
		.db		0Eh
		.db		1
		.db		0Fh
		.db		1
		.dw		a9_06
		.dw		fmtDigits
		.db		9
		.db		0FFh
		.db		97h	; �
		.db		0
		.db		0Fh
		.db		0Eh
		.db		3
		.db		10h
		.db		2
		.db		0
		.db		0C6h	; �
		.dw		aRadian
		.dw		89F0h
		.db		0
		.db		4
		.db		0FEh	; �
		.db		4Dh	; M
		.db		0Fh
		.db		0Eh
		.db		3
		.db		10h
		.db		2
		.db		7
		.db		0C6h	; �
		.dw		aDegree
		.dw		89F0h
		.db		4
		.db		4
		.db		0FEh	; �
		.db		4Eh	; N
		.db		11h
		.db		10h
		.db		0Eh
		.db		14h
		.db		3
		.db		0
		.db		84h	; �
		.dw		aFunc
		.dw		89F2h
		.db		10h
		.db		0F0h	; �
		.db		0FEh	; �
		.db		56h	; V
		.db		12h
		.db		10h
		.db		0Eh
		.db		14h
		.db		3
		.db		5
		.db		83h	; �
		.dw		aPar
		.dw		89F2h
		.db		40h	; @
		.db		0F0h	; �
		.db		0FEh	; �
		.db		57h	; W
		.db		13h
		.db		11h
		.db		0Eh
		.db		14h
		.db		3
		.db		9
		.db		83h	; �
		.dw		aPol
		.dw		89F2h
		.db		20h
		.db		0F0h	; �
		.db		0FEh	; �
		.db		58h	; X
		.db		13h
		.db		12h
		.db		0Eh
		.db		14h
		.db		3
		.db		0Dh
		.db		83h	; �
		.dw		aSeq
		.dw		89F2h
		.db		80h	; �
		.db		0F0h	; �
		.db		0FEh	; �
		.db		59h	; Y
		.db		15h
		.db		14h
		.db		10h
		.db		16h
		.db		4
		.db		0
		.db		89h	; 	
		.dw		aConnected
		.dw		89F4h
		.db		0
		.db		1
		.db		0FEh	; �
		.db		6Fh	; o
		.db		15h
		.db		14h
		.db		10h
		.db		16h
		.db		4
		.db		0Ah
		.db		83h	; �
		.dw		aDot
		.dw		89F4h
		.db		1
		.db		1
		.db		0FEh	; �
		.db		70h	; p
		.db		17h
		.db		16h
		.db		14h
		.db		18h
		.db		5
		.db		0
		.db		8Ah	; 
		.dw		aSequential
		.dw		89F4h
		.db		0
		.db		2
		.db		0FEh	; �
		.db		69h	; i
		.db		17h
		.db		16h
		.db		14h
		.db		18h
		.db		5
		.db		0Bh
		.db		85h	; �
		.dw		aSimul
		.dw		89F4h
		.db		2
		.db		2
		.db		0FEh	; �
		.db		6Ah	; j
		.db		19h
		.db		18h
		.db		16h
		.db		1Bh
		.db		6
		.db		0
		.db		84h	; �
		.dw		aReal
		.dw		89FAh
		.db		20h
		.db		0E0h	; �
		.db		0FEh	; �
		.db		0ACh	; 
		.db		1Ah
		.db		18h
		.db		16h
		.db		1Bh
		.db		6
		.db		5
		.db		84h	; �
		.dw		aAB
		.dw		89FAh
		.db		40h	; @
		.db		0E0h	; �
		.db		0FEh	; �
		.db		0AEh	; �
		.db		1Ah
		.db		19h
		.db		16h
		.db		1Bh
		.db		6
		.db		0Ah
		.db		85h	; �
		.dw		arMode
		.dw		89FAh
		.db		80h	; �
		.db		0E0h	; �
		.db		0FEh	; �
		.db		0ADh	; 
		.db		1Ch
		.db		1Bh
		.db		18h
		.db		1Bh
		.db		7
		.db		0
		.db		84h	; �
		.dw		aFull
		.dw		8A04h
		.db		0
		.db		3
		.db		0FEh	; �
		.db		55h	; U
		.db		1Dh
		.db		1Bh
		.db		18h
		.db		1Ch
		.db		7
		.db		5
		.db		85h	; �
		.dw		aHoriz
		.dw		8A04h
		.db		1
		.db		3
		.db		0FEh	; �
		.db		54h	; T
		.db		1Dh
		.db		1Ch
		.db		18h
		.db		1Dh
		.db		7
		.db		0Bh
		.db		83h	; �
		.dw		aGT
		.dw		8A04h
		.db		2
		.db		3
		.db		0FEh	; �
		.db		0FBh	; �
p06loc_7AC1:
		.db		1
		.db		0
		.db		0
		.db		2
		.db		0
		.db		0
		.db		6
		.dw		aRectgc
		.dw		89F4h
		.db		0
		.db		8
		.db		0FEh
		.db		6Ch
		.db		1
		.db		0
		.db		1
		.db		2
		.db		0
		.db		7
		.db		7
		.dw		aPolargc
		.dw		89F4h
		.db		8
		.db		8
		.db		0FEh	; �
		.db		6Bh	; k
		.db		3
		.db		2
		.db		0
		.db		4
		.db		1
		.db		0
		.db		7
		.dw		aCoordon
		.dw		89F4h
		.db		0
		.db		10h
		.db		0FEh	; �
		.db		6Dh	; m
		.db		3
		.db		2
		.db		0
		.db		4
		.db		1
		.db		8
		.db		8
		.dw		aCoordoff
		.dw		89F4h
		.db		10h
		.db		10h
		.db		0FEh	; �
		.db		6Eh	; n
		.db		5
		.db		4
		.db		2
		.db		6
		.db		2
		.db		0
		.db		87h	; �
		.dw		aGridoff
		.dw		89F4h
		.db		0
		.db		4
		.db		0FEh	; �
		.db		74h	; t
		.db		5
		.db		4
		.db		2
		.db		6
		.db		2
		.db		8
		.db		86h	; �
		.dw		aGridon
		.dw		89F4h
		.db		4
		.db		4
		.db		0FEh	; �
		.db		73h	; s
		.db		7
		.db		6
		.db		4
		.db		8
		.db		3
		.db		0
		.db		86h	; �
		.dw		aAxeson
		.dw		89F4h
		.db		0
		.db		20h
		.db		0FEh	; �
		.db		71h	; q
		.db		7
		.db		6
		.db		4
		.db		8
		.db		3
		.db		7
		.db		87h	; �
		.dw		aAxesoff
		.dw		89F4h
		.db		20h
		.db		20h
		.db		0FEh	; �
		.db		72h	; r
		.db		9
		.db		8
		.db		6
		.db		0Ah
		.db		4
		.db		0
		.db		8
		.dw		aLabeloff
		.dw		89F4h
		.db		0
		.db		40h	; @
		.db		0FEh	; �
		.db		76h	; v
		.db		9
		.db		8
		.db		6
		.db		0Ah
		.db		4
		.db		9
		.db		7
		.dw		aLabelon
		.dw		89F4h
		.db		40h	; @
		.db		40h	; @
		.db		0FEh	; �
		.db		75h	; u
		.db		0Bh
		.db		0Ah
		.db		8
		.db		0Ah
		.db		5
		.db		0
		.db		6
		.dw		aExpron
		.dw		8A08h
		.db		0
		.db		1
		.db		0FEh	; �
		.db		0B5h	; �
		.db		0Bh
		.db		0Ah
		.db		8
		.db		0Bh
		.db		5
		.db		7
		.db		7
		.dw		aExproff
		.dw		8A08h
		.db		1
		.db		1
		.db		0FEh	; �
		.db		0B6h	; �
p06loc_7B75:
		.db		1
		.db		0
		.db		0
		.db		5
		.db		0
		.db		0
		.db		0C4h	; �
		.dw		aTime
		.dw		89FFh
		.db		0
		.db		1Dh
		.db		0FEh	; �
		.db		0F0h	; �
		.db		2
		.db		0
		.db		1
		.db		5
		.db		0
		.db		4
		.db		0C3h	; �
		.dw		aWeb
		.dw		89FFh
		.db		1
		.db		1Dh
		.db		0FEh	; �
		.db		0EFh	; �
		.db		3
		.db		1
		.db		2
		.db		5
		.db		0
		.db		8
		.db		0C2h	; �
		.dw		aUV_06
		.dw		89FFh
		.db		4
		.db		1Dh
		.db		0FEh	; �
		.db		0AFh	; �
		.db		4
		.db		2
		.db		3
		.db		5
		.db		0
		.db		0Bh
		.db		0C2h	; �
		.dw		aVW_06
		.dw		89FFh
		.db		8
		.db		1Dh
		.db		0FEh	; �
		.db		0B0h	; �
		.db		4
		.db		3
		.db		4
		.db		5
		.db		0
		.db		0Eh
		.db		0C2h	; �
		.dw		aUW_06
		.dw		89FFh
		.db		10h
		.db		1Dh
		.db		0FEh	; �
		.db		0B1h	; �
		.db		6
		.db		5
		.db		0
		.db		7
		.db		1
		.db		0
		.db		6
		.dw		aRectgc
		.dw		89F4h
		.db		0
		.db		8
		.db		0FEh	; �
		.db		6Ch	; l
		.db		6
		.db		5
		.db		0
		.db		7
		.db		1
		.db		7
		.db		7
		.dw		aPolargc
		.dw		89F4h
		.db		8
		.db		8
		.db		0FEh	; �
		.db		6Bh	; k
		.db		8
		.db		7
		.db		5
		.db		9
		.db		2
		.db		0
		.db		7
		.dw		aCoordon
		.dw		89F4h
		.db		0
		.db		10h
		.db		0FEh	; �
		.db		6Dh	; m
		.db		8
		.db		7
		.db		5
		.db		9
		.db		2
		.db		8
		.db		8
		.dw		aCoordoff
		.dw		89F4h
		.db		10h
		.db		10h
		.db		0FEh	; �
		.db		6Eh	; n
		.db		0Ah
		.db		9
		.db		7
		.db		0Bh
		.db		3
		.db		0
		.db		87h	; �
		.dw		aGridoff
		.dw		89F4h
		.db		0
		.db		4
		.db		0FEh	; �
		.db		74h	; t
		.db		0Ah
		.db		9
		.db		7
		.db		0Bh
		.db		3
		.db		8
		.db		86h	; �
		.dw		aGridon
		.dw		89F4h
		.db		4
		.db		4
		.db		0FEh	; �
		.db		73h	; s
		.db		0Ch
		.db		0Bh
		.db		9
		.db		0Dh
		.db		4
		.db		0
		.db		86h	; �
		.dw		aAxeson
		.dw		89F4h
		.db		0
		.db		20h
		.db		0FEh	; �
		.db		71h	; q
		.db		0Ch
		.db		0Bh
		.db		9
		.db		0Dh
		.db		4
		.db		7
		.db		87h	; �
		.dw		aAxesoff
		.dw		89F4h
		.db		20h
		.db		20h
		.db		0FEh	; �
		.db		72h	; r
		.db		0Eh
		.db		0Dh
		.db		0Bh
		.db		0Fh
		.db		5
		.db		0
		.db		8
		.dw		aLabeloff
		.dw		89F4h
		.db		0
		.db		40h	; @
		.db		0FEh	; �
		.db		76h	; v
		.db		0Eh
		.db		0Dh
		.db		0Bh
		.db		0Fh
		.db		5
		.db		9
		.db		7
		.dw		aLabelon
		.dw		89F4h
		.db		40h	; @
		.db		40h	; @
		.db		0FEh	; �
		.db		75h	; u
		.db		10h
		.db		0Fh
		.db		0Dh
		.db		0Fh
		.db		6
		.db		0
		.db		6
		.dw		aExpron
		.dw		8A08h
		.db		0
		.db		1
		.db		0FEh	; �
		.db		0B5h	; �
		.db		10h
		.db		0Fh
		.db		0Dh
		.db		10h
		.db		6
		.db		7
		.db		7
		.dw		aExproff
		.dw		8A08h
		.db		1
		.db		1
		.db		0FEh	; �
		.db		0B6h	; �
p06loc_7C74:
		.db		1
		.db		0
		.db		0
		.db		2
		.db		1
		.db		8
		.db		4
		.dw		aAuto
		.dw		8A03h
		.db		0
		.db		10h
		.db		0FEh	; �
		.db		5Ah	; Z
		.db		1
		.db		0
		.db		1
		.db		2
		.db		1
		.db		0Dh
		.db		3
		.dw		aAsk
		.dw		8A03h
		.db		10h
		.db		10h
		.db		0FEh	; �
		.db		5Bh	; [
		.db		3
		.db		2
		.db		0
		.db		2
		.db		2
		.db		8
		.db		4
		.dw		aAuto
		.dw		8A03h
		.db		0
		.db		20h
		.db		0FEh	; �
		.db		5Ch	; \
		.db		3
		.db		2
		.db		0
		.db		3
		.db		2
		.db		0Dh
		.db		3
		.dw		aAsk
		.dw		8A03h
		.db		20h
		.db		20h
		.db		0FEh	; �
		.db		5Dh	; ]
p06loc_7CB0:
		.db		1
		.db		0
		.db		0FEh	; �
		.db		0
		.db		7
		.db		5
		.db		83h	; �
		.dw		aEnd
		.dw		8A08h
		.db		0
		.db		8
		.db		0FEh	; �
		.db		0B2h	; �
		.db		1
		.db		0
		.db		0FEh	; �
		.db		1
		.db		7
		.db		9
		.db		85h	; �
		.dw		aBegin
		.dw		8A08h
		.db		8
		.db		8
		.db		0FEh	; �
		.db		0B3h	; �
p06loc_7CCE:
		.db		1
		.db		0
		.db		0FEh	; �
		.db		2
		.db		3
		.db		8
		.db		4
		.dw		aAuto
		.dw		8A03h
		.db		0
		.db		10h
		.db		0FEh	; �
		.db		5Ah	; Z
		.db		1
		.db		0
		.db		0FEh	; �
		.db		2
		.db		3
		.db		0Dh
		.db		3
		.dw		aAsk
		.dw		8A03h
		.db		10h
		.db		10h
		.db		0FEh	; �
		.db		5Bh	; [
		.db		3
		.db		2
		.db		0
		.db		2
		.db		4
		.db		8
		.db		4
		.dw		aAuto
		.dw		8A03h
		.db		0
		.db		20h
		.db		0FEh	; �
		.db		5Ch	; \
		.db		3
		.db		2
		.db		0
		.db		3
		.db		4
		.db		0Dh
		.db		3
		.dw		aAsk
		.dw		8A03h
		.db		20h
		.db		20h
		.db		0FEh	; �
		.db		5Dh	; ]
; ---------------------------------------------------------------------------

Page06_36E7:
		ld		(curRow), a
		ld		a, 1
		ld		(curRow+1), a
		ld		hl, p06loc_7E40
		ld		a, 2
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook

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


p06sub_7D1E:
		; itemName+6Ep	...
		push	bc
		push	af
		ld		a, (winTop+1)
		ld		b, a

p06loc_7D24:
		ld		a, (hl)
		inc		hl
		or		a
		scf
		jr		z, p06loc_7D33
		call	j_PutC
		ld		a, (curRow)
		cp		b
		jr		c, p06loc_7D24

p06loc_7D33:
		pop		bc
		ld		a, b
		pop		bc
		ret
; End of function p06sub_7D1E

; ---------------------------------------------------------------------------
a0_06:		.asc '0',0
a1_06:		.asc '1',0
a2_06:		.asc '2',0
a3_06:		.asc '3',0
a4_06:		.asc '4',0
a5_06:		.asc '5',0
a6_06:		.asc '6',0
a7_06:		.asc '7',0
a8_06:		.asc '8',0
a9_06:		.asc '9',0
aAuto:		.asc 'Auto',0
aAxesoff:	.asc 'AxesOff',0
aAxeson:	.asc 'AxesOn',0
aCoordoff:	.asc 'CoordOff',0
aCoordon:	.asc 'CoordOn',0
aDegree:	.asc 'Degree',0
aDot:		.asc 'Dot',0
aConnected:	.asc 'Connected',0
aEng:		.asc 'Eng',0
aFloat:		.asc 'Float',0
aFunc:		.asc 'Func',0
aGridoff:	.asc 'GridOff',0
aGridon:	.asc 'GridOn',0
aLabeloff:	.asc 'LabelOff',0
aLabelon:	.asc 'LabelOn',0
aExproff:	.asc 'ExprOff',0
aExpron:	.asc 'ExprOn',0
aSci:		.asc 'Sci',0
aSequential:	.asc 'Sequential',0
aSimul:		.asc 'Simul',0
aFull:		.asc 'Full',0
aHoriz:		.asc 'Horiz',0
aGT:		.asc 'G-T',0
aWeb:		.asc 'Web',0
aUV_06:	.db		2
		.db		3
		.db		0
aVW_06:	.db		3
		.db		4
		.db		0
aUW_06:	.db		2
		.db		4
		.db		0
aRectgc:	.asc 'RectGC',0
aAB:		.asc 'a+b',0D7h,0
arMode:
		.db		72h	; r
		.db		0DBh	; �
		.db		5Eh	; ^
		.db		5Bh	; [
		.db		0D7h	; �
		.db		0
aSeq:		.asc 'Seq',0
aRadian:	.asc 'Radian',0
aAsk:		.asc 'Ask',0
aTime:		.asc 'Time',0
aPolargc:	.asc 'PolarGC',0
aBegin:		.asc 'BEGIN',0
aEnd:		.asc 'END',0
aPar:		.asc 'Par',0
aPol:		.asc 'Pol',0
p06loc_7E34:
aTableSetup:	.asc 'TABLE SETUP',0
p06loc_7E40:
aPmt:		.asc 'PMT:',0
p06loc_7E45:
aIndpnt:	.asc 'Indpnt:',0
p06loc_7E4D:
aDepend:	.asc 'Depend:',0
p06loc_7E55:
		.db		0Ch
		.db		34h	; 4
		.db		30h	; 0
		.db		2Fh	; /
		.db		2Eh	; .
p06loc_7E5A:
		.db		0
		.db		40h	; @
		.db		60h	; `
		.db		5Fh	; _
		.db		5Eh	; ^
p06loc_7E5F:
		.db		20h
		.db		20h
		.db		60h	; `
		.db		5Fh	; _
		.db		5Eh	; ^

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


SetNorm_Vals:
		ld		hl, p06loc_7E5A
		jr		p06sub_7E6C
; End of function SetNorm_Vals


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


SetYOffset:
		ld		hl, p06loc_7E55
; End of function SetYOffset


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


p06sub_7E6C:
		; SetNorm_Vals+3j
		ld		de, YOffset
		jp		page0_118B
; End of function p06sub_7E6C

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

getBCOffsetIX:
		push	ix
		add		ix, bc
		ld		a, (ix+0)
		pop		ix
		ret
; ---------------------------------------------------------------------------
p06loc_7E7C:
		.db		4
		.db		2
		.db		1
		.db		3
		.db		0
		.db		0
		.db		0
		.db		0
		.db		5
		.db		80h	; �
		.db		81h	; �
		.db		82h	; �
		.db		83h	; �
		.db		84h	; �
		.db		9
		.db		0
		.db		8Ch	; 
		.db		91h	; �
		.db		94h	; �
		.db		97h	; �
		.db		86h	; �
		.db		0BBh	; �
		.db		35h	; 5
		.db		0
		.db		8Dh	; 

		.db		90h	; �
		.db		93h	; �
		.db		96h	; �
		.db		85h	; �
		.db		0B9h	; �
		.db		2Dh	; -
		.db		31h	; 1
		.db		8Eh	; �
		.db		8Fh	; �
		.db		92h	; �
		.db		95h	; �
		.db		8Bh	; 
		.db		0B7h	; �
		.db		2Ch	; ,
		.db		0B4h	; �
		.db		0
		.db		8Ah	; 

		.db		0BFh	; �
		.db		0C1h	; �
		.db		0BDh	; �
		.db		0B6h	; �
		.db		32h	; 2
		.db		0
		.db		44h	; D
		.db		5Ah	; Z
		.db		2Eh	; .
		.db		48h	; H
		.db		49h	; I
		.db		0
		.db		45h	; E
		.db		0Ah
		.db		4
		.db		0Eh
		.db		0Fh
		.db		3
		.db		0
		.db		0
		.db		0
		.db		0
		.db		0Dh
		.db		36h	; 6
		.db		88h	; �
		.db		87h	; �
		.db		0EFh	; �
		.db		0B5h	; �
		.db		9
		.db		0
		.db		0C5h	; �
		.db		0F5h	; �
		.db		0F8h	; �
		.db		0FBh	; �
		.db		0EDh	; 

		.db		0BCh	; �
		.db		38h	; 8
		.db		0
		.db		0EEh	; �
		.db		0F4h	; �
		.db		0F7h	; �
		.db		0FAh	; �
		.db		0ECh	; 
		.db		0BAh	; �
		.db		2Fh	; /
		.db		3Ah	; :
		.db		3Eh	; >
		.db		0F3h	; �
		.db		0F6h	; �
		.db		0F9h	; �
		.db		98h	; �
		.db		0B8h	; �
		.db		39h	; 9
		.db		41h	; A
		.db		0
		.db		0Ch
		.db		0C0h	; �
		.db		0C2h	; �
		.db		0BEh	; �
		.db		37h	; 7
		.db		33h	; 3
		.db		0
		.db		4Ah	; J
		.db		3Bh	; ;
		.db		57h	; W
		.db		4Bh	; K
		.db		30h	; 0
		.db		0
		.db		40h	; @
		.db		0Bh
		.db		8
		.db		2
		.db		1
		.db		7
		.db		0
		.db		0
		.db		0
		.db		0
		.db		6
		.db		0CBh	; 
		.db		0B0h	; �
		.db		0ABh	; 
		.db		0A6h	; �
		.db		0A1h	; �
		.db		9
		.db		0
		.db		0CAh	; 

		.db		0CCh	; 
		.db		0AFh	; �
		.db		0AAh	; 

		.db		0A5h	; �
		.db		0A0h	; �
		.db		35h	; 5
		.db		0
		.db		0C6h	; �
		.db		0B3h	; �
		.db		0AEh	; �
		.db		0A9h	; 	
		.db		0A4h	; �
		.db		9Fh	; �
		.db		9Ch	; �
		.db		31h	; 1
		.db		99h	; �
		.db		0B2h	; �
		.db		0ADh	; 

		.db		0A8h	; �
		.db		0A3h	; �
		.db		9Eh	; �
		.db		9Bh	; �
		.db		0B4h	; �
		.db		0
		.db		0B1h	; �
		.db		0ACh	; 
		.db		0A7h	; �
		.db		0A2h	; �
		.db		9Dh	; �
		.db		9Ah	; �
		.db		0
		.db		44h	; D
		.db		5Ah	; Z
		.db		2Eh	; .
		.db		48h	; H
		.db		49h	; I
		.db		0
		.db		45h	; E
		.db		0Ah
		.db		8
		.db		2
		.db		1
		.db		7
		.db		0
		.db		0
		.db		0
		.db		0
		.db		6
		.db		0CBh	; 
		.db		0F8h	; �
		.db		0F3h	; �
		.db		0EEh	; �
		.db		0E9h	; 	
		.db		9
		.db		0
		.db		0CAh	; 

		.db		0CCh	; 
		.db		0F7h	; �
		.db		0F2h	; �
		.db		0EDh	; 

		.db		0E8h	; �
		.db		35h	; 5
		.db		0
		.db		0C6h	; �
		.db		0FBh	; �
		.db		0F6h	; �
		.db		0F1h	; �
		.db		0ECh	; 
		.db		0E7h	; �
		.db		0E4h	; �
		.db		31h	; 1
		.db		99h	; �
		.db		0FAh	; �
		.db		0F5h	; �
		.db		0F0h	; �
		.db		0EBh	; 
		.db		0E6h	; �
		.db		0E3h	; �
		.db		0B4h	; �
		.db		0
		.db		0F9h	; �
		.db		0F4h	; �
		.db		0EFh	; �
		.db		0EAh	; 

		.db		0E5h	; �
		.db		0E2h	; �
		.db		0
		.db		44h	; D
		.db		5Ah	; Z
		.db		2Eh	; .
		.db		48h	; H
		.db		49h	; I
		.db		0
		.db		45h	; E
		.db		0Ah