source/page79/initial.asm
changeset 41 9ef17625274f
parent 39 4651e87022c7
child 42 adad2f097dcb
--- a/source/page79/initial.asm	Thu May 15 05:38:01 2014 -0400
+++ b/source/page79/initial.asm	Tue May 20 02:59:10 2014 -0400
@@ -441,13 +441,8 @@
 		inc		hl
 		ld		(hl), 5Eh ; '^'
 		ret
-; End of function p79sub_42B3
-
-
-; =============== S U B	R O U T	I N E =======================================
-
-
-Page79_3ED9:
+
+ClearScreen_SetupAPDFromPowerOn:
 		call	PreviousContext_CloseAnyOpenMenu
 		call	j_ClrScrn
 		res		onInterrupt, (iy+onFlags)
@@ -503,191 +498,135 @@
 		ret		z
 
 p79loc_4359:
-		ld		hl, p79loc_443C
-		call	p79sub_43FE
+		ld		hl, aBatteryMessage
+		call	PutS_79
 		call	j_newline
-		ld		hl, p79loc_444B
-		call	p79sub_43FE
+		ld		hl, aAreLow
+		call	PutS_79
 		call	j_newline
-		ld		hl, p79loc_4473
-		call	p79sub_43FE
+		ld		hl, aChangeIs
+		call	PutS_79
 		call	j_newline
-		ld		hl, p79loc_447D
-		call	p79sub_43FE
+		ld		hl, aRequired
+		call	PutS_79
 		call	j_newline
 		ret
-; ---------------------------------------------------------------------------
-
-Page79_3EDF:
+
+DisplayLowBattRecommendChange:
 		call	IsEditEmpty
-		jr		nz, p79loc_438C
+		jr		nz, {++}
 		call	j_ClrWindow
 		res		AnsScroll, (iy+ansFlags)
-		jr		p79loc_4392
-; ---------------------------------------------------------------------------
-
-p79loc_438C:
-		call	j_DispHead
+		jr		{+}
+++:		call	j_DispHead
 		call	j_EraseEOW2
-
-p79loc_4392:
-		call	j_BufClear
++:		call	j_BufClear
 		set		cmdVirgin, (iy+cmdFlags)
 		res		appTextSave, (iy+appFlags)
 		bit		localizeHookActive, (iy+hookflags3)
-		jr		z, p79loc_43AA
-		ld		a, 41h ; 'A'
+		jr		z, {+}
+		ld		a, 41h
 		call	j_call_character_hook
-		jr		z, p79loc_43D3
-
-p79loc_43AA:
-		ld		hl, p79loc_443C
+		jr		z, _skipBatteryMessage
++:		ld		hl, aBatteryMessage
 		ld		de, 1
-		call	p79sub_43FA
+		call	PutSDE_79
 		ld		de, 2
-		call	p79sub_43FA
+		call	PutSDE_79
 		ld		de, 4
-		call	p79sub_43FA
+		call	PutSDE_79
 		ld		de, 5
-		call	p79sub_43FA
+		call	PutSDE_79
 		ld		de, 6
-; START	OF FUNCTION CHUNK FOR p79sub_4516
-
-p79loc_43C8:
-		; p79sub_4516-11Ej
+PutSDE_CursorOn:
 		ld		(curRow), de
 		res		appTextSave, (iy+appFlags)
-		call	p79sub_43FE
-
-p79loc_43D3:
+		call	PutS_79
+_skipBatteryMessage:
 		set		appTextSave, (iy+appFlags)
 		call	j_HomeUp
 		call	j_CursorOn
-		jp		page0_A26
-; END OF FUNCTION CHUNK	FOR p79sub_4516
-; ---------------------------------------------------------------------------
+		jp		GetKey_ClearScrn_MonForceKey
 
 Page79_3ECD:
-		ld		hl, p79loc_4417
-		ld		a, 42h ; 'B'
-		jr		p79loc_43EC
-; ---------------------------------------------------------------------------
-
+		ld		hl, aMemCleared
+		ld		a, 42h ;Memory Cleared
+		jr		DisplayClearedText
 Page79_3EC7:
-		ld		hl, p79loc_4423
-		ld		a, 43h ; 'C'
-; START	OF FUNCTION CHUNK FOR p79sub_4516
-
-p79loc_43EC:
+		ld		hl, aRAMCleared
+		ld		a, 43h ;RAM Cleared
+DisplayClearedText:
 		bit		localizeHookActive, (iy+hookflags3)
 		call	nz, j_call_character_hook
-		jr		nz, p79loc_43C8
-		ld		de, 205h
-		jr		p79loc_43C8
-; END OF FUNCTION CHUNK	FOR p79sub_4516
-
-; =============== S U B	R O U T	I N E =======================================
-
-
-p79sub_43FA:
+		jr		nz, PutSDE_CursorOn
+		ld		de, 0205h
+		jr		PutSDE_CursorOn
+PutSDE_79:
 		ld		(curRow), de
