-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitor.asm
More file actions
193 lines (171 loc) · 5.7 KB
/
monitor.asm
File metadata and controls
193 lines (171 loc) · 5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
.cpu "65816"
;Cmd Command Params
;A ASSEMBLE [Start] [Assembly code]
;C COMPARE Start1 Start2 [Len (1 if blank)]
;D DISASSEMBLE Start [End]
;F FILL Start End Byte
;G GO [Address]
;J [Address]
;H HUNT (find) Start End Byte [Byte]...
;L LOAD "File" [Device] [Start]
;M MEMORY [Start] [End]
;R REGISTERS Register [Value] (A 1234, F 00100011)
;; PC A X Y SP DBR DP NVMXDIZC
;S SAVE "File" Device Start End
;T TRANSFER Start End Destination
;V VERIFY "File" [Device] [Start]
;X EXIT
;> MODIFY Start Byte [Byte]...
;@ DOS [Command] Returns drive status if no params.
;? HELP Display a short help screen
;Monitor.asm
;Jump Table
* = $195000
MONITOR JML IMONITOR
MSTATUS JML IMSTATUS
MREADY JML IMREADY
MRETURN JML IMRETURN
MPARSE JML IMPARSE
MPARSE1 JML IMPARSE1
MEXECUTE JML IMEXECUTE
MASSEMBLE JML IMASSEMBLE
MASSEMBLEA JML IMASSEMBLEA
MCOMPARE JML IMCOMPARE
MDISASSEMBLE JML IMDISASSEMBLE
MFILL JML IMFILL
MJUMP JML IMJUMP
MHUNT JML IMHUNT
MLOAD JML IMLOAD
MMEMORY JML IMMEMORY
MREGISTERS JML IMREGISTERS
MSAVE JML IMSAVE
MTRANSFER JML IMTRANSFER
MVERIFY JML IMVERIFY
MEXIT JML IMEXIT
MMODIFY JML IMMODIFY
MDOS JML IMDOS
;
; IMONITOR
; monitor entry point. This initializes the monitor
; and prints the prompt.
; Make sure 16 bit mode is turned on
;
IMONITOR CLC ; clear the carry flag
XCE ; move carry to emulation flag.
LDA #STACK_END ; Reset the stack
TAS
JML IMREADY
;
; IMREADY
; Print the status prompt, then wait for input
;
IMREADY ;set the READY handler to jump here instead of BASIC
setaxl
LDA #<>IMREADY
STA JMP_READY+1
setas
LDA #`IMREADY
STA JMP_READY+3
;set the RETURN vector and then wait for keyboard input
setal
LDA #<>IMRETURN
STA RETURN+1
setas
LDA #`IMRETURN
STA RETURN+3
JML IMSTATUS
;
; IMSTATUS
; Prints the regsiter status
; Reads the saved register values at CPU_REGISTERS
;
; PC A X Y SP DBR DP NVMXDIZC
; 000000 0000 0000 0000 0000 00 0000 00000000
;
; Arguments: none
; Modifies: A,X,Y
IMSTATUS ; Print the MONITOR prompt (registers header)
setdbr `mregisters_msg
LDX #<>mregisters_msg
JSL IPRINT
setas
LDA #';'
JSL IPUTC
setaxl
setdbr $0
; print Program Counter
LDY #3
LDX #CPUPC+2
JSL IPRINTH
; print A register
LDA ' '
JSL IPUTC
LDY #2
LDX #CPUA+1
JSL IPRINTH
; print X register
LDA ' '
JSL IPUTC
LDY #2
LDX #CPUX+1
JSL IPRINTH
; print Y register
LDA ' '
JSL IPUTC
LDY #2
LDX #CPUY+1
JSL IPRINTH
; print Stack Pointer
LDA ' '
JSL IPUTC
LDY #2
LDX #CPUSTACK+1
JSL IPRINTH
; print DBR
LDA ' '
JSL IPUTC
LDY #1
LDX #CPUDBR
JSL IPRINTH
; print Direct Page
LDA ' '
JSL IPUTC
JSL IPUTC
LDY #2
LDX #CPUDP+1
JSL IPRINTH
; print Flags
LDA ' '
JSL IPUTC
LDY #1
LDX #CPUFLAGS
JSL IPRINTH
JSL IPRINTCR
JML IREADYWAIT
IMRETURN RTL ; Handle RETURN key (ie: execute command)
IMPARSE BRK ; Parse the current command line
IMPARSE1 BRK ; Parse one word on the current command line
IMEXECUTE BRK ; Execute the current command line (requires MCMD and MARG1-MARG8 to be populated)
IMASSEMBLE BRK ; Assemble a line of text.
IMASSEMBLEA BRK ; Assemble a line of text.
IMCOMPARE BRK ; Compare memory. len=1
IMDISASSEMBLE BRK ; Disassemble memory. end=1 instruction
IMFILL BRK ; Fill memory with specified value. Start and end must be in the same bank.
IMGO BRK ; Execute from specified address
IMJUMP BRK ; Execute from spefified address
IMHUNT BRK ; Hunt (find) value in memory
IMLOAD BRK ; Load data from disk. Device=1 (internal floppy) Start=Address in file
IMMEMORY BRK ; View memory
IMREGISTERS BRK ; View/edit registers
IMSAVE BRK ; Save memory to disk
IMTRANSFER BRK ; Transfer (copy) data in memory
IMVERIFY BRK ; Verify memory and file on disk
IMEXIT BRK ; Exit monitor and return to BASIC command prompt
IMMODIFY BRK ; Modify memory
IMDOS BRK ; Execute DOS command
;
; MMESSAGES
; MONITOR messages and responses.
MMESSAGES
MMERROR .text
mregisters_msg .null $0D," PC A X Y SP DBR DP NVMXDIZC"