-
Notifications
You must be signed in to change notification settings - Fork 1
/
minibug.asm
195 lines (175 loc) · 4.29 KB
/
minibug.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
191
192
193
194
195
MACEXP off
CPU 6800 ; That's what asl has
include "asl.inc" ;
NAM MINIB
;* MINI-BUG
;* COPYWRITE 1973, MOTOROLA INC
;* REV 004 (USED WITH MIKBUG)
;
;ACIACS EQU @176364 ACIA CONTROL/STATUS ($FCF4-F5)
ACIACS EQU $FCF4 ACIA CONTROL/STATUS ($FCF$
ACIADA EQU ACIACS+1
ORG $FE00 ;* FE00-FEFF
* MINIB
* INPUT ONE CHAR INTO A-REGISTER
INCH LDA A ACIACS
ASR A
BCC INCH RECEIVE NOT READY
LDA A ACIADA INPUT CHARACTER
AND A #$7F RESET PARITY BIT
CMP A #$7F
BEQ INCH RUBOUT; IGNORE
JMP OUTCH ECHO CHAR
* INPUT HEX CHAR
INHEX BSR INCH
CMP A #$30
BMI C1 NOT HEX
CMP A #$39
BLE IN1HG
CMP A #$41
BMI C1 NOT HEX
CMP A #$46
BGT C1 NOT HEX
SUB A #7
IN1HG RTS
LOAD LDA A #$D1 TURN READER ON
STA A ACIACS
LDA A #@21
BSR OUTCH
LOAD3 BSR INCH
CMP A #'S
BNE LOAD3 1ST CHAR NOT (S)
BSR INCH
CMP A #'9
BEQ LOAD21
CMP A #'1
BNE LOAD3 2ND CHAR NOT (1)
CLR CKSM ZERO CHECKSUM
BSR BYTE READ BYTE
SUB A #2
STA A BYTECT BYTE COUNT
* BUILD ADDRESS
BSR BADDR
* STORE DATA
LOAD11 BSR BYTE
DEC BYTECT
BEQ LOAD15 ZERO BYTE COUNT
STA A X STORE DATA
INX
BRA LOAD11
LOAD15 INC CKSM
BEQ LOAD3
LOAD19 LDA A #'? PRINT QUESTION MARK
BSR OUTCH
LOAD21 LDA A #$B1 TURN READER OFF
STA A ACIACS
LDA A #@23
BSR OUTCH
C1 JMP CONTRL
* BUILD ADDRESS
BADDR BSR BYTE READ 2 FRAMES
STA A XHI
BSR BYTE
STA A XLOW
LDX XHI (X) ADDRESS WE BUILT
RTS
* INPUT BYTE (TWO FRAMES)
BYTE BSR INHEX GET HEX CHAR
ASL A
ASL A
ASL A
ASL A
TAB
BSR INHEX
AND A #$0F MASK TO 4 BITS
ABA
TAB
ADD B CKSM
STA B CKSM
RTS
* CHANGE MEMORY (M AAAA DD NN)
CHANGE BSR BADDR BUILD ADDRESS
BSR OUTS PRINT SPACE
BSR OUT2HS
BSR BYTE
DEX
STA A X
CMP A X
BNE LOAD19 MEMORY DID NOT CHANGE
BRA CONTRL
OUTHL LSR A OUT HEX LEFT BCD DIGIT
LSR A
LSR A
LSR A
OUTHR AND A #$F OUT HEX RIGHT BCD DIGIT
ADD A #$30
CMP A #$39
BLS OUTCH
ADD A #$7
* OUTPUT ONE CHAR
OUTCH PSH B SAVE B-REG
OUTC1 LDA B ACIACS
ASR B
ASR B
BCC OUTC1 XMIT NOT READY
STA A ACIADA OUTPUT CHARACTER
PUL B
RTS
OUT2H LDA A 0,X OUTPUT 2 HEX CHAR
BSR OUTHL OUT LEFT HEX CHAR
LDA A 0,X
BSR OUTHR OUT RIGHT HEX VHAR
INX
RTS
OUT2HS BSR OUT2H OUTPUT 2 HEX CHAR + SPACE
OUTS LDA A #$20 SPACE
BRA OUTCH (BSR & RTS)
* PRINT CONTENTS OF STACK
PRINT TSX
STX SP SAVE STACK POINTER
LDA B #9
PRINT2 BSR OUT2HS OUT 2 HEX & SPCACE
DEC B
BNE PRINT2
* ENTER POWER ON SEQUENCE
START EQU *
* INZ ACIA
LDA A #$B1 SET SYSTEM PARAMETERS
STA A ACIACS
CONTRL LDS #STACK SET STACK POINTER
LDA A #$D CARRIAGE RETURN
BSR OUTCH
LDA A #$A LINE FEED
BSR OUTCH
JSR INCH READ CHARACTER
TAB
BSR OUTS PRINT SPACE
CMP B #'L
BNE *+5
JMP LOAD
CMP B #'M
BEQ CHANGE
CMP B #'P
BEQ PRINT STACK
CMP B #'G
BNE CONTRL
RTI GO
ORG $FF00
RMB 40
STACK RMB 1 STACK POINTER
* REGISTERS FOR GO
RMB 1 CONDITION CODES
RMB 1 B ACCUMULATOR
RMB 1 A
RMB 1 X-HIGH
RMB 1 X-LOW
RMB 1 P-HIGH
RMB 1 P-LOW
SP RMB 1 S-HIGH
RMB 1 S-LOW
* END REGISTERS FOR GO
CKSM RMB 1 CHECKSUM
BYTECT RMB 1 BYTE COUNT
XHI RMB 1 XREG HIGH
XLOW RMB 1 XREG LOW
END