source/page00/system.asm
author brandonlw
Thu, 15 May 2014 05:23:44 -0400
changeset 39 4651e87022c7
parent 38 a4c5f839b738
child 40 ba7bd14b7d7b
permissions -rw-r--r--
Fix flag.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
     1
coorMon:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
     2
		res		g_style_active, (iy+sGrFlags)
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
     3
		call	j_CursorOff
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
     4
		call	j_COORDISP
36
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
     5
Mon:	call	j_RunIndicOff
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
     6
		call	j_CursorOn
36
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
     7
		res		displayCoords, (iy+newDispF)
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
     8
		bit		sendFinalPacketOnMon, (iy+linkFlags2)
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
     9
		jr		z, Mon_NoPacketSend
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
    10
		di
36
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
    11
		res		sendFinalPacketOnMon, (iy+linkFlags2)
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
    12
		ld		hl, Mon_ResetIndicOnly
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
    13
		call	pushErrorHandleR
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
    14
		set		indicOnly, (iy+indicFlags)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    15
		ld		a, (mcxCurApp)
36
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
    16
		cp		kError
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
    17
		jr		nz, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    18
		ld		a, (errNo)
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
    19
		call	j_SendSkipExitPacket
36
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
    20
		jr		Mon_LinkEnd
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
    21
+:		call	j_SendAck
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
    22
Mon_LinkEnd:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
    23
		call	popErrorHandleR
36
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
    24
Mon_ResetIndicOnly:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
    25
		res		indicOnly, (iy+indicFlags)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
    26
		ei
36
2fca899545cf Minor cleanup
brandonlw
parents: 34
diff changeset
    27
Mon_NoPacketSend:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    28
		xor		a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    29
		ld		(kbdKey), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    30
		ld		(keyExtend), a
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
    31
		call	j_getkey
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
    32
monForceKey:
37
9cdbb6464f89 Renaming recall-related flags
brandonlw
parents: 36
diff changeset
    33
		res		recallingPrgmName, (iy+rclFlag2)
9cdbb6464f89 Renaming recall-related flags
brandonlw
parents: 36
diff changeset
    34
		res		recallingListName, (iy+rclFlag3)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    35
		ld		(kbdKey), a
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    36
		bit		allowCursor, (iy+plotFlags)
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    37
		jr		z, {+}
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
    38
		res		curAble, (iy+curFlags)
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
    39
		bit		curOn, (iy+curFlags)
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
    40
		call	z, j_BLINKGCUR
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    41
		ld		a, (kbdKey)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    42
		jr		{++}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    43
+:		call	j_CursorOff
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    44
++:		call	j_RunIndicOn
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    45
		or		a
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    46
		jr		nz, {++}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    47
		;ON was pressed; now what?
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
    48
		bit		appWantIntrpt, (iy+appFlags)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    49
		jr		nz, {+}
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
    50
		res		onInterrupt, (iy+onFlags)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    51
		jr		jpCoorMon
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    52
+:		;Return kEnter instead
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    53
		ld		a, kEnter
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    54
		jp		sendKPress
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    55
++:		cp		kVarx
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    56
		jr		nz, monNotVarKey
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    57
		ld		a, kTheta
27
5220b6f6c984 More page 0 cleanup.
brandonlw
parents: 26
diff changeset
    58
		call	IsFunctionMode
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    59
		jr		nz, {+}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    60
		ld		a, kCapT
27
5220b6f6c984 More page 0 cleanup.
brandonlw
parents: 26
diff changeset
    61
		call	IsParametricMode
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    62
		jr		nz, {+}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    63
		ld		a, kCapX
27
5220b6f6c984 More page 0 cleanup.
brandonlw
parents: 26
diff changeset
    64
		call	IsFuncMode
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    65
		jr		nz, {+}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    66
		ld		a, kRecn
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    67
		ld		(keyExtend), a
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    68
		ld		a, kExtendEcho
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    69
+:		ld		(kbdKey), a
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    70
monNotVarKey:
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    71
		res		appIgnoreKey, (iy+APIFlg)
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    72
		res		sendKeyStraightTocxMain, (iy+APIFlg)
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
    73
		bit		rawKeyHookActive, (iy+hookflags2)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    74
		jr		z, {+}
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
    75
		call	j_call_rawkey_hook
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    76
		bit		appIgnoreKey, (iy+APIFlg)
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    77
		jr		nz, jpCoorMon
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    78
		bit		sendKeyStraightTocxMain, (iy+APIFlg)
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    79
		jr		z, {+}
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
    80
		push	af
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    81
		jp		Mon_CallcxMain
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    82
+:		cp		kOff
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    83
		jr		z, {+}
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
    84
		call	j_PULLDOWNCHK
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    85
		jr		c, jpCoorMon
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
    86
		call	j_clrTR
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    87
		jr		c, jpCoorMon
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    88
		call	IsExternalApp
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    89
+:		jr		z, sendKPress
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    90
		cp		kDoug
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    91
		jr		z, sendKPress
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    92
		cp		kListflag
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    93
		jr		z, sendKPress
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    94
		jr		Mon_Continue
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    95
-:		pop		hl
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    96
		pop		bc
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    97
		djnz	{+}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
    98
jpCoorMon:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
    99
		jp		coorMon
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   100
SendProgToEditTocxMain:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   101
		ld		b, 8
37
9cdbb6464f89 Renaming recall-related flags
brandonlw
parents: 36
diff changeset
   102
		ld		hl, progToEdit-1
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   103
+:		inc		hl
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   104
		ld		a, (hl)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   105
		or		a
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   106
		jr		z, jpCoorMon
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   107
		push	bc
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   108
		push	hl
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   109
		ld		d, 0
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   110
		ld		e, a
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   111
		call	j_TokToKey
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   112
		call	cxMain
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   113
		res		onInterrupt, (iy+onFlags)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   114
		jr		{-}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   115
