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

p04sub_4000:
		; BCALL_4D92+4Ep ...
		ld		h, 0
		ld		a, (unk_966C)
		jp		DivHLByA
; End of function p04sub_4000


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


HorizontalLine:
		; p04sub_6431+Ap
		ld		bc, (curGY2)
		ld		e, c
		ld		b, 0
		push	af
		ld		a, (pixWide_m_2)
		ld		d, a
		pop		af
		jr		DarkLine
; End of function HorizontalLine


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


p04sub_4017:
		; p04sub_6440+Ap ...
		ld		bc, (curGY2)
; End of function p04sub_4017


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


VerticalLine:
		push	af
		ld		a, (lcdTallP)
		ld		e, a
		pop		af
		dec		e
		ld		d, b
		ld		c, 1
; End of function VerticalLine


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


DarkLine:
		; ForceGraphKeypress+81Dp ...
		ld		h, 1
		jr		ILine

ILine:
		push	af
		ld		a, 1
		bit		drawingHookActive, (iy+hookflags3)
		call	nz, Page0Call_3483
		jr		z, p04loc_4038
		pop		af
		ret
; ---------------------------------------------------------------------------

ILineNoHook:
		push	af

p04loc_4038:
		push	bc
		ld		(unk_9315), bc
		pop		ix
		push	bc
		push	de
		push	hl
		ld		a, e
		sub		c
		jr		nc, p04loc_404A
		neg
		set		4, h

p04loc_404A:
		ld		l, a
		ld		a, d
		sub		b
		jr		nc, p04loc_4053
		neg
		set		5, h

p04loc_4053:
		ld		e, a
		ld		b, h
		ld		a, l
		cp		e
		jr		c, p04loc_405D
		set		6, b
		ld		l, e
		ld		e, a

p04loc_405D:
		xor		a
		ld		d, a
		ld		h, a
		push	hl
		sbc		hl, de
		add		hl, hl
		ex		(sp), hl
		add		hl, hl
		push	hl
		sbc		hl, de
		push	ix
		inc		e
		ld		a, b
		and		0Fh
		ld		d, a
		ld		a, b
		pop		bc
		ld		ix, 0
		add		ix, sp

p04loc_4078:
		call	IPoint
		push	bc
		bit		7, h
		jr		z, p04loc_4091
		ld		c, (ix+0)
		ld		b, (ix+1)
		add		hl, bc
		pop		bc
		bit		6, a
		jr		nz, p04loc_409C
		call	p04sub_4314
		jr		p04loc_40A3
; ---------------------------------------------------------------------------

p04loc_4091:
		ld		c, (ix+2)
		ld		b, (ix+3)
		add		hl, bc
		pop		bc
		call	p04sub_4314

p04loc_409C:
		inc		c
		bit		4, a
		jr		z, p04loc_40A3
		dec		c
		dec		c

p04loc_40A3:
		dec		e
		jr		nz, p04loc_4078
; End of function DarkLine

; START	OF FUNCTION CHUNK FOR p04sub_41F1

p04loc_40A6:
		pop		hl
		pop		hl

p04loc_40A8:
		; p04sub_41F1:p04loc_4297j ...
		pop		hl
		pop		de
		pop		bc
		pop		af
		ret
; END OF FUNCTION CHUNK	FOR p04sub_41F1

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


BCALL_4D92:
		ld		hl, 9668h
		ld		a, (hl)
		or		a
		jr		nz, p04loc_40EB
		bit		7, (iy+1Eh)
		jr		nz, p04loc_40BF
		ld		a, 2
		ld		(unk_966C), a

p04loc_40BF:
		ld		l, b
		call	p04sub_4000
		ld		e, a
		ld		a, (unk_966C)
		dec		a
		cp		e
		ret		nz
		ld		a, 1
		ld		(unk_966C), a
		xor		a

p04loc_40D0:
		; BCALL_4D92+5Ej ...
		ld		hl, 9775h
		bit		0, (hl)
		jr		z, p04loc_40D9
		neg

p04loc_40D9:
		add		a, c
		ret		z
		ld		c, a
		ld		hl, 966Dh
		cp		(hl)
		ret		nc
		ld		d, 1
		call	p04sub_41F1
		ld		a, (unk_966C)
		jr		p04loc_40D0
; ---------------------------------------------------------------------------

p04loc_40EB:
		cp		2
		jr		nc, p04loc_4115
		bit		7, (iy+1Eh)
		jr		nz, p04loc_40FA
		ld		a, 2
		ld		(unk_966C), a

p04loc_40FA:
		ld		l, c
		call	p04sub_4000
		ld		hl, 9775h
		bit		0, (hl)
		jr		nz, p04loc_410D
		ld		e, a
		ld		a, (unk_966C)
		dec		a
		sub		e
		jr		p04loc_40D0
; ---------------------------------------------------------------------------

p04loc_410D:
		push	af
		ld		a, (unk_966C)
		ld		e, a
		pop		af
		jr		p04loc_40D0
; ---------------------------------------------------------------------------

p04loc_4115:
		push	af
		bit		7, (iy+1Eh)
		jr		nz, p04loc_4121
		ld		a, 3
		ld		(unk_966C), a

p04loc_4121:
		ld		l, c
		call	p04sub_4000
		push	af
		ld		l, b
		call	p04sub_4000
		pop		de
		ld		e, a
		pop		af
		jr		z, p04loc_4135
		ld		a, e
		sub		d
		jr		nc, p04loc_4143
		jr		p04loc_413E
; ---------------------------------------------------------------------------

p04loc_4135:
		ld		a, e
		ld		a, (unk_966C)
		dec		a
		sub		e
		sub		d
		jr		nc, p04loc_4143

p04loc_413E:
		ld		e, a
		ld		a, (unk_966C)
		add		a, e

p04loc_4143:
		; BCALL_4D92+8Fj
		ld		hl, 9775h
		bit		0, (hl)
		jr		z, p04loc_40D0
		or		a
		jr		z, p04loc_40D0
		ld		e, a
		ld		a, (unk_966C)
		sub		e
		jp		p04loc_40D0
; End of function BCALL_4D92


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


PointOn:
		; Axes+145p ...
		ld		d, 1
; End of function PointOn


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


IPoint:
		; CPoint+1Dp ...
		push	af
		ld		a, 0
		bit		drawingHookActive, (iy+hookflags3)
		call	nz, Page0Call_3483
		jr		z, p04loc_4166
		pop		af
		ret
; ---------------------------------------------------------------------------

IPointNoGraphicsHook:
		push	af

p04loc_4166:
		push	bc
		bit		g_style_active, (iy+sGrFlags)
		jp		z, p04loc_41F3
		ld		a, (unk_9775)
		cp		1
		jr		z, p04loc_418A
		jp		c, p04loc_41F3
		cp		4
		jr		nc, p04loc_41F3
		set		6, (iy+19h)
		push	hl
		push	de
		call	BCALL_4D92
		pop		de
		pop		hl
		pop		bc
		jr		p04loc_41F2
; ---------------------------------------------------------------------------

p04loc_418A:
		call	p04sub_41F1
		push	hl
		push	bc
		ld		a, c
		ld		bc, (unk_9315)
		cp		c
		jr		z, p04loc_41C0
		jr		c, p04loc_41A9
		inc		b
		call	p04sub_41F1
		dec		b
		inc		c
		dec		c
		pop		af
		cp		b
		jr		z, p04loc_41D2
		jr		c, p04loc_41D3
		dec		c
		jr		p04loc_41D4
; ---------------------------------------------------------------------------

p04loc_41A9:
		inc		b
		call	p04sub_41F1
		dec		b
		dec		c
		call	p04sub_41F1
		pop		af
		cp		b
		jr		nz, p04loc_41D7

p04loc_41B6:
		inc		b
		jr		p04loc_41D4
; ---------------------------------------------------------------------------
		dec		b
		call	p04sub_41F1
		inc		b
		jr		p04loc_41B6
; ---------------------------------------------------------------------------

p04loc_41C0:
		pop		af
		dec		c
		cp		b
		jr		z, p04loc_41D7
		push	af
		call	p04sub_41F1
		pop		af
		jr		c, p04loc_41CF
		inc		b
		jr		p04loc_41D4
; ---------------------------------------------------------------------------

p04loc_41CF:
		dec		b
		jr		p04loc_41D4
; ---------------------------------------------------------------------------

p04loc_41D2:
		inc		b

p04loc_41D3:
		inc		c

p04loc_41D4:
		call	p04sub_41F1

p04loc_41D7:
		pop		hl
		pop		bc
		ld		(unk_9315), bc
		pop		af
		ret
; End of function IPoint

; ---------------------------------------------------------------------------
		ld		a, (ix+0)
		or		(ix+1)
		jr		nz, p04loc_41EA
		dec		c
		jr		p04loc_41EB
; ---------------------------------------------------------------------------

p04loc_41EA:
		inc		b

p04loc_41EB:
		call	p04sub_41F1
		pop		bc
		pop		af
		ret

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


p04sub_41F1:
		; IPoint:p04loc_418Ap ...



		push	af

p04loc_41F2:
		push	bc

p04loc_41F3:
		ld		a, (XOffset)
		add		a, b
		ld		b, a
		ld		a, (YOffset)
		add		a, c
		ld		c, a
		push	de
		push	hl
		bit		fullScrnDraw, (iy+apiFlg4)
		jr		z, p04loc_420A
		call	IBoundsFull
		jr		p04loc_420D
; ---------------------------------------------------------------------------

p04loc_420A:
		call	IBounds

p04loc_420D:
		jp		c, p04loc_40A8
		call	IOffset
		ld		b, d
		ld		c, a
		ex		de, hl
		ld		hl, appBackUpScreen
		add		hl, de
		push	hl
		bit		3, (iy+3Ch)
		jr		z, p04loc_4224
		push	hl
		jr		p04loc_4251
; ---------------------------------------------------------------------------

p04loc_4224:
		ld		hl, plotSScreen
		add		hl, de
		push	hl
		bit		bufferOnly, (iy+plotFlag3)
		jr		nz, p04loc_4251
		di
		ld		a, (curXRow)
		call	SetYUp
		call	lcd_busy
		out		(10h), a
		call	SetXUp
		ld		a, (curY)
		call	lcd_busy
		out		(10h), a
		call	j_sOK
		pop		hl
		push	hl
		bit		plotLoc, (iy+plotFlags)
		jr		nz, p04loc_4252

p04loc_4251:
		ld		a, (hl)

p04loc_4252:
		inc		b
		djnz	p04loc_4258

p04loc_4255:
		or		c
		jr		p04loc_425F
; ---------------------------------------------------------------------------

p04loc_4258:
		djnz	p04loc_425D

p04loc_425A:
		or		c
		jr		p04loc_4260
; ---------------------------------------------------------------------------

p04loc_425D:
		djnz	p04loc_429A

p04loc_425F:
		xor		c

p04loc_4260:
		bit		3, (iy+3Ch)
		jr		nz, p04loc_426C
		bit		bufferOnly, (iy+plotFlag3)
		jr		z, p04loc_4270

p04loc_426C:
		pop		hl
		ei
		jr		p04loc_428E
; ---------------------------------------------------------------------------

p04loc_4270:
		ld		h, a
		call	Bit_VertSplit
		jr		z, p04loc_4280
		ld		a, (curY)
		cp		25h ; '%'
		ld		a, h
		jr		nz, p04loc_4280
		or		1

p04loc_4280:
		call	lcd_busy
		out		(11h), a
		ld		a, h
		pop		hl
		ei
		bit		plotLoc, (iy+plotFlags)
		jr		nz, p04loc_428F

p04loc_428E:
		ld		(hl), a

p04loc_428F:
		pop		hl
		bit		2, (iy+3Ch)
		jr		z, p04loc_4297
		ld		(hl), a

p04loc_4297:
		jp		p04loc_40A8
; ---------------------------------------------------------------------------

p04loc_429A:
		dec		b
		jr		nz, p04loc_42A7
		ld		a, (hl)
		and		c
		ei
		pop		hl
		pop		hl
		pop		hl
		pop		hl
		pop		hl
		pop		hl
		ret
; ---------------------------------------------------------------------------

p04loc_42A7:
		dec		b
		jp		nz, p04loc_40A6
		ld		b, a
		ld		a, (hl)
		and		c
		ld		a, b
		jr		z, p04loc_4255
		jr		p04loc_425A
; End of function p04sub_41F1


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


IOffset:
		push	de
		ld		hl, p04loc_42E2
		ld		d, 0
		ld		a, b
		and		7
		ld		e, a
		add		hl, de
		ld		e, (hl)
		ld		h, d
		srl	b
		srl	b
		srl	b
		ld		a, b
		or		20h ; ' '
		ld		(curY), a
		ld		a, 3Fh ; '?'
		sub		c
		or		80h ; '�'
		ld		(curXRow), a
		and		7Fh ; ''
		add		a, a
		add		a, a
		ld		c, a
		ld		l, a
		add		hl, hl
		ld		a, e
		ld		e, c
		add		hl, de
		ld		e, b
		add		hl, de
		pop		de
		ret
; End of function IOffset

p04loc_42E2:
		.db		80h	; �
		.db		40h	; @
		.db		20h
		.db		10h
		.db		8
		.db		4
		.db		2
		.db		1

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


IBounds:
		; ForceGraphKeypress:p04loc_485Ap
		push	af
		push	hl
		ld		hl, (lcdTallP)
		dec		h
		ld		a, b
		cp		h
		jr		nc, p04loc_4300
		ld		a, c
		cp		40h ; '@'
		jr		nc, p04loc_4300
		or		a
		jr		z, p04loc_4300

p04loc_42FC:
		pop		hl
		pop		af
		or		a
		ret
; ---------------------------------------------------------------------------

p04loc_4300:
		pop		hl
		pop		af
		scf
		ret
; End of function IBounds


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


IBoundsFull:
		push	af
		push	hl
		ld		hl, (lcdTallP)
		ld		a, b
		cp		h
		jr		nc, p04loc_4300
		ld		a, c
		cp		40h ; '@'
		jr		nc, p04loc_4300
		jr		p04loc_42FC
; End of function IBoundsFull


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


p04sub_4314:
		inc		b
		bit		5, a
		ret		z
		dec		b
		dec		b
		ret
; End of function p04sub_4314


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


XYRNDBOTH:
		ld		hl, (FPS)
		add		hl, de
		push	hl
		call	XYRND
		pop		hl
		ret		nz
		ld		de, 0FFF7h
		add		hl, de
; End of function XYRNDBOTH


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


XYRND:
		bit		5, (hl)
		ret		nz
		push	hl
		rst		20h
		call	j_RndGuard
		ld		a, (OP1+1)
		cp		0E4h ; '�'
		jr		nc, p04loc_433E
		pop		de
		call	MovFrOP1
		xor		a
		ret
; ---------------------------------------------------------------------------

p04loc_433E:
		pop		hl
		set		5, (hl)
		inc		h
		ret
; End of function XYRND


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


CheckTOP:
		ld		hl, (FPS)
		ld		de, 0FFF7h
		add		hl, de
		ex		de, hl
		add		hl, de
		ex		de, hl

CheckXY:
		push	de
		push	hl
		ex		de, hl
		xor		a
		ld		de, Xmin
		call	Page04_3405
		sla	a
		sla	a
		ld		de, Ymin
		pop		hl
		call	Page04_3405
		pop		de
		ret
; End of function CheckTOP


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


Page04_3405:
		push	hl
		push	af
		push	de
		rst		20h
		pop		hl
		inc		de
		inc		de
		call	mov9B2
		push	hl
		call	cpop1op2
		jr		nc, p04loc_437A
		pop		hl
		pop		af
		or		2
		jr		p04loc_4388
; ---------------------------------------------------------------------------

p04loc_437A:
		rst		8
		pop		hl
		rst		20h
		call	cpop1op2
		jr		nc, p04loc_4387
		pop		af
		or		1
		jr		p04loc_4388
; ---------------------------------------------------------------------------

p04loc_4387:
		pop		af

p04loc_4388:
		; Page04_3405+21j
		pop		hl
		ret
; End of function Page04_3405

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR PLOTPT

DarkPnt:
		ld		a, 1
; END OF FUNCTION CHUNK	FOR PLOTPT

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


CPoint:
		push	af
		call	PUSHMCPLXO1
		pop		af

CPointS:
		push	af
		ld		de, 0FFF7h
		call	XYRNDBOTH
		jr		nz, p04loc_43AF
		call	CheckTOP
		and		0Fh
		jr		nz, p04loc_43AF
		call	WTOV
		pop		de
		ld		(unk_9315), bc
		call	IPoint
		jp		FPOPCPLX
; ---------------------------------------------------------------------------

p04loc_43AF:
		pop		hl
		jp		FPOPCPLX
; End of function CPoint


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


WTOV:
		push	hl
		call	XftoI
		pop		de
		push	af
		call	YftoI
		pop		bc
		ld		c, a
		ret
; End of function WTOV


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


VtoWHLDE:
		ld		hl, OP4
; End of function VtoWHLDE


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


p04sub_43C2:
		ld		de, OP1
; End of function p04sub_43C2


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


p04sub_43C5:
		push	de
		push	bc
		ld		a, c
		call	p04sub_43E1
		pop		af
		pop		hl
; End of function p04sub_43C5


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


Xitof:
		; p04sub_58BE+17Bp ...
		bit		7, (iy+17h)
		jr		z, p04loc_43D5
		neg

p04loc_43D5:
		ld		bc, 8E6Ah
		ld		de, deltaX
		push	hl
		ld		l, a
		ld		a, 0FFh
		jr		p04loc_43EA
; End of function Xitof


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


p04sub_43E1:
		ld		bc, Ymin
		ld		de, deltaY
		dec		a
		push	hl
		ld		l, a

p04loc_43EA:
		ld		h, 0

p04loc_43EC:
		push	bc
		push	af
		push	de
		call	j_SetXXXXOP2
		bit		7, (iy+17h)
		call	nz, InvOP2S
		pop		hl
		pop		af
		inc		a
		jr		nz, p04loc_4406
		push	hl
		ld		hl, 8E73h
		rst		20h
		rst		30h
		rst		8
		pop		hl

p04loc_4406:
		rst		20h
		call	FPMult
		call	j_RndGuard
		pop		hl
		call	page0_BEC
		call	CkValidNum
		pop		de
		jp		MovFrOP1
; End of function p04sub_43E1


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


p04sub_4418:
		push	hl
		ld		hl, (curInc)
		xor		a
		jr		p04loc_43EC
; End of function p04sub_4418


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


YftoI:
		ld		bc, Ymin
		ld		hl, shortY
		or		a
		call	p04sub_4432
		inc		a
		ret
; End of function YftoI


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


XftoI:
		ld		bc, 8E6Ah
		ld		hl, shortX
		scf
; End of function XftoI


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


p04sub_4432:
		push	af
		push	hl
		push	bc
		ex		de, hl
		rst		20h
		pop		hl
		call	page0_C25
		pop		hl
		call	page0_D19
		pop		af
		jr		nc, p04loc_4448

p04loc_4442:
		ld		hl, 8E73h
		call	page0_C25

p04loc_4448:
		call	p04sub_4469
		call	j_ConvOP1
		ret
; End of function p04sub_4432


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


p04sub_444F:
		ld		hl, 8E6Ah
		call	page0_C25
		ld		hl, shortX
		call	page0_D19
		ld		hl, XresO
		call	page0_EC1
		call	int
		call	FPMult
		jr		p04loc_4442
; End of function p04sub_444F


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


p04sub_4469:
		ld		a, (OP1+1)
		sub		7Fh ; ''
		jr		c, p04loc_4497
		jr		z, p04loc_4490
		ld		b, 2
		ld		hl, 847Bh
		cp		2
		ld		a, 50h ; 'P'
		jr		z, p04loc_4481
		ld		a, 5
		dec		b
		dec		hl

p04loc_4481:
		call	ADDPROP
		ret		nc

p04loc_4485:
		ld		hl, OP1M
		ld		(hl), 10h
		inc		hl
		ld		(hl), 0
		jp		INCO1EXP
; ---------------------------------------------------------------------------

p04loc_4490:
		ld		a, (OP1M)
		cp		50h ; 'P'
		jr		nc, p04loc_4485

p04loc_4497:
		jp		OP1Set0
; End of function p04sub_4469


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


p04sub_449A:
		xor		a
		call	NEXTEQ
		or		a
		ret
; End of function p04sub_449A

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

InitGraphContext:
		ld		b, a
		ld		a, 0
		bit		graphHookActive, (iy+hookflags3)
		call	nz, Page0Call_330F
		push	bc
		res		write_on_graph, (iy+sGrFlags)
		ld		hl, p04loc_4516
		call	AppInit
		res		plotLoc, (iy+plotFlags)
		res		splitOverride, (iy+graphFlags2)
		pop		af
		ld		hl, p04loc_4523
		ld		bc, 9
		cpir
		jr		z, TraceOff
		bit		graphDraw, (iy+graphFlags)
		jr		z, p04loc_44E1
		or		a
		jr		z, TraceOff
		cp		6
		jr		c, p04loc_44DE
		cp		7
		jr		z, p04loc_44DE
		cp		5
		jr		nz, TraceOff
		ret
; ---------------------------------------------------------------------------

p04loc_44DE:
		call	Regraph

p04loc_44E1:
		call	DoNothing3

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


TraceOff:
		call	p04sub_6715
		call	p04sub_5CEA
		ret
; End of function TraceOff


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


CentCursor:
		; Regraph+3Ap ...
		bit		allowCursor, (iy+plotFlags)
		ret		nz
		push	hl
		push	af
		ld		a, (lcdTallP+1)
		srl	a
		dec		a
		ld		h, a
		pop		af
		ld		l, 20h ; ' '
		call	CheckSplitFlag
		jr		z, p04loc_4503
		ld		l, 10h

p04loc_4503:
		bit		vertSplit, (iy+sGrFlags)
		jr		z, p04loc_450B
		ld		l, 1Ah

p04loc_450B:
		ld		(curGY), hl
		ld		(freeSaveY), hl
		ld		(curGY2), hl
		pop		hl
		ret
; End of function CentCursor

; ---------------------------------------------------------------------------
p04loc_4516:
		.dw		p04loc_45A5
		.dw		p04loc_5CCC
		.dw		p04loc_5CB1
		.dw		p04loc_4543
		.dw		noErrorEntry
		.dw		p04loc_452C
		.db		0AAh