-; End of function p79sub_43FA
-
-
-; =============== S U B	R O U T	I N E =======================================
-
-
-p79sub_43FE:
-		push	bc
+PutS_79:push	bc
 		push	af
 		ld		a, (winTop+1)
 		ld		b, a
-
-p79loc_4404:
-		ld		a, (hl)
+-:		ld		a, (hl)
 		inc		hl
 		or		a
 		scf
-		jr		z, p79loc_4413
+		jr		z, {+}
 		call	j_PutC
 		ld		a, (curRow)
 		cp		b
-		jr		c, p79loc_4404
-
-p79loc_4413:
-		pop		bc
+		jr		c, {-}
++:		pop		bc
 		ld		a, b
 		pop		bc
 		ret
-; End of function p79sub_43FE
-
-p79loc_4417:
-aMemCleared:	.asc 'Mem cleared',0
-p79loc_4423:
-aRamCleared:	.asc 'RAM cleared',0
-p79loc_442F:
-aDefaultsSet:	.asc 'Defaults set',0
-p79loc_443C:
-aYourBatteries:	.asc 'Your batteries',0
-p79loc_444B:
-aAreLow_:	.asc 'are low.',0
-aRecommend:	.asc 'Recommend',0
-aChangeOf:	.asc 'change of',0
-aBatteries_:	.asc 'batteries.',0
-p79loc_4473:
-aChangeIs:	.asc 'change is',0
-p79loc_447D:
-aRequired_:	.asc 'required.',0
-; ---------------------------------------------------------------------------
-
-Page79_3F57:
-		cp		44h ; 'D'
-		jr		z, p79loc_449B
-		cp		52h ; 'R'
+
+aMemCleared:
+		.asc 'Mem cleared',0
+aRAMCleared:
+		.asc 'RAM cleared',0
+aDefaultsSet:
+		.asc 'Defaults set',0
+aBatteryMessage:
+		.asc 'Your batteries',0
+aAreLow:
+		.asc 'are low.',0
+		.asc 'Recommend',0
+		.asc 'change of',0
+		.asc 'batteries.',0
+aChangeIs:
+		.asc 'change is',0
+aRequired:
+		.asc 'required.',0
+
+RefreshSplitGraphTableFlags:
+		cp		kGraph
+		jr		z, {+}
+		cp		kError
 		ret		z
-
-; =============== S U B	R O U T	I N E =======================================
-
-
-p79sub_448E:
-		res		3, (iy+15h)
-		res		4, (iy+15h)
-		res		0, (iy+1Eh)
-		ret
-; End of function p79sub_448E
-
-; ---------------------------------------------------------------------------
-
-p79loc_449B:
-		call	CheckSplitFlag
-		jr		z, p79sub_448E
+-:		res		DISP_ALT_STATS, (iy+NEWFLAGS3)
+		res		GR_ABOVE_BELOW, (iy+GSFLAG2)
+		res		HaveEqual, (iy+SolvedFlag)
+		ret
++:		call	CheckSplitFlag
+		jr		z, {-}
 		ld		b, a
 		ld		a, (mcxCurApp)
-		cp		44h ; 'D'
+		cp		kGraph
 		ret		z
-		call	p79sub_448E
-		cp		43h ; 'C'
-		jr		nz, p79loc_44B4
-		set		3, (iy+15h)
-		jr		p79loc_44C4
-; ---------------------------------------------------------------------------
-
-p79loc_44B4:
-		cp		4Ah ; 'J'
-		jr		nz, p79loc_44BC
-		set		4, (iy+15h)
-
-p79loc_44BC:
-		cp		49h ; 'I'
-		jr		nz, p79loc_44C4
-		set		0, (iy+1Eh)
-
-p79loc_44C4:
-		ld		a, b
-		ret
-
-; =============== S U B	R O U T	I N E =======================================
-
+		call	{-}
+		cp		kStatEd
+		jr		nz, {+}
+		set		DISP_ALT_STATS, (iy+NEWFLAGS3)
+		jr		{++}
++:		cp		kTable
+		jr		nz, {+}
+		set		GR_ABOVE_BELOW, (iy+GSFLAG2)
++:		cp		kYequ
+		jr		nz, {++}
+		set		HaveEqual, (iy+SolvedFlag)
+++:		ld		a, b
+		ret
 
 p79sub_44C6:
 		ld		a, 7
@@ -737,30 +676,18 @@
 		ld		hl, OP1M
 		inc		(hl)
 		jr		p79loc_44F1
-; End of function p79sub_44C6
-
-
-; =============== S U B	R O U T	I N E =======================================
-
 
 p79sub_4516:
-
-
-
-
 		call	RandInit
 		call	forcecmd
 		set		fmtReal, (iy+numMode)
