Sie sind auf Seite 1von 34

KIM.

ASM
LINE LOC INSTR
df34324234423
sdf234324324
sdffsd
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

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

12-17-1981

Page 1

;
;- - - - - - - - - - - - - - KIM.ASM - - - - - - - - - - ; COPYRIGHT MOS TECHNOLOGY, INC
; DATE: OCT 18, 1975 REV-D
;************************ 6530-003 I.C. ******************
; 6530-003 I.C. IS AN AUDIO CASSETTE TAPE RECORDER
; EXTENSION OF THE BASIC KIM MONITOR. IT FEATURES
; TWO ROUTINES:
; LOADT - LOAD MEMORY FROM AUDIO TAPE
;
ID=00
IGNORE ID
;
ID=FF
IGNORE ID, USE SA FOR START ADDR
;
ID=01-FE USE ADDRESS ON TAPE
;
; DUMPT - STORE MEMORY ONTO AUDIO TAPE
;
ID=00
SHOULD NOT BE USED
;
ID=FF
SHOULD NOT BE USED
;
ID=01-FE NORMAL ID RANGE
;
SAL
LSB STARTING ADDRESS OF PROGRAM
;
SAH
MSB
;
EAL
ENDING ADDRESS OF PROGRAM
;
EAH
MSB
;
*=
$1800
SAD
=
$1740
6530 A DATA
PADD
=
$1741
6530 A DATA DIRECTION
SBD
=
$1742
6530 B DATA
PBDD
=
$1743
6530 B DATA DIRECTION
CLK1T =
$1744
DIV BY 1 TIME
CLK8T =
$1745
DIV BY 8 TIME
CLK64T =
$1746
DIV BY 64 TIME
CLKKT =
$1747
DIV BY 1024 TIME
CLKRDI =
$1747
READ TIME OUT BIT
CLKRDT =
$1746
READ TIME
;
** MPU REG. SAVX AREA IN PAGE 0 **
PCL
=
$EF
PROGRAM CNT LOW
PCH
=
$F0
PROGRAM CNT HI
PREG
=
$F1
CURRENT STATUS REG
SPUSER =
$F2
CURRENT STACK POINTER
ACC
=
$F3
ACCUMULATOR
YREG
=
$F4
Y INDEX
XREG
=
$F5
X INDEX
;
** KIM FIXED AREA IN PAGE 0 **
CHKHI =
$F6
CHKSUM =
$F7
INL
=
$F8
INPUT BUFFER
INH
=
$F9
INPUT BUFFER
POINTL =
$FA
LSB OF OPEN CELL
POINTH =
$FB
MSB OF OPEN CELL
TEMP
=
$FC
TMPX
=
$FD
CHAR
=
$FE
MODE
=
$FF
;
** KIM FIXED AREA IN PAGE 23 **
CHKL
=
$17E7
CHKH
=
$17E8
CHKSUM

56
57

SAVX
VEB

=
=

$17E9
$17EC

(3-BYTES)
VOLATILE EXEC BLOCK (6-B)

KIM.ASM
LINE LOC INSTR
58
59
60
61
62
63
64
65
66
67
68
69
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

1800
1802
1805
1808
180A
180D
180F
1812
1814
1816
1819
181A
181C
181E
1821
1824
1827
182A
182D
1830
1833
1836
1839
183C
183F
1841
1843
1846
1849
184C
184F
1852
1854
1856
1859
185A
185C
185E
1860
1862
1865
1868

A9
8D
20
A9
8D
A9
8D
A2
A9
20
CA
D0
A9
20
AD
20
AD
20
AD
20
AD
CD
AD
ED
90
A9
20
AD
20
AD
20
A2
A9
20
CA
D0
A9
85
85
4C
20
20

AD
EC
32
27
42
BF
43
64
16
7A
F8
2A
7A
F9
61
F5
5E
F6
5E
ED
F7
EE
F8
24
2F
7A
E7
61
E8
61
02
04
7A

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE
CNTL30
CNTH30
TIMH
SAL
SAH
EAL
EAH
ID
;
NMIV
RSTV
IRQV
;
;
DUMPT
17
19
17
17
DUMPT1
19

19
17
19
17
19
17
19
17 DUMPT2
17
17
17
19
17
19
17
19
DUMPT3
19

F8
00
FA
FB
4F 1C
EC 17 DUMPT4
5E 19

12-17-1981

Page 2

=
$17F2
TTY DELAY
=
$17F3
TTY DELAY
=
$17F4
=
$17F5
LOW STARTING ADDRESS
=
$17F6
HI STARTING ADDRESS
=
$17F7
LOW ENDING ADDRESS
=
$17F8
HI ENDING ADDRESS
=
$17F9
TAPE PROGRAM ID NUMBER
** INTERRUPT VECTORS **
=
$17FA
STOP VECTOR (STOP=1C00)
=
$17FC
RST VECTOR
=
$17FE
IRQ VECTOR (BRK=1C00)
** DUMP MEMORY
LDA #$AD
STA VEB
JSR INTVEB
LDA #$27
STA SBD
LDA #$BF
STA PBDD
LDX #$64
LDA #$16
JSR OUTCHT
DEX
BNE DUMPT1
LDA #$2A
JSR OUTCHT
LDA ID
JSR OUTBT
LDA SAL
JSR OUTBTC
LDA SAH
JSR OUTBTC
LDA VEB+1
CMP EAL
LDA VEB+2
SBC EAH
BCC DUMPT4
LDA #'/
JSR OUTCHT
LDA CHKL
JSR OUTBT
LDA CHKH
JSR OUTBT
LDX #$02
LDA #$04
JSR OUTCHT
DEX
BNE DUMPT3
LDA #$00
STA POINTL
STA POINTH
JMP START
JSR VEB
JSR OUTBTC

TO TAPE **
LOAD ABSOLUTE INST
TURN OFF DATAIN PB5
CONVERT PB7 TO OUTPUT
100 CHARS
SYNC CHARS

START CHAR
OUTPUT ID
OUTPUT STARTING
ADDRESS
CHECK FOR LAST
DATA BYTE

OUTPUT END-OF-DATA CHAR


LAST BYTE HAS BEEN
OUTPUT NOW OUTPUT
CHKSUM
2 CHARS
EOT CHAR

DISPLAY 0000
FOR NORMAL EXIT
DATA BYTE OUTPUT

1800

115 186B 20 EA 19

JSR

INCVEB

KIM.ASM
LINE LOC INSTR
116
117
118
119
120
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

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

186E 4C 33 18

1871 0F 19
1873
1875
1878
187B
187D
1880
1883
1886
1889
188C
188E
1891
1893
1896
1899
189C
189F
18A2
18A5
18A7
18A9
18AB
18AE
18B0
18B2
18B3
18B5
18B8
18BA
18BC
18BE
18C0
18C2
18C5
18C8
18CA
18CD
18CF
18D1
18D3
18D5
18D7
18DA
18DD
18E0
18E3
18E6
18E9

A9
8D
20
A9
8D
AD
8D
AD
8D
A9
8D
A9
8D
20
4E
0D
8D
AD
C9
D0
A2
20
C9
D0
CA
D0
20
C9
F0
C9
D0
F0
20
CD
F0
AD
C9
F0
C9
F0
D0
20
20
8D
20
20
8D
4C