Mon_Continue:
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   116
		cp		EchoStart
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   117
		jp		c, Mon_HandleNonEchoKey
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   118
		cp		kExtendEcho
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   119
		jr		z, sendKPress
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   120
		cp		kExtendEcho2
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   121
		jr		z, sendKPress
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   122
		cp		kExtendEcho3
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   123
		jr		nz, _isOtherKey
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   124
		ld		a, (keyExtend)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   125
		or		a
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   126
		jr		z, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   127
		cp		0Dh
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   128
		jr		c, _isValid3Key
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   129
		cp		8Ch
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   130
		jr		c, Mon_HandleOurselves
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   131
		cp		0A6h
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   132
		jr		nc, Mon_HandleOurselves
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   133
_isValid3Key:
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   134
		ld		a, kExtendEcho3
11
fea1578031ed Cleanup to page 0.
brandonlw
parents: 10
diff changeset
   135
		jr		sendKPress
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   136
+:		ld		a, (kbdKey)
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   137
_isOtherKey:
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   138
		cp		0EFh
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   139
		jr		nz, {+}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   140
		ld		a, 0A6h
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   141
		jr		setKeyExtend
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   142
+:		cp		0F9h
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   143
		jr		c, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   144
		sub		14h
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   145
		jr		setKeyExtend
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   146
+:		cp		0F3h
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   147
		jr		c, sendKPress
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   148
		sub		7Ch
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   149
setKeyExtend:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   150
		ld		(keyExtend), a
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   151
		ld		a, kExtendEcho
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   152
sendKPress:
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   153
		cp		echoStart2
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   154
		jr		nz, {+}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   155
		ld		a, kExtendEcho2
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   156
		jr		setKeyExtend
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   157
+:		cp		echoStart1+1
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   158
		jr		nz, {+}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   159
		ld		a, 0FDh
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   160
		jr		setKeyExtend
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   161
sendKPress_NamedVar:
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   162
+:		cp		kDoug
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   163
		push	af
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   164
		jr		nz, {+}
37
9cdbb6464f89 Renaming recall-related flags
brandonlw
parents: 36
diff changeset
   165
		set		recallingPrgmName, (iy+rclFlag2)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   166
		ld		a, kExec
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   167
		jr		Mon_CallcxMain
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   168
+:		pop		af
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   169
		cp		kListflag
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   170
		push	af
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   171
		jr		nz, Mon_CallcxMain
37
9cdbb6464f89 Renaming recall-related flags
brandonlw
parents: 36
diff changeset
   172
		set		recallingListName, (iy+rclFlag3)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   173
		ld		a, kListName
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   174
Mon_CallcxMain:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   175
		call	cxMain
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   176
		res		onInterrupt, (iy+onFlags)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   177
		pop		af
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   178
		jp		z, SendProgToEditTocxMain
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   179
Mon_HandleOurselves:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   180
		bit		enableQueue, (iy+rclFlag)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   181
		jr		z, Mon_Restart
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   182
		ld		de, (rclQueue)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   183
		ld		hl, (editCursor)
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   184
		bit		useRclQueueEnd, (iy+hookflags1)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   185
		jr		z, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   186
		ld		hl, (rclQueueEnd)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   187
		ex		de, hl
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   188
+:		call	CpHLDE
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   189
		jr		nc, Mon_DisableQueueRestart
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   190
		ld		a, (hl)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   191
		call	isPtrHLA2ByteTok
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   192
		ld		d, 0
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   193
		ld		e, a
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   194
		jr		nz, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   195
		ld		d, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   196
		inc		hl
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   197
		ld		e, (hl)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   198
+:		bit		useRclQueueEnd, (iy+hookflags1)
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   199
		jr		z, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   200
		inc		hl
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   201
		ld		(rclQueue), hl
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   202
+:		call	j_TokToKey
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   203
jpSendKPress:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   204
		jr		sendKPress
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   205
Mon_DisableQueueRestart:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   206
		res		enableQueue, (iy+rclFlag)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   207
		ld		hl, flags+textFlags
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   208
		ld		a, (promptIns)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   209
		res		textInsMode, (hl)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   210
		or		(hl)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   211
		ld		(hl), a
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   212
Mon_Restart:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   213
		res		useRclQueueEnd, (iy+hookflags1)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   214
		jp		Mon
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   215
Mon_HandleNonEchoKey:
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   216
		cp		kApp
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   217
		jr		c, jpSendKPress
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   218
		cp		echoStart1
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   219
		jr		c, Mon_SwitchToStandardContext
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   220
		cp		kEval
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   221
		jr		nc, Mon_SwitchToGraphContextThenPressKey
39
4651e87022c7 Fix flag.
brandonlw
parents: 38
diff changeset
   222
		bit		prgmEdit, (iy+prgmFlags)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   223
		jr		nz, jpSendKPress
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   224
		cp		echoStart2
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   225
		jr		c, Mon_SwitchToGraphContextThenPressKey
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   226
		cp		kPen
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   227
		jr		z, Mon_SwitchToGraphContextThenPressKey
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   228
		cp		echoStart2
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   229
		jr		z, jpSendKPress
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   230
		ld		b, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   231
		ld		a, (mcxCurApp)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   232
		cp		kGraph
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   233
		ld		a, b
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   234
		jr		nz, jpSendKPress
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   235
Mon_SwitchToGraphContextThenPressKey:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   236
		ld		b, a
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   237
		ld		a, kGraph
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   238
		jr		{+}
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   239
		push	af
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   240
Mon_SwitchToStandardContext:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   241
		ld		b, a
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   242
		cp		kNewApps
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   243
		jr		nz, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   244
		ld		a, (keyExtend)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   245
		add		a, b
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   246
		cp		echoStart1+1
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   247
		jr		nc, JForceCmdNoChar
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   248
		ld		b, a
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   249
+:		ld		c, a
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   250
		ld		a, (mcxCurApp)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   251
		cp		kPrgmInput
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   252
		jr		nz, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   253
		ld		a, b
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   254
		cp		appStart
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   255
		jr		z, JForceCmdNoChar
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   256
		ld		a, kPrgmInput
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   257
		jr		{++}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   258