p04loc_4523:
		.db		63h ; c
		.db		65h ; e
		.db		62h ; b
		.db		60h ; `
		.db		6Bh ; k
		.db		64h ; d
		.db		5Eh ; ^
		.db		68h ; h
		.db		5Bh ; [

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

p04loc_452C:
DoNothing3:
		ret
; End of function DoNothing3

; ---------------------------------------------------------------------------
		bit		plotDisp, (iy+plotFlags)
		jr		nz, p04loc_4533

p04loc_4533:
		call	GrBufCpy
		call	LABCOOR
		bit		promptEdit, (iy+promptFlags)
		jr		z, p04loc_4541
		pop		af
		ret
; ---------------------------------------------------------------------------

p04loc_4541:
		pop		af
		ret
; ---------------------------------------------------------------------------

p04loc_4543:
GrRedisp:
		bit		promptEdit, (iy+promptFlags)
		jr		nz, p04loc_4555
		bit		2, (iy+17h)
		jr		nz, p04loc_4555
		ld		hl, (monQH)
		ld		a, h
		cp		l
		ret		nz

p04loc_4555:
		call	GRBUFCPY_V
		call	LABCOOR
		bit		promptEdit, (iy+promptFlags)
		ret		z
		call	j_rstrCurRow
		bit		2, (iy+17h)
		ret		z
		ld		a, (curGY2+1)
		call	PUTEQUNO
		call	p04loc_48FE
		ret
p04loc_4572:
		call	GRBUFCPY_V
		ld		a, (unk_85FD)
		ld		(curGStyle), a
		call	LABCOOR
		bit		2, (iy+17h)
		jr		z, p04loc_458A
		ld		a, (curGY2+1)
		call	PUTEQUNO

p04loc_458A:
		call	p04loc_48FE
		call	p04sub_4FB9
		jp		j_numError02_2

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


p04sub_4593:
		call	j_closeEditBuf
; End of function p04sub_4593


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


p04sub_4596:

		res		promptEdit, (iy+promptFlags)
		set		appCurGraphic, (iy+appFlags)
		ld		hl, noErrorEntry
		ld		(mcxErrorEP), hl
		ret
; End of function p04sub_4596


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


ForceGraphKeypress:
p04loc_45A5:
		ld		b, a
		ld		a, 6
		bit		graphHookActive, (iy+hookflags3)
		call	nz, Page0Call_330F
		ret		nz
		ld		a, b
		res		g_style_active, (iy+sGrFlags)
		bit		promptEdit, (iy+promptFlags)
		jp		z, p04loc_46FA

p04loc_45BC:
		cp		0FEh ; '�'
		jp		z, j_CallCommon
		cp		0Ch
		ret		z
		cp		5
		jp		z, p04loc_45DA
		cp		9
		jp		nz, j_CallCommon
		call	IsEditEmpty
		jr		z, p04loc_45DF
		call	CanAlphIns
		call	j_fDel
		ret
; ---------------------------------------------------------------------------

p04loc_45DA:
		call	IsEditEmpty
		jr		nz, p04loc_45E8

p04loc_45DF:
		call	p04sub_4593
		call	GRBUFCPY_V
		jp		p04sub_5720
; ---------------------------------------------------------------------------

p04loc_45E8:
		call	zero_basic_prog
		res		smarter_mask, (iy+smartFlags)
		call	j_parseEditBuf
		call	page0_1851
		scf
		call	p04sub_5AE5

p04loc_45F9:
		call	j_releaseBuffer
		call	PopRealO1
		ld		a, 4Fh ; 'O'
		bit		2, (iy+17h)
		jr		z, p04loc_460A
		ld		a, (unk_85FD)

p04loc_460A:
		ld		(curGStyle), a
		call	p04sub_4596
		ld		a, (curGStyle)
		res		4, (iy+1Eh)
		cp		4Fh ; 'O'
		jr		nz, p04loc_461F
		set		4, (iy+1Eh)

p04loc_461F:
		cp		52h ; 'R'
		jr		c, p04sub_465B
		bit		smarter_mask, (iy+smartFlags)
		jr		nz, p04sub_465B
		rst		18h
		set		5, (iy+17h)
		call	p04sub_465B
		res		5, (iy+17h)
		ld		hl, (EQS)
		ld		(FPS), hl
		call	PopRealO1
		ld		a, (curGStyle)
		cp		7Dh ; '}'
		jr		z, p04loc_464D
		cp		6Fh ; 'o'
		jr		c, p04loc_4652
		cp		74h ; 't'
		jr		nc, p04loc_4652

p04loc_464D:
		call	p04sub_5CA7
		jr		nz, p04sub_465B

p04loc_4652:
		; ForceGraphKeypress+A6j
		set		allowCursor, (iy+plotFlags)
		ld		a, 5
		call	ForceGraphKeypress
; End of function ForceGraphKeypress


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


p04sub_465B:
		ld		hl, 0
		call	IsRecursiveMode
		jr		z, p04loc_468B
		bit		webMode, (iy+seqFlags)
		jr		nz, p04loc_4686
		rst		18h
		call	p04sub_501E
		call	OP1ToOP4
		call	PopRealO2
		call	InvSub
		ld		hl, PlotStep
		call	page0_EC1
		call	int
		call	FPMult
		call	OP4ToOP2
		rst		30h

p04loc_4686:
		call	p04sub_6726
		jr		p04loc_46CC
; ---------------------------------------------------------------------------

p04loc_468B:
		call	IsFuncMode
		jr		nz, p04loc_46B6
		ld		hl, ThetaMin
		call	IsFunctionMode
		jr		nz, p04loc_469B
		ld		hl, TminPar

p04loc_469B:
		call	Mov9ToOP2
		push	hl
		call	FPSub
		pop		hl
		ld		de, 9
		add		hl, de
		call	page0_EC1
		call	int
		call	j_ConvOP1
		ex		de, hl
		ld		(unk_8E2B), hl
		jr		p04loc_46CC
; ---------------------------------------------------------------------------

p04loc_46B6:
		rst		18h
		call	p04sub_444F
		ld		l, a
		ld		h, 0
		ld		(unk_8E2B), hl
		call	PopRealO1
		ld		de, OP1
		call	XftoI
		ld		l, a
		ld		h, 0

p04loc_46CC:
		set		0, (iy+27h)
		jp		p04loc_506F
; End of function p04sub_465B

; ---------------------------------------------------------------------------
		call	p04sub_46DE
		rst		18h
		set		smarter_mask, (iy+smartFlags)
		jp		p04loc_45F9

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


p04sub_46DE:
		call	IsFuncMode
		call	nz, XName
		call	IsParametricMode
		call	nz, TName
		call	IsFunctionMode
		call	nz, ThetaName
		call	IsRecursiveMode
		call	nz, RECURNNAME
		call	j_RclVarSym
		ret
; End of function p04sub_46DE

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

p04loc_46FA:
		bit		allowCursor, (iy+plotFlags)
		jr		nz, p04loc_4706
		ld		hl, (freeSaveY)
		ld		(curGY), hl

p04loc_4706:
		cp		7Fh ; ''
		jp		c, GRDECODA
		ld		b, a
		ld		a, 1
		bit		graphHookActive, (iy+hookflags3)
		call	nz, Page0Call_330F
		ret		nz
		bit		allowCursor, (iy+plotFlags)
		jr		z, p04loc_474E
		ld		a, (curPlotNumber)
		or		a
		jr		nz, p04loc_474E
		ld		a, (curGStyle)
		cp		65h ; 'e'
		jr		z, p04loc_474E
		cp		67h ; 'g'
		jr		z, p04loc_474E
		ld		hl, (EQS)
		ld		(FPS), hl
		res		allowCursor, (iy+plotFlags)
		set		2, (iy+17h)
		push	bc
		push	af
		call	p04sub_4F71
		pop		af
		ld		(curGStyle), a
		ld		(unk_85FD), a
		call	p04loc_48FE
		pop		af
		jp		p04loc_45BC
; ---------------------------------------------------------------------------

p04loc_474E:
		; ForceGraphKeypress+17Bj ...
		ld		a, (curGStyle)
		cp		2Fh ; '/'
		ld		a, b
		jp		nz, JForceCmd
		res		4, (iy+24h)

TEXT:
		call	j_ConvKeyToTok
		call	GDISPTOKEN
		jp		p04loc_489F
; END OF FUNCTION CHUNK	FOR ForceGraphKeypress

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


GDISPTOKEN:

		ld		bc, (curGY)
		push	bc
		bit		4, (iy+11h)
		jr		nz, p04loc_478B
		push	de
		ld		a, (lcdTallP)
		dec		a
		sub		c
		ld		c, b
		ld		b, a
		ld		(penCol), bc
		pop		de
		push	de
		push	bc
		call	p04sub_47AB
		set		textWrite, (iy+sGrFlags)
		pop		bc
		pop		de
		ld		(penCol), bc

p04loc_478B:
		call	p04sub_47AB
		res		textWrite, (iy+sGrFlags)
		ld		a, (penCol)
		pop		bc
		ld		b, a
		jr		nc, p04loc_479D
		cp		5Fh ; '_'
		jr		c, p04loc_47A6

p04loc_479D:
		call	Bit_VertSplit
		ld		b, 2Eh ; '.'
		jr		nz, p04loc_47A6
		ld		b, 5Eh ; '^'

p04loc_47A6:
		; GDISPTOKEN+3Ej
		ld		(curGY), bc
		ret
; End of function GDISPTOKEN


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


p04sub_47AB:
		; GDISPTOKEN:p04loc_478Bp
		call	j_GetTokLen
		inc		hl
		ld		b, a
		set		write_on_graph, (iy+sGrFlags)
		call	j_vputsnG
		res		write_on_graph, (iy+sGrFlags)
		ret
; End of function p04sub_47AB

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

GRDECODA:
		ld		b, a
		ld		a, 7
		bit		graphHookActive, (iy+hookflags3)
		call	nz, Page0Call_330F
		ret		nz
		ld		a, b
		res		0, (iy+27h)
		res		1, (iy+27h)
		res		2, (iy+27h)
		res		g_style_active, (iy+sGrFlags)
		cp		5
		jr		c, p04loc_47E6
		cp		0Eh
		jp		c, p04loc_4A51
		cp		10h
		jp		nc, p04loc_4A51

p04loc_47E6:
		ld		d, a
		ld		a, 2
		bit		graphHookActive, (iy+hookflags3)
		call	nz, Page0Call_330F
		ret		nz
		ld		a, (curGStyle)
		cp		4Dh ; 'M'
		jr		z, p04loc_4811
		bit		allowCursor, (iy+plotFlags)
		jr		z, p04loc_4817
		cp		5
		jr		z, p04loc_4811
		cp		4Fh ; 'O'
		ld		a, d
		jp		nz, p04loc_51D0
		cp		3

p04loc_480A:
		jp		z, p04loc_51D0
		cp		4
		jr		z, p04loc_480A

p04loc_4811:
		; ForceGraphKeypress+25Bj
		call	j_CursorOff
		call	p04sub_5CEA

p04loc_4817:
		ld		a, (curGStyle)
		or		a
		jr		nz, p04loc_4822
		ld		a, 7
		ld		(curGStyle), a

p04loc_4822:
		ld		a, d
		ld		bc, (curGY)
		cp		2
		jr		z, p04loc_4830
		jr		nc, p04loc_4836
		inc		b
		jr		p04loc_485A
; ---------------------------------------------------------------------------

p04loc_4830:
		dec		b
		jr		p04loc_485A
; ---------------------------------------------------------------------------

p04loc_4833:
		dec		c
		jr		p04loc_485A
; ---------------------------------------------------------------------------

p04loc_4836:
		cp		4
		jr		z, p04loc_4833
		jr		c, p04loc_4859
		cp		0Eh
		ld		a, b
		jr		nz, p04loc_484A
		sub		5
		ld		b, a
		jr		nc, p04loc_4860
		ld		b, 0
		jr		p04loc_4860
; ---------------------------------------------------------------------------

p04loc_484A:
		add		a, 5
		ld		hl, pixWide_m_1
		cp		(hl)
		jr		c, p04loc_4856
		ld		b, (hl)
		dec		b
		jr		p04loc_4860
; ---------------------------------------------------------------------------

p04loc_4856:
		ld		b, a
		jr		p04loc_4860
; ---------------------------------------------------------------------------

p04loc_4859:
		inc		c

p04loc_485A:
		; ForceGraphKeypress+28Cj ...
		call	IBounds
		jp		c, p04loc_48AE

p04loc_4860:
		; ForceGraphKeypress+2A3j ...
		call	CheckSplitFlag
		jr		z, p04loc_486A
		ld		a, c
		cp		20h ; ' '
		jr		nc, p04loc_48AE

p04loc_486A:
		call	Bit_VertSplit
		jr		z, p04loc_4874
		ld		a, c
		cp		34h ; '4'
		jr		nc, p04loc_48AE

p04loc_4874:
		ld		a, (curGStyle)
		cp		2Fh ; '/'
		jr		nz, p04loc_4896
		call	CHKTEXTCURS
		jr		nc, p04loc_48AE
		ld		(curGY), bc
		jr		p04loc_489F
; END OF FUNCTION CHUNK	FOR ForceGraphKeypress

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


p04sub_4886:
		set		3, (iy+2)
		set		displayCoords, (iy+newDispF)
		ld		hl, (curGY)
		ld		(freeSaveY), hl
		jr		p04loc_48C2
; End of function p04sub_4886

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

p04loc_4896:
		; ForceGraphKeypress:p04loc_5717j
		ld		(curGY), bc
		cp		2Dh ; '-'
		call	z, PointOn

p04loc_489F:
		; ForceGraphKeypress+2DFj ...
		ld		hl, OP6
		call	p04sub_43C2
		call	j_StoX
		call	OP6ToOP1
		call	j_StoY

p04loc_48AE:
		; ForceGraphKeypress+2C3j ...
		call	VALCUR
		set		displayCoords, (iy+newDispF)

p04loc_48B5:
		; p04sub_465B+D50j ...
		ld		hl, (curGY)
		ld		(freeSaveY), hl
; END OF FUNCTION CHUNK	FOR ForceGraphKeypress

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


LABCOOR:









		call	GRLABELS

COORDISP:
		res		3, (iy+2)

p04loc_48C2:
		ld		a, (curGStyle)
		or		a
		ret		z
		bit		2, (iy+17h)
		ret		nz
		cp		4Dh ; 'M'
		ret		z
		cp		2Fh ; '/'
		ret		z
		cp		5
		jp		z, PutXY
		bit		allowCursor, (iy+plotFlags)
		jr		z, p04loc_4948
		ld		a, (curPlotNumber)
		or		a
		jr		z, p04loc_48F4
		call	j_SPLOTCOORD
		bit		grfNoCoord, (iy+grfDBFlags)
		jr		nz, p04loc_48FE
		ld		a, (curGStyle)
		cp		7Fh ; ''
		jr		nc, p04loc_48FE
		ret
; ---------------------------------------------------------------------------

p04loc_48F4:
		ld		a, (curGY2+1)
		bit		3, (iy+2)
		call	z, PUTEQUNO

p04loc_48FE:

		ld		a, (curGStyle)
		cp		5Fh ; '_'
		jp		z, p04loc_78D0
		cp		61h ; 'a'
		jp		z, p04loc_78DE
		cp		53h ; 'S'
		jr		z, p04loc_4923
		cp		65h ; 'e'
		jp		z, p04loc_78A6
		cp		67h ; 'g'
		jp		z, p04loc_78B4
		cp		59h ; 'Y'
		jr		z, p04loc_4934
		cp		55h ; 'U'
		jr		z, p04loc_493D
		cp		69h ; 'i'

p04loc_4923:
		jp		z, p04loc_7898
		cp		7Fh ; ''
		jr		z, p04loc_4923
		cp		81h ; '�'
		jr		z, p04loc_493D
		cp		6Bh ; 'k'
		jr		z, p04loc_493D
		cp		6Dh ; 'm'

p04loc_4934:
		jp		z, p04loc_78EC
		cp		77h ; 'w'
		jr		z, p04loc_4923
		cp		79h ; 'y'

p04loc_493D:
		jp		z, p04loc_78C2
		cp		7Bh ; '{'
		jr		z, p04loc_4934
		cp		57h ; 'W'
		jr		z, p04loc_4934

p04loc_4948:
		bit		promptEdit, (iy+promptFlags)
		ret		nz
		cp		4Fh ; 'O'
		jr		z, p04loc_4956
		bit		grfNoCoord, (iy+grfDBFlags)
		ret		nz

p04loc_4956:
		set		NEED_BUFCPY, (iy+VERTFLAG2)
		call	IsFunctionMode
		jr		z, p04loc_498D
		bit		allowCursor, (iy+plotFlags)
		jr		z, p04loc_498D
		bit		3, (iy+2)
		jr		z, p04loc_4983
		call	CLRGRAPHXY
		bit		grfPolar, (iy+grfDBFlags)
		jr		z, p04loc_497A
		call	p04sub_7685
		jp		FINISHSPEC
; ---------------------------------------------------------------------------

p04loc_497A:
		call	PutXY
		call	FINISHSPEC
		jp		p04loc_761E
; ---------------------------------------------------------------------------

p04loc_4983:
		bit		grfPolar, (iy+grfDBFlags)
		jp		nz, p04sub_7685
		jp		p04loc_767A
; ---------------------------------------------------------------------------

p04loc_498D:
		bit		grfPolar, (iy+grfDBFlags)
		jp		z, p04loc_4A06
		bit		6, (iy+3)
		jp		nz, p04loc_4A06
		bit		7, (iy+3)
		jp		nz, p04loc_4A06
		ld		hl, p04loc_4A06
		call	pushErrorHandleR
		call	RName
		rst		10h
		jr		c, p04loc_49B3
		bit		6, (hl)
		jp		nz, ErrOverflow

p04loc_49B3:
		call	ThetaName
		rst		10h
		jr		c, p04loc_49BE
		bit		6, (hl)
		jp		nz, ErrOverflow

p04loc_49BE:
		call	j_RclY
		rst		8
		call	j_RclX
		call	j_RToP
		call	CkValidNum
		call	popErrorHandleR
		call	PushRealO2
		call	j_StoR
		call	PopRealO1
		call	j_StoTheta
		bit		allowCursor, (iy+plotFlags)
		jp		z, p04sub_7685
		bit		3, (iy+2)
		jr		z, p04loc_49FD
		call	CLRGRAPHXY
		call	p04sub_7685
		call	FINISHSPEC
		call	IsRecursiveMode
		call	nz, p04sub_7661
		call	IsParametricMode
		ret		z
		jp		p04sub_762E
; ---------------------------------------------------------------------------

p04loc_49FD:
		call	IsParametricMode
		jp		nz, p04loc_7682
		jp		p04sub_7685
; ---------------------------------------------------------------------------

p04loc_4A06:
		bit		allowCursor, (iy+plotFlags)
		jp		z, PutXY
		call	IsRecursiveMode
		jr		z, p04loc_4A1F
		bit		3, (iy+2)
		jp		z, p04loc_765C
		call	p04sub_4A31
		jp		p04sub_7661
; ---------------------------------------------------------------------------

p04loc_4A1F:
		call	IsParametricMode
		jr		z, p04sub_4A31
		bit		3, (iy+2)
		jp		z, p04loc_764B
		call	p04sub_4A31
		jp		p04sub_762E
; End of function LABCOOR


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


p04sub_4A31:
		bit		3, (iy+2)
		call	nz, CLRGRAPHXY
		call	PutXY
		bit		3, (iy+2)
		ret		z
; End of function p04sub_4A31


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


FINISHSPEC:
		call	j_CursorOff
; End of function FINISHSPEC


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


p04sub_4A43:
		call	GRLABELS
		ld		a, (curGY2+1)
		call	PUTEQUNO
		res		3, (iy+2)
		ret
; End of function p04sub_4A43

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

p04loc_4A51:
		; ForceGraphKeypress+23Ej
		cp		5
		jp		nz, p04loc_4ED0
		bit		allowCursor, (iy+plotFlags)
		jp		z, p04loc_4DB3
		call	j_CursorOff
		ld		a, (curGStyle)
		cp		51h ; 'Q'
		jp		z, p04loc_4D7D
		cp		7Dh ; '}'
		jr		nz, p04loc_4AE2
		bit		2, (iy+17h)
		jr		z, p04loc_4A76
		pop		de
		call	p04sub_6715

p04loc_4A76:
		call	p04sub_5CA7
		jp		nz, LABCOOR
		bit		graphCursor, (iy+graphFlags)
		push	af
		ld		hl, (curGY)
		push	hl
		call	j_RclX
		ld		de, 8D8Fh
		call	MovFrOP1
		call	MATHTANLN
		pop		hl
		ld		(curGY), hl
		call	CkOP1Real
		jr		nz, p04loc_4ACC
		call	CkValidNum
		call	j_StoAns
		call	IsFuncMode
		jr		z, p04loc_4ABA
		ld		hl, 8D8Fh
		rst		20h
		call	j_StoX
		call	p04sub_7636
		call	OP2ToOP1
		call	TAN_EQU_DISP
		call	markTableDirty
		jr		p04loc_4ABD
; ---------------------------------------------------------------------------

p04loc_4ABA:
		call	p04sub_787A

p04loc_4ABD:
		; ForceGraphKeypress+53Bj
		call	GRLABELS
		pop		af
		ret		z
		set		graphCursor, (iy+graphFlags)
		ld		a, 4Dh ; 'M'
		ld		(curGStyle), a
		ret
; ---------------------------------------------------------------------------

p04loc_4ACC:
		ld		hl, p04loc_7A20
		call	setPenX
		set		textEraseBelow, (iy+textFlags)
		call	Page04_3345
		call	p04sub_7A03
		res		textEraseBelow, (iy+textFlags)
		jr		p04loc_4ABD
; ---------------------------------------------------------------------------

p04loc_4AE2:
		cp		6Fh ; 'o'
		jr		z, p04loc_4AF3
		cp		73h ; 's'
		jr		z, p04loc_4AF3
		cp		71h ; 'q'
		jr		z, p04loc_4AF3
		cp		63h ; 'c'
		jp		nz, p04loc_4B7B

p04loc_4AF3:
		; ForceGraphKeypress+543j ...
		bit		2, (iy+17h)
		jr		z, p04loc_4AFA
		pop		hl

p04loc_4AFA:
		call	p04sub_5CA7
		jr		z, p04loc_4B09
		call	p04sub_6715
		call	LABCOOR
		call	p04sub_5CEA
		ret
; ---------------------------------------------------------------------------

p04loc_4B09:
		bit		graphCursor, (iy+graphFlags)
		push	af
		ld		hl, (pTempCnt)
		push	hl
		call	j_sDone
		ld		a, (curGStyle)
		call	IsFuncMode
		jr		nz, p04loc_4B43
		call	IsFunctionMode
		jr		nz, p04loc_4B48
		cp		63h ; 'c'
		jr		nz, p04loc_4B5C
		call	page0_17E0
		push	hl
		rst		18h
		pop		hl
		res		0, (hl)
		call	Page0Call_38D3

p04loc_4B31:
		; ForceGraphKeypress+5ADj
		ld		hl, p04loc_7A20

p04loc_4B34:
		; ForceGraphKeypress+5C4j ...
		call	CkOP1Real
		jp		nz, ErrDomain
		call	p04sub_6419
		pop		af
		call	p04sub_46DE
		jr		p04loc_4BBD
; ---------------------------------------------------------------------------

p04loc_4B43:
		call	Page0Call_38BB
		jr		p04loc_4B31
; ---------------------------------------------------------------------------

p04loc_4B48:
		cp		6Fh ; 'o'
		jr		z, p04loc_4B54
		call	j_PolarDerivative
		call	fpdiv
		jr		p04loc_4B31
; ---------------------------------------------------------------------------

p04loc_4B54:
		call	Page0Call_38C1
		ld		hl, p04loc_6735
		jr		p04loc_4B34
; ---------------------------------------------------------------------------

p04loc_4B5C:
		cp		73h ; 's'
		jr		z, p04loc_4B6B
		call	page0_17E0
		call	Page0Call_38C7
		ld		hl, p04loc_6743
		jr		p04loc_4B34
; ---------------------------------------------------------------------------

p04loc_4B6B:
		call	Page0Call_38C7
		ld		hl, p04loc_673C
		jr		p04loc_4B34
; ---------------------------------------------------------------------------

p04loc_4B73:
		; ForceGraphKeypress+62Dj ...
		call	j_RclX
		ld		de, 8D98h
		jr		p04loc_4B8C
; ---------------------------------------------------------------------------

p04loc_4B7B:
		cp		7Fh ; ''
		jr		z, p04loc_4B86
		cp		81h ; '�'
		ret		z
		cp		53h ; 'S'
		jr		nz, p04loc_4BA2

p04loc_4B86:
		; ForceGraphKeypress+625j ...
		call	j_RclX
		ld		de, 8D8Fh

p04loc_4B8C:
		call	MovFrOP1
		ld		a, (curGStyle)
		add		a, 2
		ld		(curGStyle), a
		bit		2, (iy+17h)
		ret		nz
		call	GrBufCpy
		jp		LABCOOR
; ---------------------------------------------------------------------------

p04loc_4BA2:
		cp		55h ; 'U'
		jr		z, p04loc_4B73
		cp		57h ; 'W'
		jr		nz, p04loc_4BC8
		call	p04sub_4D54
		push	hl
		call	j_GRITSOLVER
		call	j_StoX
		call	p04sub_5B86
		call	p04sub_7968

p04loc_4BBA:
		; ForceGraphKeypress+78Dj
		call	j_RclX

p04loc_4BBD:
		set		4, (iy+17h)
		set		2, (iy+17h)
		jp		p04sub_465B
; ---------------------------------------------------------------------------

p04loc_4BC8:
		cp		5Fh ; '_'
		jr		z, p04loc_4B86
		cp		69h ; 'i'
		jr		z, p04loc_4B86
		cp		6Bh ; 'k'
		jr		z, p04loc_4B73
		cp		77h ; 'w'
		jr		z, p04loc_4B86
		cp		79h ; 'y'
		jr		z, p04loc_4B73
		cp		61h ; 'a'
		jr		nz, p04loc_4BEE
		call	p04sub_4D5C
		push	hl
		call	j_BC2NOREAL
		ld		hl, p04loc_672C
		call	p04sub_6419
		ret
; ---------------------------------------------------------------------------

p04loc_4BEE:
		cp		6Dh ; 'm'
		jr		nz, p04loc_4C3B
		or		a

p04loc_4BF3:
		push	af
		bit		2, (iy+17h)
		jr		z, p04loc_4BFD
		pop		af
		pop		de
		push	af

p04loc_4BFD:
		call	p04sub_6715
		call	p04sub_4D54
		pop		af
		push	hl
		push	af
		call	OP1ToOP5
		call	PopRealO3
		call	PopRealO1
		rst		8
		call	XName
		call	OP1ToOP4
		call	OP1Set1
		ld		a, 7Bh ; '{'
		ld		(OP1+1), a
		call	OP1ExOP5
		pop		af
		push	af
		ld		b, 0
		call	j_DFMIN2
		pop		af
		pop		hl
		push	af
		push	hl
		call	p04sub_5B86
		pop		af
		push	af
		call	c, p04sub_794C
		pop		af
		call	nc, p04sub_793E
		jp		p04loc_4BBA
; ---------------------------------------------------------------------------

p04loc_4C3B:
		cp		7Bh ; '{'
		scf
		jr		z, p04loc_4BF3
		cp		65h ; 'e'
		jr		nz, p04loc_4C78
		call	p04sub_5CA7
		jp		nz, LABCOOR
		ld		a, (curGY2+1)
		ld		(OP1M), a
		ld		hl, (unk_980E)
		ld		(OP1+5), hl
		ld		hl, (unk_9810)
		ld		(OP1+3), hl
		ld		a, 67h ; 'g'
		ld		(curGStyle), a
		ld		hl, (curGY)
		bit		graphCursor, (iy+graphFlags)
		jr		nz, p04loc_4C6C
		set		7, l

p04loc_4C6C:
		ld		(OP1+7), hl
		ld		de, 8D8Fh
		call	MovFrOP1
		jp		p04loc_51A2
; ---------------------------------------------------------------------------

p04loc_4C78:
		cp		67h ; 'g'
		jp		nz, p04loc_4CB7
		call	p04sub_5CA7
		jp		nz, LABCOOR
		ld		hl, 8D8Fh
		rst		20h
		ld		hl, curGX2
		ld		a, (OP1M)
		cp		(hl)
		jr		nz, p04loc_4C9B
		ld		hl, (unk_980E)
		ld		de, (OP1+5)
		sbc		hl, de
		jr		z, p04loc_4CB4

p04loc_4C9B:
		ld		hl, (curGY)
		bit		graphCursor, (iy+graphFlags)
		jr		nz, p04loc_4CA6
		set		7, l

p04loc_4CA6:
		ld		(OP1), hl
		ld		de, 8D8Fh
		call	MovFrOP1
		ld		a, 59h ; 'Y'
		ld		(curGStyle), a

p04loc_4CB4:
		jp		LABCOOR
; ---------------------------------------------------------------------------

p04loc_4CB7:
		cp		59h ; 'Y'
		jp		nz, p04sub_5CEA
		bit		2, (iy+17h)
		jr		z, p04loc_4CC3
		pop		hl

p04loc_4CC3:
		ld		l, 13h
		call	p04sub_4D35
		push	de
		ld		hl, 8D8Fh
		rst		20h
		ld		a, (OP1M)
		ld		(OP1+7), a
		ld		h, 41h ; 'A'
		ld		l, 63h ; 'c'
		ld		(OP1+1), hl
		pop		de
		ld		hl, 8479h
		call	page0_1189
		ld		a, (hl)
		call	p04sub_4D45
		push	de
		ld		hl, (unk_980E)
		ld		(OP1+5), hl
		ld		hl, (unk_9810)
		ld		(OP1+3), hl
		ld		h, 41h ; 'A'
		ld		l, 63h ; 'c'
		ld		(OP1+1), hl
		ld		a, 71h ; 'q'
		ld		hl, OP1
		ld		(hl), a
		pop		de
		call	Mov7B2
		call	p04sub_4D42
		call	OP4ToOP1
		rst		18h
		rst		18h
		ld		hl, (pTempCnt)
		push	hl
		ld		a, 5
		ld		(curGStyle), a
		call	VALCUR
		call	XName
		rst		18h
		call	j_ITSOLVER
		call	j_StoX
		call	PopRealO1
		rst		10h
		jr		c, p04loc_4D29
		set		7, (hl)

p04loc_4D29:
		call	j_RclX
		call	p04sub_5B86
		call	p04sub_795A
		jp		p04loc_4BBA
; END OF FUNCTION CHUNK	FOR ForceGraphKeypress

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


p04sub_4D35:
		ld		h, 0
; End of function p04sub_4D35


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


TMPEQUNOSRC:
		call	CreateTempEqu
		inc		de
		inc		de
		xor		a
		ld		(de), a
		inc		de
		ld		(de), a
		inc		de
		ret
; End of function TMPEQUNOSRC


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


p04sub_4D42:
		ld		a, (curGY2+1)
; End of function p04sub_4D42


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


p04sub_4D45:
		push	de
		call	Page0Call_3363
		pop		de
		ld		a, 5Eh ; '^'
		ld		(de), a
		inc		de
		ld		a, (OP1M)
		ld		(de), a
		inc		de
		ret
; End of function p04sub_4D45


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


p04sub_4D54:
		; ForceGraphKeypress+65Bp
		ld		hl, 8D8Fh
		call	PushReal
		jr		p04loc_4D5F
; End of function p04sub_4D54


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


p04sub_4D5C:
		ld		hl, 8D8Fh

p04loc_4D5F:
		call	PushReal
		pop		hl
		bit		2, (iy+17h)
		jr		z, p04loc_4D6D
		pop		de
		call	p04sub_6715

p04loc_4D6D:
		push	hl
		ld		a, 5
		ld		(curGStyle), a
		call	VALCUR
		call	j_sDone
		ld		hl, (pTempCnt)
		ret
; End of function p04sub_4D5C

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

p04loc_4D7D:
		bit		6, (iy+3)
		jr		nz, p04loc_4DA2
		bit		7, (iy+3)
		jr		nz, p04loc_4DA2
		ld		hl, OP6
		call	page0_1254
		ld		hl, p04loc_6094
		call	pushErrorHandleR
		xor		a
		ld		hl, OP6
		ld		de, OP6
		call	Page0Call_35DF
		call	popErrorHandleR

p04loc_4DA2:
		; ForceGraphKeypress+7E2j
		call	TraceOff
		call	CentCursor
		call	SetTblGraphDraw
		ld		a, 5Ah ; 'Z'
		jp		ForceGraphKeypress
; ---------------------------------------------------------------------------

p04loc_4DB0:
		jp		p04loc_4F3D
; ---------------------------------------------------------------------------

p04loc_4DB3:
		ld		a, (curGStyle)
		cp		1Dh
		jr		nz, p04loc_4DC9
		ld		bc, (curGY)
		ld		de, (curGY2)
		call	DarkLine
		ld		a, 1Bh
		jr		p04loc_4DD3
; ---------------------------------------------------------------------------

p04loc_4DC9:
		cp		27h ; '''
		jr		nz, p04loc_4DD6
		xor		a
		call	Page0Call_35EB
		ld		a, 25h ; '%'

p04loc_4DD3:
		; ForceGraphKeypress+862j
		jp		p04loc_56FE
; ---------------------------------------------------------------------------

p04loc_4DD6:
		cp		0Bh
		jr		nz, p04loc_4DE3
		ld		hl, p04loc_6094
		call	pushErrorHandleR
		scf
		jr		p04loc_4DEE
; ---------------------------------------------------------------------------

p04loc_4DE3:
		cp		0Dh
		jr		nz, p04loc_4E0C
		ld		hl, p04loc_6094
		call	pushErrorHandleR
		or		a

p04loc_4DEE:
		ld		hl, YFact
		ld		de, XFact
		call	Page0Call_35DF
		call	popErrorHandleR
		ld		a, (curGStyle)
		call	SetTblGraphDraw
		call	Regraph
		bit		graphDraw, (iy+graphFlags)
		jr		z, p04loc_4DD3
		jp		p04loc_5470
; ---------------------------------------------------------------------------

p04loc_4E0C:
		cp		29h ; ')'
		jr		nz, p04loc_4E15
		call	p04sub_4017
		jr		p04loc_4E4D
; ---------------------------------------------------------------------------

p04loc_4E15:
		cp		31h ; '1'
		jr		nz, p04loc_4E1E
		call	HorizontalLine
		jr		p04loc_4E4D
; ---------------------------------------------------------------------------

p04loc_4E1E:
		cp		2Bh ; '+'
		jr		nz, p04loc_4E2B
		ld		a, 2Dh ; '-'
		ld		(curGStyle), a
		ld		d, 1
		jr		p04loc_4E46
; ---------------------------------------------------------------------------

p04loc_4E2B:
		cp		2Dh ; '-'
		jr		nz, p04loc_4E36
		ld		a, 2Bh ; '+'
		ld		(curGStyle), a
		jr		p04loc_4E4D
; ---------------------------------------------------------------------------

p04loc_4E36:
		ld		d, 0
		cp		21h ; '!'
		jr		z, p04loc_4E46
		inc		d
		cp		1Fh
		jr		z, p04loc_4E46
		inc		d
		cp		23h ; '#'
		jr		nz, p04loc_4E50

p04loc_4E46:
		; ForceGraphKeypress+895j ...
		ld		bc, (curGY)
		call	IPoint

p04loc_4E4D:
		; ForceGraphKeypress+877j ...
		jp		p04loc_48AE
; ---------------------------------------------------------------------------

p04loc_4E50:
		cp		15h
		jr		nz, p04loc_4E66
		call	p04sub_5CEA
		call	j_RclX
		call	OP1ToOP5
		call	j_RclY
		call	ZmInt
		jp		p04loc_4DB0
; ---------------------------------------------------------------------------

p04loc_4E66:
		cp		13h
		jr		nz, p04loc_4E6E
		ld		a, 9
		jr		p04loc_4EC4
; ---------------------------------------------------------------------------

p04loc_4E6E:
		cp		9
		jp		nz, p04loc_4EB5
		call	p04sub_5CEA
		ld		hl, (curGY2)
		ld		de, (curGY)
		ld		a, h
		cp		d
		jp		z, Page0Call_250D
		jr		c, p04loc_4E85
		ex		de, hl

p04loc_4E85:
		ld		a, l
		cp		e
		jp		z, Page0Call_250D
		jr		c, p04loc_4E8E
		ld		l, e
		ld		e, a

p04loc_4E8E:
		ld		(curGY2), hl
		ld		(curGY), de
		ld		c, l
		ld		b, h
		ld		de, OP5
		ld		hl, OP6
		call	p04sub_43C5
		ld		bc, (curGY)
		call	VtoWHLDE
		call	COPYRNG
		call	p04sub_5EF2
		call	SetTblGraphDraw
		ld		a, 5Fh ; '_'
		jp		ForceGraphKeypress
; ---------------------------------------------------------------------------

p04loc_4EB5:
		cp		25h ; '%'
		jr		nz, p04loc_4EBD
		ld		a, 27h ; '''
		jr		p04loc_4EC4
; ---------------------------------------------------------------------------

p04loc_4EBD:
		cp		1Bh
		jp		nz, p04sub_5CEA
		ld		a, 1Dh

p04loc_4EC4:
		; ForceGraphKeypress+916j
		ld		(curGStyle), a
		ld		hl, (curGY)
		ld		(curGY2), hl
		jp		p04loc_48AE
; ---------------------------------------------------------------------------

p04loc_4ED0:
		cp		63h ; 'c'
		jr		nz, p04loc_4EDC
		call	COPYRNG
		call	ZooDefault
		jr		p04loc_4F3D
; ---------------------------------------------------------------------------

p04loc_4EDC:
		cp		5Bh ; '['
		jr		nz, p04loc_4EE5
		call	ZmFit
		jr		p04loc_4F3D
; ---------------------------------------------------------------------------

p04loc_4EE5:
		cp		65h ; 'e'
		jr		nz, p04loc_4EEE
		call	ZmUsr
		jr		p04loc_4F3D
; ---------------------------------------------------------------------------

p04loc_4EEE:
		cp		5Eh ; '^'
		jr		nz, p04loc_4EF7
		call	ZmPrev
		jr		p04loc_4F3D
; ---------------------------------------------------------------------------

p04loc_4EF7:
		cp		62h ; 'b'
		jr		nz, p04loc_4F00
		call	ZmSquare
		jr		p04loc_4F3D
; ---------------------------------------------------------------------------

p04loc_4F00:
		cp		60h ; '`'
		jr		nz, p04loc_4F09
		call	ZmDecml
		jr		p04loc_4F3D
