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