8D
EC
32
4C
EF
71
F0
72
F1
07
42
FF
E9
41
E9
E9
E9
E9
16
ED
0A
24
16
DF

JMP
;
;
;
TAB
;
LOADT

Page 3

DUMPT2

** LOAD MEMORY FROM TAPE **


.WORD LOAD12

LDA
STA
JSR
LDA
17
STA
18
LDA
17
STA
18
LDA
17
STA
LDA
17
STA
SYNC
LDA
17
STA
1A SYNC1 JSR
17
LSR
17
ORA
17
STA
17
LDA
CMP
BNE
LDX
1A SYNC2 JSR
CMP
BNE
DEX
F6
BNE
24 1A LOADT4 JSR
2A
CMP
06
BEQ
16
CMP
D1
BNE
F3
BEQ
F3 19 LOAD11 JSR
F9 17
CMP
0D
BEQ
F9 17
LDA
00
CMP
06
BEQ
FF
CMP
17
BEQ
9C
BNE
F3 19 LOADT5 JSR
4C 19
JSR
ED 17
STA
F3 19
JSR
4C 19
JSR
EE 17
STA
F8 18
JMP
;
18EC 20 F3 19 LOADT6 JSR
17
19

12-17-1981

#$8D
VEB
INTVEB
#$4C
VEB+3
TAB
VEB+4
TAB+1
VEB+5
#$07
SBD
#$FF
SAVX
RDBIT
SAVX
SAVX
SAVX
SAVX
#$16
SYNC1
#$0A
RDCHT
#$16
SYNC
SYNC2
RDCHT
#$2A
LOAD11
#$16
SYNC
LOADT4
RDBYT
ID
LOADT5
ID
#$00
LOADT5
#$FF
LOADT6
LOADT
RDBYT
CHKT
VEB+1
RDBYT
CHKT
VEB+2
LOADT7
RDBYT

'LOAD12' ADDRESS
INIT VOLATILE EXECUTION
BLOCK WITH STA ABS.

1871
1873

JUMP TYPE RTRN

RESET PB5=0 (DATA-IN)


CLEAR SAVX FOR SYNC CHAR

1891

GET A BIT
SHIFT BIT INTO CHAR
GET NEW CHAR
SYNC CHAR
TEST FOR 10 SYNC CHARS
IF NOT 10 CHAR, RE-SYNC
LOOK FOR START OF
DATA CHAR
IF NOT , SHOULD BE SYNC
READ ID FROM TAPE
COMPARE WITH REQUESTED ID
DEFAULT 00, READ RECORD
ANYWAY
DEFAULT FF, IGNORE SA ON
TAPE
GET SA FROM TAPE
SAVX IN VEB+1,2

GET SA BUT IGNORE

18EC

173 18EF 20 4C 19

JSR

CHKT

KIM.ASM
LINE LOC INSTR
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229

18F2
18F5
18F8
18FA
18FD
18FF
1901
1904
1906
1907
1909
190C
190F
1912

20
20
A2
20
C9
F0
20
D0
CA
D0
20
4C
20
4C

1915
1918
191B
191D
1920
1923
1925
1927
1929
192B
192D
192F

20
CD
D0
20
CD
D0
A9
F0
A9
85
85
4C

1932
1935
1938
193B
193E
1940
1943
1945
1948
194B

AD
8D
AD
8D
A9
8D
A9
8D
8D
60

194C
194D
194E
1951
1954
1957
1959
195C
195D

A8
18
6D
8D
AD
69
8D
98
60

195E
1961
1962
1963
1964
1965

20
A8
4A
4A
4A
4A

F3
4C
02
24
2F
14
00
23

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

12-17-1981

Page 4

19
19

JSR RDBYT
JSR CHKT
LOADT7 LDX #$02
GET 2 CHARS
1A LOAD13 JSR RDCHT
GET CHAR (X)
CMP #$2F
LOOK FOR LAST CHAR
BEQ LOADT8
1A
JSR PACKT
CONVERT TO HEX
BNE LOADT9
Y=1 NON-HEX CHAR
DEX
F1
BNE LOAD13
4C 19
JSR CHKT
COMPARE CHECKSUM
EC 17
JMP VEB
SAVX DATA IN MEMORY
EA 19 LOAD12 JSR INCVEB
INCR DATA POINTER
F8 18
JMP LOADT7
;
F3 19 LOADT8 JSR RDBYT
END OF DATA, COMPARE CHKSUM
E7 17
CMP CHKL
0C
BNE LOADT9
F3 19
JSR RDBYT
E8 17
CMP CHKH
04
BNE LOADT9
00
LDA #$00
NORMAL EXIT
02
BEQ LOAD10
FF
LOADT9 LDA #$FF
ERROR EXIT
FA
LOAD10 STA POINTL
FB
STA POINTH
4F 1C
JMP START
;
;
** SUBROUTINES BELOW **
F5 17 INTVEB LDA SAL
MOVE SA TO VEB+1,2
ED 17
STA VEB+1
F6 17
LDA SAH
EE 17
STA VEB+2
60
LDA #$60
RTS INST
EF 17
STA VEB+3
00
LDA #$00
CLEAR CHKSUM AREA
E7 17
STA CHKL
E8 17
STA CHKH
RTS
;
** COMPUTE CHKSUM FOR TAPE LOAD **
CHKT
TAY
CLC
E7 17
ADC CHKL
E7 17
STA CHKL
E8 17
LDA CHKH
00
ADC #$00
E8 17
STA CHKH
TYA
RTS
;
** OUTPUT ONE BYTE **
4C 19 OUTBTC JSR CHKT
COMPARE CHKSUM
OUTBT TAY
SAVX DATA BYTE
LSR A
SHIFT OFF LSD
LSR A
LSR A
LSR A

1915

1932

194C

195E

230 1966 20 6F 19

JSR

HEXOUT

OUTPUT MSD

KIM.ASM
LINE LOC INSTR
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286

1969
196A
196D
196E

98
20 6F 19
98
60

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

12-17-1981

Page 5