+:		cp		kError
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   259
		ld		a, c
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   260
		jr		nz, {++}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   261
		cp		appStart
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   262
		jr		nz, Mon_Restart
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   263
++:		call	newContext0
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   264
		ld		a, b
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   265
		jp		sendKPress_NamedVar
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   266
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   267
JForceCmdNoChar:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   268
		xor		a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   269
JForceCmd:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   270
		ld		b, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   271
		ld		sp, (onSP)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   272
		res		cmdExec, (iy+cmdFlags)
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   273
		call	SetFastSpeed
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   274
		ld		a, appStart
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   275
		call	newContext0
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   276
		ld		a, b
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   277
		cp		kExec
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   278
		jr		nz, {+}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   279
		ld		a, kDoug
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   280
-:		jp		sendKPress
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   281
+:		cp		kListName
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   282
		jr		nz, {-}
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   283
		ld		a, kListflag
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   284
		jr		{-}
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   285
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   286
sysErrHandler:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   287
		ld		sp, (onSP)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   288
		ld		a, kError
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   289
		call	newContext
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   290
		jp		Mon
11
fea1578031ed Cleanup to page 0.
brandonlw
parents: 10
diff changeset
   291
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   292
#ifndef DEVIATE_FROM_ORIGINAL_FILE
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   293
;We don't need this, I don't think.
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   294
		ret
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   295
#endif
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   296
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   297
newContext:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   298
		ld		c, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   299
		sub		a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   300
		ld		(kbdKey), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   301
		ld		b, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   302
		in		a, (6)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   303
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   304
		ld		a, c
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   305
		call	newContext0
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   306
		pop		af
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   307
sub_630:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   308
		out		(6), a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   309
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   310
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   311
newContext0:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   312
		res		appRetKeyOff, (iy+APIFlg)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   313
		ld		hl, mcxCurApp
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   314
		cp		(hl)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   315
		jr		nz, page0_64E
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   316
		cp		44h ; 'D'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   317
		jr		nz, page0_647
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   318
		push	bc
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   319
page0_642:
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   320
		call	j_GRPUTAWAY
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   321
		pop		bc
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   322
		ret
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   323
page0_647:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   324
		cp		40h ; '@'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   325
		jr		z, page0_64E
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   326
		ld		b, 27h ; '''
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   327
		ret
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   328
page0_64E:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   329
		push	bc
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   330
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   331
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   332
page0_651:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   333
		cp		3Fh ; '?'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   334
		jr		nz, page0_65B
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   335
		ld		a, 40h ; '@'
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   336
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   337
		xor		a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   338
		jr		page0_664
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   339
page0_65B:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   340
		push	af
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   341
page0_65C:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   342
		sub		40h ; '@'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   343
		jr		nz, page0_664
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   344
		res		cmdExec, (iy+cmdFlags)
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   345
page0_664:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   346
		call	Page0Call_3F51
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   347
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   348
		push	hl
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   349
		push	af
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   350
		res		curLock, (iy+curFlags)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   351
		call	cxPutAway2
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   352
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   353
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   354
		ld		b, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   355
		ld		a, (mcxCurApp)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   356
		cp		47h ; 'G'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   357
		ld		a, b
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   358
		jr		z, page0_68E
39
4651e87022c7 Fix flag.
brandonlw
parents: 38
diff changeset
   359
		bit		prgmEdit, (iy+prgmFlags)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   360
		jr		z, page0_68E
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   361
		cp		57h ; 'W'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   362
		jr		z, page0_69E
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   363
		cp		45h ; 'E'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   364
		jr		z, page0_69E
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   365
		cp		4Bh ; 'K'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   366
		jr		z, page0_69E
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   367
page0_68E:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   368
		call	Page0Call_3F57
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   369
		cp		52h ; 'R'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   370
		jr		z, page0_69E
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   371
		call	cxPPutAway
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   372
		call	IsExternalApp
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   373
		call	z, SetFastSpeed
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   374
page0_69E:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   375
		ld		a, (mcxCurApp)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   376
		pop		bc
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   377
		push	af
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   378
		push	bc
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   379
		cp		52h ; 'R'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   380
		jr		nz, page0_6B4
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   381
		call	j_POPCX
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   382
		call	sub_73D
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   383
		call	IsExternalApp
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   384
		call	z, SetFastSpeed
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   385
page0_6B4:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   386
		ld		hl, 858Dh
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   387
		ld		de, 859Bh
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   388
		ld		bc, 0Eh
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   389
		ldir
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   390
		ld		a, (appFlagsAddr)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   391
		ld		(de), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   392
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   393
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   394
		cp		4Ah ; 'J'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   395
		jr		nz, page0_6CE
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   396
		call	Page0Call_3F63
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   397
		jr		page0_707
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   398
page0_6CE:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   399
		cp		44h ; 'D'
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   400
		call	z, Page0Call_3F63
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   401
		jr		z, page0_6DF
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   402
		set		6, (iy+1Dh)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   403
		set		7, (iy+1Dh)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   404
		jr		page0_707
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   405
page0_6DF:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   406
		call	page0_17DB
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   407
		call	CheckSplitFlag
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   408
		jr		z, page0_707
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   409
		ld		a, (mcxCurApp)
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   410
		call	j_CompareContext
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   411
		jr		nz, page0_707
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   412
		ld		a, 40h ; '@'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   413
		ld		(mcxCurApp), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   414
		ld		hl, Page0Call_3F6F
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   415
		ld		a, (iy+12h)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   416
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   417
		ld		a, 40h ; '@'
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   418
		call	sub_71D
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   419
		call	cxPutAway
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   420
		pop		af
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   421
		ld		(iy+12h), a
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   422
page0_707:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   423
		pop		af
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   424
		pop		bc
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   425
		cp		46h ; 'F'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   426
		jr		nz, page0_718
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   427
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   428
		ld		a, b
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   429
		cp		52h ; 'R'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   430
		jr		z, page0_717
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   431
		set		promptEdit, (iy+promptFlags)
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   432
page0_717:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   433
		pop		af
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   434
page0_718:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   435
		pop		hl
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   436
		ld		(mcxCurApp), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   437
		pop		af
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   438
sub_71D:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   439
		bit		2, (iy+36h)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   440
		call	nz, Page0Call_3F75
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   441
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   442
		set		5, (iy+1)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   443
		call	sub_7A1
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   444
		res		5, (iy+1)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   445
		pop		bc
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   446
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   447
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   448
page0_732:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   449
		add		a, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   450
		ld		e, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   451
		ld		d, 0
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   452
		add		hl, de
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   453
		jp		ldHLind
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   454
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   455
cxPutAway:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   456
		call	cxPutAway2
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   457
sub_73D:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   458
		call	cxPPutAway
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   459
page0_740:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   460
		res		promptEdit, (iy+promptFlags)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   461
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   462
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   463
cxPutAway2:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   464
		bit		nocxPutAway, (iy+contextFlags)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   465
		ret		nz
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   466
		push	hl
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   467
		ld		hl, (mcxPPutAway)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   468
page0_74E:
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   469
		call	sub_77F
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   470
		jr		page0_762
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   471
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   472
cxPPutAway:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   473
		bit		nocxPutAway, (iy+contextFlags)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   474
		ret		nz
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   475
		push	hl
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   476
		ld		hl, (mcxPutAway)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   477
		call	sub_77F
10
20102b43be54 Clean up boot.asm.
brandonlw
parents: 9
diff changeset
   478
		call	zero_basic_prog
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   479
page0_762:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   480
		pop		hl
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   481
page0_763:
32
263488c56ee1 More cleanup.
brandonlw
parents: 31
diff changeset
   482
		jp		CancelAlpha
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   483
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   484
cxRedisp:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   485
		ld		hl, (unk_8593)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   486
		jr		sub_77F
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   487
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   488
cxSizeWind:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   489
		bit		5, (iy+1)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   490
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   491
		ld		a, (menuActive)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   492
		ld		b, a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   493
page0_774:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   494
		ld		hl, (mcxSizeWind)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   495
sub_777:
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   496
		call	sub_77F
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   497
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   498
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   499
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   500
cxErrEP:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   501
		ld		hl, (mcxErrorEP)
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   502
sub_77F:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   503
		in		a, (6)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   504
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   505
		ld		a, (mcxPage)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   506
		call	sub_630
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   507
		call	sub_7A1
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   508
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   509
		call	sub_630
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   510
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   511
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   512
cxMain:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   513
		push	hl
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   514
		ld		hl, (mcxMain)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   515
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   516
		ld		a, (mcxPage)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   517
		call	sub_630
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   518
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   519
		call	sub_7A1
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   520
		pop		hl
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   521
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   522
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   523
sub_7A1:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   524
		jp		(hl)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   525
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   526
page0_7A2:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   527
		ld		a, (unk_85A7)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   528
		call	sub_630
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   529
		ld		hl, (unk_85A1)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   530
		jr		sub_7A1
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   531
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   532
monErrHand:
26
fb2b0058e568 Fix hard-coded error handler address.
brandonlw
parents: 25
diff changeset
   533
		ld		hl, monErrHand
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   534
		call	pushErrorHandleR
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   535
		ld		a, 52h ; 'R'
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   536
		call	newContext0
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   537
		jp		Mon
11
fea1578031ed Cleanup to page 0.
brandonlw
parents: 10
diff changeset
   538
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   539
		push	hl
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   540
		ld		hl, 64h	; 'd'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   541
		jr		page0_7C5
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   542
page0_7C1:
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   543
		push	hl
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   544
		ld		hl, 32h	; '2'
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   545
page0_7C5:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   546
		call	EnoughMem
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   547
		jp		c, Page0Call_24F9
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   548
		pop		hl
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   549
AppInit:
26
fb2b0058e568 Fix hard-coded error handler address.
brandonlw
parents: 25
diff changeset
   550
		ld		de, mcxMain
fb2b0058e568 Fix hard-coded error handler address.
brandonlw
parents: 25
diff changeset
   551
		ld		bc, 12
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   552
		ldir
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   553
		ld		a, (hl)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   554
		ld		(appFlagsAddr), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   555
		in		a, (6)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   556
		ld		(mcxPage), a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   557
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   558
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   559
IsExternalApp:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   560
		ld		b, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   561
		ld		a, (mcxCurApp)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   562
		cp		kExtApps
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   563
		ld		a, b
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   564
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   565
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   566
handleONKeyPress:
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   567
		;Switch to slow speed
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   568
		in		a, (2)
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   569
		and		80h
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   570
		jr		z, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   571
		in		a, (20h)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   572
		ld		e, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   573
		xor		a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   574
		out		(20h), a
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   575
+:		ld		b, 0
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   576
debounceRestart:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   577
		ld		hl, 1016h
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   578
debounceLoop:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   579
		in		a, (4)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   580
		and		8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   581
		cp		b
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   582
		ld		b, a
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   583
		jr		nz, debounceRestart
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   584
		dec		hl
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   585
		ld		a, l
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   586
		or		h
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   587
		jr		nz, debounceLoop
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   588
		cp		b
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   589
		jr		z, ONKeyBeingPressed
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   590
		;ON key is being released
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   591
		in		a, (7)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   592
		ld		b, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   593
		in		a, (2)
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   594
		and		80h
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   595
		jr		z, {+}
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   596
		;Restore previous speed
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   597
		ld		a, e
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   598
		out		(20h), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   599
		ld		a, b
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   600
		cp		81h
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   601
		jr		isRAMUnhooked
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   602
+:		ld		a, b
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   603
		and		4Fh
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   604
		cp		41h
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   605
isRAMUnhooked:
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   606
		jp		nz, RAMUnhookedWaitForPowerOn
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   607
		bit		onRunning, (iy+onFlags)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   608
		ret		nz
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   609
		;ON key being released and we're just off, so just return from the interrupt handler
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   610
		pop		hl
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   611
		sub		a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   612
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   613
		ld		a, 8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   614
		out		(3), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   615
		pop		af
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   616
		out		(3), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   617
		ld		a, 11h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   618
		jp		noSecondHardwareTimer
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   619
ONKeyBeingPressed:
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   620
		;Restore previous speed
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   621
		in		a, (2)
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   622
		and		80h
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   623
		jr		z, HandlePowerOnRequest
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   624
		ld		a, e
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   625
		out		(20h), a
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   626
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   627
.module	HandlePowerOnRequest
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   628
HandlePowerOnRequest:
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   629
		ld		a, 76h
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   630
		out		(4), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   631
		in		a, (2)
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   632
		and		80h
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   633
		jr		z, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   634
		in		a, (7)
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   635
		cp		81h
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   636
		jr		_isRAMUnhooked
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   637
+:		in		a, (7)
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   638
		and		4Fh
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   639
		cp		41h
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   640
_isRAMUnhooked:
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   641
		jp		nz, HookRAMAndPowerOn
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   642
		bit		shift2nd, (iy+shiftFlags)
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   643
		jp		z, HandleONPressed
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   644
		;2nd is being pressed, so we might be turning off
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   645
		bit		enableKeyEcho, (iy+hookflags1)
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   646
		jr		nz, {+}
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   647
		bit		appRetKeyOff, (iy+APIFlg)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   648
		jr		z, PowerOff
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   649
+:		set		kOffPressed, (iy+APIFlg)
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   650
		ret
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   651
.endmodule
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   652
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   653
.module	PowerOff
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   654
PowerOff:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   655
		ld		a, 8
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   656
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   657
		ld		a, 8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   658
		out		(3), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   659
		pop		af
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   660
		out		(3), a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   661
		call	TurnOffLCD
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   662
		bit		resetOnPowerOn, (iy+selfTestFlag)
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   663
		jr		z, {+}
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   664
		;If above flag is set and APD is disabled, skip RAM checksum generation (forcing a reset)
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   665
		bit		apdAble, (iy+apdFlags)
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   666
		jr		z, _skipRAMChecksum
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   667
+:		call	SetFastSpeed
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   668
		call	PreviousContext_CloseAnyOpenMenu
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   669
		call	j_hideCursor
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   670
		set		monAbandon, (iy+monFlags)
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   671
		ld		hl, lcdFlag
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   672
		set		powerLcdForGC, (hl)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   673
		call	forcecmd
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   674
		ld		hl, lcdFlag
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   675
		res		powerLcdForGC, (hl)
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   676
		res		monAbandon, (iy+monFlags)
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   677
		bit		alt_Off, (iy+hookflags1)
24
12b896331796 More cleanup.
brandonlw
parents: 23
diff changeset
   678
		call	nz, j_ExecuteOFFSCRPT
28
55da9f386e8e Lots of cleanup.
brandonlw
parents: 27
diff changeset
   679
_DoShutDown:
55da9f386e8e Lots of cleanup.
brandonlw
parents: 27
diff changeset
   680
		call	j_SetupDBusMem
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   681
		ld		a, 8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   682
		out		(3), a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   683
		call	TurnOffLCD
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   684
		ld		hl, flags+onFlags
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   685
		bit		clrScrnOnPowerOff, (hl)
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   686
		res		clrScrnOnPowerOff, (hl)
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   687
		call	nz, j_ClrScrn
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   688
		call	calculateRAMChecksum
22
dea09e588bf1 Cleanup of page 0's boot.asm.
brandonlw
parents: 21
diff changeset
   689
		ld		(RAMChecksum), hl
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   690
_skipRAMChecksum:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   691
		res		bPLinkOn, (iy+hookflags1)
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   692
		res		enableKeyEcho, (iy+hookflags1)
24
12b896331796 More cleanup.
brandonlw
parents: 23
diff changeset
   693
		ld		a, 36h
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   694
		out		(4), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   695
		ld		a, 11h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   696
		out		(3), a
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   697
		res		shift2nd, (iy+shiftFlags)
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   698
		res		onRunning, (iy+onFlags)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   699
		ex		af, af'
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   700
		exx
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   701
		ei
22
dea09e588bf1 Cleanup of page 0's boot.asm.
brandonlw
parents: 21
diff changeset
   702
-:		halt
dea09e588bf1 Cleanup of page 0's boot.asm.
brandonlw
parents: 21
diff changeset
   703
		jr		{-}
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   704
.endmodule
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   705
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   706
HandleONPressed:
22
dea09e588bf1 Cleanup of page 0's boot.asm.
brandonlw
parents: 21
diff changeset
   707
		res		checkNoBatteriesNextTime, (iy+batteryFlags2)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   708
		call	ApdSetup
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   709
		bit		onRunning, (iy+onFlags)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   710
		jr		nz, page0_94D
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   711
page0_8F1:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   712
		set		onRunning, (iy+onFlags)
22
dea09e588bf1 Cleanup of page 0's boot.asm.
brandonlw
parents: 21
diff changeset
   713
		ld		hl, flags+apdFlags
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   714
		bit		4, (hl)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   715
		res		4, (hl)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   716
		jr		nz, page0_92C
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   717
		res		indicInUse, (iy+indicFlags)
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   718
		bit		resetOnPowerOn, (iy+selfTestFlag)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   719
		jr		z, page0_90D
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   720
		bit		2, (hl)
25
fab1bedd3281 Commit some experimental commented-out code for 84+CSE detection and booting
brandonlw
parents: 24
diff changeset
   721
		jp		z, resetRam
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   722
page0_90D:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   723
		ld		sp, (onSP)
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   724
		call	j_resetStacks
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   725
		xor		a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   726
		ld		(MenuCurrent), a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   727
		call	refreshSystemRAM
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   728
		call	sub_ADA
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   729
		call	Page0Call_3E97
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   730
		bit		cmdExec, (iy+cmdFlags)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   731
		call	nz, Page0Call_3E9D
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   732
		ei
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   733
		jp		Mon
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   734
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   735
page0_92C:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   736
		bit		alt_On, (iy+hookflags1)
24
12b896331796 More cleanup.
brandonlw
parents: 23
diff changeset
   737
		call	nz, j_ExecuteONSCRPT
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   738
		ld		a, 8
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   739
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   740
		ld		a, 8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   741
		out		(3), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   742
		pop		af
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   743
		out		(3), a
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   744
		call	j_RstrOScreen
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   745
		pop		de
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   746
		pop		de
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   747
		pop		de
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   748
		set		3, (hl)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   749
		call	sub_ADA
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   750
		ex		af, af'
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   751
		exx
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   752
		ei
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   753
		reti
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   754
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   755
page0_94D:
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   756
		set		onInterrupt, (iy+onFlags)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   757
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   758
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   759
HookRAMAndPowerOn:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   760
		ld		a, 76h ; 'v'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   761
		out		(4), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   762
		ld		a, 0C0h	; ''
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   763
		out		(0), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   764
		in		a, (2)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   765
		and		80h ; ''
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   766
		ld		a, 41h ; 'A'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   767
		jr		z, page0_96B
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   768
		ld		a, 1
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   769
		out		(20h), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   770
		xor		a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   771
		out		(0Fh), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   772
		ld		a, 81h ; 'g
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   773
page0_96B:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   774
		out		(7), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   775
		xor		a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   776
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   777
		ld		a, 8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   778
		out		(3), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   779
		pop		af
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   780
		out		(3), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   781
		ld		iy, 89F0h
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   782
		call	NZIf83Plus
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   783
		call	z, Page0Call_3EAF
22
dea09e588bf1 Cleanup of page 0's boot.asm.
brandonlw
parents: 21
diff changeset
   784
		ld		hl, (RAMChecksum)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   785
		ld		de, 0A55Ah
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   786
		call	CpHLDE
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   787
		jp		z, doFunkyTurnOnFromA55AChecksum
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   788
		call	NZIf83Plus
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   789
		jr		z, page0_9A0
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   790
		ld		b, 0
11
fea1578031ed Cleanup to page 0.
brandonlw
parents: 10
diff changeset
   791
		B_CALL(_getHardwareVersion)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   792
		bit		0, b
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   793
		ld		a, 1Fh
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   794
		jr		z, page0_9A2
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   795
		ld		a, 1Ch
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   796
		jr		page0_9A2
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   797
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   798
page0_9A0:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   799
		ld		a, 17h
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   800
page0_9A2:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   801
		ld		(contrast), a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   802
		call	calculateRAMChecksum
22
dea09e588bf1 Cleanup of page 0's boot.asm.
brandonlw
parents: 21
diff changeset
   803
		ld		de, (RAMChecksum)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   804
		call	CpHLDE
25
fab1bedd3281 Commit some experimental commented-out code for 84+CSE detection and booting
brandonlw
parents: 24
diff changeset
   805
		jr		nz, resetRam
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   806
		dec		de
22
dea09e588bf1 Cleanup of page 0's boot.asm.
brandonlw
parents: 21
diff changeset
   807
		ld		(RAMChecksum), de
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   808
		call	Page0Call_3EB5
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   809
		call	PreviousContext_CloseAnyOpenMenu
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   810
		ld		a, 0Bh
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   811
		out		(3), a
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   812
		res		apdWarmStart, (iy+apdFlags)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   813
		call	forcecmd
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   814
		jp		page0_8F1
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   815
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   816
resetRam:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   817
		di
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   818
		ld		hl, 8000h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   819
		ld		de, 8001h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   820
		ld		bc, 7FFFh
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   821
		ld		(hl), 0
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   822
		ldir
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   823
		ld		hl, 109h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   824
		ld		(localLanguage), hl
25
fab1bedd3281 Commit some experimental commented-out code for 84+CSE detection and booting
brandonlw
parents: 24
diff changeset
   825
;#ifdef DEVIATE_FROM_ORIGINAL_FILE
fab1bedd3281 Commit some experimental commented-out code for 84+CSE detection and booting
brandonlw
parents: 24
diff changeset
   826
;		call	NZIfColorModel
fab1bedd3281 Commit some experimental commented-out code for 84+CSE detection and booting
brandonlw
parents: 24
diff changeset
   827
;		jr		z, {+}
fab1bedd3281 Commit some experimental commented-out code for 84+CSE detection and booting
brandonlw
parents: 24
diff changeset
   828
;		set		0, (iy+asm_Flag3)
fab1bedd3281 Commit some experimental commented-out code for 84+CSE detection and booting
brandonlw
parents: 24
diff changeset
   829
;+:
fab1bedd3281 Commit some experimental commented-out code for 84+CSE detection and booting
brandonlw
parents: 24
diff changeset
   830
;#endif
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   831
page0_9DE:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   832
		ld		a, 0C0h	; ''
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   833
		out		(0), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   834
		ld		sp, 0FFF7h
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   835
		call	Page0Call_3EBB
26
fb2b0058e568 Fix hard-coded error handler address.
brandonlw
parents: 25
diff changeset
   836
		ld		hl, monErrHand
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   837
		call	pushErrorHandleR
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   838
		ld		(onSP), sp
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   839
		call	Page0Call_3EC1
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   840
		jp		Page0Call_3EC7
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   841
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   842
page0_9F8:
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   843
		di
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   844
		ld		a, 0C0h	; ''
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   845
		out		(0), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   846
		ld		sp, 0FFF7h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   847
		ld		hl, 8000h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   848
		ld		de, 8001h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   849
		ld		bc, 7FFFh
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   850
		ld		(hl), 0
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   851
		ldir
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   852
		ld		hl, 109h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   853
		ld		(localLanguage), hl
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   854
		call	Page0Call_3EBB
26
fb2b0058e568 Fix hard-coded error handler address.
brandonlw
parents: 25
diff changeset
   855
		ld		hl, monErrHand
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   856
		call	pushErrorHandleR
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   857
		ld		(onSP), sp
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   858
		call	Page0Call_3EC1
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   859
		jp		Page0Call_3ECD
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   860
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   861
page0_A26:
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   862
		call	GetCSC
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   863
		set		2, (iy+9)
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   864
		call	j_getkey
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   865
		call	j_ClrScrn
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   866
		res		2, (iy+9)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   867
		jp		monForceKey
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   868
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   869
calculateRAMChecksum:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   870
		push	ix
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   871
		ld		ix, 9D95h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   872
		ld		bc, 60DBh
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   873
		ld		hl, 11h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   874
		ld		d, h
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   875
page0_A47:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   876
		ld		e, (ix+0)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   877
		inc		ix
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   878
		add		hl, de
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   879
		dec		bc
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   880
		ld		a, c
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   881
		or		b
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   882
		jr		nz, page0_A47
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   883
		ld		e, d
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   884
		ex		de, hl
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   885
		sbc		hl, de
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   886
		pop		ix
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   887
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   888
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   889
forcecmd:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   890
		call	CanAlphIns
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
   891
		res		textInverse, (iy+textFlags)
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   892
		call	j_Disp
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
   893
		res		cmdExec, (iy+cmdFlags)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   894
		ld		a, 40h ; '@'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   895
		jp		newContext0
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   896
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   897
bootCalc:
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   898
		call	SetSlowSpeed
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   899
		ld		a, 77h ; 'w'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   900
		out		(4), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   901
		ld		b, 0
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   902
		ld		sp, 0FDFAh
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   903
page0_A78:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   904
		djnz	$
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   905
		ld		ix, 1
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   906
		add		ix, sp
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   907
		ld		sp, ix
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   908
		jr		nc, page0_A78
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   909
		ld		sp, 0FFC5h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   910
		in		a, (2)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   911
		and		80h ; ''
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   912
		jr		z, page0_A91
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   913
		ld		a, 1
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   914
		out		(20h), a
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   915
page0_A91:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   916
		ld		a, 77h ; 'w'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   917
		out		(4), a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   918
		im	1
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   919
		ld		a, 0C0h	; ''
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   920
		out		(0), a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   921
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   922
RAMUnhookedWaitForPowerOn:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   923
		ld		a, 37h ; '7'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   924
		out		(4), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   925
		sub		a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   926
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   927
		ld		a, 8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   928
		out		(3), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   929
		pop		af
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   930
		out		(3), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   931
		ld		a, 11h
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   932
		out		(3), a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   933
		ei
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   934
		halt
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   935
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   936
lcd_busy:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   937
		push	af
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   938
page0_AAF:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   939
		in		a, (2)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   940
		and		2
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   941
		jr		z, page0_AAF
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   942
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   943
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   944
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   945
page0_AB7:
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   946
TurnOffLCD:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   947
		ld		a, 2
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   948
page0_AB9:
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   949
		push	af
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   950
loop:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   951
		in		a, (2)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   952
		and		2
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   953
		jr		z, loop
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   954
		pop		af
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   955
		out		(10h), a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   956
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   957
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   958
page0_AC4:
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   959
smallDelay:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   960
		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   961
		inc		hl
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   962
		dec		hl
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   963
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   964
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   965
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   966
page0_AC9:
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   967
slowDelay:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   968
		ld		a, 0FFh
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   969
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   970
slowDelayA:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   971
		push	af
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   972
		call	forceSlowSpeed
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   973
		pop		af
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   974
delayLoop:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   975
		call	smallDelay
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   976
		dec		a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   977
		jr		nz, delayLoop
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   978
		call	restorePreviousSpeed
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   979
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   980
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   981
sub_ADA:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   982
		ld		a, 0Bh
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   983
		out		(3), a
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
   984
		call	j_LCD_DRIVERON
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   985
		call	Chk_Batt_Low_2
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   986
		ret		nz
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   987
		call	refreshSystemRAM
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   988
		in		a, (2)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   989
		bit		0, a
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
   990
		jp		z, PowerOff._skipRAMChecksum
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   991
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   992
sub_AEF:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   993
		call	Page0Call_3ED9
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   994
		call	forcecmd
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
   995
		jp		Page0Call_3EDF
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   996
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
   997
Chk_Batt_Low_2:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   998
		call	refreshSystemRAM
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
   999
Chk_Batt_Low:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1000
		ld		a, 76h ; 'v'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1001
		out		(4), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1002
		ld		a, 0F6h	; '򧍊
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1003
		out		(4), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1004
		ld		b, 5
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
  1005
longerDelay:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1006
		call	slowDelay
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1007
		djnz	longerDelay
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1008
		set		5, (iy+18h)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1009
		in		a, (2)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1010
		bit		0, a
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
  1011
		jr		nz, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1012
		res		5, (iy+18h)
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
  1013
+:		ld		a, 76h ; 'v'
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1014
		out		(4), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1015
		ld		a, 0Ah
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1016
		call	slowDelayA
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1017
		ld		a, 76h ; 'v'
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1018
		out		(4), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1019
		bit		5, (iy+18h)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1020
		ret
24
12b896331796 More cleanup.
brandonlw
parents: 23
diff changeset
  1021
12b896331796 More cleanup.
brandonlw
parents: 23
diff changeset
  1022
.module	RefreshSystemRAM
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
  1023
refreshSystemRAM:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1024
		ld		bc, 2710h
24
12b896331796 More cleanup.
brandonlw
parents: 23
diff changeset
  1025
		ld		hl, ramStart
12b896331796 More cleanup.
brandonlw
parents: 23
diff changeset
  1026
-:		ld		a, (hl)
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1027
		ld		(hl), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1028
		dec		bc
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1029
		ld		a, b
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1030
		or		c
24
12b896331796 More cleanup.
brandonlw
parents: 23
diff changeset
  1031
		jr		nz, {-}
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1032
		ret
24
12b896331796 More cleanup.
brandonlw
parents: 23
diff changeset
  1033
.endmodule
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1034
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
  1035
doFunkyTurnOnFromA55AChecksum:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1036
		ld		hl, 0
22
dea09e588bf1 Cleanup of page 0's boot.asm.
brandonlw
parents: 21
diff changeset
  1037
		ld		(RAMChecksum), hl
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1038
		ld		sp, (onSP)
24
12b896331796 More cleanup.
brandonlw
parents: 23
diff changeset
  1039
		ld		iy, flags
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1040
		call	Page0Call_3EE5
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1041
		call	PreviousContext_CloseAnyOpenMenu
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1042
		call	forcecmd
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
  1043
		res		apdWarmStart, (iy+apdFlags)
38
a4c5f839b738 Cleanup of _Mon. This sucked a lot.
brandonlw
parents: 37
diff changeset
  1044
		bit		cmdExec, (iy+cmdFlags)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1045
		call	nz, Page0Call_3E9D
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1046
		ld		a, 0Bh
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1047
		out		(3), a
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
  1048
		call	j_LCD_DRIVERON
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
  1049
		set		onRunning, (iy+onFlags)
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1050
		call	Chk_Batt_Low_2
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1051
		call	z, sub_AEF
19
271dfee8e3ad Set all known flags -- I'm amazed this actually worked.
brandonlw
parents: 16
diff changeset
  1052
		bit		alt_On, (iy+hookflags1)
24
12b896331796 More cleanup.
brandonlw
parents: 23
diff changeset
  1053
		call	nz, j_ExecuteONSCRPT
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1054
		ei
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1055
		jp		Mon
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1056
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1057
PreviousContext_CloseAnyOpenMenu:
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1058
		call	IsInMenu
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1059
		jr		z, PreviousContext
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1060
		xor		a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1061
		ld		(MenuCurrent), a
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
  1062
		call	j_rstrpartial
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1063
PreviousContext:
16
27ca02d0d8aa Give meaningful names to the page 0 calls we know about so far.
brandonlw
parents: 13
diff changeset
  1064
		call	j_PrevContext
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1065
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1066
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1067
IsInMenu:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1068
		ld		b, a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1069
		ld		a, (MenuCurrent)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1070
		or		a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1071
		ld		a, b
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1072
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1073
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1074
SetSlowSpeed:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1075
		call	NZIf83Plus
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1076
		ret		nz
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1077
		jr		{+}
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
  1078
forceSlowSpeed:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1079
		call	NZIf83Plus
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1080
		ret		nz
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1081
		in		a, (20h)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1082
		ld		(oldSESpeed), a
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1083
+:		push	af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1084
		xor		a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1085
		out		(20h), a
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1086
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1087
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1088
7
89b82476a75f Get rid of (most) of the godawful IDA comments.
brandonlw
parents: 6
diff changeset
  1089
restorePreviousSpeed:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1090
		call	NZIf83Plus
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1091
		ret		nz
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1092
		ld		a, (oldSESpeed)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1093
		and		1
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1094
		out		(20h), a
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1095
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1096
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1097
SetExSpeed:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1098
		or		a
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1099
SetSpeed_NZForFast:
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1100
		jr		z, SetSlowSpeed
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1101
SetFastSpeed:
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1102
		push	af
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1103
		call	NZIf83Plus
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1104
		jr		nz, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1105
		ld		a, 1
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1106
		out		(20h), a
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1107
+:		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1108
		ret
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1109
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1110
page0_BBD:
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1111
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1112
		push	hl
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1113
		ld		hl, SEspeed
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1114
		dec		(hl)
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1115
		pop		hl
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1116
		call	NZIf83Plus
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1117
		jr		nz, {+}
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1118
		and		1
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1119
		out		(20h), a
23
5252151efccf More cleanup
brandonlw
parents: 22
diff changeset
  1120
+:		pop		af
8
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1121
		pop		af
795326a8c258 More formatting cleanup.
brandonlw
parents: 7
diff changeset
  1122
		pop		af
4
59f60baeaf6a Initial commit
brandonlw
parents:
diff changeset
  1123
		ret