Minor cleanup
authorbrandonlw
Thu, 15 May 2014 05:38:01 -0400
changeset 40 ba7bd14b7d7b
parent 39 4651e87022c7
child 41 9ef17625274f
Minor cleanup
source/page00/jump_table.asm
source/page00/system.asm
source/page02/initial.asm
source/page03/initial.asm
source/page7B/initial.asm
--- a/source/page00/jump_table.asm	Thu May 15 05:23:44 2014 -0400
+++ b/source/page00/jump_table.asm	Thu May 15 05:38:01 2014 -0400
@@ -2593,9 +2593,9 @@
 		.branchrule _{*}
 		.branch	Page78_2E47
 		.branchrule __{*}
-Page0Call_3F75:                         
-		call    sNameEq
-		.branch	Page7B_3F75
+j_call_appchange_hook:                         
+		call    sNameEq
+		.branch	call_appchange_hook
 j_SaveOScreen:                         
 		call    sNameEq
 		.branch	 SaveOScreen
--- a/source/page00/system.asm	Thu May 15 05:23:44 2014 -0400
+++ b/source/page00/system.asm	Thu May 15 05:38:01 2014 -0400
@@ -312,34 +312,33 @@
 		res		appRetKeyOff, (iy+APIFlg)
 		ld		hl, mcxCurApp
 		cp		(hl)
-		jr		nz, page0_64E
-		cp		44h ; 'D'
-		jr		nz, page0_647
+		jr		nz, newContext_Start
+		cp		kGraph
+		jr		nz, {+}
+		;If you try to start the graph context again, just put it away
 		push	bc
-page0_642:
 		call	j_GRPUTAWAY
 		pop		bc
 		ret