TYA
JSR HEXOUT
OUTPUT LSD
TYA
RTS
;
** CONVERT LSD OF A TO ASCII, OUTPUT TO TAPE **
196F 29 0F
HEXOUT AND #$0F
196F
1971 C9 0A
CMP #$0A
1973 18
CLC
1974 30 02
BMI HEX1
1976 69 07
ADC #$07
1978 69 30
HEX1
ADC #$30
;
** OUTPUT TO TAPE ONE ASCII CHAR **
197A 8E E9 17 OUTCHT STX SAVX
197A
197D 8C EA 17
STY SAVX+1
1980 A0 08
LDY #$08
START BIT
1982 20 9E 19 CHT1
JSR ONE
1985 4A
LSR A
GET DATA BIT
1986 B0 06
BCS CHT2
1988 20 9E 19
JSR ONE
DATA BIT=1
198B 4C 91 19
JMP CHT3
198E 20 C4 19 CHT2
JSR ZRO
DATA BIT=0
1991 20 C4 19 CHT3
JSR ZRO
1994 88
DEY
1995 D0 EB
BNE CHT1
1997 AE E9 17
LDX SAVX
199A AC EA 17
LDY SAVX+1
199D 60
RTS
;
** OUTPUT 1 TO TAPE, 9 PULSES, 138 US EACH **
199E A2 09
ONE
LDX #$09
199E
19A0 48
PHA
SAVX A
19A1 2C 47 17 ONE1
BIT CLKRDI
WAIT FOR TIME OUT
19A1
19A4 10 FB
BPL ONE1
19A6 A9 7E
LDA #126
19A8 8D 44 17
STA CLK1T
19AB A9 A7
LDA #$A7
19AD 8D 42 17
STA SBD
SET PB7 = 1
19B0 2C 47 17 ONE2
BIT CLKRDI
19B0
19B3 10 FB
BPL ONE2
19B5 A9 7E
LDA #126
19B7 8D 44 17
STA CLK1T
19BA A9 27
LDA #$27
19BC 8D 42 17
STA SBD
RESET PB7=0
19BF CA
DEX
19C0 D0 DF
BNE ONE1
19C2 68
PLA
19C3 60
RTS
;
** OUTPUT 0 TO TAPE, 6 PULSES, 207 US EACH **
19C4 A2 06
ZRO
LDX #$06
19C4
19C6 48
PHA
SAVX A
19C7 2C 47 17 ZRO1
BIT CLKRDI
19C7
19CA 10 FB
BPL ZRO1
19CC A9 C3
LDA #$C3
19CE 8D 44 17
STA CLK1T
19D1 A9 A7
LDA #$A7
19D3 8D 42 17
STA SBD
SET PB7=1
19D6 2C 47 17 ZRO2
BIT CLKRDI

287 19D9 10 FB

BPL

ZRO2

KIM.ASM
LINE LOC INSTR
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343

19DB
19DD
19E0
19E2
19E5
19E6
19E8
19E9
19EA
19ED
19EF
19F2
19F3
19F6
19F9
19FC
19FF
1A00
1A02
1A04
1A06
1A08
1A0A
1A0C
1A0D
1A0F
1A10
1A11
1A12
1A13
1A15
1A16
1A19
1A1A
1A1C
1A1F
1A21
1A22
1A23
1A24
1A27
1A29
1A2C
1A2F
1A32
1A35
1A36
1A38
1A3B
1A3C
1A3D

A9
8D
A9
8D
CA
D0
68
60

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

C3
44 17
27
42 17
DF

;
EE ED 17 INCVEB
D0 03
EE EE 17
60
INCVE1
;
20 24 1A RDBYT
20 00 1A
20 24 1A
20 00 1A
60
;
C9 30
PACKT
30 1E
C9 47
10 1A
C9 40
30 03
18
69 09
2A
PACKT1
2A
2A
2A
A0 04
2A
PACKT2
2E E9 17
88
D0 F9
AD E9 17
A0 00
60
C8
PACKT3
60
;
;
8E EB 17 RDCHT
A2 08
20 41 1A RDCHT1
4E EA 17
0D EA 17
8D EA 17
CA
D0 F1
AD EA 17
2A
4A
AE EB 17

12-17-1981

LDA #195
STA CLK1T
LDA #$27
STA SBD
RESET PB7=0
DEX
BNE ZRO1
PLA
RESTORE A
RTS
** SUB TO INC VEB+1,2 **
INC VEB+1
BNE INCVE1
INC VEB+2
RTS
** SUB TO READ BYTE FROM TAPE **
JSR RDCHT
JSR PACKT
JSR RDCHT
JSR PACKT
RTS
** PACK A=ASCII INTO SAVX AS HEX DATA **
CMP #$30
BMI PACKT3
CMP #$47
BPL PACKT3
CMP #$40
BMI PACKT1
CLC
ADC #$09
ROL A
ROL A
ROL A
ROL A
LDY #$04
ROL A
ROL SAVX
DEY
BNE PACKT2
LDA SAVX
LDY #$00
Y=0 VALID HEX CHAR
RTS
INY
Y=1 NOT HEX
RTS
** GET 1 CHAR FROM TAPE AND RETURN WITH
CHAR IN A. USE SAVX+1 TO ASM CHAR **
STX SAVX+2
LDX #$08
READ 8 BITS
JSR RDBIT
GET NEXT DATA BIT
LSR SAVX+1
RIGHT SHIFT CHAR
ORA SAVX+1
OR IN SIGN BIT
STA SAVX+1
REPLACE CHAR
DEX
BNE RDCHT1
LDA SAVX+1
MOVE CHAR INTO A
ROL A
SHIFT OFF PARITY
LSR A
LDX SAVX+2

Page 6

19EA

19F3

1A00

1A24

344 1A40 60

RTS

KIM.ASM
LINE LOC INSTR
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
391
393
395
396
397
398
399
400
401
402
403

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

;
;
42 17 RDBIT
FB
46 17
FF
46 17
14
RDBIT3
FD
42 17 RDBIT2
FB

12-17-1981

Page 7

** THIS SUB GETS ONE BIT FROM TAPE AND


RETURNS IT IN SIGN OF A **
1A41 2C
BIT SBD
WAIT FOR END OF START BIT
1A41
1A44 10
BPL RDBIT
1A46 AD
LDA CLKRDT
GET START BIT TIME
1A49 A0
LDY #$FF
A=256-T1
1A4B 8C
STY CLK64T
SET UP TIMER
1A4E A0
LDY #$14
1A50 88
DEY
DELAY 100 MICRO SEC
1A51 D0
BNE RDBIT3
1A53 2C
BIT SBD
1A56 30
BMI RDBIT2
WAIT FOR NEXT START BIT
1A58 38
SEC
1A59 ED 46 17
SBC CLKRDT
(256-T1)-(256-T2)=T2-T1
1A5C A0 FF
LDY #$FF
1A5E 8C 46 17
STY CLK64T
SET UP TIMER FOR NEXT BIT
1A61 A0 07
LDY #$07
1A63 88
RDBIT4 DEY
DELAY 50 MICROSEC
1A64 D0 FD
BNE RDBIT4
1A66 49 FF
EOR #$FF
COMPLEMENT SIGN OF A
1A68 29 80
AND #$80
MASK ALL EXCEPT SIGN
1A6A 60
RTS
;
** PLLCAL OUTPUT 166 MICROSEC (6024 HZ)
;
PULSE STRING
1A6B A9 27
PLLCAL LDA #$27
1A6B
1A6D 8D 42 17
STA SBD
TURN OFF DATIN PB5=1
1A70 A9 BF
LDA #$BF
CONVERT PB7 TO OUTPUT
1A72 8D 43 17
STA PBDD
1A75 2C 47 17 PLL1
BIT CLKRDI
1A78 10 FB
BPL PLL1
1A7A A9 9A
LDA #154
WAIT 166 MICROSEC
1A7C 8D 44 17
STA CLK1T
1A7F A9 A7
LDA #$A7
OUTPUT PB7=1
1A81 8D 42 17
STA SBD
1A84 2C 47 17 PLL2
BIT CLKRDI
1A87 10 FB
BPL PLL2
1A89 A9 9A
LDA #154
1A8B 8D 44 17
STA CLK1T
1A8E A9 27
LDA #$27
PB7=0
1A90 8D 42 17
STA SBD
1A93 4C 75 1A
JMP PLL1
;
;
** INTERRUPTS **
*=
$1BFA
1BFA 6B 1A
NMIP27 .WORD PLLCAL
1BFC 6B 1A
RSTP27 .WORD PLLCAL
1BFE 6B 1A
IRQP27 .WORD PLLCAL
;
;******************* 6530-002 I.C. *****************
;
** COPYRIGHT MOS TECHNOLOGY INC.
;
DATE OCT 13, 1975 REV E
;
;
** KIM **
;
TTY INTERFACE 6530-002
;
KEYBOARD INTERFACE,
;
7-SEGMENT 6-DIGIT DISPLAY