-		call	Page79_3ED9
+		call	ClearScreen_SetupAPDFromPowerOn
 		call	Page0Call_3EC1
-		ld		hl, p79loc_442F
-		ld		a, 44h ; 'D'
-		jp		p79loc_43EC
-; End of function p79sub_4516
-
-; ---------------------------------------------------------------------------
-
-Page79_3A59:
+		ld		hl, aDefaultsSet
+		ld		a, 44h
+		jp		DisplayClearedText
+
+InitResetMemContext:
 		ld		a, (keyExtend)
 		cp		1
 		jr		z, p79loc_45A7
@@ -798,8 +725,8 @@
 		pop		hl
 		ld		(localLanguage), hl
 		ld		hl, silentLinkHookPtr
-		ld		de, 9BD1h
-		ld		bc, p79loc_642F
+		ld		de, silentLinkHookPtr+1
+		ld		bc, 0FFFFh-silentLinkHookPtr
 		ld		(hl), 0
 		ldir
 		jp		page0_9DE
@@ -840,7 +767,7 @@
 		set		appTextSave, (iy+appFlags)
 		call	j_HomeUp
 		call	j_CursorOn
-		jp		page0_A26
+		jp		GetKey_ClearScrn_MonForceKey
 ; ---------------------------------------------------------------------------
 
 p79loc_45E5:
@@ -860,7 +787,7 @@
 		jp		p79loc_45BC
 ; ---------------------------------------------------------------------------
 
-Page79_3A5F:
+InitResetDefaultContext:
 		call	SetFastSpeed
 		res		extraIndic, (iy+newIndicFlags)
 		res		6, (iy+24h)
@@ -2411,8 +2338,8 @@
 
 p79loc_4FB3:
 		; p79sub_5695+197j
-		set		6, (iy+1Dh)
-		set		7, (iy+1Dh)
+		set		NEED_BUFCPY, (iy+VERTFLAG2)
+		set		NEED_RETABLE, (iy+VERTFLAG2)
 		call	p79sub_6925
 		call	CancelAlpha
 		call	p79sub_5087
@@ -2421,8 +2348,8 @@
 ; ---------------------------------------------------------------------------
 
 p79loc_4FC6:
-		set		6, (iy+1Dh)
-		set		7, (iy+1Dh)
+		set		NEED_BUFCPY, (iy+VERTFLAG2)
+		set		NEED_RETABLE, (iy+VERTFLAG2)
 		push	af
 		xor		a
 		ld		(unk_984B), a
@@ -2443,7 +2370,7 @@
 		call	j_ZifRclHandler
 		jr		z, p79loc_4FFD
 		call	IsExternalApp
-		call	z, cxPutAway2
+		call	z, cxPPutAway2
 
 p79loc_4FFD:
 		pop		af
@@ -4639,11 +4566,11 @@
 
 ; =============== S U B	R O U T	I N E =======================================
 BCALL_5068:
-		bit		3, (iy+15h)
+		bit		DISP_ALT_STATS, (iy+NEWFLAGS3)
 		jr		nz, p79loc_5C54
-		bit		0, (iy+1Eh)
+		bit		HaveEqual, (iy+SolvedFlag)
 		jr		nz, p79loc_5C98
-		bit		4, (iy+15h)
+		bit		GR_ABOVE_BELOW, (iy+GSFLAG2)
 		ret		z
 		jp		p79loc_5CD1
 ; End of function BCALL_5068
@@ -4753,7 +4680,6 @@
 		ret		nz
 
 p79loc_5CD1:
-		; SetMenuFlags+85j
 		bit		vertSplit, (iy+sGrFlags)
 		jr		z, p79loc_5CE5
 		call	j_GrBufCpy
@@ -7888,7 +7814,7 @@
 p79loc_69C5:
 		call	p79sub_6ECD
 
-Page79_3AA1:
+InitUngroupContext:
 		xor		a
 		ld		(ioFlag), a
 		ld		(winTop), a
@@ -8074,7 +8000,7 @@
 		or		a
 		sbc		hl, bc
 		call	EnoughMem
-		jp		c, Page0Call_24F9
+		jp		c, ErrMemory_NoGoTo
 		ld		a, (arcPage)
 		ld		hl, (arcPtr)
 		call	Page0Call_23FA
@@ -8390,7 +8316,7 @@
 p79loc_6DB8:
 		ld		hl, (unk_83F1)
 		call	page0_1F38
-		jp		Page0Call_24F9
+		jp		ErrMemory_NoGoTo
 ; ---------------------------------------------------------------------------
 
 p79loc_6DC1:
@@ -8399,7 +8325,7 @@
 		jp		z, p79loc_69C5
 		call	p79sub_6ECD
 
-Page79_3A9B:
+InitGroupContext:
 		xor		a
 		ld		(basic_prog), a
 		ld		a, (basic_prog)