-page0_647:
-		cp		40h ; '@'
-		jr		z, page0_64E
-		ld		b, 27h ; '''
++:		;We're allowed to re-start the homescreen context again
+		cp		appStart
+		jr		z, newContext_Start
+		ld		b, kApp
 		ret
-page0_64E:
+newContext_Start:
 		push	bc
 		push	af
 		pop		af
-page0_651:
-		cp		3Fh ; '?'
+		cp		kInputDone
 		jr		nz, page0_65B
-		ld		a, 40h ; '@'
+		ld		a, appStart
 		push	af
 		xor		a
 		jr		page0_664
 page0_65B:
 		push	af
 page0_65C:
-		sub		40h ; '@'
+		sub		appStart
 		jr		nz, page0_664
 		res		cmdExec, (iy+cmdFlags)
 page0_664:
@@ -353,20 +352,20 @@
 		push	af
 		ld		b, a
 		ld		a, (mcxCurApp)
-		cp		47h ; 'G'
+		cp		kPrgmCr
 		ld		a, b
 		jr		z, page0_68E
 		bit		prgmEdit, (iy+prgmFlags)
 		jr		z, page0_68E
-		cp		57h ; 'W'
+		cp		kFormat
 		jr		z, page0_69E
-		cp		45h ; 'E'
+		cp		kMode
 		jr		z, page0_69E
-		cp		4Bh ; 'K'
+		cp		kTblSet
 		jr		z, page0_69E
 page0_68E:
 		call	Page0Call_3F57
-		cp		52h ; 'R'
+		cp		kError
 		jr		z, page0_69E
 		call	cxPPutAway
 		call	IsExternalApp
@@ -376,27 +375,27 @@
 		pop		bc
 		push	af
 		push	bc
-		cp		52h ; 'R'
+		cp		kError
 		jr		nz, page0_6B4
 		call	j_POPCX
 		call	sub_73D
 		call	IsExternalApp
 		call	z, SetFastSpeed
 page0_6B4:
-		ld		hl, 858Dh
-		ld		de, 859Bh
-		ld		bc, 0Eh
+		ld		hl, mcxMain
+		ld		de, mcxPrev
+		ld		bc, 14
 		ldir
 		ld		a, (appFlagsAddr)
 		ld		(de), a
 		pop		af
 		push	af
-		cp		4Ah ; 'J'
+		cp		4Ah
 		jr		nz, page0_6CE
 		call	Page0Call_3F63
 		jr		page0_707
 page0_6CE:
-		cp		44h ; 'D'
+		cp		kGraph
 		call	z, Page0Call_3F63
 		jr		z, page0_6DF
 		set		6, (iy+1Dh)
@@ -409,12 +408,12 @@
 		ld		a, (mcxCurApp)
 		call	j_CompareContext
 		jr		nz, page0_707
-		ld		a, 40h ; '@'
+		ld		a, appStart
 		ld		(mcxCurApp), a
 		ld		hl, Page0Call_3F6F
 		ld		a, (iy+12h)
 		push	af
-		ld		a, 40h ; '@'
+		ld		a, appstart
 		call	sub_71D
 		call	cxPutAway
 		pop		af
@@ -426,7 +425,7 @@
 		jr		nz, page0_718
 		push	af
 		ld		a, b
-		cp		52h ; 'R'
+		cp		kError
 		jr		z, page0_717
 		set		promptEdit, (iy+promptFlags)
 page0_717:
@@ -436,16 +435,16 @@
 		ld		(mcxCurApp), a
 		pop		af
 sub_71D:
-		bit		2, (iy+36h)
-		call	nz, Page0Call_3F75
+		bit		appChangeHookActive, (iy+hookflags4)
+		call	nz, j_call_appchange_hook
 		push	af
 		set		5, (iy+1)
-		call	sub_7A1
+		call	jpHL
 		res		5, (iy+1)
 		pop		bc
 		ret
 
-page0_732:
+ldHLind_AWord:
 		add		a, a
 		ld		e, a
 		ld		d, 0
@@ -504,7 +503,7 @@
 		push	af
 		ld		a, (mcxPage)
 		call	sub_630
-		call	sub_7A1
+		call	jpHL
 		pop		af
 		call	sub_630
 		ret
@@ -516,18 +515,18 @@
 		ld		a, (mcxPage)
 		call	sub_630
 		pop		af
-		call	sub_7A1
+		call	jpHL
 		pop		hl
 		ret
 
-sub_7A1:
+jpHL:
 		jp		(hl)
 
 page0_7A2:
 		ld		a, (unk_85A7)
 		call	sub_630
 		ld		hl, (unk_85A1)
-		jr		sub_7A1
+		jr		jpHL
 
 monErrHand:
 		ld		hl, monErrHand
--- a/source/page02/initial.asm	Thu May 15 05:23:44 2014 -0400
+++ b/source/page02/initial.asm	Thu May 15 05:38:01 2014 -0400
@@ -2965,7 +2965,7 @@
 
 Page02_3F51:
 		ld		hl, p02loc_4FD1
-		jp		page0_732
+		jp		ldHLind_AWord
 p02loc_4FD1:
 		.dw		Page0Call_3F6F
 		.dw		Page0Call_3A0B
--- a/source/page03/initial.asm	Thu May 15 05:23:44 2014 -0400
+++ b/source/page03/initial.asm	Thu May 15 05:38:01 2014 -0400
@@ -9362,7 +9362,7 @@
 		push	af
 		sub		52h ; 'R'
 		ld		hl, p03loc_7AD2
-		call	page0_732
+		call	ldHLind_AWord
 		pop		af
 		cp		58h ; 'X'
 		jr		c, p03loc_71BA
--- a/source/page7B/initial.asm	Thu May 15 05:23:44 2014 -0400
+++ b/source/page7B/initial.asm	Thu May 15 05:38:01 2014 -0400
@@ -7428,7 +7428,7 @@
 		ret
 ; ---------------------------------------------------------------------------
 
-Page7B_3F75:
+call_appchange_hook:
 		push	af
 		push	hl
 		ld		hl, appChangeHookPtr