404

KIM.ASM
LINE LOC INSTR
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;

1C00
1C02
1C03
1C05
1C06
1C08
1C0A
1C0B
1C0D
1C0F
1C11
1C13
1C14
1C16
1C19

85
68
85
68
85
85
68
85
85
84
86
BA
86
20
4C

1C1C
1C1F
1C22
1C24
1C25
1C27
1C2A
1C2C
1C2F
1C31
1C34
1C36
1C38
1C3A
1C3B
1C3D
1C3F
1C42
1C45

6C
6C
A2
9A
86
20
A9
8D
A9
2C
D0
30
A9
18
69
90
EE
AC
10

F3

SAVE

F1
EF
FA
F0
FB
F4
F5
F2
88 1E
4F 1C
;
FA 17 NMIT
FE 17 IRQT
FF
RST
F2
88 1E
FF
F3 17
01
40 17 DET1
19
F9
FC
DET3
01
03
F3 17
40 17 DET2
F3

12-17-1981

Page 8

TTY COMANDS:
G
GOEXEC
CR OPEN NEXT CELL
LF OPEN PREVIOUS CELL
.
MODIFY OPEN CELL
SP OPEN NEW CELL
L
LOAD (OBJECT FORMAT)
Q
DUMP FROM OPEN CELL ADDR TO HI LIMIT
RO RUB OUT - RETURN TO START KIM
(ALL ILLEGAL CHARS ARE IGNORED)
KEYBOARD COMMANDS:
ADDR SETS MODE TO MODIFY CELL ADDRESS
DATA SETS MODE TO MODIFY DATA IN OPEN CELL
STEP INCREMENTS TO NEXT CELL
RST SYSTEM RESET
RUN GOEXEC
STOP $1C00 CAN BE LOADED INTO NMIV TO USE
PC
DISPLAY PC (PROGRAM COUNTER)
*=
STA
PLA
STA
PLA
STA
STA
PLA
STA
STA
STY
STX
TSX
STX
JSR
JMP

$1C00
ACC

JMP
JMP
LDX
TXS
STX
JSR
LDA
STA
LDA
BIT
BNE
BMI
LDA
CLC
ADC
BCC
INC
LDY
BPL

KIM ENTRY VIA STOP (NMI)


OR BRK (IRQ)

1C00

KIM ENTRY VIA JSR (A LOST)

1C05

(NMIV)
(IRQV)
#$FF

NON-MASKABLE INTERRUPT TRAP


INTERRUPT TRAP
KIM ENTRY VIA RST

1C1C
1C1F
1C22

SPUSER
INITS
#$FF
CNTH30
#$01
SAD
START
DET1
#$FC

COUNT START BIT


ZERO CNTH30
MASK HI ORDER BITS
TEST
KEYBD SSW TEST
START BIT TEST

1C31

THIS LOOP COUNTS


THE START BIT TIME

1C3A

CHECK FOR END OF START BIT

1C42

PREG
PCL
POINTL
PCH
POINTH
YREG
XREG
SPUSER
INITS
START

#$01
DET2
CNTH30
SAD
DET3

461 1C47 8D F2 17

STA

CNTL30

KIM.ASM
LINE LOC INSTR
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

1C4A A2 08
1C4C 20 6A 1E
1C4F
1C52
1C54
1C57
1C59
1C5C
1C5E
1C61

20
A9
2C
D0
20
A2
20
4C

1C64
1C66
1C68
1C6A
1C6D
1C6F
1C71
1C74

A9
85
85
20
C9
F0
20
4C

1C77
1C7A
1C7C
1C7E
1C81
1C83
1C86
1C88
1C8B
1C8D
1C90
1C92
1C94
1C96
1C98
1C9A
1C9C
1C9E
1CA0
1CA2
1CA4
1CA6
1CA8
1CA9
1CAA
1CAB
1CAC
1CAE
1CB0
1CB2
1CB4
1CB6
1CB8
1CB9
1CBB

20
D0
A9
2C
F0
20
F0
20
F0
20
C9
10
C9
F0
C9
F0
C9
F0
C9
F0
C9
F0
0A
0A
0A
0A
85
A2
A4
D0
B1
06
2A
91
4C

;
8C 1E START
01
40 17
1E
2F 1E
0A
31 1E
AF 1D
;
00
CLEAR
F8
F9
5A 1E READ
01
06
AC 1F
DB 1D
;
19 1F TTYKB
D3
01
TTYKB1
40 17
CC
19 1F
F4
19 1F
EF
6A 1F
15
BB
14
44
10
2C
11
2C
12
2F
13
31

FC
04
FF
0A
FA
FC
FA
C3 1C

DATA1

LDX #$08
JSR GET5
** MAKE TTY/KB
JSR INIT1
LDA #$01
BIT SAD
BNE TTYKB
JSR CRLF
LDX #$0A
JSR PRTST
JMP SHOW1

12-17-1981

Page 9

GET REST OF THE CHAR, TEST CHAR


SELECTION **
1C4F

PRT CR LF
TYPE OUT KIM

LDA #$00
STA INL
CLEAR INPUT BUFFER
STA INH
JSR GETCH
GET CHAR
CMP #$01
BEQ TTYKB
JSR PACK
JMP SCAN
** MAIN ROUTINE FOR KEYBOARD AND DISPLAY **
JSR SCAND
IF A=0 NO KEY
BNE START
LDA #$01
BIT SAD
BEQ START
JSR SCAND
BEQ TTYKB1
JSR SCAND
BEQ TTYKB1
JSR GETKEY
CMP #$15
BPL START
CMP #$14
BEQ PCCMD
DISPLAY PC
CMP #$10
ADDR MODE=1
BEQ ADDRM
CMP #$11
DATA MODE=1
BEQ DATAM
CMP #$12
STEP
BEQ STEP
CMP #$13
RUN
BEQ GOV
ASL A
SHIFT CHAR INTO HIGH
ASL A
ORDER NIBBLE
ASL A
ASL A
STA TEMP
STORE IN TEMP
LDX #$04
LDY MODE
TEST MODE 1=ADDR
BNE ADDR
MODE=0 DATA
LDA (POINTL),Y GET DATA
ASL TEMP
SHIFT CHAR
ROL A
SHIFT DATA
STA (POINTL),Y STORE OUT DATA
JMP DATA2

1C77

518

KIM.ASM
LINE LOC INSTR
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574

1CBE
1CBF
1CC1
1CC3
1CC4
1CC6
1CC8
1CCA
1CCC
1CCE
1CD0

0A
26
26
CA
D0
F0
A9
D0
A9
85
4C

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

12-17-1981

ADDR

FA
FB
EA
08
01
02
00
FF
4F

1CD3 20 63
1CD6 4C 4F
1CD9 4C C8
1CDC
1CDE
1CE0
1CE2
1CE4

A5
85
A5
85
4C

EF
FA
F0
FB
4F