; ---------------------------------------------------------------------------

p04loc_4F09:
		cp		66h ; 'f'
		jr		nz, p04loc_4F12
		call	SETUZM
		jr		p04loc_4F43
; ---------------------------------------------------------------------------

p04loc_4F12:
		cp		68h ; 'h'
		jr		nz, p04loc_4F1D
		ld		a, 8Fh ; '�'
		call	Page0Call_35EB
		jr		p04loc_4F3D
; ---------------------------------------------------------------------------

p04loc_4F1D:
		cp		44h ; 'D'
		jr		z, p04loc_4F43
		cp		6Bh ; 'k'
		jr		z, p04loc_4F3D
		cp		9
		jr		nz, p04loc_4F36
		call	j_CursorOff
		ld		a, (curGStyle)
		or		a
		jp		z, JForceCmd

p04loc_4F33:
		jp		p04sub_5720
; ---------------------------------------------------------------------------

p04loc_4F36:
		cp		64h ; 'd'
		jr		nz, p04loc_4F52
		call	ZmTrig

p04loc_4F3D:
		; ForceGraphKeypress+935j ...
		call	SetTblGraphDraw
		xor		a
		jr		p04loc_4F52
; ---------------------------------------------------------------------------

p04loc_4F43:
		; ForceGraphKeypress+97Aj ...
		bit		graphDraw, (iy+graphFlags)
		push	af
		call	nz, Regraph
		pop		af
		call	z, GRBUFCPY_V
		jp		p04sub_5720
; ---------------------------------------------------------------------------

p04loc_4F52:
		; ForceGraphKeypress+99Cj
		bit		graphDraw, (iy+graphFlags)
		push	af
		call	nz, Regraph
		pop		af
		push	af
		call	z, GRBUFCPY_V
		pop		af
		bit		graphDraw, (iy+graphFlags)
		jr		nz, p04loc_4F33
		cp		75h ; 'u'
		jp		nz, p04loc_502C
		xor		a
		ld		(unk_85FD), a
		jr		p04loc_4F7B
; END OF FUNCTION CHUNK	FOR ForceGraphKeypress

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


p04sub_4F71:
		res		curOn, (iy+curFlags)
		call	GrBufCpy
		call	GRLABELS

p04loc_4F7B:
		call	Page04_33BD
		ld		hl, (EQS)
		ld		(FPS), hl
		jp		z, p04sub_5720
		call	p04sub_5720
		call	p04sub_4FB9
		ld		a, (curGY2+1)
		bit		2, (iy+17h)
		call	nz, PUTEQUNO
		call	j_setNumWindow
		call	j_createNumEditBuf
		ld		(editSym), hl
		call	j_SetEmptyEditPtr
		call	CanAlphIns
		res		curLock, (iy+curFlags)
		set		promptEdit, (iy+promptFlags)
		res		appCurGraphic, (iy+appFlags)
		ld		hl, p04loc_4572
		ld		(mcxErrorEP), hl
		ret
; End of function p04sub_4F71


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


p04sub_4FB9:
		call	p04sub_4FEC
		set		NEED_BUFCPY, (iy+VERTFLAG2)
		set		NEED_RETABLE, (iy+VERTFLAG2)
		bit		2, (iy+17h)
		jr		p04loc_4FCA

p04loc_4FCA:
		ld		hl, aX
		call	IsFuncMode
		jr		nz, p04loc_4FE5
		ld		hl, unk_26BF
		call	IsFunctionMode
		jr		nz, p04loc_4FE5
		ld		hl, aT
		call	IsParametricMode
		jr		nz, p04loc_4FE5
		ld		hl, unk_26C8

p04loc_4FE5:
		call	j_PutS
		call	j_EraseEOL
		ret
; End of function p04sub_4FB9


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


p04sub_4FEC:
		ld		hl, (winBtm)
		dec		l
		bit		grfSplit, (iy+sGrFlags)
		jr		z, p04loc_4FF8
		ld		l, 3

p04loc_4FF8:
		ld		h, 0
		ld		(curRow), hl
		ret
; End of function p04sub_4FEC

p04loc_4FFE:
		.db		5Ah	; Z
		.db		74h	; t
		.db		79h	; y
		.db		78h	; x
		.db		7Ah	; z
		.db		7Bh	; {
		.db		7Ch	; |
		.db		77h	; w
		.db		7Dh	; }
		.db		7Eh	; ~
		.db		76h	; v
		.db		69h	; i
p04loc_500A:
		.db		7Fh	; 
		.db		65h	; e
		.db		77h	; w
		.db		69h	; i
		.db		63h	; c
		.db		6Fh	; o
		.db		73h	; s
		.db		71h	; q
		.db		5Fh	; _
		.db		53h	; S
		.db		7Dh	; }
		.db		51h	; Q
p04loc_5016:
		.db		55h	; U
		.db		57h	; W
		.db		59h	; Y
		.db		61h	; a
		.db		6Bh	; k
		.db		6Dh	; m
		.db		79h	; y
		.db		7Bh	; {

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


p04sub_501E:
		ld		a, 1Fh
		call	j_RclSysTok
		ld		hl, PlotStart
		call	page0_BEC
		jp		Minus1
; End of function p04sub_501E

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

p04loc_502C:
		ld		hl, p04loc_4FFE
		ld		bc, 0Ch
		cpir
		jp		nz, p04loc_56E6
		set		3, (iy+27h)
		res		4, (iy+1Fh)
		ld		hl, p04loc_500A
		add		hl, bc
		ld		a, (hl)
		ld		(curGStyle), a
		ld		hl, p04loc_505F-1
		ld		a, (Xres_int)
		call	Bit_VertSplit
		jr		z, p04loc_5054
		add		a, 8

p04loc_5054:
		ld		e, a
		ld		d, 0
		add		hl, de
		ld		l, (hl)
		ld		h, d
		call	p04sub_6715
		jr		p04loc_507D
p04loc_505F:
		.db		2Fh	; /
		.db		30h	; 0
		.db		30h	; 0
		.db		30h	; 0
		.db		32h	; 2
		.db		30h	; 0
		.db		31h	; 1
		.db		30h	; 0
		.db		17h
		.db		18h
		.db		18h
		.db		18h
		.db		19h
		.db		18h
		.db		1Ch
		.db		18h
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p04sub_465B

p04loc_506F:
		bit		4, (iy+17h)
		jr		nz, p04loc_507D
		push	hl
		call	GRBUFCPY_V
		call	GRLABELS
		pop		hl

p04loc_507D:
		res		6, (iy+17h)
		ld		(curInc), hl
		bit		2, (iy+17h)
		jr		nz, p04loc_5099
		ld		hl, 0
		ld		(unk_8E65), hl
		ld		(curGY2), hl
		ld		(unk_9810), hl
		ld		(unk_980E), hl

p04loc_5099:
		call	j_CMPBOXINFO
		xor		a
		ld		(curPlotNumber), a
		set		allowCursor, (iy+plotFlags)
		call	FNDSELEQ
		bit		2, (iy+17h)
		jr		z, p04loc_50DC
		set		7, (iy+0)
		call	IsRecursiveMode
		jr		z, p04loc_50D9
		res		2, (iy+17h)
		call	j_RclN
		bit		webMode, (iy+seqFlags)
		jr		z, p04loc_50CA
		ld		hl, nMin
		rst		20h
		call	j_StoN

p04loc_50CA:
		call	p04sub_51B5
		set		2, (iy+17h)
		set		6, (iy+17h)
		set		4, (iy+1Fh)

p04loc_50D9:
		jp		p04loc_52EC
; ---------------------------------------------------------------------------

p04loc_50DC:
		call	p04sub_449A
		jr		nz, p04loc_50E9
		call	j_NEXTPLOT
		jp		z, p04loc_4F43
		jr		p04loc_5139
; ---------------------------------------------------------------------------

p04loc_50E9:
		ld		a, (curGStyle)
		cp		4Fh ; 'O'
		jr		z, p04loc_5139
		call	IsParametricMode
		call	nz, p04sub_7298
		call	IsFunctionMode
		call	nz, p04sub_7289
		jr		p04loc_5136
; END OF FUNCTION CHUNK	FOR p04sub_465B

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


p04sub_50FE:
		; ForceGraphKeypress+C46p
		ld		hl, (curInc)
		bit		7, (iy+0)
		jr		z, p04loc_511C
		call	IsRecursiveMode
		jr		z, p04loc_5119
		bit		webMode, (iy+seqFlags)
		ret		nz
		ld		hl, 8D21h
		rst		20h
		call	j_StoN
		ret
; ---------------------------------------------------------------------------

p04loc_5119:
		ld		hl, (unk_8E2B)

p04loc_511C:
		call	p04sub_6700
		ld		bc, ThetaMin
		call	IsFunctionMode
		jr		nz, p04loc_512E
		ld		bc, TminPar
		call	IsParametricMode
		ret		z

p04loc_512E:
		ld		a, (curPlotNumber)
		or		a
		call	z, NEWINDEP
		ret
; End of function p04sub_50FE

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p04sub_465B

p04loc_5136:
		call	p04sub_50FE

p04loc_5139:
		; p04sub_465B+A93j
		call	IsRecursiveMode
		jr		z, p04loc_5182
		call	j_RclN
		ld		a, (curGStyle)
		cp		4Fh ; 'O'
		jr		nz, p04loc_5150
		bit		webMode, (iy+seqFlags)
		jr		z, p04loc_517F
		jr		p04loc_5173
; ---------------------------------------------------------------------------

p04loc_5150:
		ld		hl, 8D21h
		rst		20h
		bit		7, (iy+0)
		jr		nz, p04loc_516D
		ld		hl, PlotStart
		rst		20h
		call	Minus1
		call	CkOP1Pos
		jp		nz, Page0Call_2509
		call	p04sub_6726
		call	p04sub_501E

p04loc_516D:
		bit		webMode, (iy+seqFlags)
		jr		z, p04loc_517C

p04loc_5173:
		ld		hl, nMin
		rst		20h
		call	j_StoN
		jr		p04loc_517F
; ---------------------------------------------------------------------------

p04loc_517C:
		call	p04sub_6726

p04loc_517F:
		; p04sub_465B+B1Fj
		call	p04sub_51B5

p04loc_5182:
		set		7, (iy+0)
		ld		a, 0Bh
		ld		(curGY2+1), a
		bit		cmdExec, (iy+cmdFlags)
		jr		nz, p04loc_519C
		call	IsOnInterruptSet
		jr		z, p04loc_51A2
		call	GRBUFCPY_V
		call	GRLABELS

p04loc_519C:
		call	IsOnInterruptSet
		jp		nz, p04loc_5470
; END OF FUNCTION CHUNK	FOR p04sub_465B
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

p04loc_51A2:
		; p04sub_465B+B39j
		ld		a, 4
		set		0, (iy+27h)
		jr		p04loc_51EF
; END OF FUNCTION CHUNK	FOR ForceGraphKeypress

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


p04sub_51AA:
		bit		webMode, (iy+seqFlags)
		call	nz, FPOPREAL
		ld		hl, 8D21h
		rst		20h
; End of function p04sub_51AA


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


p04sub_51B5:
		; p04sub_465B:p04loc_517Fp ...
		rst		18h
		call	Page04_38E5
		call	PopRealO1
		call	j_SEQSET
		res		webVert, (iy+seqFlags)
		set		5, (iy+0Fh)
		call	RECURNNAME
		rst		10h
		ld		(inputDat), de
		ret
; End of function p04sub_51B5

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

p04loc_51D0:
		; ForceGraphKeypress:p04loc_480Aj
		ld		b, a
		ld		a, 1
		bit		0, (iy+36h)
		call	nz, j_RunTraceHook
		ret		nz
		push	bc
		bit		4, (iy+1Fh)
		call	nz, p04sub_51AA
		res		4, (iy+1Fh)
		res		6, (iy+17h)
		call	p04sub_50FE
		pop		af

p04loc_51EF:
		res		7, (iy+19h)
		res		1, (iy+1Fh)
		cp		2
		jp		z, p04loc_53B2
		jp		c, p04loc_5483
		cp		0Eh
		jr		nc, p04loc_5222
		ld		d, a
		ld		a, (curGStyle)
		cp		81h ; '�'
		jr		nz, p04loc_5216
		ld		hl, (unk_8E65)
		dec		hl
		ld		(unk_8E65), hl
		call	j_SPLOTRIGHT
		ret
; ---------------------------------------------------------------------------

p04loc_5216:
		ld		hl, p04loc_5016
		ld		bc, 8
		cpir
		jp		z, p04loc_52F1
		ld		a, d

p04loc_5222:
		cp		4
		jp		nz, p04loc_5548
		res		5, (iy+3)
		ld		a, (curPlotNumber)
		or		a
		jr		z, p04loc_525D
		call	j_NEXTPLOT
		jr		nz, p04loc_5246
		call	NEXTEQ
		jr		nz, p04loc_5246
		call	j_NEXTPLOT
		ld		b, a
		ld		a, (curPlotNumber)
		cp		b
		jp		z, LABCOOR

p04loc_5246:
		; ForceGraphKeypress+C94j
		ld		a, (curPlotNumber)
		call	j_CLRPREVPLOT

p04loc_524C:
		call	j_CursorOff
		ld		a, (curPlotNumber)
		call	j_NEXTPLOT
		jr		z, p04loc_5274
		call	j_INITNEWTRACEP
		jp		p04loc_48B5
; ---------------------------------------------------------------------------

p04loc_525D:
		ld		hl, (unk_9810)
		ld		a, l
		or		h
		jr		z, p04loc_5277
		ld		de, (unk_980E)
		or		a
		sbc		hl, de
		jr		z, p04loc_5277
		inc		de
		ld		(unk_980E), de
		jr		p04loc_52F1
; ---------------------------------------------------------------------------

p04loc_5274:
		ld		(curPlotNumber), a

p04loc_5277:
		; ForceGraphKeypress+CC6j
		ld		a, (curGY2+1)
		call	NEXTEQ
		jr		nz, p04loc_529B
		call	j_NEXTPLOT
		jr		nz, p04loc_529B
		call	NEXTEQ
		ld		b, a
		ld		a, (curGY2+1)
		cp		b
		jr		nz, p04loc_529B
		ld		hl, (unk_9810)
		ld		a, l
		or		h
		jr		nz, p04loc_529B
		set		7, (iy+19h)
		jr		p04loc_52F1
; ---------------------------------------------------------------------------

p04loc_529B:
		; ForceGraphKeypress+CDDj ...
		ld		hl, 0
		ld		(unk_9810), hl
		inc		hl
		ld		(unk_980E), hl
		ld		a, (curGY2+1)
		cp		0Ah
		jr		z, p04loc_52B7
		or		a
		jr		z, p04loc_52B7
		call	IsRecursiveMode
		jr		z, p04loc_52B7
		call	p04sub_52C2

p04loc_52B7:
		; ForceGraphKeypress+D08j ...
		call	NEXTEQ
		or		a
		jr		nz, p04loc_52CD
		ld		(curGY2+1), a
		jr		p04loc_524C
; END OF FUNCTION CHUNK	FOR ForceGraphKeypress

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


p04sub_52C2:
		; ForceGraphKeypress+104Dp
		ld		hl, (EQS)
		ld		de, 12h
		add		hl, de
		ld		(FPS), hl
		ret
; End of function p04sub_52C2

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

p04loc_52CD:
		; ForceGraphKeypress+1054j
		ld		(curGY2+1), a
		call	IsRecursiveMode
		jr		z, p04loc_52E5
		bit		webMode, (iy+seqFlags)
		jr		z, p04loc_52E5
		ld		hl, nMin
		rst		20h
		call	j_StoN
		call	p04sub_51B5

p04loc_52E5:
		; ForceGraphKeypress+D34j
		set		0, (iy+27h)
		call	j_CursorOff
; END OF FUNCTION CHUNK	FOR ForceGraphKeypress
; START	OF FUNCTION CHUNK FOR p04sub_465B

p04loc_52EC:
		call	IsRecursiveMode
		jr		z, p04loc_52F1

p04loc_52F1:
		; ForceGraphKeypress+CCDj ...
		res		6, (iy+17h)
		bit		2, (iy+17h)
		jr		z, p04loc_5300
		call	IsFuncMode
		jr		nz, p04loc_5306

p04loc_5300:
		ld		hl, (curInc)
		call	p04sub_6700

p04loc_5306:
		ld		hl, (pTempCnt)
		push	hl
		call	IsFuncMode
		jp		z, p04loc_5607
		bit		7, (iy+19h)
		jr		nz, p04loc_5340
		call	VALCUR
		ld		hl, OP2
		ld		a, (curInc)
		ld		(curGY+1), a
		bit		2, (iy+17h)
		jr		nz, p04loc_5333
		call	Xitof
		ld		a, (curGStyle)
		cp		4Fh ; 'O'
		call	nz, j_StoX

p04loc_5333:
		call	j_GRPHPARS

TRCYFUNC:
		; p04sub_465B+FFAj ...
		rst		18h
		call	PopRealO1
		call	p04sub_5467
		call	p04sub_5BB6

p04loc_5340:
		; p04sub_465B+1001j ...
		res		6, (iy+17h)
		ld		a, (iy+17h)
		push	af
		res		2, (iy+17h)
		ld		hl, (unk_980E)
		ld		a, l
		or		h
		cp		1
		call	z, j_TBLTRACE
		res		7, (iy+19h)
		res		1, (iy+1Fh)
		res		3, (iy+27h)
		pop		af
		bit		2, a
		jr		z, p04loc_536B
		set		2, (iy+17h)

p04loc_536B:
		bit		2, (iy+17h)
		jr		z, p04loc_539A
		bit		5, (iy+17h)
		jr		nz, p04loc_5389
		call	p04loc_6721
		bit		4, (iy+17h)
		jr		z, p04loc_539A
		res		4, (iy+17h)
		ld		a, 4Fh ; 'O'
		ld		(curGStyle), a

p04loc_5389:
		res		5, (iy+17h)
		pop		hl
		ld		(pTempCnt), hl
		res		3, (iy+2)
		set		displayCoords, (iy+newDispF)
		ret
; ---------------------------------------------------------------------------

p04loc_539A:
		; p04sub_465B+D23j
		res		4, (iy+17h)
		pop		hl
		ld		(pTempCnt), hl
		bit		grfNoCoord, (iy+grfDBFlags)
		jr		z, p04loc_53AE
		call	j_CursorOff
		jp		p04loc_48B5
; ---------------------------------------------------------------------------

p04loc_53AE:
		call	p04sub_4886
		ret
; END OF FUNCTION CHUNK	FOR p04sub_465B
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

p04loc_53B2:
		ld		b, 1

p04loc_53B4:
		ld		a, (curPlotNumber)
		or		a
		jr		z, p04loc_53BE
		call	j_SPLOTLEFT
		ret
; ---------------------------------------------------------------------------

p04loc_53BE:
		set		2, (iy+27h)
		call	IsRecursiveMode
		jr		z, p04loc_541F
		bit		webMode, (iy+seqFlags)
		jr		z, p04loc_53F0
		ld		hl, 8D21h
		rst		20h
		ld		hl, PlotStart
		call	Mov9OP2Cp
		jp		c, LABCOOR
		call	Minus1
		call	p04sub_6726
		call	FPOPREAL
		ld		hl, nMin
		rst		20h
		call	j_StoN
		call	p04sub_51B5
		jp		p04loc_52F1
; ---------------------------------------------------------------------------

p04loc_53F0:
		push	bc
		call	p04sub_501E
		call	OP1ToOP3
		call	j_RclN
		pop		bc
		set		7, (iy+19h)

p04loc_53FF:
		push	bc
		call	BCALL_4120
		call	cpop1op2
		pop		bc
		jr		z, p04loc_5417
		res		7, (iy+19h)
		push	bc
		ld		hl, PlotStep
		call	page0_C25
		pop		bc
		djnz	p04loc_53FF

p04loc_5417:
		call	p04sub_6726
		call	j_SEQSET
		jr		p04loc_5460
; ---------------------------------------------------------------------------

p04loc_541F:
		call	p04sub_5474
		set		4, (iy+3)
		call	IsFuncMode
		ld		de, 0FFFFh
		jp		z, p04loc_54E3

p04loc_542F:
		ld		a, (curInc)
		sub		c
		ld		(curInc), a
		jr		nc, p04loc_545E
		push	bc
		call	p04sub_5C7A
		ld		a, (curInc)
		jr		nz, p04loc_5448
		pop		bc
		add		a, c
		ld		(curInc), a
		jr		p04loc_5460
; ---------------------------------------------------------------------------

p04loc_5448:
		push	af
		call	j_CursorOff
		call	p04sub_58BE
		pop		de
		push	af
		ld		a, d
		add		a, 8
		ld		l, a
		ld		h, 0
		pop		af
		pop		bc
		jr		nz, p04loc_5462
		ld		(curInc), hl

p04loc_545E:
		djnz	p04loc_542F

p04loc_5460:
		; ForceGraphKeypress+EA1j
		jr		p04loc_54D3
; ---------------------------------------------------------------------------

p04loc_5462:
		; ForceGraphKeypress+F27j
		call	SetTblGraphDraw
		jr		p04loc_5470
; END OF FUNCTION CHUNK	FOR ForceGraphKeypress

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


p04sub_5467:
		; p04sub_465B+FB7p ...
		call	IsOnInterruptSet
		ret		z
		pop		hl
		pop		hl
		ld		(pTempCnt), hl

p04loc_5470:
		; p04sub_465B+B44j ...
		call	p04sub_5CEA
		ret
; End of function p04sub_5467


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


p04sub_5474:
		; ForceGraphKeypress+EF7p
		res		6, (iy+17h)
		ld		c, 1
		call	IsFuncMode
		ret		z
		ld		a, (Xres_int)
		ld		c, a
		ret
; End of function p04sub_5474

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

p04loc_5483:
		ld		b, 1

p04loc_5485:
		res		4, (iy+3)
		ld		a, (curPlotNumber)
		or		a
		jr		z, p04loc_5493
		call	j_SPLOTRIGHT
		ret
; ---------------------------------------------------------------------------

p04loc_5493:
		set		1, (iy+27h)
		call	IsFuncMode
		jr		z, p04loc_54DB
		call	p04sub_5474

p04loc_549F:
		ld		a, (curInc)
		add		a, c
		ld		(curInc), a
		call	p04sub_75A2
		jr		c, p04loc_54D1
		push	bc
		call	p04sub_5C7A
		ld		a, (curInc)
		jr		nz, p04loc_54BB
		pop		bc
		sub		c
		ld		(curInc), a
		jr		p04loc_54D3
; ---------------------------------------------------------------------------

p04loc_54BB:
		push	af
		call	j_CursorOff
		call	p04sub_58BE
		pop		de
		push	af
		ld		a, d
		sub		8
		ld		h, 0
		ld		l, a
		pop		af
		pop		bc
		jr		nz, p04loc_5462
		ld		(curInc), hl

p04loc_54D1:
		djnz	p04loc_549F

p04loc_54D3:
		; ForceGraphKeypress+F14j ...
		jp		p04loc_52F1
; ---------------------------------------------------------------------------

p04loc_54D6:
		add		hl, de
		jr		c, p04loc_54F2

p04loc_54D9:
		jr		p04loc_54D3
; ---------------------------------------------------------------------------

p04loc_54DB:
		call	IsRecursiveMode
		jr		nz, p04loc_5516
		ld		de, 1

p04loc_54E3:
		set		7, (iy+19h)

p04loc_54E7:
		ld		hl, (curInc)
		ld		a, e
		cp		1
		jr		nz, p04loc_54D6
		add		hl, de
		jr		c, p04loc_54D9

p04loc_54F2:
		push	de
		push	bc
		ld		(curInc), hl
		ld		bc, TminPar
		call	IsParametricMode
		jr		nz, p04loc_5502
		ld		bc, ThetaMin

p04loc_5502:
		call	NEWINDEP
		pop		bc
		pop		de
		jr		c, p04loc_553F
		res		7, (iy+19h)
		res		1, (iy+1Fh)
		djnz	p04loc_54E7

p04loc_5513:
		; ForceGraphKeypress+FA1j ...
		jp		p04loc_52F1
; ---------------------------------------------------------------------------

p04loc_5516:
		bit		webMode, (iy+seqFlags)
		jr		z, p04loc_5525
		ld		hl, 8D21h
		call	page0_186A
		jp		p04loc_54D3
; ---------------------------------------------------------------------------

p04loc_5525:
		set		7, (iy+19h)

p04loc_5529:
		push	bc
		call	p04sub_6F32
		jr		c, p04loc_553E
		res		7, (iy+19h)
		call	p04sub_6726
		call	j_SEQSOLVE
		pop		bc
		djnz	p04loc_5529
		jr		p04loc_5513
; ---------------------------------------------------------------------------

p04loc_553E:
		pop		bc

p04loc_553F:
		ld		hl, (curInc)
		dec		hl
		ld		(curInc), hl
		jr		p04loc_5513
; ---------------------------------------------------------------------------

p04loc_5548:
		cp		0Eh
		jr		c, p04loc_5558
		set		0, (iy+27h)
		ld		b, 5
		jp		nz, p04loc_5485
		jp		p04loc_53B4
; ---------------------------------------------------------------------------

p04loc_5558:
		set		0, (iy+27h)
		set		5, (iy+3)
		ld		a, (curPlotNumber)
		or		a
		jr		z, p04loc_559E
		call	j_PREVPLOT
		jr		nz, p04loc_557F
		ld		a, 0Bh
		call	PREVEQ
		jr		nz, p04loc_557F
		ld		a, 4
		call	j_PREVPLOT
		ld		b, a
		ld		a, (curPlotNumber)
		cp		b
		jp		z, LABCOOR

p04loc_557F:
		; ForceGraphKeypress+FCBj
		ld		a, (curPlotNumber)
		call	j_CLRPREVPLOT

p04loc_5585:
		call	j_CursorOff
		call	j_PREVPLOT
		jr		z, p04loc_5593
		call	j_INITNEWTRACEP
		jp		p04loc_48B5
; ---------------------------------------------------------------------------

p04loc_5593:
		xor		a
		ld		(curPlotNumber), a
		ld		a, 0Bh
		ld		(curGY2+1), a
		jr		p04loc_55F5
; ---------------------------------------------------------------------------

p04loc_559E:
		ld		hl, (unk_9810)
		ld		a, l
		or		h
		jr		z, p04loc_55B5
		ld		de, (unk_980E)
		dec		de
		ld		a, e
		or		d
		jr		z, p04loc_55B5
		ld		(unk_980E), de
		jp		p04loc_5513
; ---------------------------------------------------------------------------

p04loc_55B5:
		; ForceGraphKeypress+1007j
		ld		a, (curGY2+1)
		call	PREVEQ
		jr		nz, p04loc_55DE
		ld		a, 4
		call	j_PREVPLOT
		jr		nz, p04loc_55DE
		ld		a, 0Bh
		call	PREVEQ
		ld		b, a
		ld		a, (curGY2+1)
		cp		b
		jr		nz, p04loc_55DE
		ld		hl, (unk_9810)
		ld		a, l
		or		h
		jr		nz, p04loc_55DE
		set		7, (iy+19h)
		jp		p04loc_52F1
; ---------------------------------------------------------------------------

p04loc_55DE:
		; ForceGraphKeypress+101Dj ...
		xor		a
		ld		h, a
		ld		l, a
		ld		(unk_9810), hl
		ld		(curPlotNumber), a
		ld		a, (curGY2+1)
		or		a
		jr		z, p04loc_55F5
		call	IsRecursiveMode
		jr		z, p04loc_55F5
		call	p04sub_52C2

p04loc_55F5:
		; ForceGraphKeypress+1046j ...
		call	PREVEQ
		or		a
		jp		nz, p04loc_52CD
		ld		(curGY2+1), a
		ld		a, 4
		ld		(curPlotNumber), a
		jp		p04loc_5585
; END OF FUNCTION CHUNK	FOR ForceGraphKeypress
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p04sub_465B

p04loc_5607:
		call	IsParametricMode
		jr		z, p04loc_5624
		call	VALCUR
		call	j_GRPHPARS
		call	p04sub_5467
		call	p04sub_5C0A
		call	j_sDone
		call	page0_17E0
		call	j_PLOTPARS
		jp		TRCYFUNC
; ---------------------------------------------------------------------------

p04loc_5624:
		call	IsRecursiveMode
		jr		nz, p04loc_5658
		call	VALCUR
		call	j_GRPHPARS
		call	p04sub_5467
		call	IsOP1Num
		jr		z, p04loc_564C
		call	j_StoR
		ld		hl, (inputDat)
		call	Mov9ToOP2
		ld		hl, p04loc_56B9
		call	pushErrorHandleR
		call	j_PtoR
		call	popErrorHandleR

p04loc_564C:
		call	PushRealO2
		call	p04sub_5C0A
		call	PopRealO1
		jp		TRCYFUNC
; ---------------------------------------------------------------------------

p04loc_5658:
		bit		7, (iy+19h)
		jp		nz, p04loc_5340
		bit		webMode, (iy+seqFlags)
		jp		nz, p04loc_5758
		set		numOP1, (iy+ParsFlag2)
		call	VALCUR
		call	RCL_SEQ_X
		call	CkOP1Real
		cp		0Eh
		jr		nz, p04loc_5680
		res		numOP1, (iy+ParsFlag2)
		ld		hl, OP1
		set		5, (hl)

p04loc_5680:
		call	p04sub_5467
		call	p04sub_5C0A
		set		numOP1, (iy+ParsFlag2)
		call	p04sub_5729
		call	CkOP1Real
		cp		0Eh
		jr		nz, p04loc_569D
		ld		hl, OP1
		set		5, (hl)
		res		numOP1, (iy+ParsFlag2)

p04loc_569D:
		jp		TRCYFUNC
; END OF FUNCTION CHUNK	FOR p04sub_465B

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


RCL_SEQ_X:
		; Regraph+71Ep
		call	j_RclN
		call	p04sub_56B3
		ret		z
		ld		hl, 8E3Fh
		bit		3, a
		jr		nz, p04loc_56B1
		ld		hl, 8E2Dh

p04loc_56B1:
		rst		20h
		ret
; End of function RCL_SEQ_X


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


p04sub_56B3:
		ld		a, (iy+0Fh)
		and		1Ch
		ret
; End of function p04sub_56B3

p04loc_56B9:
		call	p04loc_5C4D
		call	p04loc_5BFB
		bit		grfPolar, (iy+grfDBFlags)
		jr		z, p04loc_56C9
		res		6, (iy+3)

p04loc_56C9:
		jp		p04loc_5340
p04loc_56CC:
		.db		5Fh	; _
		.db		5Ch	; \
		.db		5Dh	; ]
		.db		70h	; p
		.db		6Fh	; o
		.db		6Eh	; n
		.db		71h	; q
		.db		72h	; r
		.db		6Ah	; j
		.db		6Dh	; m
		.db		67h	; g
		.db		6Ch	; l
		.db		73h	; s
