-
Notifications
You must be signed in to change notification settings - Fork 7
/
OSKMon.asm
190 lines (168 loc) · 7.75 KB
/
OSKMon.asm
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
;*******************************************************************************
;* OldSkoolCoder Machine Code Monitor *
;* *
;* Writtern By John C. Dale *
;* *
;* Date 16th April 2018 *
;*******************************************************************************
;* *
;* Change History *
;* 16th Apr 2018 : Created new project for use in the new Machine Code Monitor *
;* Video Series *
;* 18th Apr 2018 : Added Break, Tokaniser and Register Command *
;* 2nd May 2018 : Added Assembler Command *
;* 14th May 2018 : Added Dissassembler Command *
;* 18th May 2018 : Added Command Command *
;* 20th May 2018 : Added Fill Command *
;* 22nd May 2018 : Added Gosub Command *
;* 2nd June 2018 : Added Hunt Command *
;* 6th June 2018 : Added Interpret Command *
;* 21st June 2018 : Added Load Command *
;* 22nd June 2018 : Added Memory Command *
;* 22nd June 2018 : Added MemoryPut Command *
;* 23rd June 2018 : Added Output Command *
;* 24th June 2018 : Added Save Command *
;* 24th June 2018 : Added Transfer Command *
;* 24th June 2018 : Added Exit Command *
;* 26th June 2018 : Added Decimal Command *
;* 26th June 2018 : Added Hexadecimal Command *
;* 26th June 2018 : Added Binary Command *
;* 26th June 2018 : Added Octal Command *
;*******************************************************************************
;*******************************************************************************
;* Includes *
;*******************************************************************************
ifdef TGT_C64
*= $9000
CARTSTART = $9000
endif
ifdef TGT_VIC20_8K
*= $B000
CARTSTART = $B000
endif
jmp STARTMON
incasm "libOpCodesArray.asm"
incasm "libCharacterASCIIConst.asm"
incasm "libROMRoutines.asm"
;*******************************************************************************
;* Variables *
;*******************************************************************************
ADDVEC = 247
CINV = $0314
CBINV = $0316
NMINV = $0318
HT = $14
HTVEC = $0014
;*******************************************************************************
;* Code *
;*******************************************************************************
STARTMON
ldy #>TITLE ; Load Title Start Location
lda #<TITLE
jsr bas_PrintString$ ; Print out Title to screen
lda #<BREAK_VECTOR ; Load BRK Vector locations
ldy #>BREAK_VECTOR
sei
sta CBINV ; Set Break Vectors
sty CBINV + 1
cli
brk
;*******************************************************************************
;* Break Operation *
;*******************************************************************************
BREAK_VECTOR
pla ; Get X Reg from Stack
sta YREG
pla ; Get Y Reg from Stack
sta XREG
pla ; Get Acc From Stack
sta ACCREG
pla ; Get Status Register From Stack
sta STREG
pla ; Get Program Counter Lo From Stack
sta PCLOREG
pla ; Get Program Counter Hi From Stack
sta PCHIREG
tsx ; Get Current Status Register
stx STPTREG
lda CINV ; Get current IRQ Pointer Vector
ldy CINV + 1
sta IRQINT
sty IRQINT + 1
lda NMINV ; Get Current NMI Pointer Vector
ldy NMINV + 1
sta NMIINT
sty NMIINT + 1
lda PCLOREG ; Load PC Counter Lo
sec
sbc #2 ; Subtract 2
sta PCLOREG ; Store back to PC Counter Lo
bcs @BREAK
dec PCHIREG ; Dec PC Counter Hi if Carry Clear
@BREAK
jmp COM_REGISTER
TITLE
ifdef TGT_C64
BYTE CHR_ClearScreen
TEXT "oldskoolcoder machine code monitor"
BYTE 13, CHR_CursorDown
TEXT "for the commodore 64 by j.c.dale"
BYTE 13, CHR_CursorDown
TEXT "(c) april 2018 oldskoolcoder"
BYTE CHR_CursorDown
brk
endif
ifdef TGT_VIC20_8K
BYTE CHR_ClearScreen
TEXT "machine code monitor"
BYTE 13, CHR_CursorDown
TEXT "for vic20 by j.c.dale"
BYTE 13, CHR_CursorDown
TEXT "(c) april 2018 osk"
BYTE CHR_CursorDown
brk
endif
;*******************************************************************************
;* Storage Locations *
;*******************************************************************************
YREG = $02A7 ; Store location for Y Register
XREG = YREG + 1 ; Store location for X Register
ACCREG = XREG + 1 ; Store location for Accumulator Register
STREG = ACCREG + 1 ; Store location for Status Register
PCLOREG = STREG + 1 ; Store location for Program Counter Lo
PCHIREG = PCLOREG + 1 ; Store location for Program Counter Hi
STPTREG = PCHIREG + 1 ; Store location for Stack Pointer Register
IRQINT = STPTREG + 1 ; Store location for IRQ Vector Address
NMIINT = IRQINT + 2 ; Store location for NMI Vector Address
TEMP = NMIINT + 2 ; Store location for Temp Vector Address
STREGISTER = TEMP + 1
COM_P = STREGISTER + 1
COM_NB = COM_P + 1
COM_MODE = COM_NB + 1 ; Store location for Mode
COM_CODE = COM_MODE + 1
COM_L = COM_CODE + 1
COM_TEXT = COM_L + 1 ; Storage Location For Command Buffer Text
DIS_END = COM_TEXT + 26 ; Store location for End Vector Address
NEXT = DIS_END + 2 ; Store location for Next Vector Address
LOCATION = NEXT + 2 ; Store location for Location Vector Address
MODE_JUMP_VEC = LOCATION + 2 ; Store location for MODE Jump Vector Address
incasm "libOSKRoutines.asm"
incasm "libRegisterCommand.asm"
incasm "libAssembleCommand.asm"
incasm "libDissassembleCommand.asm"
incasm "libCommandCommand.asm"
incasm "libFillCommand.asm"
incasm "libGoCommand.asm"
incasm "libHuntCommand.asm"
incasm "libInterpretCommand.asm"
incasm "libLoadCommand.asm"
incasm "libMemoryCommand.asm"
incasm "libOutputCommand.asm"
incasm "libSaveCommand.asm"
incasm "libTransferCommand.asm"
incasm "libExitCommand.asm"
incasm "libDecimalCommand.asm"
incasm "libHexadecimalCommand.asm"
incasm "libBinaryCommand.asm"
incasm "libOctalCommand.asm"
incasm "libHelpCommand.asm"