1CE7
1CEA
1CEC
1CEE
1CF0
1CF2
1CF4
1CF7
1CF8
1CFB
1CFE
1D00
1D03
1D06
1D08
1D0B
1D0C
1D0E
1D11
1D13
1D16
1D19
1D1A
1D1C
1D1D
1D20
1D22
1D24
1D27
1D29
1D2B
1D2C
1D2E

20
C9
D0
A9
85
85
20
AA
20
20
85
20
20
85
20
8A
F0
20
91
20
20
CA
D0
E8
20
C5
D0
20
C5
D0
8A
D0
A2

5A
3B
F9
00
F7
F6
9D
91
9D
FB
91
9D
FA
91
0F
9D
FA
91
63
F2
9D
F6
17
9D
F7
13
B9
0C

ASL A
SHIFT CHAR
ROL POINTL
SHIFT ADDR
ROL POINTH
SHIFT ADDR HI
DATA2 DEX
BNE DATA1
DO 4 TIMES
BEQ DATAM2
EXIT HERE
ADDRM LDA #$01
BNE DATAM1
DATAM LDA #$00
DATAM1 STA MODE
1C DATAM2 JMP START
;
1F STEP
JSR INCPT
1C
JMP START
;
1D GOV
JMP GOEXEC
;
** DISPLAY PC BY MOVING PC TO POINT **
PCCMD LDA PCL
STA POINTL
LDA PCH
STA POINTH
1C
JMP START
;
** LOAD PAPER TAPE FROM TTY **
1E LOAD
JSR GETCH
LOOK FOR FIRST CHAR
CMP #$3B
SEMICOLON
BNE LOAD
LDA #$00
STA CHKSUM
STA CHKHI
1F
JSR GETBYT
GET BYTE COUNT
TAX
SAVE IN X INDEX
1F
JSR CHK
COMPUTE CHECKSUM
1F
JSR GETBYT
GET ADDRESS HI
STA POINTH
1F
JSR CHK
1F
JSR GETBYT
GET ADDRESS LO
STA POINTL
1F
JSR CHK
TXA
IF CNT=0 DONT
BEQ LOAD3
GET ANY DATA
1F LOAD2 JSR GETBYT
GET DATA
STA (POINTL),Y STORE DATA
1F
JSR CHK
1F
JSR INCPT
NEXT ADDRESS
DEX
BNE LOAD2
INX
X=1 DATA RCD X=0 LAST RCD
1F LOAD3 JSR GETBYT
COMPARE CHKSUM
CMP CHKHI
BNE LOADE1
1F
JSR GETBYT
CMP CHKSUM
BNE LOADER
TXA
X=0 LAST RECORD
BNE LOAD
LDX #$0C
X-OFF KIM

Page 10

1CD3
1CD9
1CDC

1CE7

575 1D30 A9 27

LOAD8

LDA

#$27

KIM.ASM
LINE LOC INSTR
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631

1D32 8D 42 17
1D35 20 31 1E
1D38 4C 4F 1C

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE
STA
JSR
JMP

SBD
PRTST
START

12-17-1981

Page 11

DISABLE DATA IN

;
1D3B 20 9D 1F LOADE1 JSR GETBYT
DUMMY
1D3E A2 11
LOADER LDX #$11
X-OFF ERR KIM
1D40 D0 EE
BNE LOAD8
;
** DUMP TO TTY FROM OPEN CELL ADDRESS TO
;
LIMHL, LIMHH **
1D42 A9 00
DUMP
LDA #$00
1D44 85 F8
STA INL
1D46 85 F9
STA INH
CLEAR RECORD COUNT
1D48 A9 00
DUMP0 LDA #$00
1D4A 85 F6
STA CHKHI
CLEAR CHKSUM
1D4C 85 F7
STA CHKSUM
1D4E 20 2F 1E
JSR CRLF
PRINT CR LF
1D51 A9 3B
LDA #$3B
PRINT SEMICOLON
1D53 20 A0 1E
JSR OUTCH
1D56 A5 FA
LDA POINTL
TEST POINT GT OR ET
1D58 CD F7 17
CMP EAL
HI LIMIT GOTO EXIT
1D5B A5 FB
LDA POINTH
1D5D ED F8 17
SBC EAH
1D60 90 18
BCC DUMP4
1D62 A9 00
LDA #$00
PRINT LAST RECORD
1D64 20 3B 1E
JSR PRTBYT
0 BYTES
1D67 20 CC 1F
JSR OPEN
1D6A 20 1E 1E
JSR PRTPNT
1D6D A5 F6
LDA CHKHI
PRINT CHKSUM
1D6F 20 3B 1E
JSR PRTBYT
FOR LAST RECORD
1D72 A5 F7
LDA CHKSUM
1D74 20 3B 1E
JSR PRTBYT
1D77 4C 64 1C
JMP CLEAR
;
1D7A A9 18
DUMP4 LDA #$18
PRINT 24 BYTE COUNT
1D7C AA
TAX
SAVE AS INDEX
1D7D 20 3B 1E
JSR PRTBYT
1D80 20 91 1F
JSR CHK
1D83 20 1E 1E
JSR PRTPNT
1D86 A0 00
DUMP2 LDY #$00
PRINT 24 BYTES
1D88 B1 FA
LDA (POINTL),Y GET DATA
1D8A 20 3B 1E
JSR PRTBYT
PRINT DATA
1D8D 20 91 1F
JSR CHK
COMPUTE CHKSUM
1D90 20 63 1F
JSR INCPT
INCREMENT POINT
1D93 CA
DEX
1D94 D0 F0
BNE DUMP2
1D96 A5 F6
LDA CHKHI
PRINT CHKSUM
1D98 20 3B 1E
JSR PRTBYT
1D9B A5 F7
LDA CHKSUM
1D9D 20 3B 1E
JSR PRTBYT
1DA0 E6 F8
INC INL
INCR RECORD COUNT
1DA2 D0 02
BNE DUMP3
1DA4 E6 F9
INC INH
1DA6 4C 48 1D DUMP3 JMP DUMP0
;
1DA9 20 CC 1F SPACE JSR OPEN
OPEN NEW CELL
1DAC 20 2F 1E SHOW
JSR CRLF
PRINT CR LF

1D42

1D7A

1DA9

632 1DAF 20 1E 1E SHOW1

JSR

PRTPNT

KIM.ASM
LINE LOC INSTR
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688

1DB2
1DB5
1DB7
1DB9
1DBC
1DBF

20
A0
B1
20
20
4C

9E
00
FA
3B
9E
64

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE
1E
1E
1E
1C

;
1DC2 20 63 1F RTRN
1DC5 4C AC 1D
;
1DC8 A6 F2
GOEXEC
1DCA 9A
1DCB A5 FB
1DCD 48
1DCE A5 FA
1DD0 48
1DD1 A5 F1
1DD3 48
1DD4 A6 F5
1DD6 A4 F4
1DD8 A5 F3
1DDA 40
;
1DDB C9 20
SCAN
1DDD F0 CA
1DDF C9 7F
1DE1 F0 1B
1DE3 C9 0D
1DE5 F0 DB
1DE7 C9 0A
1DE9 F0 1C
1DEB C9 2E
1DED F0 26
1DEF C9 47
1DF1 F0 D5
1DF3 C9 51
1DF5 F0 0A
1DF7 C9 4C
1DF9 F0 09
1DFB 4C 6A 1C
;
1DFE 4C 4F 1C STV
1E01 4C 42 1D DUMPV
1E04 4C E7 1C LOADV
;
1E07 38
FEED
1E08 A5 FA
1E0A E9 01
1E0C 85 FA
1E0E B0 02
1E10 C6 FB
1E12 4C AC 1D FEED1
;
1E15 A0 00
MODIFY
1E17 A5 F8
1E19 91 FA