p04loc_56D9:
		.db		2Fh	; /
		.db		1Bh
		.db		15h
		.db		2Bh	; +
		.db		25h	; %
		.db		31h	; 1
		.db		29h	; )
		.db		23h	; #
		.db		21h	; !
		.db		1Fh
		.db		0Dh
		.db		0Bh
		.db		13h
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR ForceGraphKeypress

p04loc_56E6:
		ld		hl, p04loc_56CC
		ld		bc, 0Dh
		cpir
		jr		nz, p04loc_571D
		ld		hl, p04loc_56D9
		add		hl, bc
		ld		a, (hl)
		push	af
		bit		graphDraw, (iy+graphFlags)
		call	z, GRBUFCPY_V
		pop		af

p04loc_56FE:
		ld		bc, (curGY)
		ld		(curGStyle), a
		cp		2Fh ; '/'
		jr		nz, p04loc_571A
		ld		a, b
		cp		5Ch ; '\'
		jr		c, p04loc_5710
		ld		b, 5Bh ; '['

p04loc_5710:
		ld		a, c
		cp		6
		jr		nc, p04loc_5717
		ld		c, 6

p04loc_5717:
		jp		p04loc_4896
; ---------------------------------------------------------------------------

p04loc_571A:
		jp		p04loc_489F
; ---------------------------------------------------------------------------

p04loc_571D:
		or		a
		jr		nz, p04loc_5723
; END OF FUNCTION CHUNK	FOR ForceGraphKeypress

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


p04sub_5720:
		; ForceGraphKeypress:p04loc_4F33j	...
		call	p04sub_5CEA

p04loc_5723:
		jp		LABCOOR
; End of function p04sub_5720

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p04sub_58BE

p04loc_5726:
		jp		Page0Call_2509
; END OF FUNCTION CHUNK	FOR p04sub_58BE

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


p04sub_5729:
		; p04sub_465B+1118p ...
		ld		a, (curGY2+1)
		ld		c, a
; End of function p04sub_5729


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


RCLSEQ2:
		ld		hl, 8E3Fh
		ld		a, (iy+0Fh)
		ld		b, 2
		bit		0, a
		jr		nz, p04loc_5743
		and		1Ch
		jr		z, p04loc_5743
		bit		2, a
		jr		nz, p04loc_5754
		jr		p04loc_574F
; ---------------------------------------------------------------------------

p04loc_5743:
		ld		a, c
		cp		2
		jr		z, p04loc_5754
		ld		b, 1
		ld		hl, 8E2Dh
		jr		c, p04loc_5754

p04loc_574F:
		ld		b, 3
		ld		hl, 8E51h

p04loc_5754:
		push	bc
		rst		20h
		pop		bc
		ret
; End of function RCLSEQ2

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p04sub_465B

p04loc_5758:
		; p04sub_465B+11BFj
		call	VALCUR
		ld		a, (iy+0Fh)
		bit		5, a
		jr		z, p04loc_57B3
		bit		1, a
		jr		nz, p04loc_5779
		call	j_CursorOff
		set		webVert, (iy+seqFlags)
		call	OP1Set0
		call	YPIXSET
		call	p04sub_5729
		rst		18h
		jr		p04loc_57DA
; ---------------------------------------------------------------------------

p04loc_5779:
		call	p04sub_5848
		ld		a, (iy+17h)
		push	af
		res		2, (iy+17h)
		call	j_SEQSOLVE
		pop		af
		bit		2, a
		jr		z, p04loc_5790
		set		2, (iy+17h)

p04loc_5790:
		res		5, (iy+0Fh)
		res		webVert, (iy+seqFlags)
		call	p04sub_5729
		rst		8
		call	CpyTo1FPST
		call	OP1ToOP3
		call	OP4Set0

p04loc_57A5:
		call	j_CursorOff
		call	p04sub_5855
		call	p04sub_5729
		call	YPIXSET
		jr		p04loc_57D7
; ---------------------------------------------------------------------------

p04loc_57B3:
		bit		1, a
		jr		nz, p04loc_581D
		set		webVert, (iy+seqFlags)
		call	p04sub_5729
		call	OP1ToOP4
		rst		8
		call	CpyTo3FPST
		call	CpyO2ToFPST
		call	j_CursorOff
		call	p04sub_5855
		call	CpyTo1FPST
		call	YPIXSET
		call	page0_1867

p04loc_57D7:
		call	CpyTo1FPST

p04loc_57DA:
		call	XPIXSET
		pop		hl
		ld		(pTempCnt), hl
		ld		hl, 91D0h
		rst		20h
		bit		2, (iy+17h)
		call	nz, j_RclN
		ld		a, (curGStyle)
		cp		4Fh ; 'O'
		jr		nz, p04loc_57FA
		bit		4, (iy+1Eh)
		call	nz, j_RclN

p04loc_57FA:
		ld		hl, 8D21h
		call	Mov9OP2Cp
		jr		nz, p04loc_5816
		res		4, (iy+1Eh)
		res		2, (iy+17h)
		ld		de, 8D21h
		ld		hl, 91D0h
		call	mov9B2
		jp		p04loc_48B5
; ---------------------------------------------------------------------------

p04loc_5816:
		ld		hl, (pTempCnt)
		push	hl
		jp		p04loc_5758
; ---------------------------------------------------------------------------

p04loc_581D:
		res		webVert, (iy+seqFlags)
		call	p04sub_5848
		ld		a, (iy+17h)
		push	af
		res		2, (iy+17h)
		call	j_SEQSOLVE
		pop		af
		bit		2, a
		jr		z, p04loc_5838
		set		2, (iy+17h)

p04loc_5838:
		call	p04sub_5729
		rst		8
		call	CpyTo1FPST
		call	OP1ToOP3
		call	OP1ToOP4
		jp		p04loc_57A5
; END OF FUNCTION CHUNK	FOR p04sub_465B

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


p04sub_5848:
		; p04sub_465B+11C6p
		call	page0_1867
		call	j_RclN
		call	Plus1
		call	j_StoN
		ret
; End of function p04sub_5848


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


p04sub_5855:
		; p04sub_465B+1170p
		call	PUSHMCPLXO1
		ld		hl, 91D0h
		rst		20h
		ld		hl, PlotStart
		call	Mov9OP2Cp
		push	af
		call	POPMCPLXO1
		pop		af
		call	nc, j_CLine
		ret
; End of function p04sub_5855


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


p04sub_586B:
		push	bc
		push	de
		call	IOffset
		pop		de
		push	de
		add		hl, de
		ld		bc, 0Bh
		call	Bit_VertSplit
		jr		z, p04loc_587D
		ld		c, 5

p04loc_587D:
		ld		e, l
		ld		d, h
		bit		4, (iy+3)
		jr		z, p04loc_588A
		inc		de
		lddr
		jr		p04loc_588D
; ---------------------------------------------------------------------------

p04loc_588A:
		dec		de
		ldir

p04loc_588D:
		pop		de
		pop		bc
		dec		c
		jr		nz, p04sub_586B
		ret
; End of function p04sub_586B


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


p04sub_5893:
		ld		b, 3Fh ; '?'
		push	de

p04loc_5896:
		add		hl, de
		ld		(hl), 0
		push	hl
		bit		4, (iy+3)
		jr		nz, p04loc_58A5
		dec		hl
		ld		a, 0F8h	; '�'
		jr		p04loc_58A8
; ---------------------------------------------------------------------------

p04loc_58A5:
		inc		hl
		ld		a, 3Fh ; '?'

p04loc_58A8:
		and		(hl)
		ld		(hl), a
		pop		hl
		ld		de, 0Ch
		djnz	p04loc_5896
		pop		hl
		ld		de, 0Bh
		add		hl, de
		inc		de
		ld		b, 3Fh ; '?'

p04loc_58B8:
		res		0, (hl)
		add		hl, de
		djnz	p04loc_58B8
		ret
; End of function p04sub_5893


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


p04sub_58BE:
		; ForceGraphKeypress+F1Ap



		ld		hl, p04loc_5726
		call	pushErrorHandleR
		ld		a, 2
		bit		0, (iy+36h)
		call	nz, j_RunTraceHook
		set		0, (iy+27h)
		set		6, (iy+17h)
		ld		hl, 8E73h
		rst		20h
		ld		a, 8
		call	j_SetXXOP2
		bit		4, (iy+3)
		call	nz, InvOP2S
		rst		30h
		ld		a, (OP1+1)
		cp		8Eh ; '�'
		jp		z, p04loc_5726
		call	SetTblGraphDraw
		ld		de, 8E73h
		call	MovFrOP1
		ld		hl, deltaX
		call	page0_D19
		call	OP1ToOP4
		call	OP2ToOP1
		ld		a, (pixWide_m_2)
		ld		l, a
		ld		h, 0
		call	j_SetXXXXOP2
		call	FPMult
		call	OP4ToOP2
		call	OP1ToOP4
		ld		hl, 8E6Ah
		rst		20h
		rst		30h
		call	j_RndGuard
		call	CkValidNum
		call	OP1ToOP5
		call	OP4ToOP2
		rst		30h
		call	CkValidNum
		ld		hl, Xmax
		ld		(chkDelPtr1), hl
		call	Page0Call_3381
		ld		hl, OP5
		set		6, (hl)
		ld		de, Xmin
		call	mov9B2
		ld		hl, deltaX
		call	Mov9ToOP2
		ld		hl, 8484h
		call	INCEXP
		call	InvOP2S
		bit		4, (iy+3)
		jr		z, p04loc_5959
		call	InvOP2S
		call	OP5ToOP1

p04loc_5959:
		rst		30h
		rst		18h
		call	CKVALDELX
		call	PopRealO6
		call	popErrorHandleR
		ld		c, 3Fh ; '?'
		ld		b, 0Fh
		bit		4, (iy+3)
		jr		z, p04loc_5974
		ld		a, (lcdTallP+1)
		sub		9
		ld		b, a

p04loc_5974:
		ld		de, plotSScreen
		push	bc
		push	hl
		call	p04sub_586B
		pop		hl
		pop		bc
		ld		de, appBackUpScreen
		bit		1, (iy+3Ch)
		call	nz, p04sub_586B
		ld		bc, (lcdTallP)
		dec		b
		ld		c, 3Fh ; '?'
		bit		4, (iy+3)
		jr		z, p04loc_5997
		ld		b, 7

p04loc_5997:
		call	IOffset
		push	hl
		ld		de, plotSScreen
		call	p04sub_5893
		pop		hl
		ld		de, appBackUpScreen
		bit		1, (iy+3Ch)
		call	nz, p04sub_5893
		call	GrBufCpy
		bit		5, (iy+3)
		push	af
		set		5, (iy+3)
		ld		hl, (curGY2)
		push	hl
		ld		hl, (unk_9810)
		push	hl
		ld		hl, (unk_980E)
		push	hl
		ld		a, (curInc)
		push	af
		call	Axes
		res		1, (iy+3Ch)
		pop		af
		push	af
		ld		(curInc), a
		res		5, (iy+3)
		ld		hl, 0
		ld		(curGY2), hl
		set		drawingGraph, (iy+graphFlags)
		ld		hl, (pTempCnt)
		push	hl
		call	p04sub_72C4
		rst		18h
		rst		18h

p04loc_59EB:
		call	p04sub_7211
		jp		z, p04loc_5AAD
		pop		hl
		pop		af
		push	af
		push	hl
		ld		(curInc), a
		ld		hl, 0
		ld		(unk_9810), hl
		inc		hl
		ld		(unk_980E), hl
		ld		a, (curInc)
		add		a, 8
		ld		hl, Xres_int
		bit		4, (iy+3)
		jr		nz, p04loc_5A20
		sub		10h
		push	af
		ld		a, (lcdTallP+1)
		sub		0Bh
		ld		d, a
		pop		af

p04loc_5A1A:
		sub		(hl)
		cp		d
		jr		nc, p04loc_5A1A
		jr		p04loc_5A25
; ---------------------------------------------------------------------------

p04loc_5A20:
		; p04sub_58BE+165j
		add		a, (hl)
		cp		0Ah
		jr		c, p04loc_5A20

p04loc_5A25:
		ld		(curInc+1), a

p04loc_5A28:
		ld		a, (curInc+1)
		set		smarter_mask, (iy+smartFlags)
		res		7, (iy+17h)

p04loc_5A33:
		ld		(curInc), a
		ld		hl, (XOutDat)
		call	Xitof
		call	j_GRPHPARS
		call	INITNSEQ
		ld		de, OP3
		call	CPYFPS1
		inc		de
		inc		de
		call	mov9B2
		rst		8
		call	CpyO1ToFPST
		ld		hl, (XOutDat)
		rst		20h
		call	CpyO1ToFPS1
		call	NEDXT_Y_STYLE
		set		g_style_active, (iy+sGrFlags)
		bit		smarter_mask, (iy+smartFlags)
		call	z, PLOTPT
		res		smarter_mask, (iy+smartFlags)
		res		g_style_active, (iy+sGrFlags)
		call	IsOnInterruptSet
		jr		nz, p04loc_5AAD
		call	Page04_3393
		bit		7, (iy+17h)
		jr		nz, p04loc_5AA0
		ld		hl, pixWide_m_2
		ld		a, (curInc)
		cp		0
		jr		z, p04loc_5AA0
		cp		(hl)
		jr		nc, p04loc_5AA0
		ld		hl, Xres_int
		add		a, (hl)
		bit		4, (iy+3)
		jr		z, p04loc_5A9B
		sub		(hl)
		sub		(hl)
		jr		nc, p04loc_5A9B
		set		7, (iy+17h)

p04loc_5A9B:
		; p04sub_58BE+1D7j
		ld		(curInc), a
		jr		p04loc_5A33
; ---------------------------------------------------------------------------

p04loc_5AA0:
		; p04sub_58BE+1C6j ...
		res		7, (iy+17h)
		call	p04sub_712A
		jp		nc, p04loc_59EB
		jp		p04loc_5A28
; ---------------------------------------------------------------------------

p04loc_5AAD:
		; p04sub_58BE+1B3j
		res		graphDraw, (iy+graphFlags)
		res		drawingGraph, (iy+graphFlags)
		res		smarter_test, (iy+smartFlags)
		pop		hl
		pop		af
		ld		(pTempCnt), hl
		pop		hl
		ld		(unk_980E), hl
		pop		hl
		ld		(unk_9810), hl
		pop		hl
		ld		(curGY2), hl
		pop		af
		jr		z, p04loc_5AD1
		set		5, (iy+3)

p04loc_5AD1:
		call	FPOPCPLX
		ld		hl, (XOutSym)
		res		6, (hl)
		jp		IsOnInterruptSet
; End of function p04sub_58BE


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


Page04_33BD:
		call	FNDSELEQ
		xor		a
		call	NEXTEQ
		or		a
		ret
; End of function Page04_33BD


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


p04sub_5AE5:
		push	af
		call	EOP1NotReal
		pop		af
		jr		nc, p04loc_5B51
		ld		hl, Xmin
		call	IsFuncMode
		jr		nz, p04loc_5B22
		ld		hl, ThetaMin
		call	IsFunctionMode
		jr		nz, p04loc_5B22
		call	IsRecursiveMode
		jr		z, p04loc_5B1F
		bit		webMode, (iy+seqFlags)
		jr		z, p04loc_5B12
		call	ErrD_OP1NotPosInt
		ld		hl, nMin
		call	Mov9ToOP2
		jr		p04loc_5B1A
; ---------------------------------------------------------------------------

p04loc_5B12:
		rst		18h
		call	p04sub_501E
		rst		8
		call	PopRealO1

p04loc_5B1A:
		ld		hl, nMax
		jr		p04loc_5B25
; ---------------------------------------------------------------------------

p04loc_5B1F:
		ld		hl, TminPar

p04loc_5B22:
		call	Mov9ToOP2

p04loc_5B25:
		push	hl
		call	OP1ToOP4
		call	cpop1op2
		pop		hl
		jr		z, p04loc_5B4E
		push	af
		call	Mov9OP2Cp
		jr		z, p04loc_5B4D
		jr		c, p04loc_5B48
		pop		af
		jr		c, p04loc_5B4E
		call	IsRecursiveMode
		jr		z, p04loc_5B45
		bit		webMode, (iy+seqFlags)
		jr		nz, p04loc_5B4E

p04loc_5B45:
		jp		ErrInvalid
; ---------------------------------------------------------------------------

p04loc_5B48:
		pop		af
		jr		c, p04loc_5B45
		jr		p04loc_5B4E
; ---------------------------------------------------------------------------

p04loc_5B4D:
		pop		hl

p04loc_5B4E:
		call	OP4ToOP1

p04loc_5B51:
		call	IsFuncMode
		call	nz, j_StoX
		call	IsParametricMode
		call	nz, j_StoT
		call	IsFunctionMode
		call	nz, j_StoTheta
		call	IsRecursiveMode
		jr		z, p04loc_5B7F
p04loc_5B68:
		call	page0_14E1
		jp		nz, ErrDomain
		rst		18h
		call	RECURNNAME
		rst		10h
		push	de
		call	PopRealO1
		pop		de
		ld		(inputDat), de
		jp		MovFrOP1
; ---------------------------------------------------------------------------

p04loc_5B7F:
		ld		hl, (chkDelPtr1)
		ld		(inputDat), hl
		ret
; End of function p04sub_5AE5


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


p04sub_5B86:
		; ForceGraphKeypress+687p ...
		call	p04sub_5C0A
		ld		(curInc), a
		call	j_RclX
		call	j_StoAns
		call	j_GRPHPARS
		pop		bc
		call	p04sub_5467
		pop		hl
		ld		(pTempCnt), hl
		push	bc
		call	p04sub_5BB6
; End of function p04sub_5B86


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


GRLABELS:
		bit		graphDraw, (iy+graphFlags)
		ret		nz
		push	af
		bit		grfNoAxis, (iy+grfDBFlags)
		jr		nz, p04loc_5BB4
		bit		grfLabel, (iy+grfDBFlags)
		call	nz, p04sub_775A

p04loc_5BB4:
		pop		af
		ret
; End of function GRLABELS


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


p04sub_5BB6:
		; p04sub_5B86+18p
		call	IsOP1Num
		jr		z, p04loc_5BFB
; End of function p04sub_5BB6


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


YPIXSET:
		; p04sub_465B+1153p ...
		ld		hl, p04loc_5BFB
		call	pushErrorHandleR
		call	CkValidNum
		call	popErrorHandleR
		call	j_StoY
		ld		hl, OP1
		call	XYRND
		jr		nz, p04loc_5BFB
		call	OP1ToOP3
		xor		a
		ld		de, Ymin
		ld		hl, OP1
		call	Page04_3405
		call	OP3ToOP1
		ld		b, a
		ld		a, 1
		bit		1, b
		jr		nz, p04loc_5C04
		ld		a, (lcdTallP)
		dec		a
		bit		0, b
		jr		nz, p04loc_5C04
		ld		de, OP1
		call	YftoI

p04loc_5BF7:
		ld		(curGY), a
		ret
; ---------------------------------------------------------------------------

p04loc_5BFB:
		ld		a, (lcdTallP)
		srl	a
		set		7, (iy+3)

p04loc_5C04:
		res		graphCursor, (iy+graphFlags)
		jr		p04loc_5BF7
; End of function YPIXSET


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


p04sub_5C0A:
		; p04sub_465B+FF4p ...
		call	IsOP1Num
		jr		z, p04loc_5C4D
; End of function p04sub_5C0A


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


XPIXSET:
		ld		hl, p04loc_5C4D
		call	pushErrorHandleR
		call	CkValidNum
		call	popErrorHandleR
		call	j_StoX
		ld		hl, OP1
		call	XYRND
		jr		nz, p04loc_5C4D
		call	OP1ToOP3
		xor		a
		ld		de, Xmin
		ld		hl, OP1
		call	Page04_3405
		call	OP3ToOP1
		ld		b, a
		xor		a
		bit		1, b
		jr		nz, p04loc_5C57
		ld		a, (pixWide_m_2)
		bit		0, b
		jr		nz, p04loc_5C57
		ld		de, OP1
		call	XftoI

p04loc_5C49:
		ld		(curGY+1), a
		ret
; ---------------------------------------------------------------------------

p04loc_5C4D:
		ld		a, (lcdTallP+1)
		srl	a
		dec		a
		set		6, (iy+3)

p04loc_5C57:
		res		graphCursor, (iy+graphFlags)
		jr		p04loc_5C49
; End of function XPIXSET


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


COPYRNG:
		; ForceGraphKeypress+92Fp ...
		ld		hl, Xmin
		ld		de, prevData
		set		7, (iy+4)
; End of function COPYRNG


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


p04sub_5C67:
		ld		bc, 36h	; '6'
		ldir
		ret
; End of function p04sub_5C67


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


VALCUR:
		; ForceGraphKeypress+76Fp ...
		set		graphCursor, (iy+graphFlags)
		res		6, (iy+3)
		res		7, (iy+3)
		ret
; End of function VALCUR


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


p04sub_5C7A:
		; ForceGraphKeypress+F07p
		xor		a
		call	Page0Call_35B5
		jr		z, p04loc_5C86

p04loc_5C80:
		set		1, (iy+1Fh)
		xor		a
		ret
; ---------------------------------------------------------------------------

p04loc_5C86:
		call	IsFuncMode
		jr		z, p04loc_5C91
		bit		6, (iy+19h)
		jr		nz, p04loc_5C80

p04loc_5C91:
		bit		6, (iy+17h)
		jr		nz, p04loc_5C80
		ld		a, (curGStyle)
		cp		61h ; 'a'
		jr		z, p04loc_5C80
		cp		55h ; 'U'
		jr		z, p04loc_5C80
		cp		57h ; 'W'
		jr		z, p04loc_5C80
		ret
; End of function p04sub_5C7A


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


p04sub_5CA7:
		; ForceGraphKeypress:p04loc_4A76p	...
		bit		6, (iy+3)
		ret		nz
		bit		7, (iy+3)
		ret

p04loc_5CB1:
GRPUTAWAY:
		call	j_closeEditBuf
		call	p04sub_4596
		call	j_CursorOff
		res		monAbandon, (iy+monFlags)
		res		write_on_graph, (iy+sGrFlags)
		res		2, (iy+17h)
		set		NEED_RETABLE, (iy+VERTFLAG2)
		jr		RSTGFLAGS
; ---------------------------------------------------------------------------
p04loc_5CCC:
GRPPutAway:
		bit		promptEdit, (iy+promptFlags)
		call	nz, j_saveShadow2
		bit		2, (iy+17h)
		call	nz, j_saveShadow2
		call	j_CursorOff
		nop

RSTGFLAGS:
		res		2, (iy+11h)
		res		drawingGraph, (iy+graphFlags)
		res		3, (iy+3)

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


p04sub_5CEA:
		; ForceGraphKeypress+26Fp ...
		push	af
		bit		allowCursor, (iy+plotFlags)
		jr		z, p04loc_5D04
		push	hl
		push	de
		ld		hl, (EQS)
		ld		de, (FPS)
		call	CpHLDE
		jr		nc, p04loc_5D02
		ld		(FPS), hl

p04loc_5D02:
		pop		de
		pop		hl

p04loc_5D04:
		res		allowCursor, (iy+plotFlags)
		xor		a
		ld		(curGStyle), a
		res		graphCursor, (iy+graphFlags)
		pop		af
		ret
; End of function p04sub_5CEA

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

GRReset:
		push	af
		push	bc
		push	de
		push	hl
		res		6, (iy+19h)
		xor		a
		ld		(unk_8F4F), a
		ld		a, 0Eh
		ld		(OP1), a
		ld		de, u0
		ld		b, 6

p04loc_5D28:
		push	bc
		call	MovFrOP1
		pop		bc
		djnz	p04loc_5D28
		ld		de, w02
		call	MovFrOP1
		call	p04sub_5E72
		call	ZooDefault
		call	p04loc_6145
		call	p04loc_614A
		call	p04loc_612A
		ld		de, uXmin
		ld		hl, Xmin
		ld		bc, 0CFh ; '�'
		ldir
		call	OP1Set0
		ld		a, 40h ; '@'
		ld		(OP1M), a
		ld		de, XFact
		call	MovFrOP1
		call	MovFrOP1
		ld		hl, 0D0h ; '�'
		ld		(unk_8F4D), hl
		ld		hl, 0CFh ; '�'
		ld		(unk_8E7C), hl
		ld		hl, 12h
		ld		(unk_92B1), hl
		jp		p04loc_40A8
; ---------------------------------------------------------------------------

XYCENT:
		ld		hl, Xmin
		rst		20h
		call	page0_BEC
		call	TimesPt5
		call	OP1ToOP5
		ld		hl, Ymin
		rst		20h
		call	page0_BEC
		jp		TimesPt5
; ---------------------------------------------------------------------------

Page04_3543:
		push	af
		push	de
		call	Mov9ToOP2
		rst		20h
		call	FPSub
		call	TimesPt5
		call	OP1ToOP4
		pop		hl
		rst		20h
		pop		af
		call	c, fprecip
		call	OP4ToOP2
		call	FPMult
		call	OP1ToOP4
		call	OP5ToOP2

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


p04sub_5DAD:
		rst		30h
		call	j_RndGuard
		call	CkValidNum
		call	OP4ToOP2
		call	OP1ToOP4
		call	OP5ToOP1
		call	FPSub
		call	j_RndGuard
		jp		CkValidNum
; End of function p04sub_5DAD


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


CPTDELY:
		; ZooDefault+21p ...
		ld		hl, Ymin
		ld		a, (lcdTallP)
		sub		2
		ld		c, a
		ld		b, 0
		ld		de, deltaY
; End of function CPTDELY


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


p04sub_5DD4:
		push	de
		push	bc
		ld		de, OP2
		call	mov9B2
		call	page0_117C
		call	FPSub
		call	CkOP1Pos
		jp		nz, Page0Call_2509
		pop		hl
		call	j_SetXXXXOP2
		call	fpdiv
		ld		a, (OP1+1)
		cp		0E4h ; '�'
		jp		nc, Page0Call_2509
		call	CkValidNum
		call	CkOP1FP0
		jp		z, Page0Call_2509
		pop		de
		push	de
		call	MovFrOP1
		call	fprecip
		ld		hl, 847Ch
		ld		b, 3
		ld		a, 50h ; 'P'
		call	p04loc_4481
		ld		hl, 847Ch
		ld		b, 5
		call	ClrLp
		ld		hl, 12h
		pop		de
		add		hl, de
		ex		de, hl
		jp		MovFrOP1
; End of function p04sub_5DD4


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


CPTDELX:
		; ZooDefault+1Ep ...
		ld		hl, Xmin
		ld		a, (pixWide_m_2)
		ld		c, a
		ld		b, 0
		ld		de, deltaX
		call	p04sub_5DD4

CKVALDELX:
		ld		hl, Xmin
		ld		a, (unk_9153)
; End of function CPTDELX


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


CKVALDELTA:
		push	af
		rst		20h
		call	Mov9ToOP2
		ld		a, (OP1M)
		or		a
		jr		z, p04loc_5E5B
		ld		a, (OP2M)
		or		a
		jr		z, p04loc_5E5B
		ld		a, (OP1+1)
		ld		hl, 8484h
		cp		(hl)
		jr		nc, p04loc_5E53
		ld		a, (hl)

p04loc_5E53:
		sub		0Ah
		pop		de
		sub		d
		jp		nc, Page0Call_2509
		ret
; ---------------------------------------------------------------------------

p04loc_5E5B:
		; CKVALDELTA+Fj
		pop		de
		ret
; End of function CKVALDELTA


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


p04sub_5E5D:
		res		grfPolarM, (iy+grfModeFlags)
		res		grfParamM, (iy+grfModeFlags)
		res		grfFuncM, (iy+grfModeFlags)
		res		grfRecurM, (iy+grfModeFlags)
		ret
; End of function p04sub_5E5D

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

SetFuncM:
		call	IsFuncMode
		ret		nz

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


p04sub_5E72:
		call	p04sub_5E5D
		set		grfFuncM, (iy+grfModeFlags)

p04loc_5E79:
		jp		SetTblGraphDraw
; End of function p04sub_5E72

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

SetSeqM:
		call	IsRecursiveMode
		ret		nz
		call	p04sub_5E5D
		set		grfRecurM, (iy+grfModeFlags)
		jr		p04loc_5E79
; ---------------------------------------------------------------------------

SetPolM:
		call	IsFunctionMode
		ret		nz
		call	p04sub_5E5D
		set		grfPolarM, (iy+grfModeFlags)
		jr		p04loc_5E79
; ---------------------------------------------------------------------------

SetParM:
		call	IsParametricMode
		ret		nz
		call	p04sub_5E5D
		set		grfParamM, (iy+grfModeFlags)
		jr		p04loc_5E79

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


ZmInt:

		call	COPYRNG
		call	int
		bit		grfSplit, (iy+sGrFlags)
		ld		a, (lcdTallP)
		sub		2
		push	af
		srl	a
		call	j_SetXXOP2
		call	FPSub
		call	OP1ToOP6
		pop		af
		call	j_SetXXOP2
		rst		30h
		call	OP1ToOP4
		call	OP1Set1
		call	INCO1EXP
		ld		de, Xscl
		call	MovFrOP1
		ld		de, Yscl
		call	MovFrOP1
		call	OP5ToOP1
		call	int
		ld		a, (pixWide_m_2)
		push	af
		srl	a
		call	j_SetXXOP2
		call	FPSub
		call	OP1ToOP5
		pop		af
		call	j_SetXXOP2
		rst		30h
; End of function ZmInt


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


p04sub_5EF2:
		ld		hl, Xmax
		ld		(chkDelPtr1), hl
		call	Page0Call_3381
		call	OP4ToOP1
		ld		hl, Ymax
		ld		(chkDelPtr1), hl
		call	Page0Call_3381
		call	OP5ToOP1
		ld		a, 0Ah
		call	j_StoSysTok
		call	OP6ToOP1
		ld		hl, Ymin
		ld		(chkDelPtr1), hl
		call	Page0Call_3381
		ret
; End of function p04sub_5EF2


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


ZmDecml:

		call	COPYRNG
		call	OP1Set1
		ld		de, Xscl
		call	MovFrOP1
		ld		de, Yscl
		call	MovFrOP1
		ld		a, (pixWide_m_2)
		srl	a
		call	j_SetXXOP1
		call	p04sub_60DC
		ld		a, (lcdTallP)
		sub		2
		srl	a
		call	j_SetXXOP1
		call	FDIV10
		jp		p04sub_60D8
; End of function ZmDecml


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


ZmPrev:

		ld		hl, Xmin
		bit		7, (iy+4)
		jr		z, p04loc_5F55
		ld		hl, prevData

p04loc_5F55:
		ld		de, OP1
		call	p04sub_5C67
		call	COPYRNG
		ld		de, OP1
		scf
		push	af
		jr		p04loc_5F9E
; End of function ZmPrev


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


ZmUsr:

		call	COPYRNG
		scf

p04loc_5F69:
		push	af
		call	IsFunctionMode
		jr		z, p04loc_5F86
		ld		hl, ThetaMin
		ld		de, uThetMin
		jr		p04loc_5F91
; ---------------------------------------------------------------------------

p04loc_5F77:
		call	IsRecursiveMode
		jr		z, p04loc_5F9B
		ld		hl, PlotStart
		ld		de, uPlotStart
		ld		b, 5
		jr		p04loc_5F93
; ---------------------------------------------------------------------------

p04loc_5F86:
		call	IsParametricMode
		jr		z, p04loc_5F77
		ld		hl, TminPar
		ld		de, uTmin

p04loc_5F91:
		ld		b, 3

p04loc_5F93:
		pop		af
		push	af
		jr		c, p04loc_5F98
		ex		de, hl

p04loc_5F98:
		call	p04sub_5FA7

p04loc_5F9B:
		ld		de, uXmin

p04loc_5F9E:
		ld		hl, Xmin
		ld		b, 6
		pop		af
		jr		c, p04sub_5FA7
		ex		de, hl
; End of function ZmUsr


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


p04sub_5FA7:
		call	page0_16FA
		ex		de, hl
		push	bc
		push	de
		call	mov9B2
		ex		de, hl
		ex		(sp), hl
		res		6, (hl)
		pop		hl
		pop		bc
		djnz	p04sub_5FA7
		ret
; End of function p04sub_5FA7


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


SETUZM:

		or		a
		jr		p04loc_5F69
; End of function SETUZM


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


ZmFit:

		ld		hl, p04loc_6094
		call	pushErrorHandleR
		call	COPYRNG
		call	Bit_VertSplit
		jr		z, p04loc_5FD5
		bit		NEED_RETABLE, (iy+VERTFLAG2)
		call	nz, j_DSPGRTBL
		res		2, (iy+1Fh)

p04loc_5FD5:
		call	SetGraphDraw
		set		smarter_test, (iy+smartFlags)
		set		2, (iy+11h)
		call	Regraph
		res		2, (iy+11h)
		call	CpyTo1FPS2
		ld		a, (OP1)
		inc		a
		jr		z, p04loc_601D
		call	j_RndGuard
		call	CkValidNum
		call	CpyO1ToFPS2
		call	CpyTo1FPS3
		call	j_RndGuard
		call	CkValidNum
		call	CpyO1ToFPS3
		call	PopRealO1
		call	j_RndGuard
		call	CkValidNum
		call	OP1ToOP4
		call	PopRealO1
		call	j_RndGuard
		call	CkValidNum
		call	Page0Call_35E5

p04loc_601D:
		ld		hl, (EQS)
		ld		(FPS), hl
		call	popErrorHandleR
		call	IsRecursiveMode
		ret		z
		bit		webMode, (iy+seqFlags)
		ret		z
; End of function ZmFit


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


ZmSquare:

		call	SetTblGraphDraw
		call	CPTDELX
		call	CPTDELY
		ld		hl, p04loc_6094
		call	pushErrorHandleR
		ld		hl, deltaY
		rst		20h
		ld		hl, deltaX
		call	Mov9OP2Cp
		jr		c, p04loc_6057
		jr		z, p04loc_6090
		ld		hl, Xmin
		ld		a, (pixWide_m_2)
		srl	a
		or		a
		jr		p04loc_6065
; ---------------------------------------------------------------------------

p04loc_6057:
		call	OP2ToOP1
		ld		hl, Ymin
		ld		a, (lcdTallP)
		sub		2
		srl	a
		scf

p04loc_6065:
		push	af
		push	hl
		call	j_SetXXOP2
		call	FPMult
		call	OP1ToOP4
		pop		hl
		push	hl
		call	Mov9OP1OP2
		rst		30h
		call	TimesPt5
		call	OP1ToOP5
		call	OP4ToOP2
		call	p04sub_5DAD
		call	COPYRNG
		pop		de
		call	MovFrOP1
		ld		hl, OP4
		call	mov9B2
		pop		af

p04loc_6090:
		call	popErrorHandleR
		ret
; End of function ZmSquare

p04loc_6094:
		and		7Fh ; ''
		cp		6
		jp		nc, JErrorNo
		jp		Page0Call_250D
p04loc_609E:
		.db		0
		.db		82h	; �
		.db		35h	; 5
		.db		25h	; %
		.db		0
		.db		0
		.db		0
		.db		0
		.db		0

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


ZmTrig:

		call	COPYRNG
		ld		a, 5Ah ; 'Z'
		call	j_SetXXOP1
		bit		trigDeg, (iy+trigFlags)
		call	z, DToR
		ld		de, Xscl
		call	MovFrOP1
		ld		hl, p04loc_609E
		rst		20h
		bit		trigDeg, (iy+trigFlags)
		call	z, DToR
		call	SetXMinMax
		call	OP1Set1
		ld		de, Yscl
		call	MovFrOP1
		ld		a, 40h ; '@'
		ld		(OP1M), a
; End of function ZmTrig


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


p04sub_60D8:
		; ZooDefault+18p
		ld		a, 0Ch
		jr		p04loc_60E1
; End of function p04sub_60D8


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


p04sub_60DC:
		call	FDIV10
; End of function p04sub_60DC


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


SetXMinMax:
		ld		a, 0Ah

p04loc_60E1:
		push	af
		call	OP1ToOP5
		call	InvOP1S
		pop		af
		push	af
		call	j_StoSysTok
		call	OP5ToOP1
		pop		af
		inc		a
		call	j_StoSysTok
		jp		OP5ToOP1
; End of function SetXMinMax


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


ZooDefault:

		call	OP1Set1
		ld		a, 2
		call	j_StoSysTok
		ld		a, 3
		call	j_StoSysTok
		ld		a, 36h ; '6'
		call	IsFuncMode
		call	nz, j_StoSysTok
		call	INCO1EXP
		call	p04sub_60D8
		call	SetXMinMax
		call	CPTDELX
		call	CPTDELY
		call	IsFuncMode
		ret		nz
		call	IsFunctionMode
		jr		nz, p04loc_6145
		call	IsParametricMode
		jr		nz, p04loc_614A

p04loc_612A:
		call	OP1Set1
		ld		a, 1Fh
		call	j_StoSysTok
		ld		a, 1Bh
		call	j_StoSysTok
		ld		a, 34h ; '4'
		call	j_StoSysTok
		call	INCO1EXP
		ld		a, 1Dh
		call	j_StoSysTok
		ret
; ---------------------------------------------------------------------------

p04loc_6145:
		; ZooDefault+2Bj
		ld		hl, ThetaMin
		jr		p04loc_614D
; ---------------------------------------------------------------------------

p04loc_614A:
		; ZooDefault+30j
		ld		hl, TminPar

p04loc_614D:
		call	OPSet0
		ld		(chkDelPtr1), hl
		ld		de, 9
		add		hl, de
		push	hl
		call	OP1Set0
		ld		a, 75h ; 'u'
		ld		(OP1M), a
		bit		trigDeg, (iy+trigFlags)
		call	z, DToR
		pop		de
		call	MovFrOP1
		ld		a, 30h ; '0'
		call	j_SetXXOP2
		call	FPMult
		call	Page0Call_3381
		ret
; End of function ZooDefault


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


GrBufClr:
		ld		hl, plotSScreen

BufClr:
		push	hl
		pop		de
		inc		de
		ld		bc, 2FFh
		ld		(hl), 0
		ldir
		ret
; End of function GrBufClr


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


GRBUFCPY_V:

		set		plotDisp, (iy+plotFlags)
		call	Bit_VertSplit
		jr		z, GrBufCpy
		bit		NEED_RETABLE, (iy+VERTFLAG2)
		call	nz, j_DSPGRTBL
		res		2, (iy+1Fh)
		set		plotDisp, (iy+plotFlags)
		res		NEED_RETABLE, (iy+VERTFLAG2)
		bit		NEED_BUFCPY, (iy+VERTFLAG2)
		ret		z
; End of function GRBUFCPY_V


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


GrBufCpy:
		; ForceGraphKeypress+5F7p ...
		ld		hl, plotSScreen

BufCpy:
		set		plotDisp, (iy+plotFlags)
		ld		b, 20h ; ' '
		call	CheckSplitFlag
		jr		nz, p04loc_61BB
		ld		a, (winBtm)
		add		a, a
		add		a, a
		add		a, a
		ld		b, a

p04loc_61BB:
		bit		allowCursor, (iy+plotFlags)
		jr		z, p04loc_61D3
		bit		3, (iy+2)
		jr		z, p04loc_61D3
		ld		a, b
		sub		7
		bit		vertSplit, (iy+sGrFlags)
		jr		z, p04loc_61D2
		sub		7

p04loc_61D2:
		ld		b, a

p04loc_61D3:
		call	RestoreDisp
		res		NEED_BUFCPY, (iy+VERTFLAG2)
		ei
; End of function GrBufCpy


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


DRAWSPLITLINE:
		call	Bit_VertSplit
		jr		z, p04loc_61F6
		push	de
		call	j_SetNorm_Vals
		ld		b, 2Fh ; '/'
		set		plotLoc, (iy+plotFlags)
		call	VerticalLine
		res		plotLoc, (iy+plotFlags)
		call	j_SetYOffset
		pop		de
		ret
; ---------------------------------------------------------------------------

p04loc_61F6:
		call	CheckSplitFlag
		ret		z
		push	de
		ld		bc, 0
		ld		de, 5E00h
		call	DarkLine
		pop		de
		ret
; End of function DRAWSPLITLINE


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


RestoreDisp:
		di
		ld		a, 7
		call	lcd_busy
		out		(10h), a
		ld		a, 7Fh ; ''

p04loc_6210:
		push	bc
		inc		a
		ld		(curXRow), a
		call	SetYUp
		call	lcd_busy
		out		(10h), a
		ld		a, 20h ; ' '
		call	lcd_busy
		out		(10h), a
		ld		b, 0Ch
		call	Bit_VertSplit
		jr		z, p04loc_622D
		ld		b, 5

p04loc_622D:
		; RestoreDisp+2Ej
		ld		a, (hl)
		inc		hl
		call	lcd_busy
		out		(11h), a
		djnz	p04loc_622D
		call	Bit_VertSplit
		jr		z, p04loc_6247
		ld		a, (hl)
		or		1
		call	lcd_busy
		out		(11h), a
		ld		bc, 7
		add		hl, bc

p04loc_6247:
		pop		bc
		ld		a, (curXRow)
		djnz	p04loc_6210
		ld		a, 5
		call	lcd_busy
		out		(10h), a
		ret
; End of function RestoreDisp

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

FNDDB:
		ld		hl, 0
		ld		(OP3), hl
		ld		(OP3M), hl
		ld		a, 2
		jr		p04loc_626C

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


p04loc_6265:
AllEq:
		ld		(OP2M), a
		jr		p04loc_627A
; End of function AllEq

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

fndallseleq:
		ld		a, 6
		jr		p04loc_626C

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


FNDSELEQ:
		; Page04_33BDp	...
		xor		a

p04loc_626C:
		ld		(OP2M), a
		ld		hl, (FPS)
		ld		(EQS), hl
		call	ZeroOP1
		rst		18h
		rst		18h

p04loc_627A:
		ld		a, 1
		call	Page0Call_385B
		ld		hl, symTable

p04loc_6282:
		; FNDSELEQ+16Aj
		ex		de, hl
		ld		hl, (unk_982E)
		or		a
		sbc		hl, de
		ret		z
		ex		de, hl
		push	hl
		ld		a, (hl)
		call	equ_or_newequ
		jp		nz, p04loc_634E
		ld		b, a
		ld		a, (OP2M)
		cp		1
		jr		nz, p04loc_62A4
		bit		3, b
		jr		z, p04loc_62A1
		res		3, (hl)

p04loc_62A1:
		jp		p04loc_634E
; ---------------------------------------------------------------------------

p04loc_62A4:
		cp		6
		jr		z, p04loc_62AB
		or		a
		jr		nz, p04loc_62FF

p04loc_62AB:
		call	IsRecursiveMode
		jr		z, p04loc_62DB
		ld		a, (iy+0Fh)
		and		1Ch
		jr		z, p04loc_62DB
		push	hl
		dec		hl
		dec		hl
		dec		hl
		dec		hl
		dec		hl
		dec		hl
		dec		hl
		ld		a, (hl)
		pop		hl
		bit		sequv, (iy+seqFlags)
		jr		z, p04loc_62CB
		cp		82h ; '�'
		jr		p04loc_62D7
; ---------------------------------------------------------------------------

p04loc_62CB:
		bit		seqvw, (iy+seqFlags)
		jr		z, p04loc_62D5
		cp		80h ; '�'
		jr		p04loc_62D7
; ---------------------------------------------------------------------------

p04loc_62D5:
		cp		81h ; '�'

p04loc_62D7:
		jr		z, p04loc_634E
		jr		p04loc_62DF
; ---------------------------------------------------------------------------

p04loc_62DB:
		bit		5, (hl)
		jr		z, p04loc_634E

p04loc_62DF:
		ld		a, (OP2M)
		bit		allowCursor, (iy+plotFlags)
		jr		nz, p04loc_62FF
		cp		6
		jr		z, p04loc_62FF
		ld		a, (mcxCurApp)
		cp		4Ah ; 'J'
		jr		z, p04loc_62FF
		call	page0_185F
		jr		nz, p04loc_62FF
		ld		a, (hl)
		and		1Fh
		cp		0Bh
		jr		nz, p04loc_634E

p04loc_62FF:
		dec		hl
		dec		hl
		dec		hl
		dec		hl
		dec		hl
		dec		hl
		dec		hl
		ld		a, (OP1M)
		and		0F0h ; '�'
		ld		b, a
		ld		a, (hl)
		and		0F0h ; '�'
		cp		b
		jr		nz, p04loc_634E
		cp		20h ; ' '
		ld		a, (hl)
		jr		nz, p04loc_6319
		srl	a

p04loc_6319:
		and		0Fh
		inc		a
		ld		b, a
		ld		a, (OP2M)
		cp		3
		jr		nc, p04loc_6355

p04loc_6324:
		ld		a, b
		call	p04sub_6409
		ld		hl, (EQS)
		call	isInSet
		or		(hl)
		ld		(hl), a
		ld		a, (OP2M)
		cp		2
		jr		nz, p04loc_634E
		pop		hl
		push	hl
		dec		hl
		dec		hl
		dec		hl
		ld		e, (hl)
		dec		hl
		ld		d, (hl)
		ex		de, hl
		ld		c, (hl)
		inc		hl
		ld		b, (hl)
		ld		hl, (OP3)
		add		hl, bc
		ld		(OP3), hl
		ld		hl, OP3M
		inc		(hl)

p04loc_634E:
		; FNDSELEQ:p04loc_62A1j ...
		pop		hl

p04loc_634F:
		; FNDSELEQ+135j ...
		call	j_MoveToNextSym
		jp		p04loc_6282
; ---------------------------------------------------------------------------

p04loc_6355:
		cp		6
		jr		z, p04loc_6324
		pop		hl
		cp		3
		jr		nz, p04loc_63AA
		bit		5, (hl)
		jr		nz, p04loc_634F
		push	hl
		dec		hl
		dec		hl
		dec		hl
		ld		e, (hl)
		dec		hl
		ld		d, (hl)
		ex		de, hl
		ld		a, (hl)
		inc		hl
		or		(hl)
		jr		z, p04loc_634E
		call	IsParametricMode
		jr		z, p04loc_6396
		ex		de, hl
		dec		hl
		dec		hl
		ld		e, (hl)
		dec		hl
		ld		a, (hl)
		xor		1
		ld		d, a
		ld		(OP1+1), de
		xor		a
		ld		(OP1+3), a
		rst		10h
		jr		c, p04loc_63A2
		ex		de, hl
		ld		a, (hl)
		inc		hl
		or		(hl)
		jr		z, p04loc_63A2
		ex		de, hl
		set		5, (hl)
		ld		a, 1
		call	Page0Call_385B

p04loc_6396:
		pop		hl
		set		5, (hl)

p04loc_6399:
		call	SetTblGraphDraw
		set		smarter_test, (iy+smartFlags)
		jr		p04loc_634F
; ---------------------------------------------------------------------------

p04loc_63A2:
		; FNDSELEQ+121j
		ld		a, 1
		call	Page0Call_385B
		pop		hl
		jr		p04loc_634F
; ---------------------------------------------------------------------------

p04loc_63AA:
		cp		5
		jr		z, p04loc_63B6
		bit		5, (hl)
		jr		z, p04loc_634F
		res		5, (hl)
		jr		p04loc_6399
; ---------------------------------------------------------------------------

p04loc_63B6:
		push	hl
		dec		hl
		dec		hl
		dec		hl
		ld		e, (hl)
		dec		hl
		ld		d, (hl)
		dec		hl
		ld		b, (hl)
		inc		hl
		inc		hl
		inc		hl
		inc		hl
		inc		hl
		bit		1, (iy+1Eh)
		jr		z, p04loc_63D1
		ld		a, (OP1M)
		cp		82h ; '�'
		jr		z, p04loc_63D4

p04loc_63D1:
		call	DelVar

p04loc_63D4:
		pop		hl
		jp		p04loc_6282
; End of function FNDSELEQ


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


NEXTEQ:
		; ForceGraphKeypress+C91p ...
		ld		b, 1
		jr		p04loc_63DE
; ---------------------------------------------------------------------------

PREVEQ:
		; ForceGraphKeypress+1013p ...
		ld		b, 0FFh

p04loc_63DE:
		push	bc
		ld		b, a
		ld		a, (curGStyle)
		cp		7Fh ; ''
		ld		a, b
		pop		bc
		jr		nc, p04loc_63EE
		add		a, b
		cp		0FFh
		jr		nz, p04loc_63F0

p04loc_63EE:
		xor		a
		ret
; ---------------------------------------------------------------------------

p04loc_63F0:
		cp		0Bh
		jr		c, p04loc_63F6
		xor		a
		ret
; ---------------------------------------------------------------------------

p04loc_63F6:
		push	af
		ld		hl, (EQS)
		call	isInSet
		jr		nz, p04loc_6402
		pop		af
		jr		p04loc_63DE
; ---------------------------------------------------------------------------

p04loc_6402:
		pop		af
		push	af
		call	Page0Call_385B
		pop		af
		ret
; End of function NEXTEQ


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


p04sub_6409:
		ld		h, a
		call	ShRAcc
		ld		b, a
		ld		a, h
		and		0Fh
		inc		b
		jr		p04loc_6416
; ---------------------------------------------------------------------------

p04loc_6414:
		add		a, 0Ah

p04loc_6416:
		djnz	p04loc_6414
		ret
; End of function p04sub_6409


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


p04sub_6419:
		; ForceGraphKeypress+645p
		push	hl
		call	p04sub_5CEA
		call	CkValidNum
		call	j_StoAns
		call	GRLABELS
		pop		hl
		pop		de
		pop		bc
		ld		(pTempCnt), bc
		push	de
		jp		PutAns
; End of function p04sub_6419


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


p04sub_6431:
		set		plotLoc, (iy+plotFlags)
		ld		a, (curGY)
		ld		(curGY2), a
		call	HorizontalLine
		jr		p04loc_648F
; End of function p04sub_6431


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


p04sub_6440:
		set		plotLoc, (iy+plotFlags)
		ld		a, (curGY+1)
		ld		(curGY2+1), a
		call	p04sub_4017
		jr		p04loc_648F
; End of function p04sub_6440


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


p04sub_644F:
		ld		de, (curGY2)
		set		plotLoc, (iy+plotFlags)
		ld		h, 1
		ld		bc, (curGY)
		jr		p04loc_648C
; End of function p04sub_644F


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


p04sub_645F:
		set		plotLoc, (iy+plotFlags)
		ld		h, 1
		ld		de, (curGY)
		ld		bc, (curGY2)
		ld		a, d
		ld		l, e
		ld		e, c
		cp		b
		jr		z, p04loc_648A
		call	ILine
		ld		a, l
		cp		c
		jr		z, p04loc_648F
		ld		c, l
		ld		l, e
		ld		e, c
		call	ILine
		ld		e, l
		ld		l, d
		ld		d, b
		call	ILine
		ld		b, l
		ld		d, l
		jr		p04loc_648C
; ---------------------------------------------------------------------------

p04loc_648A:
		ld		b, d
		ld		c, l

p04loc_648C:
		call	ILine

p04loc_648F:
		res		plotLoc, (iy+plotFlags)
		ret
; End of function p04sub_645F

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

BLINKGCUR:
		bit		graphCursor, (iy+graphFlags)
		ret		z
		bit		allowCursor, (iy+plotFlags)
		jr		nz, p04loc_64AB
		ld		a, 5
		bit		graphHookActive, (iy+hookflags3)
		call	nz, Page0Call_330F
		ret		nz
		jr		p04loc_64B5
; ---------------------------------------------------------------------------

p04loc_64AB:
		ld		a, 3
		bit		0, (iy+36h)
		call	nz, j_RunTraceHook
		ret		nz

p04loc_64B5:
		ld		a, (curGStyle)
		ld		d, 2
		jp		p04sub_6580
; ---------------------------------------------------------------------------

NBCURSOR:
		bit		allowCursor, (iy+plotFlags)
		jr		nz, p04loc_64CF
		ld		a, 4
		bit		graphHookActive, (iy+hookflags3)
		call	nz, Page0Call_330F
		ret		nz
		jr		p04loc_64D9
; ---------------------------------------------------------------------------

p04loc_64CF:
		ld		a, 4
		bit		0, (iy+36h)
		call	nz, j_RunTraceHook
		ret		nz

p04loc_64D9:
		ld		a, (curGStyle)
		cp		55h ; 'U'
		jr		nz, p04loc_64EB

p04loc_64E0:
		ld		de, 8D8Fh
		ld		hl, p04loc_665F
		call	p04sub_6619
		jr		p04loc_6518
; ---------------------------------------------------------------------------

p04loc_64EB:
		cp		6Bh ; 'k'
		jr		z, p04loc_64E0
		cp		79h ; 'y'
		jr		z, p04loc_64E0
		cp		61h ; 'a'
		jr		z, p04loc_64E0
		cp		6Dh ; 'm'
		jr		z, p04loc_6503
		cp		7Bh ; '{'
		jr		z, p04loc_6503
		cp		57h ; 'W'
		jr		nz, p04loc_650E

p04loc_6503:
		ld		de, 8D98h
		ld		hl, p04loc_6664
		call	p04sub_6619
		jr		p04loc_64E0
; ---------------------------------------------------------------------------

p04loc_650E:
		bit		graphCursor, (iy+graphFlags)
		jr		z, p04loc_6518
		cp		81h ; '�'
		jr		z, p04loc_64E0

p04loc_6518:
		bit		displayCoords, (iy+newDispF)
		call	z, COORDISP
		ld		a, (curGStyle)
		cp		67h ; 'g'
		jr		z, p04loc_6530
		cp		59h ; 'Y'
		jr		nz, p04loc_6536
		ld		de, 0FFF8h
		call	p04sub_666E

p04loc_6530:
		ld		de, 0FFFFh
		call	p04sub_666E

p04loc_6536:
		bit		graphCursor, (iy+graphFlags)
		ret		z
		ld		a, (curGStyle)
		cp		1Dh
		jr		nz, p04loc_6547
		call	p04sub_644F
		jr		p04loc_6568
; ---------------------------------------------------------------------------

p04loc_6547:
		cp		29h ; ')'
		jr		nz, p04loc_6550
		call	p04sub_6440
		jr		p04loc_657B
; ---------------------------------------------------------------------------

p04loc_6550:
		cp		31h ; '1'
		jr		nz, p04loc_6559
		call	p04sub_6431
		jr		p04loc_657B
; ---------------------------------------------------------------------------