12-17-1981

Page 12

JSR
LDY
LDA
JSR
JSR
JMP

OUTSP
PRINT SPACE
#$00
PRINT DATA SPECIFIED
(POINTL),Y BY POINT AD=LDA EXT
PRTBYT
OUTSP
PRINT SPACE
CLEAR

JSR
JMP

INCPT
SHOW

LDX
TXS
LDA
PHA
LDA
PHA
LDA
PHA
LDX
LDY
LDA
RTI

SPUSER

XREG
YREG
ACC

RESTORE REGS

CMP
BEQ
CMP
BEQ
CMP
BEQ
CMP
BEQ
CMP
BEQ
CMP
BEQ
CMP
BEQ
CMP
BEQ
JMP

#$20
SPACE
#$7F
STV
#$0D
RTRN
#$0A
FEED
#'.
MODIFY
#'G
GOEXEC
#'Q
DUMPV
#'L
LOADV
READ

OPEN CELL

JMP
JMP
JMP

START
DUMP
LOAD

SEC
LDA
SBC
STA
BCS
DEC
JMP

POINTL
#$01
POINTL
FEED1
POINTH
SHOW

LDY
LDA
STA

#$00
GET CONTENTS OF INPUT BUFF
INL
INL AND STORE IN LOC
(POINTL),Y SPECIFIED BY POINT

POINTH

OPEN NEXT CELL

1DC2
1DC8

PROGRAM RUNS FROM


OPEN CELL ADDRESS

POINTL
PREG

RUB OUT (KIM)


NEXT CELL
PREV CELL
MODIFY CELL
GO EXEC
DUMP FROM OPEN CELL TO HI LIMIT
LOAD TAPE
IGNORE ILLEGAL CHAR

1E07
DEC DOUBLE BYTE
AT POINTL AND POINTH

689 1E1B 4C C2 1D

JMP

RTRN

KIM.ASM
LINE LOC INSTR
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

1E1E
1E20
1E23
1E26
1E28
1E2B
1E2E

A5
20
20
A5
20
20
60

FB
3B
91
FA
3B
91

1E2F
1E31
1E34
1E37
1E38
1E3A

A2
BD
20
CA
10
60

07
D5 1F
A0 1E

1E3B
1E3D
1E3E
1E3F
1E40
1E41
1E44
1E46
1E49
1E4B
1E4C
1E4E
1E50
1E51
1E53
1E55
1E57

85
4A
4A
4A
4A
20
A5
20
A5
60
29
C9
18
30
69
69
4C

FC

1E5A
1E5C
1E5E
1E60
1E63
1E65
1E67
1E6A
1E6D
1E70
1E72
1E74
1E76
1E78
1E7B
1E7C
1E7E
1E81
1E83
1E85
1E86

86
A2
A9
2C
D0
30
20
20
AD
29
46
05
85
20
CA
D0
20
A6
A5
2A
4A

FD
08
01
40
22
F9
D4
EB
40
80
FE
FE
FE
D4

1E
1F
1E
1F

F7

4C 1E
FC
4C 1E
FC
0F
0A
02
07
30
A0 1E

17
1E
1E
17

1E

EF
EB 1E
FD
FE

12-17-1981

Page 13

;
;
** SUBROUTINES FOLLOW **
PRTPNT LDA POINTH
PRINT POINTL, POINTH
1E1E
JSR PRTBYT
JSR CHK
LDA POINTL
JSR PRTBYT
JSR CHK
RTS
;
**PRINT STRING OF ASCII CHARS FROM TOP+X TO TOP
CRLF
LDX #$07
PRTST LDA TOP,X
JSR OUTCH
DEX
BPL PRTST
STOP ON INDEX ZERO
RTS
;
** PRINT 1 HEX BYTE AS 2 ASCII CHARS **
PRTBYT STA TEMP
1E3B
LSR A
SHIFT CHAR RIGHT 4 BITS
LSR A
LSR A
LSR A
JSR HEXTA
CONVERT TO HEX AND PRINT
LDA TEMP
GET OTHER HALF
JSR HEXTA
CONVERT TO HEX AND PRINT
LDA TEMP
RESTORE BYTE IN A AND RETURN
RTS
HEXTA AND #$0F
MASK HI 4 BITS
CMP #$0A
CLC
BMI HEXTA1
ADC #$07
ALPHA HEX
HEXTA1 ADC #$30
DEC HEX
JMP OUTCH
PRINT CHAR
;
** GET 1 CHAR FROM TTY, CHAR IN A
GETCH STX TMPX
SAVE X REG
1E5A
LDX #$08
SET UP 8-BIT COUNT
LDA #$01
GET1
BIT SAD
BNE GET6
BMI GET1
WAIT FOR START BIT
JSR DELAY
DELAY 1 BIT
GET5
JSR DEHALF
DELAY 1/2 BIT TIME
GET2
LDA SAD
GET 8 BITS
AND #$80
MASK OFF LOW ORDER BITS
LSR CHAR
SHIFT RIGHT CHAR
ORA CHAR
STA CHAR
JSR DELAY
DELAY 1 BIT TIME
DEX
BNE GET2
GET NEXT CHAR
JSR DEHALF
EXIT THIS ROUTINE
LDX TMPX
LDA CHAR
ROL A SHIFT OFF PARITY
LSR A

746 1E87 60

GET6

RTS

KIM.ASM
LINE LOC INSTR
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

Page 14

** INITIALIZATION FOR SIGMA **


LDX #$01
SET KB MODE TO ADDR
STX MODE
LDX #$00
STX PADD
FOR SIGMA USE SADD
LDX #$3F
STX PBDD
FOR SIGMA USE SBDD
LDX #$07
ENABLE DATA IN
STX SBD
OUTPUT
CLD
SEI
RTS
;
** PRINT ONE CHAR IN A **
1E9E A9 20
OUTSP LDA #$20
PRINT SPACE
1EA0 85 FE
OUTCH STA CHAR
1EA2 86 FD
STX TMPX
1EA4 20 D4 1E
JSR DELAY
DELAY 10/11 BIT CODE SYNC
1EA7 AD 42 17
LDA SBD
START BIT
1EAA 29 FE
AND #$FE
1EAC 8D 42 17
STA SBD
1EAF 20 D4 1E
JSR DELAY
1EB2 A2 08
LDX #$08
1EB4 AD 42 17 OUT1
LDA SBD
DATA BIT
1EB7 29 FE
AND #$FE
1EB9 46 FE
LSR CHAR
1EBB 69 00
ADC #$00
1EBD 8D 42 17
STA SBD
1EC0 20 D4 1E
JSR DELAY
1EC3 CA
DEX
1EC4 D0 EE
BNE OUT1
1EC6 AD 42 17
LDA SBD
STOP BIT
1EC9 09 01
ORA #$01
1ECB 8D 42 17
STA SBD
1ECE 20 D4 1E
JSR DELAY
STOP BIT
1ED1 A6 FD
LDX TMPX
RESTORE INDEX
1ED3 60
RTS
;
** DELAY 1 BIT TIME **
1ED4 AD F3 17 DELAY LDA CNTH30
1ED7 8D F4 17
STA TIMH
1EDA AD F2 17
LDA CNTL30
1EDD 38
DE2
SEC
1EDE E9 01
DE4
SBC #$01
1EE0 B0 03
BCS DE3
1EE2 CE F4 17
DEC TIMH
1EE5 AC F4 17 DE3
LDY TIMH
1EE8 10 F3
BPL DE2
1EEA 60
RTS
;
** DELAY 1/2 BIT TIME **
1EEB AD F3 17 DEHALF LDA CNTH30
1EEE 8D F4 17
STA TIMH
1EF1 AD F2 17
LDA CNTL30
1EF4 4A
LSR A
1EF5 4E F4 17
LSR TIMH
1EF8 90 E3
BCC DE2
1EFA 09 80
ORA #$80
1EFC B0 E0
BCS DE4
1E88
1E8A
1E8C
1E8E
1E91
1E93
1E96
1E98
1E9B
1E9C
1E9D