p04loc_6559:
		cp		27h ; '''
		jr		nz, p04loc_6561
		and		0FEh ; '�'
		jr		p04loc_656A
; ---------------------------------------------------------------------------

p04loc_6561:
		cp		9
		jr		nz, p04loc_657B
		call	p04sub_645F

p04loc_6568:
		ld		a, 2

p04loc_656A:
		ld		hl, (curGY)
		push	hl
		ld		hl, (curGY2)
		ld		(curGY), hl
		call	p04sub_6580
		pop		hl
		ld		(curGY), hl

p04loc_657B:
		ld		a, (curGStyle)
		and		0FEh ; '�'

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


p04sub_6580:



		srl	a
		jr		c, p04loc_65DD
		ld		d, 1
		dec		a
		jr		c, p04loc_65D8
		cp		4
		jr		c, p04loc_659C
		cp		25h ; '%'
		jr		z, p04loc_6593
		cp		26h ; '&'

p04loc_6593:
		ld		a, 1
		jr		z, p04loc_659C
		ld		a, 4
		jr		c, p04loc_659C
		inc		a

p04loc_659C:
		ld		h, a
		add		a, a
		add		a, a
		add		a, h
		ld		hl, p04loc_6637
		ld		c, a
		ld		b, 0
		add		hl, bc
		ld		bc, (curGY)

p04loc_65AB:
		set		plotLoc, (iy+plotFlags)
; End of function p04sub_6580


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


p04sub_65AF:
		inc		b
		inc		b
		inc		c
		inc		c
		ld		e, 5

p04loc_65B5:
		push	hl
		ld		hl, p04loc_662E
		ld		a, (winBtm)
		add		a, l
		ld		l, a
		jr		nc, p04loc_65C1
		inc		h

p04loc_65C1:
		ld		a, (hl)
		cp		c
		pop		hl
		jr		nc, p04loc_65D8
		push	bc
		ld		a, (hl)

p04loc_65C8:
		srl	a
		call	c, IPoint
		jr		z, p04loc_65D2
		dec		b
		jr		p04loc_65C8
; ---------------------------------------------------------------------------

p04loc_65D2:
		pop		bc
		dec		c
		inc		hl
		dec		e
		jr		nz, p04loc_65B5

p04loc_65D8:
		res		plotLoc, (iy+plotFlags)
		ret
; End of function p04sub_65AF

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p04sub_6580

p04loc_65DD:
		cp		28h ; '('
		ld		a, 6
		jr		c, p04loc_659C
		inc		a
		jr		p04loc_659C
; END OF FUNCTION CHUNK	FOR p04sub_6580
; ---------------------------------------------------------------------------

STATMARK:
		cp		1
		ld		hl, p04loc_664B
		jr		z, p04loc_65F1
		ret		nc
		ld		hl, p04loc_6646

p04loc_65F1:
		ld		bc, (curGY)
		res		plotLoc, (iy+plotFlags)
		ld		d, 1
		call	p04sub_65AF
		scf
		ret

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


p04sub_6600:
		ld		d, 4

p04loc_6602:
		ld		hl, p04loc_6669
		set		plotLoc, (iy+plotFlags)
		call	p04sub_65AF
		res		plotLoc, (iy+plotFlags)
		ret
; End of function p04sub_6600


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


p04sub_6611:
		set		6, (iy+18h)
		ld		d, 1
		jr		p04loc_6602
; End of function p04sub_6611


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


p04sub_6619:
		push	hl
		call	XftoI
		push	af
		ld		a, (lcdTallP)
		sub		7
		sub		3
		ld		c, a
		pop		af
		ld		b, a
		pop		hl
		ld		d, 1
		jp		p04loc_65AB
; End of function p04sub_6619

p04loc_662E:
		.db		3Fh	; ?
		.db		37h	; 7
		.db		2Fh	; /
		.db		27h	; '
		.db		1Fh
		.db		17h
		.db		0Fh
		.db		7
		.db		0
p04loc_6637:
		.db		0
		.db		0Eh
		.db		0Eh
		.db		0Eh
		.db		0
		.db		11h
		.db		0Ah
		.db		0
		.db		0Ah
		.db		11h
		.db		4
		.db		4
		.db		1Bh
		.db		4
		.db		4
p04loc_6646:
		.db		0
		.db		0Eh
		.db		0Ah
		.db		0Eh
		.db		0
p04loc_664B:
		.db		0
		.db		4
		.db		0Eh
		.db		4
		.db		0
		.db		11h
		.db		0Eh
		.db		0Ah
		.db		0Eh
		.db		11h
		.db		0
		.db		0
		.db		4
		.db		0
		.db		0
		.db		11h
		.db		0
		.db		4
		.db		0
		.db		11h
p04loc_665F:
		.db		10h
		.db		18h
		.db		1Ch
		.db		18h
		.db		10h
p04loc_6664:
		.db		1
		.db		3
		.db		7
		.db		3
		.db		1
p04loc_6669:
		.db		0Eh
		.db		11h
		.db		11h
		.db		11h
		.db		0Eh

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


p04sub_666E:
		ld		hl, (curGY)
		push	hl
		ld		hl, 8D98h
		add		hl, de
		ld		d, (hl)
		dec		hl
		ld		e, (hl)
		ld		(curGY), de
		ld		a, 6
		call	p04sub_6580
		pop		hl
		ld		(curGY), hl
		ret
; End of function p04sub_666E


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


CHKTEXTCURS:

		ld		a, c
		ld		hl, lcdTallP
		cp		(hl)
		ret		nc
		bit		4, (iy+24h)
		jr		z, p04loc_6697
		cp		7
		jr		p04loc_6699
; ---------------------------------------------------------------------------

p04loc_6697:
		cp		6

p04loc_6699:
		ccf
		ret		nc
		ld		a, b
		ld		hl, pixWide_m_1
		cp		(hl)
		ret		nc
		cp		0
		ccf
		ret
; End of function CHKTEXTCURS


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


CLRGRAPHXY:
		ld		a, 0B8h	; '�'
		ld		hl, 95ECh
		call	CheckSplitFlag
		jr		z, p04loc_66B4
		ld		a, 97h ; '�'
		ld		hl, 9460h

p04loc_66B4:
		call	Bit_VertSplit
		jr		z, p04loc_66C2
		ld		a, 0B1h	; '�'
		ld		hl, 9598h
		ld		b, 0Eh
		jr		p04loc_66C4
; ---------------------------------------------------------------------------

p04loc_66C2:
		ld		b, 7

p04loc_66C4:
		ld		d, a
		di

p04loc_66C6:
		ld		e, 20h ; ' '
		inc		d
		ld		a, d
		call	SetYUp
		call	lcd_busy
		out		(10h), a
		ld		a, e
		call	lcd_busy
		out		(10h), a

p04loc_66D8:
		ld		a, (hl)
		inc		hl
		call	lcd_busy
		out		(11h), a
		inc		e
		ld		a, e
		call	Bit_VertSplit
		jr		z, p04loc_66EA
		cp		26h ; '&'
		jr		p04loc_66EC
; ---------------------------------------------------------------------------

p04loc_66EA:
		cp		2Ch ; ','

p04loc_66EC:
		jr		nz, p04loc_66D8
		call	Bit_VertSplit
		jr		z, p04loc_66F9
		inc		hl
		inc		hl
		inc		hl
		inc		hl
		inc		hl
		inc		hl

p04loc_66F9:
		djnz	p04loc_66C6
		call	SetXUp
		ei
		ret
; End of function CLRGRAPHXY


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


p04sub_6700:
		; p04sub_465B+CA8p
		ld		(curInc), hl
		ld		(unk_8E2B), hl
		ret
; End of function p04sub_6700

; ---------------------------------------------------------------------------
		ld		hl, (unk_9665)
		inc		hl

p04loc_670B:
		ld		(unk_9665), hl
		ret
; ---------------------------------------------------------------------------
		ld		hl, (unk_9665)
		dec		hl
		jr		p04loc_670B

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


p04sub_6715:
		; ForceGraphKeypress+4CEp ...
		res		5, (iy+17h)
		res		4, (iy+17h)
		res		4, (iy+1Eh)

p04loc_6721:
		res		2, (iy+17h)
		ret
; End of function p04sub_6715


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


p04sub_6726:
		; p04sub_465B+B0Cp ...
		ld		de, 8D21h
		jp		MovFrOP1
; End of function p04sub_6726

p04loc_672C:
		.db		8
		.db		66h	; f
		.db		28h	; (
		.db		78h	; x
		.db		29h	; )
		.db		64h	; d
		.db		78h	; x
		.db		3Dh	; =
		.db		0
p04loc_6735:
		.db		64h	; d
		.db		72h	; r
		.db		2Fh	; /
		.db		64h	; d
		.db		5Bh	; [
		.db		3Dh	; =
		.db		0
p04loc_673C:
		.db		64h	; d
		.db		78h	; x
		.db		2Fh	; /
		.db		64h	; d
		.db		74h	; t
		.db		3Dh	; =
		.db		0
p04loc_6743:
		.db		64h	; d
		.db		79h	; y
		.db		2Fh	; /
		.db		64h	; d
		.db		74h	; t
		.db		3Dh	; =
		.db		0
; ---------------------------------------------------------------------------

Page04_3537:
		or		a
		jp		z, CHKTEXTCURS
		cp		1
		jp		z, XYCENT
		cp		65h ; 'e'
		jp		z, ZmFit
		cp		86h ; '�'
		jp		z, ZooDefault
		cp		87h ; '�'
		jp		z, ZmTrig
		cp		8Bh ; '�'
		jp		z, ZmSquare
		cp		8Ch ; '�'
		jp		z, ZmInt
		cp		8Dh ; '�'
		jp		z, ZmPrev
		cp		8Eh ; '�'
		jp		z, ZmDecml
		cp		90h ; '�'
		jp		z, ZmUsr
		cp		92h ; '�'
		jp		z, SETUZM
		cp		93h ; '�'
		jp		z, GDISPTOKEN
		ret

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


p04sub_6786:
		ld		hl, 8479h
		inc		(hl)
		rst		10h
		call	nc, DelVar
		ret
; End of function p04sub_6786


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


Regraph:
		ei
		call	j_RunIndicOn
		ld		b, a
		ld		a, 0
		call	p04sub_7564
		ld		a, b
		ret		nz
		res		2, (iy+1Fh)
		res		7, (iy+1Eh)
		push	af
		ld		a, 40h ; '@'

p04loc_67A6:
		ld		(unk_966D), a
		res		6, (iy+18h)
		res		7, (iy+0)
		res		grfSChanged, (iy+sGrFlags)
		bit		allowCursor, (iy+plotFlags)
		jr		nz, p04loc_67C6
		ld		hl, 8D1Eh
		ld		(hl), 0
		inc		hl
		ld		(hl), 1
		inc		hl
		ld		(hl), 0

p04loc_67C6:
		call	TraceOff
		call	CentCursor
		call	IsOnInterruptSet
		jp		nz, p04loc_6993
		ld		a, 36h ; '6'
		call	j_RclSysTok
		call	j_ConvOP1
		ld		(Xres_int), a
		call	p04sub_756C
		jr		z, p04loc_67E9
		call	IsFuncMode
		jr		z, p04loc_67F2
		jr		p04loc_67EF
; ---------------------------------------------------------------------------

p04loc_67E9:
		call	j_CMPBOXINFO
		call	CPTDELY

p04loc_67EF:
		call	CPTDELX

p04loc_67F2:
		ld		hl, Xmin
		ld		de, 8E6Ah
		call	mov9B2
		call	OP1Set0
		ld		de, 8E73h
		call	MovFrOP1
		res		5, (iy+3)
		call	p04sub_756C
		jr		nz, p04loc_686D
		set		plotDisp, (iy+plotFlags)
		pop		bc
		ld		a, 1
		call	p04sub_7564
		ld		a, b
		ret		nz
		push	af
		call	page0_185F
		jr		nz, p04loc_6824
		call	GRBUFCPY_V
		jr		p04loc_686D
; ---------------------------------------------------------------------------

p04loc_6824:
		ld		a, 0FFh
		ld		(unk_9668), a
		call	GrBufClr
		call	j_ClrLCD
		call	Bit_VertSplit
		call	nz, j_DSPGRTBL
		set		plotDisp, (iy+plotFlags)
		ld		a, 2
		call	p04sub_7564
		call	z, Axes
		call	DRAWSPLITLINE
		call	IsOnInterruptSet
		jp		nz, p04loc_6993
		call	j_ClrGraphRef
		ld		hl, Xmin
		ld		b, 17h
		call	p04sub_72F9
		ld		hl, fin_N
		ld		b, 7
		call	p04sub_72F9
		ld		hl, TblMin
		ld		b, 2
		call	p04sub_72F9
		ld		hl, uXmin
		ld		b, 17h
		call	p04sub_72F9

p04loc_686D:
		ld		hl, 0
		ld		(curGY2), hl
		set		drawingGraph, (iy+graphFlags)
		ld		hl, (pTempCnt)
		push	hl
		call	FNDSELEQ
		call	ZeroOP1
		rst		18h
		rst		18h
		call	page0_185F
		jr		z, p04loc_68B8
		res		6, (iy+19h)
		call	p04sub_756C
		jr		nz, p04loc_68C8
		call	ZeroOP1
		ld		a, 26h ; '&'
		ld		(OP1+1), a
		call	p04sub_6786
		call	p04sub_6786
		call	p04sub_6786
		xor		a
		ld		(curPlotNumber), a
		call	j_DRAWSPLOT
		call	p04sub_7087
		call	j_DRAWSPLOT
		call	p04sub_7087
		call	j_DRAWSPLOT
		call	p04sub_7087

p04loc_68B8:
		set		smarter_test, (iy+smartFlags)
		xor		a
		ld		(curPlotNumber), a
		ld		a, 9
		call	p04sub_7564
		jp		nz, p04loc_6962

p04loc_68C8:
		call	IsFuncMode
		jp		z, p04loc_6A99
		call	Page04_3309
		rst		18h
		ld		a, 0FFh
		ld		(OP1), a
		call	p04sub_756C
		jr		z, p04loc_68E8
		rst		18h
		ld		hl, Xmin
		rst		20h
		push	hl
		rst		18h
		pop		hl
		rst		20h
		rst		18h
		jr		p04loc_68F0
; ---------------------------------------------------------------------------

p04loc_68E8:
		bit		grfSimul, (iy+grfDBFlags)
		jp		nz, p04loc_6A00
		rst		18h

p04loc_68F0:
		call	p04sub_7211
		jr		z, p04loc_6962
		call	p04sub_70D4

p04loc_68F8:
		call	p04sub_72A7
		set		5, (iy+3)
		call	p04sub_755F
		call	nz, GrBufCpy
		res		6, (iy+18h)
		call	NEDXT_Y_STYLE

p04loc_690C:
		ld		a, 3
		call	p04sub_7564
		call	p04sub_75A9
		call	INITNSEQ
		call	p04sub_756C
		jr		z, p04loc_6921
		call	p04sub_7571
		jr		p04loc_6941
; ---------------------------------------------------------------------------

p04loc_6921:
		call	p04sub_755A
		jr		z, p04loc_692D
		call	CpyO1ToFPST
		res		5, (iy+3)

p04loc_692D:
		set		g_style_active, (iy+sGrFlags)
		call	YRES
		res		g_style_active, (iy+sGrFlags)
		call	p04sub_6FCD
		call	p04sub_755F
		call	nz, p04sub_75B3

p04loc_6941:
		call	p04sub_7087
		call	Page04_3393
		call	p04sub_69EF
		jr		nc, p04loc_695B
		ld		hl, (inputDat)
		ld		b, a
		ld		a, 6
		call	p04sub_7564
		ld		a, b
		call	z, Xitof
		jr		p04loc_690C

p04loc_695B:
		call	p04sub_712A
		jr		nc, p04loc_68F0
		jr		p04loc_68F8
; ---------------------------------------------------------------------------

p04loc_6962:
		res		graphDraw, (iy+graphFlags)
		res		smarter_test, (iy+smartFlags)
		res		smartGraph, (iy+smartFlags)
		call	p04sub_756C
		jr		nz, p04loc_698F
		res		NEED_BUFCPY, (iy+VERTFLAG2)

p04loc_6977:
		call	p04sub_755F
		call	nz, GrBufCpy
		res		g_style_active, (iy+sGrFlags)
		ld		hl, (EQS)
		ld		(FPS), hl
		ld		a, 1
		call	AllEq
		call	p04sub_69AF

p04loc_698F:
		pop		hl
		ld		(pTempCnt), hl

p04loc_6993:
		res		drawingGraph, (iy+graphFlags)
		pop		af
		call	TraceOff
		call	CentCursor
		ld		b, a
		ld		a, 7
		call	p04sub_7564
		ld		a, b
		ret
; End of function Regraph


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


p04sub_69A6:
		ld		de, 9

p04loc_69A9:
		set		6, (hl)
		add		hl, de
		djnz	p04loc_69A9
		ret
; End of function p04sub_69A6


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


p04sub_69AF:
		ld		hl, TblMin
		ld		b, 2
		call	p04sub_69A6

DOREFFLAGS02:
		call	XName
		ld		hl, Xmin
		ld		b, 6
		call	p04sub_69A6
		call	IsFuncMode
		jr		nz, p04loc_69EA
		call	ThetaName
		ld		hl, ThetaMin
		ld		b, 3
		call	IsFunctionMode
		jr		nz, p04loc_69E7
		call	TName
		ld		hl, TminPar
		call	IsParametricMode
		jr		nz, p04loc_69E7
		call	RECURNNAME
		ld		hl, PlotStart
		ld		b, 9

p04loc_69E7:
		call	p04sub_69A6

p04loc_69EA:
		rst		10h
		ret		c
		res		6, (hl)
		ret
; End of function p04sub_69AF


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


p04sub_69EF:
		ld		a, (curInc)
		ld		hl, pixWide_m_2
		cp		(hl)
		ret		nc
		ld		hl, Xres_int
		add		a, (hl)
		ld		(curInc), a
		scf
		ret
; End of function p04sub_69EF

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR Regraph

p04loc_6A00:
		ld		hl, 1

p04loc_6A03:
		ld		(unk_980E), hl
		set		5, (iy+3)
		ld		a, (unk_9668)
		ld		(unk_9667), a

p04loc_6A10:
		call	p04sub_70A9
		jr		nz, p04loc_6A53
		call	p04sub_69EF
		jr		nc, p04loc_6A31
		call	p04sub_713E
		ex		de, hl
		ld		hl, (inputDat)
		push	hl
		call	mov9B2
		pop		hl
		call	Xitof
		call	p04sub_755F
		call	nz, p04sub_75B3
		jr		p04loc_6A10
; ---------------------------------------------------------------------------

p04loc_6A31:
		ld		de, (EQS)
		ld		hl, 12h
		add		hl, de
		call	j_Mov18B
		ld		de, 9
		add		hl, de
		ld		(FPS), hl
		call	p04sub_755F
		call	nz, GrBufCpy
		res		6, (iy+18h)
		ld		hl, (unk_980E)
		inc		hl
		jr		p04loc_6A03
; ---------------------------------------------------------------------------

p04loc_6A53:
		ld		a, (curGY2)
		dec		a
		jr		nz, p04loc_6A65
		ld		a, (unk_9667)
		ld		(unk_9668), a
		call	p04sub_755A
		call	nz, p04sub_72A7

p04loc_6A65:
		call	NEDXT_Y_STYLE
		call	p04sub_75A9
		call	p04sub_755A
		call	nz, PushRealO1
		call	INITNSEQ
		call	p04sub_7162
		call	MovFrOP1
		call	p04sub_713E
		ld		de, OP3
		call	mov9B2
		rst		8
		ld		hl, (inputDat)
		rst		20h
		set		g_style_active, (iy+sGrFlags)
		call	PLOTPT
		res		g_style_active, (iy+sGrFlags)
		call	p04sub_7087
		jp		p04loc_6A10
; ---------------------------------------------------------------------------

p04loc_6A99:
		call	IsParametricMode
		jp		z, p04loc_6C06
		ld		hl, TminPar
		call	p04sub_6DF3
		call	p04sub_72C4
		ld		a, 0FFh
		ld		(OP2), a
		call	p04sub_756C
		jr		z, p04loc_6AB7
		call	PUSHMCPLXO1
		jr		p04loc_6ABE
; ---------------------------------------------------------------------------

p04loc_6AB7:
		bit		grfSimul, (iy+grfDBFlags)
		jp		nz, p04loc_6B5E

p04loc_6ABE:
		rst		18h
		rst		18h

p04loc_6AC0:
		call	p04sub_70CF

p04loc_6AC3:
		call	p04sub_7298
		call	p04sub_756C
		jr		nz, p04loc_6ADF
		set		5, (iy+3)
		call	p04sub_755F
		call	nz, GrBufCpy
		res		6, (iy+18h)
		ld		hl, y0LineType
		call	p04sub_6FA7

p04loc_6ADF:
		call	p04sub_75A9
		call	p04sub_755A
		call	nz, CpyO1ToFPS1
		call	p04sub_715C
		call	IsOP1Num
		push	af
		call	j_sDone
		call	page0_17E0
		call	j_PLOTPARS
		call	p04sub_755A
		jr		z, p04loc_6B04
		call	CpyO1ToFPST
		res		5, (iy+3)

p04loc_6B04:
		call	INITNSEQ
		call	p04sub_756C
		jr		z, p04loc_6B1B
		pop		af
		jr		z, p04loc_6B4A
		call	p04sub_7571
		ld		hl, (XOutDat)
		rst		20h
		call	Page0Call_35D9
		jr		p04loc_6B4A
; ---------------------------------------------------------------------------

p04loc_6B1B:
		call	CpyTo3FPS1
		inc		de
		inc		de
		call	mov9B2
		rst		8
		call	CpyO1ToFPST
		ld		hl, (XOutDat)
		rst		20h
		pop		af
		jr		nz, p04loc_6B33
		ld		hl, OP1
		set		5, (hl)

p04loc_6B33:
		call	CpyO1ToFPS1
		set		g_style_active, (iy+sGrFlags)
		call	PLOTPT
		res		g_style_active, (iy+sGrFlags)
		call	OP1Set1
		call	p04sub_755F
		call	nz, p04sub_75B3

p04loc_6B4A:
		call	p04sub_7087
		call	Page04_3393
		call	p04sub_7221
		jr		nc, p04loc_6ADF
		call	p04sub_712A
		jp		nc, p04loc_6AC0
		jp		p04loc_6AC3
; ---------------------------------------------------------------------------

p04loc_6B5E:
		ld		hl, 1

p04loc_6B61:
		ld		(unk_980E), hl
		set		5, (iy+3)

p04loc_6B68:
		call	p04sub_70A9
		jr		nz, p04loc_6B90
		call	p04sub_7221
		jr		nc, p04loc_6B68
		ld		de, (EQS)
		ld		hl, 12h
		add		hl, de
		call	j_Mov18B
		ld		(FPS), hl
		call	p04sub_755F
		call	nz, GrBufCpy
		res		6, (iy+18h)
		ld		hl, (unk_980E)
		inc		hl
		jr		p04loc_6B61
; ---------------------------------------------------------------------------

p04loc_6B90:
		ld		hl, y0LineType
		call	p04sub_6FA7
		ld		a, (curGY2)
		dec		a
		jr		nz, p04loc_6BA2
		call	p04sub_755A
		call	nz, p04sub_7298

p04loc_6BA2:
		call	p04sub_75A9
		call	p04sub_755A
		call	nz, PushRealO1
		call	p04sub_715C
		call	IsOP1Num
		push	af
		call	j_sDone
		call	page0_17E0
		call	j_PLOTPARS
		call	p04sub_755A
		call	nz, PushRealO1
		call	INITNSEQ
		ld		a, (curGY2)
		dec		a
		add		a, a
		ld		de, OP3
		call	p04sub_7168
		push	de
		ld		de, OP4
		call	mov9B2
		rst		8
		ld		hl, (XOutDat)
		rst		20h
		pop		de
		pop		af
		jr		nz, p04loc_6BE4
		ld		hl, OP1
		set		5, (hl)

p04loc_6BE4:
		call	MovFrOP1
		inc		hl
		inc		hl
		call	mov9B2
		set		g_style_active, (iy+sGrFlags)
		call	PLOTPT
		res		g_style_active, (iy+sGrFlags)
		call	OP1Set1
		call	p04sub_755F
		call	nz, p04sub_75B3
		call	p04sub_7087
		jp		p04loc_6B68
; ---------------------------------------------------------------------------

p04loc_6C06:
		call	IsRecursiveMode
		jp		nz, p04loc_6E38
		ld		hl, ThetaMin
		call	p04sub_6DF3
		call	p04sub_72C4
		call	p04sub_72ED
		ld		a, 0FFh
		ld		(OP2), a
		call	p04sub_756C
		jr		z, p04loc_6C27
		call	PUSHMCPLXO1
		jr		p04loc_6C2D
; ---------------------------------------------------------------------------

p04loc_6C27:
		bit		grfSimul, (iy+grfDBFlags)
		jr		nz, p04loc_6C98

p04loc_6C2D:
		call	PUSHMCPLXO1

p04loc_6C30:
		call	p04sub_70CF

p04loc_6C33:
		call	p04sub_7289
		set		5, (iy+3)
		call	p04sub_755F
		call	nz, GrBufCpy
		res		6, (iy+18h)
		ld		hl, para6LineType
		call	p04sub_6FA7

p04loc_6C4A:
		call	p04sub_75A9
		call	p04sub_70DF
		call	p04sub_756C
		jr		z, p04loc_6C63
		call	OP2ToOP4
		call	Page0Call_35D9
		call	OP4ToOP1
		call	p04sub_7571
		jr		p04loc_6C86
; ---------------------------------------------------------------------------

p04loc_6C63:
		call	p04sub_755A
		jr		z, p04loc_6C72
		call	CpyO1ToFPS1
		call	CpyO2ToFPST
		res		5, (iy+3)

p04loc_6C72:
		set		g_style_active, (iy+sGrFlags)
		call	p04sub_7180
		res		g_style_active, (iy+sGrFlags)
		call	OP1Set1
		call	p04sub_755F
		call	nz, p04sub_75B3

p04loc_6C86:
		call	p04sub_7087
		call	Page04_3393
		call	p04sub_721C
		jr		nc, p04loc_6C4A
		call	p04sub_712A
		jr		nc, p04loc_6C30
		jr		p04loc_6C33
; ---------------------------------------------------------------------------

p04loc_6C98:
		ld		hl, 1

p04loc_6C9B:
		ld		(unk_980E), hl
		set		5, (iy+3)

p04loc_6CA2:
		call	p04sub_70A9
		jr		nz, p04loc_6CD5
		call	p04sub_721C
		jr		c, p04loc_6CB7
		call	OP1Set1
		call	p04sub_755F
		call	nz, p04sub_75B3
		jr		p04loc_6CA2
; ---------------------------------------------------------------------------

p04loc_6CB7:
		ld		de, (EQS)
		ld		hl, 12h
		add		hl, de
		call	j_Mov18B
		ld		(FPS), hl
		call	p04sub_755F
		call	nz, GrBufCpy
		res		6, (iy+18h)
		ld		hl, (unk_980E)
		inc		hl
		jr		p04loc_6C9B
; ---------------------------------------------------------------------------

p04loc_6CD5:
		ld		hl, para6LineType
		call	p04sub_6FA7
		ld		a, (curGY2)
		cp		1
		jr		nz, p04loc_6CE8
		call	p04sub_755A
		call	nz, p04sub_7289

p04loc_6CE8:
		call	p04sub_75A9
		call	p04sub_70DF
		call	p04sub_755A
		jr		z, p04loc_6CF6
		call	PUSHMCPLXO1

p04loc_6CF6:
		ld		a, (curGY2)
		dec		a
		add		a, a
		ld		de, OP3
		call	p04sub_7168
		push	de
		ld		de, OP4
		call	mov9B2
		pop		de
		call	MovFrOP1
		inc		hl
		inc		hl
		call	mov9B2
		set		g_style_active, (iy+sGrFlags)
		call	PLOTPT
		res		g_style_active, (iy+sGrFlags)
		call	p04sub_7087
		jp		p04loc_6CA2
; END OF FUNCTION CHUNK	FOR Regraph

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


p04sub_6D22:
		res		5, (iy+8)
		res		6, (iy+8)
		ret
; End of function p04sub_6D22

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR Regraph

p04loc_6D2B:
		call	OP1Set1
		call	j_StoN
		ld		hl, Xmin
		rst		20h
		call	p04sub_72B6
		set		5, (iy+3)

p04loc_6D3C:
		call	p04sub_7087
		ld		a, 1
		ld		d, 0

p04loc_6D43:
		ld		b, a
		call	p04sub_6D22
		ld		a, (unk_91CE)
		and		b
		ld		a, b
		jr		z, p04loc_6DAB
		inc		d
		push	de
		push	af
		call	j_RclX
		call	p04sub_715C
		call	p04sub_756C
		jr		z, p04loc_6D61
		call	Page0Call_35D9
		jr		p04loc_6D67
; ---------------------------------------------------------------------------

p04loc_6D61:
		call	p04sub_755A
		call	nz, PushRealO1

p04loc_6D67:
		pop		af
		push	af
		cp		4
		jr		nz, p04loc_6D6E
		dec		a

p04loc_6D6E:
		ld		b, a
		ld		hl, 89F8h
		call	ShLAcc
		sla	a
		or		(hl)
		ld		(hl), a
		ld		a, b
		call	j_serrort
		ld		hl, p04loc_6DEC
		call	pushErrorHandleR
		call	j_PLOTPARS
		call	p04sub_6D22
		call	popErrorHandleR
		call	INITNSEQ
		call	p04sub_756C
		jr		z, p04loc_6D99
		call	p04sub_7571
		jr		p04loc_6D9F
; ---------------------------------------------------------------------------

p04loc_6D99:
		call	p04sub_755A
		call	nz, PushRealO1

p04loc_6D9F:
		pop		bc
		pop		af
		push	af
		push	bc
		call	p04sub_756C
		call	z, p04sub_6F5D
		pop		af
		pop		de

p04loc_6DAB:
		add		a, a
		cp		8
		jr		nz, p04loc_6D43
		res		5, (iy+3)
		ld		a, (curInc)
		inc		a
		ld		hl, pixWide_m_1
		cp		(hl)
		jr		nc, p04loc_6DCA
		ld		(curInc), a
		ld		hl, (inputDat)
		call	Xitof
		jp		p04loc_6D3C
; ---------------------------------------------------------------------------

p04loc_6DCA:
		call	p04sub_756C
		jr		nz, p04loc_6DE9
		bit		grfNoAxis, (iy+grfDBFlags)
		jr		nz, p04loc_6DE9
		ld		a, 0Bh
		call	j_RclSysTok
		call	OP1ToOP3
		call	OP1ToOP4
		ld		a, 0Ah
		call	j_RclSysTok
		rst		8
		call	j_CLine

p04loc_6DE9:
		jp		p04loc_6962

p04loc_6DEC:
		pop		af
		call	p04sub_6D22
		jp		JErrorNo

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


p04sub_6DF3:
		ld		(OP1), hl
		ld		hl, p04loc_6E35
		call	pushErrorHandleR
		ld		hl, (OP1)
		push	hl
		call	Mov9ToOP2
		rst		20h
		push	hl
		call	FPSub
		pop		hl
		call	Mov9ToOP2
		ld		hl, (OP2+1)
		push	hl
		ld		a, (OP1)
		and		80h ; '�'
		ld		b, a
		ld		a, (OP2)
		and		80h ; '�'
		xor		b
		jr		nz, p04loc_6E35
		call	fpdiv
		call	int
		ld		hl, p04loc_7121
		call	Mov9OP2Cp
		jr		nc, p04loc_6E35
		pop		de
		pop		hl
		call	CKVALDELTA
		call	popErrorHandleR
		ret
; ---------------------------------------------------------------------------

p04loc_6E35:
		jp		Page0Call_2509
; End of function p04sub_6DF3

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR Regraph

p04loc_6E38:
		ld		hl, nMax
		rst		20h
		ld		hl, nMin
		call	Mov9OP2Cp
		jr		c, p04loc_6E35
		call	p04sub_72C4
		call	FPOPCPLX
		call	p04sub_756C
		jr		z, p04loc_6E58
		ld		a, 0FFh
		ld		(OP1), a
		rst		18h
		rst		18h
		rst		18h
		rst		18h

p04loc_6E58:
		call	Page04_38E5
		jr		z, p04loc_6E82
		ld		a, 3
		bit		sequv, (iy+seqFlags)
		jr		nz, p04loc_6E73
		add		a, a
		bit		seqvw, (iy+seqFlags)
		jr		nz, p04loc_6E73
		dec		a
		bit		sequw, (iy+seqFlags)
		jr		z, p04loc_6E7E

p04loc_6E73:
		ld		hl, 91CEh
		ld		b, a
		and		(hl)
		cp		b
		jp		nz, ErrInvalid
		jr		p04loc_6E85
; ---------------------------------------------------------------------------

p04loc_6E7E:
		ld		a, (OP2)
		or		a

p04loc_6E82:
		jp		z, p04loc_6962

p04loc_6E85:
		bit		webMode, (iy+seqFlags)
		jp		nz, p04loc_6D2B
		call	p04sub_501E
		call	j_SEQSET
		set		5, (iy+3)

p04loc_6E96:
		call	p04sub_7087
		ld		a, 1
		ld		d, 0

p04loc_6E9D:
		ld		b, a
		call	p04sub_56B3
		jr		nz, p04loc_6EAA
		ld		a, (unk_91CE)
		and		b
		ld		a, b
		jr		z, p04loc_6F07

p04loc_6EAA:
		inc		d
		push	de
		push	af
		call	RCL_SEQ_X
		call	CkOP1Real
		cp		0Eh
		jr		nz, p04loc_6EBC
		ld		hl, OP1
		set		5, (hl)

p04loc_6EBC:
		call	p04sub_715C
		call	p04sub_756C
		jr		z, p04loc_6EC9
		call	Page0Call_35D9
		jr		p04loc_6ECF
; ---------------------------------------------------------------------------

p04loc_6EC9:
		call	p04sub_755A
		call	nz, PushRealO1

p04loc_6ECF:
		pop		bc
		push	bc
		ld		c, b
		call	RCLSEQ2
		call	CkOP1Real
		cp		0Eh
		jr		nz, p04loc_6EE1
		ld		hl, OP1
		set		5, (hl)

p04loc_6EE1:
		ld		a, b
		ld		hl, polar6LineType
		call	p04sub_6FAA
		call	INITNSEQ
		call	p04sub_756C
		jr		z, p04loc_6EF5
		call	p04sub_7571
		jr		p04loc_6EFB
; ---------------------------------------------------------------------------

p04loc_6EF5:
		call	p04sub_755A
		call	nz, PushRealO1

p04loc_6EFB:
		pop		bc
		pop		af
		push	af
		push	bc
		call	p04sub_756C
		call	z, p04sub_6F5D
		pop		af
		pop		de

p04loc_6F07:
		ld		b, a
		call	p04sub_56B3
		jr		nz, p04loc_6F13
		ld		a, b
		add		a, a
		cp		8
		jr		nz, p04loc_6E9D

p04loc_6F13:
		res		5, (iy+3)
		call	p04sub_6F32
		jp		c, p04loc_6962
		ld		hl, p04loc_6F2C
		call	pushErrorHandleR
		call	j_SEQSOLVE
		call	popErrorHandleR
		jp		p04loc_6E96

p04loc_6F2C:
		call	p04sub_7087
		jp		JErrorNo

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


p04sub_6F32:
		; Regraph+788p
		call	j_RclN
		call	Plus1
		call	OP1ToOP4
		call	j_RclN
		ld		hl, PlotStep
		call	page0_BEC
		call	OP1ToOP3
		rst		8
		ld		hl, nMax
		rst		20h
		call	cpop1op2
		ret		c
		call	page0_1867
		call	OP4ToOP1
		call	j_StoN
		call	OP3ToOP1
		ret
; End of function p04sub_6F32


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


p04sub_6F5D:
		push	af
		call	p04sub_56B3
		ld		a, 2
		jr		nz, p04loc_6F76
		ld		a, b
		cp		4
		jr		nz, p04loc_6F6B
		dec		a

p04loc_6F6B:
		ld		hl, (EQS)
		call	isInSet
		pop		de
		ret		z
		push	de
		ld		a, d
		add		a, a

p04loc_6F76:
		pop		de
		ld		de, OP3
		call	p04sub_716A
		push	de
		ld		de, OP4
		call	mov9B2
		rst		8
		ld		hl, (XOutDat)
		rst		20h
		pop		de
		call	MovFrOP1
		inc		hl
		inc		hl
		call	mov9B2
		bit		webMode, (iy+seqFlags)
		jr		nz, p04loc_6F9C
		set		g_style_active, (iy+sGrFlags)

p04loc_6F9C:
		call	PLOTPT
		res		g_style_active, (iy+sGrFlags)
		ret
; End of function p04sub_6F5D


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


NEDXT_Y_STYLE:
		; Regraph+17Ap	...
		ld		hl, 9775h
; End of function NEDXT_Y_STYLE


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


p04sub_6FA7:
		ld		a, (curGY2+1)
; End of function p04sub_6FA7


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


p04sub_6FAA:
		ld		e, a
		ld		d, 0
		add		hl, de
		ld		a, (hl)
		ld		(unk_9775), a
		cp		2
		ret		c
		cp		4
		ret		nc
		ld		hl, 9668h
		inc		(hl)
		ld		a, (hl)
		cp		4
		jr		c, p04loc_6FC3
		ld		(hl), 0

p04loc_6FC3:
		inc		hl
		ld		(hl), 1
		inc		hl
		ld		(hl), 1
		inc		hl
		ld		(hl), 1
		ret
; End of function p04sub_6FAA


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


p04sub_6FCD:
		ld		a, 5
		call	p04sub_7564
		ret		nz
		ld		a, (unk_9775)
		cp		2
		ret		c
		cp		4
		ret		nc
		ld		b, a
		ld		a, (unk_9669)
		or		a
		jr		z, p04loc_6FE6
		dec		a
		jr		p04loc_6FE8
; ---------------------------------------------------------------------------

p04loc_6FE6:
		ld		a, 1

p04loc_6FE8:
		ld		(unk_9669), a
		ld		a, (unk_9668)
		cp		2
		ret		c
		jr		z, p04loc_7007
		ld		a, b
		cp		2
		ld		a, (unk_966B)
		jr		nz, p04loc_7002
		call	p04sub_7018

p04loc_6FFE:
		ld		(unk_966B), a
		ret
; ---------------------------------------------------------------------------

p04loc_7002:
		call	p04sub_701F
		jr		p04loc_6FFE
; ---------------------------------------------------------------------------

p04loc_7007:
		ld		a, b
		cp		2
		ld		a, (unk_966A)
		jr		nz, p04loc_7013

p04loc_700F:
		ld		(unk_966A), a
		ret
; ---------------------------------------------------------------------------

p04loc_7013:
		call	p04sub_7018
		jr		p04loc_700F
; End of function p04sub_6FCD


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


p04sub_7018:
		; p04sub_6FCD:p04loc_7013p
		inc		a
		cp		4
		ret		c
		ld		a, 1
		ret
; End of function p04sub_7018


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


p04sub_701F:
		cp		2
		ld		a, 1
		ret		z
		ld		a, 3
		ret		c
		ld		a, 2
		ret
; End of function p04sub_701F


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


Page04_38E5:
		; Regraph:p04loc_6E58p
		xor		a
		ld		(unk_91CE), a
		ld		(OP2), a
		inc		a
		call	p04sub_703C
		ld		a, 2
		call	p04sub_703C
		ld		a, 4
; End of function Page04_38E5


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


p04sub_703C:
		; Page04_38E5+Dp
		push	af
		cp		4
		jr		nz, p04loc_7042
		dec		a

p04loc_7042:
		call	p04sub_707E
		pop		bc
		push	af
		jr		z, p04loc_7054
		ex		de, hl
		bit		5, (hl)
		jr		z, p04loc_7054
		ld		hl, OP2
		ld		a, (hl)
		or		b
		ld		(hl), a

p04loc_7054:
		ld		hl, 91CEh
		pop		af
		ld		a, (hl)
		jr		z, p04loc_705D
		or		b
		ld		(hl), a

p04loc_705D:
		or		a
		push	af
		call	IsRecursiveMode
		jr		z, p04loc_707C
		bit		webMode, (iy+seqFlags)
		jr		z, p04loc_707C
		call	page0_172A
		jr		nz, p04loc_7075
		bit		allowCursor, (iy+plotFlags)
		jr		z, p04loc_707C

p04loc_7075:
		ld		a, (OP2)
		ld		(hl), a
		pop		bc
		or		a
		push	af

p04loc_707C:
		pop		af
		ret
; End of function p04sub_703C


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


p04sub_707E:
		call	j_serrort
		rst		10h
		ex		de, hl
		ld		a, (hl)
		inc		hl
		or		(hl)
		ret
; End of function p04sub_707E


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


p04sub_7087:
		call	IsOnInterruptSet
		jr		z, p04loc_7096
		call	p04sub_756C
		jp		nz, ErrBreak

p04loc_7092:
		pop		hl
		jp		p04loc_6977
; ---------------------------------------------------------------------------

p04loc_7096:
		call	p04sub_756C
		ret		nz
		call	GetCSC
		cp		9
		ret		nz
		call	Page0Call_32F1
		call	IsOnInterruptSet
		jr		nz, p04loc_7092
		ret
; End of function p04sub_7087


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


p04sub_70A9:
		; Regraph:p04loc_6B68p ...



		ld		hl, 0
		ld		(unk_9810), hl
		call	p04sub_720D
		ret		nz
		ld		a, (curGY2)
		cp		1
		jr		z, p04loc_70CB
		xor		a
		ld		(curGY2), a
		res		5, (iy+3)
; End of function p04sub_70A9


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


Page04_3393:
		; Regraph+1B5p	...
		pop		ix
		pop		hl
		push	hl
		ld		(pTempCnt), hl
		jp		(ix)
; End of function Page04_3393

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p04sub_70A9

p04loc_70CB:
		pop		hl
		jp		p04loc_6962
; END OF FUNCTION CHUNK	FOR p04sub_70A9

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


p04sub_70CF:
		; Regraph:p04loc_6C30p
		call	p04sub_7211
		jr		z, p04loc_70CB
; End of function p04sub_70CF


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


p04sub_70D4:
		ld		hl, 0
		ld		(unk_9810), hl
		inc		hl
		ld		(unk_980E), hl
		ret
; End of function p04sub_70D4


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


p04sub_70DF:
		call	p04sub_7146
		ld		hl, (inputDat)
		call	Mov9ToOP2
		call	IsOP1Num
		jr		z, p04loc_7114
		ld		hl, p04loc_7114
		call	pushErrorHandleR
		call	j_PtoR
		call	CkValidNum
		ld		de, (XOutDat)
		call	MovFrOP1
		call	OP1ExOP2
		call	CkValidNum
		ld		de, (YOutDat)
		call	MovFrOP1
		call	OP1ExOP2
		call	popErrorHandleR
		ret
; ---------------------------------------------------------------------------

p04loc_7114:
		res		numOP1, (iy+ParsFlag2)
		ld		a, 20h ; ' '
		ld		(OP1), a
		ld		(OP2), a
		ret
; End of function p04sub_70DF

p04loc_7121:
		.db		0
		.db		84h	; �
		.db		65h	; e
		.db		53h	; S
		.db		60h	; `
		.db		0
		.db		0
		.db		0
		.db		0

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


p04sub_712A:
		; Regraph:p04loc_695Bp ...
		ld		hl, (unk_9810)
		ld		a, h
		or		l
		ret		z
		ld		de, (unk_980E)
		sbc		hl, de
		ret		z
		inc		de
		ld		(unk_980E), de
		scf
		ret
; End of function p04sub_712A


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


p04sub_713E:
		ld		hl, (EQS)
		ld		de, 24h	; '$'
		add		hl, de
		ret
; End of function p04sub_713E


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


p04sub_7146:
		ld		hl, (inputSym)
		dec		hl
		dec		hl
		dec		hl
		ld		e, (hl)
		dec		hl
		ld		d, (hl)
		jr		p04loc_7155
; End of function p04sub_7146


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


INITNSEQ:
		; Regraph+185p	...
		ld		de, (YOutDat)

p04loc_7155:
		call	IsOP1Num
		jp		nz, MovFrOP1
		ret
; End of function INITNSEQ


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


p04sub_715C:
		ld		de, (XOutDat)
		jr		p04loc_7155
; End of function p04sub_715C


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


p04sub_7162:
		ld		a, (curGY2)
		ld		de, OP4
; End of function p04sub_7162


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


p04sub_7168:
		add		a, 4
; End of function p04sub_7168


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


p04sub_716A:
		ld		l, a
		ld		h, 0
		call	HLTimes9
		ld		bc, (EQS)
		add		hl, bc
		push	hl
		call	mov9B2
		pop		de
		ret
; End of function p04sub_716A


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


YRES:
		rst		8
		ld		hl, (inputDat)
		rst		20h
; End of function YRES


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


p04sub_7180:
		call	CpyTo3FPS1
		inc		de
		inc		de
		call	mov9B2
		call	CpyO1ToFPS1
		call	CpyO2ToFPST
; End of function p04sub_7180


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


PLOTPT:
		; Regraph+2FDp	...




		call	IsOP1Num
		ret		z
		ld		a, 4
		call	p04sub_7564
		ret		nz
		bit		g_style_active, (iy+sGrFlags)
		jr		z, p04loc_71E4
		ld		a, (unk_9775)
		cp		4
		jr		c, p04loc_71EB
		cp		6
		jp		nc, DarkPnt
		call	PUSHMCPLXO1
		call	PUSHMCPLXO3
		call	OP3ToOP1
		call	OP4ToOP2
		call	p04sub_71EF
		call	z, p04sub_6600
		call	CpyTo1FPS3
		call	CpyTo2FPS2
		call	p04sub_71DD
		call	PopRealO4
		call	PopRealO3
		call	POPMCPLXO1
		ld		a, (unk_9775)
		cp		5
		ret		z
		call	PUSHMCPLXO1
		call	j_CLine
		call	POPMCPLXO1
; End of function PLOTPT


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


p04sub_71DD:
		call	p04sub_71EF
		call	z, p04sub_6611
		ret
; End of function p04sub_71DD

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR PLOTPT

p04loc_71E4:
		bit		grfDot, (iy+grfDBFlags)
		jp		nz, DarkPnt

p04loc_71EB:
		call	j_CLine
		ret
; END OF FUNCTION CHUNK	FOR PLOTPT

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


p04sub_71EF:
		call	PUSHMCPLXO1
		ld		de, 0FFF7h
		call	XYRNDBOTH
		jr		nz, p04loc_7205
		call	CheckTOP
		and		0Fh
		jr		nz, p04loc_7205
		call	WTOV
		xor		a

p04loc_7205:
		push	af
		push	bc
		call	FPOPCPLX
		pop		bc
		pop		af
		ret
; End of function p04sub_71EF


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


p04sub_720D:
		ld		hl, curGY2
		inc		(hl)
; End of function p04sub_720D


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


p04sub_7211:
		; Regraph:p04loc_68F0p ...
		ld		a, (curGY2+1)
		call	NEXTEQ
		ld		(curGY2+1), a
		or		a
		ret
; End of function p04sub_7211


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


p04sub_721C:
		ld		bc, ThetaMin
		jr		p04loc_7224
; End of function p04sub_721C


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


p04sub_7221:
		ld		bc, TminPar

p04loc_7224:
		ld		hl, (curInc)
		ld		de, 1
		add		hl, de
		ret		c
		ld		(curInc), hl

NEWINDEP:
		; ForceGraphKeypress:p04loc_5502p
		ld		hl, 9
		add		hl, bc
		push	hl
		ld		de, 9
		add		hl, de
		ld		a, (hl)
		push	af
		ex		de, hl
		ld		hl, OP4
		call	p04sub_4418
		call	j_RndGuard
		pop		af
		pop		hl
		call	Mov9ToOP2
		rla
		jr		nc, p04loc_7278
		call	cpop1op2
		jr		nz, p04loc_7268
		call	OP4ToOP1
		call	cpop1op2

p04loc_7257:
		jr		nc, p04loc_7268
		call	CkOP2FP0
		call	z, OP2Set0
		call	OP2ToOP4
		ld		hl, OP4
		res		6, (hl)
		xor		a

p04loc_7268:
		; p04sub_7221:p04loc_7257j ...
		ret		c
		call	OP4ToOP1
		call	CkValidNum
		ld		de, (inputDat)
		call	MovFrOP1
		or		a
		ret
; ---------------------------------------------------------------------------

p04loc_7278:
		call	cpop1op2
		jr		z, p04loc_7280
		ccf
		jr		p04loc_7268
; ---------------------------------------------------------------------------

p04loc_7280:
		call	OP4ToOP1
		call	cpop1op2
		ccf
		jr		p04loc_7257
; End of function p04sub_7221


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


p04sub_7289:
		; Regraph:p04loc_6C33p ...
		ld		hl, 0
		ld		(curInc), hl
		ld		hl, ThetaMin
		rst		20h
		call	j_StoTheta
		jr		p04loc_72BD
; End of function p04sub_7289


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


p04sub_7298:
		; Regraph:p04loc_6AC3p ...
		ld		hl, TminPar
		rst		20h
		ld		hl, 0
		ld		(curInc), hl
		call	j_StoT
		jr		p04loc_72BD
; End of function p04sub_7298


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


p04sub_72A7:
		; Regraph+2D3p
		call	p04sub_713E
		push	hl
		ld		hl, Xmin
		rst		20h
		pop		de
		call	p04sub_756C
		call	z, MovFrOP1
; End of function p04sub_72A7


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


p04sub_72B6:
		xor		a
		ld		(curInc), a
		call	j_StoX

p04loc_72BD:
		ld		hl, (chkDelPtr1)
		ld		(inputDat), hl
		ret
; End of function p04sub_72B6


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


p04sub_72C4:
		; Regraph+316p	...
		call	OP1Set0
		call	j_StoX
		ld		hl, (chkDelPtr3)
		ld		(XOutSym), hl
		ld		(hl), 0
		ld		hl, (chkDelPtr1)
		ld		(XOutDat), hl
; End of function p04sub_72C4


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


Page04_3309:
		; DRAWCMD_INIT+Ap ...
		call	OP1Set0
		call	j_StoY
		ld		hl, (chkDelPtr3)
		ld		(YOutSym), hl
		ld		(hl), 0
		ld		hl, (chkDelPtr1)
		ld		(YOutDat), hl
		ret
; End of function Page04_3309


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


p04sub_72ED:
		call	j_StoR
		ld		hl, (chkDelPtr3)
		ld		(inputSym), hl
		ld		(hl), 0
		ret
; End of function p04sub_72ED


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


p04sub_72F9:
		ld		de, 9

p04loc_72FC:
		res		6, (hl)
		add		hl, de
		djnz	p04loc_72FC
		ret
; End of function p04sub_72F9


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


Axes:
		ld		a, (unk_8A2C)
		push	af
		bit		1, (iy+3Ch)
		jr		z, p04loc_7310
		set		2, (iy+3Ch)

p04loc_7310:
		ld		de, deltaX
		ld		hl, Xscl
		call	p04sub_753F
		ld		(OP5), a
		ld		de, deltaY
		ld		hl, Yscl
		call	p04sub_753F
		ld		(OP5+1), a
		bit		grfNoAxis, (iy+grfDBFlags)
		jp		nz, p04loc_73DD
		call	OP4Set0
		ld		de, OP4
		ld		l, e
		ld		h, d
		call	CheckXY
		ld		l, a
		push	hl
		ld		a, 0FFh
		call	p04sub_755A
		jr		z, p04loc_7362
		ld		a, (unk_8E69)
		call	p04sub_75A2
		jr		nc, p04loc_7362
		bit		4, (iy+3)
		jr		nz, p04loc_7359
		sub		8
		jr		nc, p04loc_7377
		set		3, l
		jr		p04loc_7362
; ---------------------------------------------------------------------------

p04loc_7359:
		add		a, 8
		call	p04sub_75A2
		jr		c, p04loc_7377
		set		2, l

p04loc_7362:
		ld		(unk_8E69), a
		xor		a
		bit		3, l
		jr		nz, p04loc_7395
		ld		a, (pixWide_m_2)
		bit		2, l
		jr		nz, p04loc_7395
		ld		de, OP4
		call	XftoI

p04loc_7377:
		ld		(curGY2+1), a
		ld		(unk_8E69), a
		call	p04sub_7473
		call	c, p04sub_4017
		ld		b, a
		ld		a, (pixWide_m_2)
		cp		b
		ld		a, b
		jr		nz, p04loc_7394
		dec		a
		ld		(curGY2+1), a
		call	p04sub_74A0
		jr		p04loc_7398
; ---------------------------------------------------------------------------

p04loc_7394:
		inc		a

p04loc_7395:
		ld		(curGY2+1), a

p04loc_7398:
		pop		hl
		ld		a, 1
		bit		1, l
		jr		nz, p04loc_73D1
		ld		a, (lcdTallP)
		dec		a
		bit		0, l
		jr		nz, p04loc_73D1
		call	OP4Set0
		ld		de, OP4
		call	YftoI
		ld		(curGY2), a
		ld		d, a
		ld		a, (lcdTallP)
		dec		a
		cp		d
		ld		a, d
		jr		nz, p04loc_73BF
		dec		a
		jr		p04loc_73C0
; ---------------------------------------------------------------------------

p04loc_73BF:
		inc		a

p04loc_73C0:
		ld		de, (curGY2)
		push	af
		ld		a, (pixWide_m_2)
		ld		c, a
		ld		b, 0
		pop		af
		ld		d, c
		ld		c, e
		call	DarkLine

p04loc_73D1:
		ld		(curGY2), a
		ld		a, (curGY2+1)
		call	p04sub_7478
		call	c, p04sub_74A0

p04loc_73DD:
		ld		a, (OP5)
		or		a
		push	af
		jr		nz, p04loc_7400
		ld		b, a
		ld		a, (pixWide_m_2)
		ld		c, a
		call	p04sub_755A
		jr		z, p04loc_73FA
		sub		9
		ld		b, a
		bit		4, (iy+3)
		jr		z, p04loc_73FA
		ld		bc, 9

p04loc_73FA:
		pop		af
		ld		a, c
		push	af
		ld		a, b
		jr		p04loc_7437
; ---------------------------------------------------------------------------

p04loc_7400:
		ld		bc, Xmin
		ld		de, Xmax
		ld		hl, Xscl
		call	p04sub_755A
		jr		z, p04loc_741C
		bit		4, (iy+3)
		jr		nz, p04loc_7419
		ld		bc, OP6
		jr		p04loc_741C
; ---------------------------------------------------------------------------

p04loc_7419:
		ld		de, OP6

p04loc_741C:
		ld		(OP5+3), de
		call	p04sub_74D7
		jr		c, p04loc_7467

p04loc_7425:
		ld		de, (OP5+3)
		ld		hl, Xscl
		call	p04sub_7514
		jr		c, p04loc_746A
		ld		de, OP1
		call	XftoI

p04loc_7437:
		call	IsOnInterruptSet
		jr		nz, p04loc_746A
		ld		(curGY2+1), a
		ld		bc, (curGY2)
		bit		grfNoAxis, (iy+grfDBFlags)
		call	z, PointOn
		ld		hl, (curInc)
		push	hl
		bit		grfGrid, (iy+grfDBFlags)
		call	nz, p04sub_74A0
		pop		hl
		inc		hl
		ld		(curInc), hl
		pop		af
		push	af
		jr		nz, p04loc_7425
		ld		bc, (curGY2)
		inc		b
		cp		b
		ld		a, b
		jr		nc, p04loc_7437

p04loc_7467:
		pop		af
		jr		p04loc_746E
; ---------------------------------------------------------------------------

p04loc_746A:
		pop		af
		call	nz, FPOPREAL

p04loc_746E:
		pop		af
		ld		(unk_8A2C), a
		ret
; End of function Axes


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


p04sub_7473:
		call	p04sub_755A
		jr		nz, p04loc_748A
; End of function p04sub_7473


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


p04sub_7478:
		call	p04sub_755A
		jr		nz, p04loc_747F

p04loc_747D:
		scf
		ret
; ---------------------------------------------------------------------------

p04loc_747F:
		or		a
		jr		z, p04loc_747D
		push	hl
		ld		hl, pixWide_m_2
		cp		(hl)
		pop		hl
		jr		z, p04loc_747D

p04loc_748A:
		bit		4, (iy+3)
		jr		z, p04loc_7493
		cp		0Ah
		ret
; ---------------------------------------------------------------------------

p04loc_7493:
		push	hl
		push	af
		ld		a, (lcdTallP+1)
		sub		0Bh
		ld		l, a
		pop		af
		cp		l
		pop		hl
		ccf
		ret
; End of function p04sub_7478


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


p04sub_74A0:
		ld		a, (OP5+1)
		or		a
		jp		z, p04sub_4017
		ld		bc, Ymin
		ld		de, Ymax
		ld		hl, Yscl
		call	p04sub_74D7
		ret		c

p04loc_74B4:
		ld		de, Ymax
		ld		hl, Yscl
		call	p04sub_7514
		jp		c, FPOPREAL
		ld		hl, (curInc)
		inc		hl
		ld		(curInc), hl
		ld		de, OP1
		call	YftoI
		ld		bc, (curGY2)
		ld		c, a
		call	PointOn
		jr		p04loc_74B4
; End of function p04sub_74A0


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


p04sub_74D7:
		push	de
		push	bc
		call	Mov9ToOP2
		pop		hl
		rst		20h
		call	CkOP2FP0
		jr		z, p04loc_7511
		call	ClrOP2S
		call	OP2ToOP4
		call	fpdiv
		call	j_RndGuard
		call	Ceiling
		call	OP4ToOP2
		call	FPMult
		call	OP1ToOP4
		call	j_RndGuard
		rst		8
		pop		hl
		rst		20h
		call	cpop1op2
		ret		c
		call	OP4ToOP1
		rst		18h
		ld		hl, 0
		ld		(curInc), hl
		xor		a
		ret
; ---------------------------------------------------------------------------

p04loc_7511:
		pop		af
		scf
		ret
; End of function p04sub_74D7


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


p04sub_7514:
		push	de
		rst		20h
		call	ClrOP1S
		ld		hl, (curInc)
		call	j_SetXXXXOP2
		call	FPMult
		call	CpyTo2FPST
		rst		30h
		call	j_RndGuard
		call	OP1ToOP4
		rst		8
		pop		hl
		rst		20h
		call	cpop1op2
		ret		c
		jp		OP4ToOP1
; End of function p04sub_7514


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


Ceiling:
		call	InvOP1S
		call	BCALL_405D
		jp		InvOP1S
; End of function Ceiling


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


p04sub_753F:
		push	de
		rst		20h
		call	ClrOP1S
		call	CkOP1FP0
		pop		hl
		jr		z, p04loc_7557
		call	Mov9ToOP2
		call	ClrOP2S
		call	cpop1op2
		jr		nc, p04loc_7557
		xor		a
		ret
; ---------------------------------------------------------------------------

p04loc_7557:
		ld		a, 1
		ret
; End of function p04sub_753F


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


p04sub_755A:
		; Regraph+2D0p	...
		bit		5, (iy+3)
		ret
; End of function p04sub_755A


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


p04sub_755F:
		bit		6, (iy+18h)
		ret
; End of function p04sub_755F


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


p04sub_7564:
		bit		regraphHookActive, (iy+hookflags3)
		call	nz, j_RunGraphingHook
		ret
; End of function p04sub_7564


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


p04sub_756C:
		bit		2, (iy+11h)
		ret
; End of function p04sub_756C


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


p04sub_7571:
		call	IsOP1Num
		ret		z
		ld		hl, (FPS)
		ld		de, 0FFE5h
		add		hl, de
		ld		a, (hl)
		inc		a
		jr		nz, p04loc_7586
		call	CpyO1ToFPS3
		jp		CpyO1ToFPS2
; ---------------------------------------------------------------------------

p04loc_7586:
		call	OP1ToOP5
		call	CpyTo2FPS3
		call	cpop1op2
		jp		c, CpyO5ToFPS3
		call	OP5ToOP2
		call	CpyTo1FPS2
		call	cpop1op2
		ret		nc
		call	OP5ToOP1
		jp		CpyO1ToFPS2
; End of function p04sub_7571


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


p04sub_75A2:
		; Axes+44p ...
		push	hl
		ld		hl, pixWide_m_1
		cp		(hl)
		pop		hl
		ret
; End of function p04sub_75A2


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


p04sub_75A9:
		ld		hl, 0FFFFh
		ld		(linkKeyTick), hl
		call	j_GRPHPARS
		ret
; End of function p04sub_75A9


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


p04sub_75B3:
		ld		hl, (linkKeyTick)
		ld		de, 0FFF1h
		or		a
		sbc		hl, de
		ret		c
		ret		z
		ld		b, l

p04loc_75BF:
		call	HandleLinkKeyActivity
		djnz	p04loc_75BF
		ret
; End of function p04sub_75B3


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


setPenX:
		; p04sub_7613p ...
		call	Bit_VertSplit
		jr		nz, p04sub_75EA

p04loc_75CA:
		sub		a

p04loc_75CB:
		ld		(penCol), a
		ld		a, (winBtm)
		add		a, a
		add		a, a
		add		a, a
		sub		7

p04loc_75D6:
		call	CheckSplitFlag
		jr		z, p04loc_75DD
		sub		21h ; '!'

p04loc_75DD:
		ld		(penCol+1), a
		ret
; End of function setPenX


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


setPenY:
		; p04sub_7651p ...
		call	Bit_VertSplit
		jr		nz, p04loc_75CA
		ld		a, 30h ; '0'
		jr		p04loc_75CB
; End of function setPenY


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


p04sub_75EA:
		sub		a
; End of function p04sub_75EA


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


p04sub_75EB:
		ld		(penCol), a
		ld		a, (winBtm)
		add		a, a
		add		a, a
		add		a, a
		sub		0Dh
		jr		p04loc_75D6
; End of function p04sub_75EB


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


setPenT:
		; LABCOOR:p04loc_761Ep ...
		call	p04sub_75EA
		call	Bit_VertSplit
		ret		z
		sub		6
		jr		p04loc_75DD
; End of function setPenT

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

Page04_32D3:
		call	Bit_VertSplit
		jr		z, p04loc_760F
		call	setPenT
		sub		6
		jr		p04loc_75DD
; ---------------------------------------------------------------------------

p04loc_760F:
		ld		a, 30h ; '0'
		jr		p04sub_75EB

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


p04sub_7613:
		call	setPenX
		ld		h, 52h ; 'R'
		bit		6, (iy+3)
		jr		p04loc_768B
; End of function p04sub_7613

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR LABCOOR

p04loc_761E:
		call	setPenT
		ld		h, 5Bh ; '['
		sub		a
		jr		p04loc_768B
; END OF FUNCTION CHUNK	FOR LABCOOR
; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR p04sub_7685

p04loc_7626:
		call	setPenY
		ld		h, 5Bh ; '['
		sub		a
		jr		p04loc_768B
; END OF FUNCTION CHUNK	FOR p04sub_7685

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


p04sub_762E:
		call	setPenT
		ld		h, 54h ; 'T'
		sub		a
		jr		p04loc_768B
; End of function p04sub_762E


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


p04sub_7636:
		call	Bit_VertSplit
		jr		nz, p04sub_7640
		call	setPenT
		jr		p04loc_7643
; End of function p04sub_7636


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


p04sub_7640:
		call	setPenX

p04loc_7643:
		ld		h, 58h ; 'X'
		bit		6, (iy+3)
		jr		p04loc_768B
; End of function p04sub_7640

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR LABCOOR

p04loc_764B:
		call	p04sub_762E
; END OF FUNCTION CHUNK	FOR LABCOOR

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


PutXY:
		; LABCOOR:p04loc_497Ap ...
		call	p04sub_7640
; End of function PutXY


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


p04sub_7651:
		call	setPenY
		ld		h, 59h ; 'Y'
		bit		7, (iy+3)
		jr		p04loc_768B
; End of function p04sub_7651

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR LABCOOR

p04loc_765C:
		call	p04sub_7661
		jr		PutXY
; END OF FUNCTION CHUNK	FOR LABCOOR

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


p04sub_7661:
		call	setPenT
		set		textEraseBelow, (iy+textFlags)
		call	Page04_3345
		ld		a, 1
		call	j_VPutMap
		ld		a, 3Dh ; '='
		call	j_VPutMap
		call	RECURNNAME
		jr		p04sub_76A2
; End of function p04sub_7661

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR LABCOOR

p04loc_767A:
		call	p04sub_7640
		call	p04sub_7651
		jr		p04loc_761E
; ---------------------------------------------------------------------------

p04loc_7682:
		call	p04sub_762E
; END OF FUNCTION CHUNK	FOR LABCOOR

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


p04sub_7685:



		call	p04sub_7613
		jr		p04loc_7626
; End of function p04sub_7685

; ---------------------------------------------------------------------------
		xor		a
; START	OF FUNCTION CHUNK FOR LABCOOR

p04loc_768B:
		push	af
		set		textEraseBelow, (iy+textFlags)
		call	Page04_3345
		ld		a, h
		call	REALNAME
		call	j_VPutMap
		ld		a, 3Dh ; '='
		call	j_VPutMap
		pop		af
		jr		nz, p04loc_76A7
; END OF FUNCTION CHUNK	FOR LABCOOR

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


p04sub_76A2:
		rst		10h
		ex		de, hl
; End of function p04sub_76A2


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


p04sub_76A4:
		call	p04sub_797A

p04loc_76A7:
		res		textEraseBelow, (iy+textFlags)
		ret
; End of function p04sub_76A4

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

Page04_3507:
		call	setPenX
		call	j_RclX
		ld		hl, (unk_8E65)
		ld		a, h
		or		h
		jr		z, p04loc_76CA

p04loc_76B9:
		call	Page0Call_35A3
		ld		a, 5
		jr		z, p04loc_76D3
		call	Page0Call_359D
		ld		a, 1
		jr		z, p04loc_76D3
		jp		p04sub_7640
; ---------------------------------------------------------------------------

p04loc_76CA:
		ld		a, l
		cp		2
		jr		c, p04loc_76B9
		cp		5
		jr		nc, p04loc_76B9

p04loc_76D3:
		dec		a
		add		a, a
		ld		e, a
		ld		d, 0
		ld		hl, p04loc_7A16
		add		hl, de
		call	ldHLind
		ld		a, 5Dh ; ']'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook

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


p04sub_76E8:
		set		textEraseBelow, (iy+textFlags)
		call	p04sub_7A03
		ld		a, 3Dh ; '='
; End of function p04sub_76E8


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


p04sub_76F1:
		call	j_VPutMap
		ld		a, (penCol)
		cp		16h
		ld		a, 5
		jr		z, p04loc_76FF
		ld		a, 6

p04loc_76FF:
		call	Bit_VertSplit
		jr		nz, p04loc_7706
		ld		a, 9

p04loc_7706:
		call	DispOP1A
		res		textEraseBelow, (iy+textFlags)
		ret
; End of function p04sub_76F1

; ---------------------------------------------------------------------------
		ld		hl, OP1
		jr		p04sub_76A4
; ---------------------------------------------------------------------------

Page04_32D9:
		call	p04sub_7737
		call	Bit_VertSplit
		jr		z, p04loc_7720
		call	setPenY
		jr		p04loc_772E
; ---------------------------------------------------------------------------

p04loc_7720:
		ld		a, 30h ; '0'
		call	p04loc_75CB
		set		textWrite, (iy+sGrFlags)
		ld		a, 20h ; ' '
		call	j_VPutMap

p04loc_772E:
		res		textWrite, (iy+sGrFlags)
		ld		hl, 8B5Ah
		ld		a, 70h ; 'p'

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


p04sub_7737:
		push	af
		rst		20h
		ld		d, 4
		call	Round
		pop		af
		set		textWrite, (iy+sGrFlags)
		set		textEraseBelow, (iy+textFlags)
		call	j_VPutMap
		ld		a, 3Dh ; '='
		call	j_VPutMap
		ld		hl, OP1
		call	p04sub_76A4
		res		textWrite, (iy+sGrFlags)
		ret
; End of function p04sub_7737


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


p04sub_775A:
		set		NEED_BUFCPY, (iy+VERTFLAG2)
		ld		de, 7800h
		call	p04sub_7767
		ld		de, 7901h
; End of function p04sub_775A


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


p04sub_7767:
		ld		b, 1
		ld		a, (lcdTallP+1)
		sub		6
		push	de
		push	bc
		rrc	e
		jr		nz, p04loc_7796
		call	p04sub_75EB
		ld		a, (penCol+1)
		call	Bit_VertSplit
		jr		z, p04loc_7781
		sub		0Dh

p04loc_7781:
		dec		a
		ld		(penCol+1), a

p04loc_7785:
		set		textEraseBelow, (iy+textFlags)
		call	Page04_3345
		pop		bc

p04loc_778D:
		pop		af
		call	j_VPutMap
		djnz	p04loc_778D
		jp		p04loc_7875
; ---------------------------------------------------------------------------

p04loc_7796:
		ld		hl, 500h
		call	Bit_VertSplit
		jr		z, p04loc_77A1
		ld		hl, 600h

p04loc_77A1:
		ld		(penCol), hl
		jr		p04loc_7785
; End of function p04sub_7767


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


p04sub_77A6:
		; PUTEQUNO:p04loc_784Ap
		ld		(penCol), hl
		ld		d, 5Eh ; '^'
		ld		a, (OP1M)
		ld		e, a
		call	j_GetTokLen
		ld		b, a
		inc		hl
		res		4, (iy+24h)
		call	j_vputsnG
		ld		hl, (curGY)
		push	hl
		rst		10h
		ex		de, hl
		ld		c, (hl)
		inc		hl
		ld		b, (hl)

p04loc_77C4:
		ld		a, 3Dh ; '='
		call	j_VPutMap
		set		4, (iy+11h)
		call	j_WRITE_TEXT
		res		4, (iy+11h)
		pop		hl
		ld		(curGY), hl
		ret
; End of function p04sub_77A6


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


TAN_EQU_DISP:
		set		NEED_BUFCPY, (iy+VERTFLAG2)
		res		3, (iy+11h)
		set		textEraseBelow, (iy+textFlags)
		ld		a, 1
		call	p04loc_75CB
		ld		a, 79h ; 'y'
		call	j_VPutMap
		ld		hl, (curGY)
		push	hl
		rst		10h
		ex		de, hl
		ld		c, (hl)
		inc		hl
		ld		b, (hl)
		dec		bc
		dec		bc
		inc		hl
		inc		hl
		jr		p04loc_77C4
; End of function TAN_EQU_DISP


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


PUTEQUNO:
		ld		b, a
		ld		a, 0
		bit		0, (iy+36h)
		call	nz, j_RunTraceHook
		ret		nz
		ld		a, b
		push	af
		set		textEraseBelow, (iy+textFlags)
		bit		grfExpr, (iy+traceFlags)
		jr		nz, p04loc_784F
		set		NEED_BUFCPY, (iy+VERTFLAG2)
		ld		a, (curPlotNumber)
		or		a
		jr		nz, p04loc_7867
		pop		af
		call	Page0Call_385B
		call	IsParametricMode
		jr		z, p04loc_782C
		set		3, (iy+11h)

p04loc_782C:
		ld		hl, 0
		call	p04sub_77A6
		res		3, (iy+11h)
		call	IsParametricMode
		jr		z, p04loc_7875
		ld		hl, OP1M
		inc		(hl)
		ld		hl, 30h	; '0'
		call	Bit_VertSplit
		jr		z, p04loc_784A
		ld		hl, 18h

p04loc_784A:
		call	p04sub_77A6
		jr		p04loc_7875
; ---------------------------------------------------------------------------

p04loc_784F:
		pop		af
		bit		grfNoCoord, (iy+grfDBFlags)
		ret		nz
		push	af
		set		NEED_BUFCPY, (iy+VERTFLAG2)
		ld		hl, 5Ah	; 'Z'
		call	Bit_VertSplit
		jr		z, p04loc_7864
		ld		l, 2Ah ; '*'

p04loc_7864:
		ld		(penCol), hl

p04loc_7867:
		call	Page04_3345
		pop		af
		cp		0Ah
		jr		nz, p04loc_7870
		xor		a

p04loc_7870:
		add		a, 30h ; '0'
		call	j_VPutMap

p04loc_7875:
		res		textEraseBelow, (iy+textFlags)
		ret
; End of function PUTEQUNO


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


p04sub_787A:
		ld		hl, p04loc_7A20

PutAns:
		call	setPenX
		set		textEraseBelow, (iy+textFlags)
		call	Page04_3345
		call	p04sub_7A03
		call	j_RclAns
		call	Bit_VertSplit
		call	nz, setPenY
		call	p04loc_797B
		jr		p04loc_7875
; End of function p04sub_787A

; ---------------------------------------------------------------------------
; START	OF FUNCTION CHUNK FOR LABCOOR

p04loc_7898:
		ld		hl, p04loc_7A8D
		ld		a, 5Ah ; 'Z'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		jr		p04loc_78F8
; ---------------------------------------------------------------------------

p04loc_78A6:
		ld		hl, p04loc_7A44
		ld		a, 5Fh ; '_'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		jr		p04loc_78F8
; ---------------------------------------------------------------------------

p04loc_78B4:
		ld		hl, p04loc_7A51
		ld		a, 5Eh ; '^'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		jr		p04loc_78F8
; ---------------------------------------------------------------------------

p04loc_78C2:
		ld		hl, p04loc_7A99
		ld		a, 59h ; 'Y'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		jr		p04loc_78F8
; ---------------------------------------------------------------------------

p04loc_78D0:
		ld		hl, p04loc_7A73
		ld		a, 5Ch ; '\'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		jr		p04loc_78F8
; ---------------------------------------------------------------------------

p04loc_78DE:
		ld		hl, p04loc_7A80
		ld		a, 5Bh ; '['
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		jr		p04loc_78F8
; ---------------------------------------------------------------------------

p04loc_78EC:
		ld		hl, p04loc_7AA6
		ld		a, 58h ; 'X'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook

p04loc_78F8:
		; LABCOOR+2FF7j ...
		bit		3, (iy+2)
		jr		z, p04loc_7910
		push	hl
		call	CLRGRAPHXY
		call	PutXY
		call	j_CursorOff
		pop		hl
		call	p04sub_7930
		call	p04sub_4A43
		ret
; ---------------------------------------------------------------------------

p04loc_7910:
		bit		2, (iy+17h)
		jr		z, p04loc_7925
		call	setPenT
		call	Bit_VertSplit
		jr		nz, p04loc_7933
		sub		2
		ld		(penCol+1), a
		jr		p04loc_7933
; ---------------------------------------------------------------------------

p04loc_7925:
		bit		grfNoCoord, (iy+grfDBFlags)
		jr		z, p04loc_7974
		call	setPenX
		jr		p04loc_7933
; END OF FUNCTION CHUNK	FOR LABCOOR

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


p04sub_7930:
		; LABCOOR:p04loc_7974p
		call	setPenT

p04loc_7933:
		; LABCOOR+3068j ...
		set		textEraseBelow, (iy+textFlags)
		call	Page04_3345
		call	p04sub_7A03
		ret
; End of function p04sub_7930


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


p04sub_793E:
		ld		hl, p04loc_7A27
		ld		a, 62h ; 'b'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		jr		p04loc_7974
; End of function p04sub_793E


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


p04sub_794C:
		ld		hl, p04loc_7A2F
		ld		a, 61h ; 'a'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		jr		p04loc_7974
; End of function p04sub_794C


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


p04sub_795A:
		ld		hl, p04loc_7A37
		ld		a, 60h ; '`'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		jr		p04loc_7974
; End of function p04sub_795A


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


p04sub_7968:
		ld		hl, p04loc_7AAD
		ld		a, 57h ; 'W'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
; End of function p04sub_7968

; START	OF FUNCTION CHUNK FOR LABCOOR

p04loc_7974:
		call	p04sub_7930
		jp		PutXY
; END OF FUNCTION CHUNK	FOR LABCOOR

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


p04sub_797A:
		rst		20h

p04loc_797B:
		ld		a, 9

DispOP1A:
		set		NEED_BUFCPY, (iy+VERTFLAG2)
		push	af
		call	j_RnFx
		pop		af
		call	j_FormEReal
		ld		hl, OP3
		call	p04sub_7A03
		call	Page04_3345
; End of function p04sub_797A


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


Page04_3345:
		; p04sub_7661+7p ...
		ld		a, 20h ; ' '
		call	j_VPutMap
		ret
; End of function Page04_3345

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

Page04_32E5:
		ld		c, a
		ld		b, 8
		sub		a

p04loc_799C:
		sla	c
		rla
		cp		0Ah
		jr		c, p04loc_79A6
		sub		0Ah
		inc		c

p04loc_79A6:
		djnz	p04loc_799C
		ld		b, a
		ld		a, c
		or		a
		ret
; ---------------------------------------------------------------------------

Page04_3501:
		call	setPenX
		call	CpyTo1FPS1
		ld		hl, aTmax+1
		ld		a, 63h ; 'c'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		set		textEraseBelow, (iy+textFlags)
		call	p04sub_7A03
		ld		a, 3Ch ; '<'
		call	p04sub_76F1
		call	YName
		call	Bit_VertSplit
		jr		z, p04loc_79D7
		call	setPenY
		jr		p04loc_79DC
; ---------------------------------------------------------------------------

p04loc_79D7:
		ld		a, 3Ah ; ':'
		call	p04loc_75CB

p04loc_79DC:
		set		textEraseBelow, (iy+textFlags)
		ld		a, 6Eh ; 'n'
		call	j_VPutMap
		ld		a, 3Dh ; '='
		call	j_VPutMap
		call	p04sub_76A2
		call	CpyTo1FPS2
		call	setPenT
		ld		hl, aTmin+1
		ld		a, 64h ; 'd'
		bit		localizeHookActive, (iy+hookflags3)
		call	nz, j_call_character_hook
		call	p04sub_76E8
		ret

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


p04sub_7A03:
		; p04sub_76E8+4p ...
		push	af
		push	de
		push	ix

p04loc_7A07:
		ld		a, (hl)
		inc		hl
		or		a
		jr		z, p04loc_7A11
		call	j_VPutMap
		jr		nc, p04loc_7A07

p04loc_7A11:
		pop		ix
		pop		de
		pop		af
		ret
; End of function p04sub_7A03

p04loc_7A16:
		.dw		aMinx04
		.dw		aQ1
		.dw		aMed
		.dw		aQ3
		.dw		aMaxx04
p04loc_7A20:
aDyDx_04:   .asc 'dy/dx=',0
p04loc_7A27:
aMinimum:	.asc 'Minimum',0
p04loc_7A2F:
aMaximum:	.asc 'Maximum',0
p04loc_7A37:
aIntersection:	.asc 'Intersection',0
p04loc_7A44:
aFirstCurve?:	.asc 'First curve?',0
p04loc_7A51:
aSecondCurve?:	.asc 'Second curve?',0
p04loc_7A5F:
aQ1:		.asc 'Q1',0
p04loc_7A62:
aQ3:		.asc 'Q3',0
p04loc_7A65:
aMinx04:		.asc 'minX',0
p04loc_7A6A:
aMaxx04:		.asc 'maxX',0
p04loc_7A6F:
aMed:		.asc 'Med',0
p04loc_7A73:
aLowerLimit?:	.asc 'Lower Limit?',0
p04loc_7A80:
aUpperLimit?:	.asc 'Upper Limit?',0
p04loc_7A8D:
aLeftBound?:	.asc 'Left Bound?',0
p04loc_7A99:
aRightBound?:	.asc 'Right Bound?',0
p04loc_7AA6:
aGuess?:	.asc 'Guess?',0
p04loc_7AAD:
aZero:		.asc 'Zero',0

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


PDspGrph:
		res		plotLoc, (iy+plotFlags)
		bit		graphDraw, (iy+graphFlags)
		call	nz, Regraph
		bit		cmdExec, (iy+cmdFlags)
		jr		z, p04loc_7ADA
		call	Bit_VertSplit
		jr		z, p04loc_7AD4
		bit		NEED_BUFCPY, (iy+VERTFLAG2)
		jr		nz, p04loc_7ADA
		bit		NEED_RETABLE, (iy+VERTFLAG2)
		jr		nz, p04loc_7ADA

p04loc_7AD4:
		bit		plotDisp, (iy+plotFlags)
		jr		nz, p04loc_7ADD

p04loc_7ADA:
		call	GRBUFCPY_V

p04loc_7ADD:
		call	GRLABELS
		ret
; End of function PDspGrph


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


p04sub_7AE1:
		ld		hl, 24h	; '$'
		call	AllocFPS1
		or		a
		sbc		hl, de
		ex		de, hl
		ret
; End of function p04sub_7AE1

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

HorizCmd:
		call	p04sub_7AE1
		ld		hl, Xmin
		call	mov9B2
		call	MovFrOP1
		ld		hl, Xmax
		call	mov9B2
		call	MovFrOP1
		jr		LineCmd

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


VertCmd:

		call	p04sub_7AE1
		call	MovFrOP1
		ld		hl, Ymax
		call	mov9B2
		call	MovFrOP1
		ld		hl, Ymin
		call	mov9B2

LineCmd:
		call	PDspGrph
		call	IsOnInterruptSet
		jr		nz, p04loc_7B24
		call	j_CLineS
		ret
; ---------------------------------------------------------------------------

p04loc_7B24:
		ld		de, 24h	; '$'
		jp		DeallocFPS1
; End of function VertCmd

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

UnLineCmd:
		call	PDspGrph
		call	IsOnInterruptSet
		jr		nz, p04loc_7B24
		call	j_UCLineS
		ret
; ---------------------------------------------------------------------------

p04loc_7B36:
		ld		a, b
		cp		2
		jr		z, p04loc_7B48
		cp		3
		jp		nz, ErrArgument
		ld		a, e
		cp		7
		jp		z, ErrArgument
		jr		p04loc_7B50
; ---------------------------------------------------------------------------

p04loc_7B48:
		push	de
		call	PushOP1
		call	OP1Set1
		pop		de

p04loc_7B50:
		ld		a, 0FBh	; '�'
		add		a, e
		push	af
		call	PushOP1
		ld		b, 3
		call	j_ErrNonReal
		call	PopRealO1
		pop		af

PointCmd:
		push	af
		rst		18h
		call	PDspGrph
		call	PopRealO1
		pop		af
		ld		hl, OP1M
		bit		5, (hl)
		jp		z, CPointS
		push	af
		ld		a, (hl)
		push	af
		call	j_POINT_STAT_HLP
		jr		z, p04loc_7B7C
		pop		af
		pop		af
		ret
; ---------------------------------------------------------------------------

p04loc_7B7C:
		pop		bc
		pop		af
		ld		hl, p04loc_664B
		bit		4, b
		jr		nz, p04loc_7B88
		ld		hl, p04loc_6646

p04loc_7B88:
		ld		bc, (curGY)
		res		plotLoc, (iy+plotFlags)
		ld		d, a
		call	p04sub_65AF
		ret
; ---------------------------------------------------------------------------

PixelTest:
		ld		a, 3
		push	af
		jr		p04loc_7B9E
; ---------------------------------------------------------------------------

PixelCmd:
		push	bc
		call	PDspGrph

p04loc_7B9E:
		ld		a, (pixWide_m_1)
		call	p04sub_7BC8
		ld		b, a
		push	bc
		ld		a, (lcdTallP)
		dec		a
		call	p04sub_7BC8
		pop		bc
		ld		c, a
		ld		a, 3Fh ; '?'
		sub		c
		jr		z, p04loc_7BE1
		call	CheckSplitFlag
		jr		z, p04loc_7BBB
		sub		20h ; ' '

p04loc_7BBB:
		call	Bit_VertSplit
		jr		z, p04loc_7BC2
		sub		0Ch

p04loc_7BC2:
		ld		c, a
		pop		de
		call	IPoint
		ret

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


p04sub_7BC8:
		push	af
		call	PopRealO1
		call	ErrD_OP1NotPosInt
		ld		a, (OP1+1)
		cp		83h ; '�'
		jr		nc, p04loc_7BE1
		call	j_ConvOP1
		ld		a, d
		or		a
		jr		nz, p04loc_7BE1
		ld		a, e
		pop		de
		cp		d
		ret		c
; End of function p04sub_7BC8

; START	OF FUNCTION CHUNK FOR MATHTANLN

p04loc_7BE1:
		jp		ErrDomain

MATHTANLN:
		call	j_sDone
		call	IsFuncMode
		jp		z, p04loc_7C93
		rst		18h
		call	j_RclY

TanLnF:
		rst		8
		call	CpyTo1FPST
		call	CpyO2ToFPST
		call	Page0Call_38BB
		call	CkOP1Real
		jr		nz, p04loc_7BE1

p04loc_7C00:
		rst		8
		call	j_RclX
		call	FPMult
		call	CpyTo3FPST
		call	CpyO2ToFPST
		call	BCALL_4120
		call	InvSub

p04loc_7C13:
		rst		18h
		call	j_RnFx
		ld		a, 15h
		call	j_formERealTOK
		push	bc
		call	CpyTo1FPS1
		call	j_RnFx
		ld		a, 15h
		call	j_formERealTOK
		pop		hl
		add		hl, bc
		ld		bc, 4
		add		hl, bc
		call	TMPEQUNOSRC
		ld		(inputDat), de
		call	PushRealO4
		call	CpyTo1FPS2
		call	j_RnFx
		ld		a, 15h
		call	j_formERealTOK
		ld		de, (inputDat)
		call	p04sub_7F9B
		ld		a, 58h ; 'X'
		ld		(de), a
		inc		de
		ld		a, 70h ; 'p'
		ld		(de), a
		inc		de
		push	de
		call	CpyTo1FPS1
		call	j_RnFx
		ld		a, 15h
		call	j_formERealTOK
		pop		de
		call	p04sub_7F9B
		call	PopRealO2
		call	FPOPREAL
		call	PopRealO1
		call	TraceOff
		call	PUSHMCPLXO1
		call	DrawCmd
		call	PopRealO1
		ld		a, (mcxCurApp)
		cp		44h ; 'D'
		jr		nz, p04loc_7C86
		call	IsFuncMode
		jr		z, p04loc_7C86
		rst		8
		jr		p04loc_7C89
; ---------------------------------------------------------------------------

p04loc_7C86:
		; MATHTANLN+9Dj
		call	markTableDirty

p04loc_7C89:
		call	PopRealO1

p04loc_7C8C:
		res		numOP1, (iy+ParsFlag2)
		jp		TraceOff
; ---------------------------------------------------------------------------

p04loc_7C93:
		call	IsParametricMode
		jr		z, p04loc_7CCE
		call	Page0Call_38C7
		rst		18h
		call	j_sDone
		call	page0_17E0
		call	Page0Call_38C7
		call	PopRealO2
		call	CkOP2FP0
		jr		z, p04loc_7CBD
		call	fpdiv
		call	OP1ToOP6
		call	j_RclY
		rst		18h
		call	OP6ToOP1
		jp		p04loc_7C00
; ---------------------------------------------------------------------------

p04loc_7CBD:
		; MATHTANLN+F6j
		call	ErrD_OP1_0
		call	j_RclX
		call	VertCmd
		ld		a, 0FFh
		ld		(OP1), a
		jp		p04loc_7C8C
; ---------------------------------------------------------------------------

p04loc_7CCE:
		call	IsRecursiveMode
		jp		nz, Page0Call_24D9
		call	j_PolarDerivative
		call	CkOP2FP0
		jr		z, p04loc_7CBD
		call	fpdiv
		rst		18h
		call	ThetaName
		call	j_RclVarSym
		call	j_Sin
		call	OP1ToOP5
		call	Mov11B
		call	RName
		call	j_RclVarSym
		rst		8
		call	OP5ToOP1
		call	FPMult
		call	OP1ToOP5
		call	OP6ToOP1
		call	FPMult
		call	CpyTo2FPST
		call	FPMult
		call	OP5ToOP2
		call	InvSub
		jp		p04loc_7C13
; End of function MATHTANLN


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


DRAWCMD_INIT:
		call	PDspGrph
		call	Page04_32B5
		set		3, (iy+3)
		call	Page04_3309
		xor		a
		ld		(curInc), a
		ld		hl, Xmin
		rst		20h
		rst		18h
		rst		18h
		call	j_StoX
		ld		hl, (chkDelPtr1)
		ld		(inputDat), hl
		set		5, (iy+3)
		ret
; End of function DRAWCMD_INIT


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


DrawCmd:

		call	DRAWCMD_INIT
		ld		hl, (pTempCnt)
		push	hl

p04loc_7D40:
		call	CpyTo1FPS2
		call	j_PLOTPARS
		bit		5, (iy+3)
		jr		z, p04loc_7D53
		call	CpyO1ToFPST
		res		5, (iy+3)

p04loc_7D53:
		call	INITNSEQ
		call	YRES
		call	p04sub_7D6C
		call	Page04_3393
		call	p04sub_7F07
		jr		nc, ENDDRAW
		ld		hl, (inputDat)
		call	Xitof
		jr		p04loc_7D40
; End of function DrawCmd


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


p04sub_7D6C:
		call	IsOnInterruptSet
		ret		z
		pop		hl

ENDDRAW:
		res		3, (iy+3)
		call	FPOPCPLX
		pop		hl
		ld		(pTempCnt), hl
		jp		TraceOff
; End of function p04sub_7D6C


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


p04sub_7D7F:

		call	PopRealO1
		call	page0_14D1
		jp		nz, ErrDomain
		call	GETEXP
		cp		81h ; '�'

p04loc_7D8D:
		jp		nc, ErrDomain
		ld		a, (OP1M)
		jp		ShRAcc
; End of function p04sub_7D7F

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

SHADECMD:
		call	p04sub_7D7F
		cp		9
		jr		nc, p04loc_7D8D
		ld		(unk_9D8E), a
		call	p04sub_7D7F
		cp		5
		jr		nc, p04loc_7D8D
		dec		a
		push	af
		call	PDspGrph
		pop		af
		ld		(unk_9668), a
		ld		a, 2
		ld		(unk_9775), a
		call	Page04_32B5
		ld		a, (unk_9D8E)
		push	af
		set		3, (iy+3)
		ld		hl, (pTempCnt)
		push	hl
		call	Page04_3309
		xor		a
		ld		(curInc), a
		ld		hl, Xmin
		rst		20h
		rst		18h
		rst		18h
		rst		18h
		call	j_StoX
		ld		hl, (chkDelPtr1)
		ld		(inputDat), hl
		set		5, (iy+3)

p04loc_7DDF:
		ld		de, OP1
		ld		hl, (FPS)
		call	CpyTo1FPS6
		call	j_PLOTPARS
		bit		5, (iy+3)
		call	nz, CpyO1ToFPS1
		ld		de, OP3
		call	CPYFPS2
		inc		de
		inc		de
		call	mov9B2
		rst		8
		call	CpyO1ToFPS1
		ld		hl, (inputDat)
		rst		20h
		call	PLOTPT
		call	CpyTo1FPS5
		call	j_PLOTPARS
		bit		5, (iy+3)
		call	nz, CpyO1ToFPST
		res		5, (iy+3)
		call	INITNSEQ
		ld		de, OP3
		call	CPYFPS2
		ld		de, OP4
		call	CPYFPST
		rst		8
		call	CpyO1ToFPST
		ld		hl, (inputDat)
		rst		20h
		call	CpyO1ToFPS2
		call	PLOTPT
		call	IsOnInterruptSet
		jp		nz, p04loc_7EFE
		call	Page04_3393
		call	CpyTo2FPST
		call	CpyTo1FPS1
		call	cpop1op2
		jp		nc, p04loc_7EF0
		call	CpyTo2FPST
		call	CpyTo1FPS1
		ld		a, (OP1)
		bit		5, a
		jp		nz, p04loc_7EF0
		ld		a, (OP2)
		bit		5, a
		jp		nz, p04loc_7EF0
		ld		hl, (inputDat)
		ld		de, OP3
		call	mov9B2
		ld		hl, OP3
		call	XYRND
		ld		hl, (FPS)
		ld		de, 0FFD3h
		add		hl, de
		ex		de, hl
		ld		hl, OP3
		xor		a
		call	Page04_3405
		or		a
		jr		nz, p04loc_7EF0
		call	CpyTo1FPST
		call	j_RndGuard
		call	PushRealO3
		rst		18h
		ld		de, Ymin
		ld		hl, OP1
		xor		a
		call	Page04_3405
		call	PopRealO1
		bit		1, a
		jr		z, p04loc_7EA2
		call	FPOPREAL
		jr		p04loc_7EF0
; ---------------------------------------------------------------------------

p04loc_7EA2:
		or		a
		ld		a, 40h ; '@'
		jr		nz, p04loc_7EAD
		ld		de, OP1
		call	YftoI

p04loc_7EAD:
		ld		(unk_966D), a
		call	CpyTo1FPS2
		call	j_RndGuard
		ld		de, Ymin
		ld		hl, OP1
		xor		a
		call	Page04_3405
		push	af
		call	PopRealO1
		call	CpyTo2FPS1
		ld		hl, Ymin
		pop		af
		bit		0, a
		jr		nz, p04loc_7EF0
		bit		1, a
		call	nz, Mov9ToOP2
		set		g_style_active, (iy+sGrFlags)
		pop		hl
		pop		af
		ld		(unk_966C), a
		push	af
		push	hl
		set		7, (iy+1Eh)
		ld		a, 3
		call	CPoint
		res		7, (iy+1Eh)
		res		g_style_active, (iy+sGrFlags)

p04loc_7EF0:
		call	p04sub_7F07
		jr		nc, p04loc_7EFE
		ld		hl, (inputDat)
		call	Xitof
		jp		p04loc_7DDF
; ---------------------------------------------------------------------------

p04loc_7EFE:
		pop		hl
		pop		de
		push	hl
		call	FPOPREAL
		jp		ENDDRAW

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


p04sub_7F07:

		ld		a, (curInc)
		inc		a
		call	p04sub_75A2
		ret		nc
		ld		(curInc), a
		ret
; End of function p04sub_7F07

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

InvCmd:
		call	IsFuncMode
		jp		z, Page0Call_24D9
		call	CPTDELY
		ld		hl, Ymin
		ld		a, (unk_915C)
		call	CKVALDELTA
		call	PDspGrph
		call	Page04_32B5
		set		3, (iy+3)
		ld		hl, (pTempCnt)
		push	hl
		call	Page04_3309
		xor		a
		ld		(curInc), a
		ld		hl, Ymin
		rst		20h
		rst		8
		call	PUSHMCPLXO1
		call	j_StoX
		ld		hl, (chkDelPtr1)
		ld		(inputDat), hl
		set		5, (iy+3)

p04loc_7F4F:
		call	CpyTo1FPS2
		call	j_PLOTPARS
		bit		5, (iy+3)
		jr		z, p04loc_7F62
		call	CpyO1ToFPS1
		res		5, (iy+3)

p04loc_7F62:
		call	INITNSEQ
		ld		de, OP3
		call	CPYFPS1
		inc		de
		inc		de
		call	mov9B2
		call	CpyO1ToFPS1
		ld		hl, (inputDat)
		call	Mov9ToOP2
		call	CpyO2ToFPST
		call	PLOTPT
		call	p04sub_7D6C
		call	Page04_3393
		ld		a, (curInc)
		inc		a
		ld		hl, lcdTallP
		cp		(hl)
		jp		nc, ENDDRAW
		ld		(curInc), a
		ld		hl, (inputDat)
		call	p04sub_43E1
		jr		p04loc_7F4F

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


p04sub_7F9B:
		; MATHTANLN+7Bp
		ld		hl, OP3
		ldir
		ret
; End of function p04sub_7F9B


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


Page04_32B5:

		call	IsOnInterruptSet
		ret		z
		pop		hl
		jp		TraceOff
; End of function Page04_32B5

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

Page04_32BB:
		or		a
		jp		z, LineCmd
		cp		9Ch ; '�'
		jp		z, UnLineCmd
		cp		9Dh ; '�'
		jp		z, VertCmd
		cp		9Eh ; '�'
		jp		z, p04loc_7B36
		cp		0A1h ; '�'
		jp		z, PixelCmd
		cp		0A4h ; '�'
		jp		z, SHADECMD
		cp		0A6h ; '�'
		jp		z, HorizCmd
		cp		0A7h ; '�'
		jp		z, TanLnF
		cp		0A8h ; '�'
		jp		z, InvCmd
		cp		0A9h ; '�'
		jp		z, DrawCmd
		ret