A2
86
A2
8E
A2
8E
A2
8E
D8
78
60

;
01
INITS
FF
00
INIT1
41 17
3F
43 17
07
42 17

12-17-1981

1E88

1E9E

1ED4

1EEB

803

** SUB TO DETERMINE IF KEY IS DEPRESSED OR

KIM.ASM
LINE LOC INSTR
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE
;
;
;
AK

12-17-1981

Page 15

CONDITION OF SSW KEY NOT DEPRESSED OR


TTY MODE A=0
KEY DEPRESSED OR KB MODE A NOT ZERO
1EFE A0 03
LDY #$03
3 ROWS
1F00 A2 01
LDX #$01
DIGIT 0
1F02 A9 FF
ONEKEY LDA #$FF
1F04 8E 42 17 AK1
STX SBD
OUTPUT DIGIT
1F07 E8
INX
GET NEXT DIGIT
1F08 E8
INX
1F09 2D 40 17
AND SAD
INPUT SEGMENTS
1F0C 88
DEY
1F0D D0 F5
BNE AK1
1F0F A0 07
LDY #$07
1F11 8C 42 17
STY SBD
1F14 09 80
ORA #$80
1F16 49 FF
EOR #$FF
1F18 60
RTS
;
** OUTPUT TO 7-SEGMENT DISPLAY **
1F19 A0 00
SCAND LDY #$00
GET DATA
1F19
1F1B B1 FA
LDA (POINTL),Y SPECIFIED BY POINT
1F1D 85 F9
STA INH
SET UP DISPLAY BUFFER
1F1F A9 7F
LDA #$7F
CHANGE SEG
1F21 8D 41 17
STA PADD
TO OUTPUT
1F24 A2 09
LDX #$09
INIT DIGIT NUMBER
1F26 A0 03
LDY #$03
OUTPUT 3 BYTES
1F28 B9 F8 00 SCAND1 LDA INL,Y
GET BYTE
1F2B 4A
LSR A
GET MSD
1F2C 4A
LSR A
1F2D 4A
LSR A
1F2E 4A
LSR A
1F2F 20 48 1F
JSR CONVD
OUTPUT CHAR
1F32 B9 F8 00
LDA INL,Y
GET BYTE AGAIN
1F35 29 0F
AND #$0F
GET LSD
1F37 20 48 1F
JSR CONVD
OUTPUT CHAR
1F3A 88
DEY
SET UP FOR NEXT BYTE
1F3B D0 EB
BNE SCAND1
1F3D 8E 42 17
STX SBD
ALL DIGITS OFF
1F40 A9 00
LDA #$00
CHANGE SEGMENT
1F42 8D 41 17
STA PADD
TO INPUTS
1F45 4C FE 1E
JMP AK
GET ANY KEY
;
** CONVERT AND DISPLAY HEX (USED BY SCAND ONLY)**
1F48 84 FC
CONVD STY TEMP
1F4A A8
TAY
SAVE Y
1F4B B9 E7 1F
LDA TABLE,Y USE CHAR AS INDEX
1F4E A0 00
LDY #$00
LOOKUP CONVERSION
1F50 8C 40 17
STY SAD
TURN OFF SEGMENTS
1F53 8E 42 17
STX SBD
OUTPUT DIGIT ENABLE
1F56 8D 40 17
STA SAD
OUTPUT SEGMENTS
1F59 A0 7F
LDY #$7F
DELAY 500 CYCLES
1F5B 88
CONVD1 DEY
1F5C D0 FD
BNE CONVD1
1F5E E8
INX
GET NEXT DIGIT NUMBER
1F5F E8
INX
ADD 2
1F60 A4 FC
LDY TEMP
RESTORE Y
1F62 60
RTS
;
** INCREMENT POINT **

860 1F63 E6 FA

INCPT

INC

POINTL

KIM.ASM
LINE LOC INSTR
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

1F65 D0 02
1F67 E6 FB
1F69 60
1F6A
1F6C
1F6E
1F71
1F73
1F75
1F77
1F79
1F7A
1F7C
1F7D
1F7F
1F80
1F82
1F83
1F85
1F86
1F87
1F88
1F8A
1F8B
1F8D
1F8E
1F90

A2
A0
20
D0
E0
D0
A9
60
A0
0A
B0
C8
10
8A
29
4A
AA
98
10
18
69
CA
D0
60

21
01
02 1F
07
27
F5
15

1F91
1F92
1F94
1F96
1F98
1F9A
1F9C

18
65
85
A5
69
85
60

F7
F7
F6
00
F6

1F9D
1FA0
1FA3
1FA6
1FA9
1FAB

20
20
20
20
A5
60

5A
AC
5A
AC
F8

1FAC
1FAE
1FB0
1FB2
1FB4
1FB6
1FB8
1FB9
1FBB
1FBC
1FBD
1FBE

C9
30
C9
10
C9
30
18
69
2A
2A
2A
2A

30
1B
47
17
40
03

FF

INCPT2
;
GETKEY
GETKE5

KEYIN
KEYIN1

03
FA
KEYIN2
0F

03
KEYIN3
07
KEYIN4
FA
;
CHK

;
1E GETBYT
1F
1E
1F
;
PACK

09
UPDATE

12-17-1981

Page 16

BNE INCPT2
INC POINTH
RTS
** GET KEY FROM KEYPAD A=KEYVALUE **
LDX #$21
START AT DIGIT 0
1F6A
LDY #$01
GET 1 ROW
JSR ONEKEY
BNE KEYIN
A=0 NO KEY
CPX #$27
TEST FOR DIGIT 2
BNE GETKE5
LDA #$15
15=NOKEY
RTS
LDY #$FF
ASL A
SHIFT LEFT
BCS KEYIN2
UNTIL Y=KEY NO
INY
BPL KEYIN1
TXA
AND #$0F
MASK MSD
LSR A
DIVIDE BY 2
TAX
TYA
BPL KEYIN4
CLC
ADC #$07
MULT (X-1 TIMES A
DEX
BNE KEYIN3
RTS
** COMPUTE CHECKSUM **
CLC
ADC CHKSUM
STA CHKSUM
LDA CHKHI
ADC #$00
STA CHKHI
RTS
** GET 2 HEX CHARS AND PACK INTO INL AND INH **
JSR GETCH
JSR PACK
JSR GETCH
JSR PACK
LDA INL
RTS
** SHIFT CHAR IN A INTO INL AND INH **
CMP #$30
CHECK FOR HEX 1FAC
BMI UPDAT2
CMP #$47
NOT HEX EXIT
BPL UPDAT2
CMP #$40
CONVERT TO HEX
BMI UPDATE
CLC
ADC #$09
ROL A
ROL A
ROL A
ROL A

917 1FBF A0 04

LDY

#$04

SHIFT INTO I/O BUFFER

KIM.ASM
LINE LOC INSTR
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
938
939
940
941
942
944
945
946
947
948
950
951
952
953
955
956
957
958
960
961
962
963
965
967
969

1FC1
1FC2
1FC4
1FC6
1FC7
1FC9
1FCB

2A
26
26
88
D0
A9
60

1FCC
1FCE
1FD0
1FD2
1FD4

A5
85
A5
85
60

F8
FA
F9
FB

1FD5
1FD7
1FD9
1FDB
1FDD
1FDE
1FDF
1FE0
1FE1
1FE2
1FE3
1FE4
1FE5
1FE6
1FE7
1FE9
1FEB
1FED
1FEF
1FF1
1FF3
1FF5

00
00
00
0A
4D
49
4B
20
13
52
52
45
20
13
BF
DB
E6
FD
FF
F7
B9
F9

00
00
00
0D

F8
F9
F8
00

86
CF
ED
87
EF
FC
DE
F1

6502 CROSS-ASSEMBLER ver 1.0rmb


SOURCE CODE

UPDAT1 ROL A
ROL INL
ROL INH
DEY
BNE UPDAT1
LDA #$00
A=0 IF HEX NUM
UPDAT2 RTS
;
OPEN
LDA INL
MOVE I/O BUFFER TO POINT
STA POINTL
LDA INH
TRANSFER INH- POINTH
STA POINTH
RTS
;
;
** TABLES **
TOP
.DBYTE $0000,$0000,$0000,$0A0D

TABLE

.BYTE 'M,'I,'K,$20,$13

KIM

.BYTE 'R,'R,'E,$20,$13

ERR

.DBYTE $BF86,$DBCF,$E6ED,$FD87 ;0-7

Page 17

1FD5

1FE7

.DBYTE $FFEF,$F7FC,$B9DE,$F9F1 ;8-F HEX TO 7-SEG

;
;
1FFA 1C 1C
1FFC 22 1C
1FFE 1F 1C

12-17-1981

** INTERRUPT VECTORS **
*=
$1FFA
NMIENT .WORD NMIT
RSTENT .WORD RST
IRQENT .WORD IRQT
.END

No Errors found above.

KIM.ASM
ACC
00F3
DET3
ADDR 1CBE
DUMP
ADDRM 1CC8
DUMP0
AK
1EFE
DUMP2
AK1
1F04
DUMP3
CHAR 00FE
DUMP4
CHK
1F91
DUMPT
CHKH 17E8
DUMPT1
CHKHI 00F6
DUMPT2
CHKL 17E7
DUMPT3
CHKSUM 00F7
DUMPT4
CHKT 194C
DUMPV
CHT1 1982
EAH
CHT2 198E
EAL
CHT3 1991
FEED
CLEAR 1C64
FEED1
CLK1T 1744
GET1
CLK64T 1746
GET2
CLK8T 1745
GET5
CLKKT 1747
GET6
CLKRDI 1747
GETBYT
CLKRDT 1746
GETCH
CNTH30 17F3
GETKE5
CNTL30 17F2
GETKEY
CONVD 1F48
GOEXEC
CONVD1 1F5B
GOV
CRLF 1E2F
HEX1
DATA1 1CB0
HEXOUT
DATA2 1CC3
HEXTA
DATAM 1CCC
HEXTA1
DATAM1 1CCE
ID
DATAM2 1CD0
INCPT
DE2
1EDD
INCPT2
DE3
1EE5
INCVE1
DE4
1EDE
INCVEB
DEHALF 1EEB
INH
DELAY 1ED4
INIT1
DET1 1C31
INITS
DET2 1C42
INL
191 Labels listed

SYMBOL TABLE DUMP


1C3A
1D42
1D48
1D86
1DA6
1D7A
1800
1814
1833
1854
1865
1E01
17F8
17F7
1E07
1E12
1E60
1E6D
1E6A
1E87
1F9D
1E5A
1F6C
1F6A
1DC8
1CD9
1978
196F
1E4C
1E55
17F9
1F63
1F69
19F2
19EA
00F9
1E8C
1E88
00F8

INTVEB
IRQENT
IRQP27
IRQT
IRQV
KEYIN
KEYIN1
KEYIN2
KEYIN3
KEYIN4
LOAD
LOAD10
LOAD11
LOAD12
LOAD13
LOAD2
LOAD3
LOAD8
LOADE1
LOADER
LOADT
LOADT4
LOADT5
LOADT6
LOADT7
LOADT8
LOADT9
LOADV
MODE
MODIFY
NMIENT
NMIP27
NMIT
NMIV
ONE
ONE1
ONE2
ONEKEY
OPEN

1932
1FFE
1BFE
1C1F
17FE
1F7A
1F7C
1F82
1F8A
1F8D
1CE7
192B
18C2
190F
18FA
1D0E
1D1D
1D30
1D3B
1D3E
1873
18B5
18D7
18EC
18F8
1915
1929
1E04
00FF
1E15
1FFA
1BFA
1C1C
17FA
199E
19A1
19B0
1F02
1FCC

OUT1
OUTBT
OUTBTC
OUTCH
OUTCHT
OUTSP
PACK
PACKT
PACKT1
PACKT2
PACKT3
PADD
PBDD
PCCMD
PCH
PCL
PLL1
PLL2
PLLCAL
POINTH
POINTL
PREG
PRTBYT
PRTPNT
PRTST
RDBIT
RDBIT2
RDBIT3
RDBIT4
RDBYT
RDCHT
RDCHT1
READ
RST
RSTENT
RSTP27
RSTV
RTRN
SAD

1EB4
1961
195E
1EA0
197A
1E9E
1FAC
1A00
1A0F
1A15
1A22
1741
1743
1CDC
00F0
00EF
1A75
1A84
1A6B
00FB
00FA
00F1
1E3B
1E1E
1E31
1A41
1A53
1A50
1A63
19F3
1A24
1A29
1C6A
1C22
1FFC
1BFC
17FC
1DC2
1740

SAH
SAL
SAVE
SAVX
SBD
SCAN
SCAND
SCAND1
SHOW
SHOW1
SPACE
SPUSER
START
STEP
STV
SYNC
SYNC1
SYNC2
TAB
TABLE
TEMP
TIMH
TMPX
TOP
TTYKB
TTYKB1
UPDAT1
UPDAT2
UPDATE
VEB
XREG
YREG
ZRO
ZRO1
ZRO2

17F6
17F5
1C00
17E9
1742
1DDB
1F19
1F28
1DAC
1DAF
1DA9
00F2
1C4F
1CD3
1DFE
1891
1896
18AB
1871
1FE7
00FC
17F4
00FD
1FD5
1C77
1C7C
1FC1
1FCB
1FBB
17EC
00F5
00F4
19C4
19C7
19D6