Skip to content

Instantly share code, notes, and snippets.

@jblang
Created February 11, 2017 05:26
Show Gist options
  • Save jblang/0f4cbfd64b484d1c4cf4b6d1b86a4fda to your computer and use it in GitHub Desktop.
Save jblang/0f4cbfd64b484d1c4cf4b6d1b86a4fda to your computer and use it in GitHub Desktop.
;
; **** ZP FIELDS ****
;
f24 = $24
RESHO = $26
FRETOP = $33
CAS1 = $C0
CURCMD = $C1
CURCMDH = $C2
;
; **** ZP ABSOLUTE ADRESSES ****
;
PCH = $02
PCL = $03
SR = $04
ACC = $05
XR = $06
YR = $07
SP = $08
COUNT = $0B
DIMFLG = $0C
VALTYP = $0D
INTFLG = $0E
GARBFL = $0F
SUBFLG = $10
INPFLG = $11
TANSGN = $12
CHANNL = $13
LINNUM = $14
LINNUMH = $15
TEMPPT = $16
LASTPT = $17
NESTIRQ = $18
NESTIRQH = $19
a1A = $1A
a1E = $1E
a1F = $1F
a20 = $20
a21 = $21
INDEX = $22
a23 = $23
a24 = $24
a25 = $25
RESHO = $26
PARAM2 = $27
PARAM2H = $28
a29 = $29
TRNFLG = $2A
TXTTAB = $2B
INBYTE = $2C
VARTAB = $2D
a2E = $2E
ARYTAB = $2F
a30 = $30
STREND = $31
a32 = $32
FRETOP = $33
a34 = $34
STATUS = $90
STKEY = $91
KVERCK = $93
DFLTN = $99
DFLTO = $9A
SAL = $AC
aAD = $AD
EAL = $AE
aAF = $AF
CMP0 = $B0
aB1 = $B1
FNLEN = $B7
SA = $B9
FA = $BA
FNADR = $BB
aBC = $BC
CURCMD = $C1
CURCMDH = $C2
PARAM1 = $C3
PARAM1H = $C4
NDX = $C6
INDX = $C8
BLNSW = $CC
GDBLN = $CE
BLNON = $CF
PNT = $D1
aD2 = $D2
PNTR = $D3
TBLX = $D6
ROBUF = $F9
aFA = $FA
;
; **** ZP POINTERS ****
;
VALTYP = $0D
SAL = $AC
EAL = $AE
CMP0 = $B0
FNADR = $BB
PARAM1 = $C3
PNT = $D1
ROBUF = $F9
;
; **** FIELDS ****
;
f0104 = $0104
;
; **** ABSOLUTE ADRESSES ****
;
a0278 = $0278
a0279 = $0279
a027A = $027A
a027B = $027B
a027C = $027C
a027D = $027D
a0284 = $0284
a0319 = $0319
aAAAA = $AAAA
;
; **** POINTERS ****
;
pA002 = $A002
pDB00 = $DB00
;
; **** USER LABELS ****
;
CINV = $0314
CINVL = $0315
CBINV = $0316
CBINVH = $0317
;
; **** PREDEFINED LABELS ****
;
D6510 = $0000
KEYD = $0277
KMEMSIZ = $0283
NMINV = $0318
VICSCN = $0400
CIAPRA = $DC00
TI2BLO = $DD06
TI2BHI = $DD07
SETMSG = $FF90
CLRCHN = $FFCC
CHRIN = $FFCF
CHROUT = $FFD2
LOAD = $FFD5
SAVE = $FFD8
GETIN = $FFE4
* = $C000
JMP SETUP
JMP BREAK
CHRIN JMP CHRIN ;$FFCF - input character
CHROUT JMP CHROUT ;$FFD2 - output character
SETUP SEI
LDA NMINV ;NMI
STA INPFLG
LDA a0319 ;NMI
STA TANSGN
LDA BKVEC
LDX BKVECH
STA CBINV
STX CBINVH
JSR SETIRQ
LDA #$00
STA ROBUF
STA aFA
LDA #$80
JSR SETMSG ;$FF90 - enable/disable KERNAL messages
LDA #$FF
STA a1A
LDA #$00
STA CHANNL
STA SUBFLG
STA STREND
CLI
BRK
BREAK JSR sCCF9
PLA
STA YR
PLA
STA XR
PLA
STA ACC
PLA
STA SR
PLA
STA PCL
PLA
STA PCH
TSX
STX SP
SEC
LDA PCL
SBC #$02
STA PCL
LDA PCH
SBC #$00
STA PCH
JSR SETIRQ
LDA a1A
CMP #$FF
BEQ bC08A
LDX LINNUM
STX CURCMD
LDX LINNUMH
STX CURCMDH
LDY #$00
JSR sCDAB
LDA VARTAB
BNE bC084
LDA a2E
BNE bC087
BEQ bC08A
bC084 JMP jC694
bC087 JMP jC692
bC08A JSR NEWLIN
LDX #$42
jC08F LDA #$2A
JSR sC864
JMP jC9A8
ERROR LDA #$3F
JSR CHROUT
START JSR NEWLIN
LDA #$2E
JSR CHROUT
LDA #$00
STA GARBFL
STA a29
STA STREND
SKIPCH JSR CHRNCR
CMP #$2E
BEQ SKIPCH
CMP #$20
BEQ SKIPCH
LDX #$14
CMDLP CMP CMDCHR,X
BNE NXTCMD
STA a1E
TXA
ASL
TAX
LDA CMDVEC,X
STA CURCMD
LDA CMDVECH,X
STA CURCMDH
JMP (CURCMD)
NXTCMD DEX
BPL CMDLP
BMI ERROR
sC0D5 LDX #$02
BNE bC0DB
sC0D9 LDX #$00
bC0DB LDY CURCMD,X
BNE bC0E7
LDY CURCMDH,X
BNE bC0E5
INC a29
bC0E5 DEC CURCMDH,X
bC0E7 DEC CURCMD,X
RTS
sC0EA LDA #$00
STA a23
JSR sC25B
LDX #$02
bC0F3 JSR sC979
DEX
BNE bC0F3
RTS
sC0FA LDX #$02
bC0FC LDA CAS1,X
PHA
LDA RESHO,X
STA CAS1,X
PLA
STA RESHO,X
DEX
BNE bC0FC
RTS
sC10A LDA PARAM2
LDY PARAM2H
JMP jC115
sC111 LDA PARAM1
LDY PARAM1H
jC115 SEC
SBC CURCMD
STA RESHO
TYA
SBC CURCMDH
TAY
ORA RESHO
RTS
COMPAR LDA #$00
BEQ bC127
TRANS LDA #$01
bC127 STA TRNFLG
JSR RD3PAR
JSR NEWLIN
JSR sC111
JSR sC877
BCC bC151
bC137 JSR sC10A
BCS bC13F
JMP jC1C1
bC13F JSR sC177
INC PARAM1
BNE bC148
INC PARAM1H
bC148 JSR sC963
LDY a29
BNE bC198
BEQ bC137
bC151 JSR sC10A
CLC
LDA RESHO
ADC PARAM1
STA PARAM1
TYA
ADC PARAM1H
STA PARAM1H
JSR sC0FA
bC163 JSR sC177
JSR sC10A
BCS jC1C1
JSR sC0D5
JSR sC0D9
LDY a29
BNE bC198
BEQ bC163
sC177 LDX #$00
JSR sCD49
PHA
JSR sCD45
PLA
LDY TRNFLG
BEQ bC188
JSR sCD53
bC188 CMP (VALTYP,X)
BEQ bC197
sC18C JSR sC84E
JSR sC979
JSR sC8E5
BEQ bC198
bC197 RTS
bC198 JMP START
FILL JSR sC836
JSR sC840
JSR CHRNCR
JSR RDBYTE
BCC bC1BE
STA a20
bC1AB LDX a29
BNE jC1C1
JSR sC111
BCC jC1C1
LDA a20
JSR sCD57
JSR sC963
BNE bC1AB
bC1BE JMP ERROR
jC1C1 JMP START
HUNT JSR sC836
JSR sC840
JSR CHRNCR
LDX #$00
JSR CHRNCR
CMP #$27
BNE bC1E9
JSR CHRNCR
bC1D9 STA FRETOP,X
INX
JSR CHRIN
CMP #$0D
BEQ bC203
CPX #$20
BNE bC1D9
BEQ bC203
bC1E9 STX INBYTE
JSR sC8B0
BCC bC1BE
bC1F0 STA FRETOP,X
INX
JSR CHRIN
CMP #$0D
BEQ bC203
JSR RDBYTE
BCC bC1BE
CPX #$20
BNE bC1F0
bC203 STX a1F
JSR NEWLIN
bC208 LDX #$00
LDY #$00
LDA CURCMD
PHA
LDA CURCMDH
PHA
bC212 JSR sCD7C
CMP FRETOP,X
BNE bC22C
JSR sC963
INX
CPX a1F
BNE bC212
PLA
STA CURCMDH
PLA
STA CURCMD
JSR sC18C
BNE bC232
bC22C PLA
STA CURCMDH
PLA
STA CURCMD
bC232 JSR sC963
LDY a29
BNE bC23E
JSR sC111
BCS bC208
bC23E JMP START
DISASS JSR sC438
bC244 JSR sC111
BCC bC256
LDY #$2C
JSR sC0EA
JSR sC2B5
JSR sC8E5
BNE bC244
bC256 JSR sC597
BNE bC23E
sC25B JSR sC96E
sC25E JSR sC84E
JSR sC979
JSR sCC1B
PHA
JSR sC2CC
PLA
LDX #$03
JSR sC352
LDX #$06
bC273 CPX #$03
BNE bC28A
LDY INDEX
BEQ bC28A
bC27B LDA TXTTAB
CMP #$E8
JSR sCD7C
BCS bC2A0
JSR sC2AD
DEY
BNE bC27B
bC28A ASL TXTTAB
BCC bC29C
LDA CHAR1,X
JSR sC592
LDA CHAR2,X
BEQ bC29C
JSR sC592
bC29C DEX
BNE bC273
RTS
bC2A0 JSR sC2C0
TAX
INX
BNE bC2A8
INY
bC2A8 TYA
JSR sC2AD
TXA
sC2AD STX a1F
JSR sC855
LDX a1F
RTS
sC2B5 LDA INDEX
jC2B7 JSR sC2BF
STA CURCMD
STY CURCMDH
RTS
sC2BF SEC
sC2C0 LDY CURCMDH
TAX
BPL bC2C6
DEY
bC2C6 ADC CURCMD
BCC bC2CB
INY
bC2CB RTS
sC2CC LDY INDEX
INY
TYA
PHA
JSR sC92A
PLA
STA a21
SEC
LDA CURCMD
SBC a21
STA CURCMD
BCS bC2E2
DEC CURCMDH
bC2E2 LDA INDEX
CLC
ADC INDEX
ADC INDEX
TAY
bC2EA LDA #$20
JSR CHROUT
INY
CPY #$07
BNE bC2EA
RTS
sC2F5 TAY
LSR
BCC bC304
LSR
BCS bC313
CMP #$22
BEQ bC313
AND #$07
ORA #$80
bC304 LSR
TAX
LDA MODE,X
BCS bC30F
LSR
LSR
LSR
LSR
bC30F AND #$0F
BNE bC317
bC313 LDY #$80
LDA #$00
bC317 TAX
LDA MODE2,X
STA TXTTAB
AND #$03
STA INDEX
TYA
AND #$8F
TAX
TYA
LDY #$03
CPX #$8A
BEQ bC337
bC32C LSR
BCC bC337
LSR
bC330 LSR
ORA #$20
DEY
BNE bC330
INY
bC337 DEY
BNE bC32C
RTS
bC33B JSR sCD7C
JSR sC2AD
LDX #$01
bC343 JSR bC0F3
CPY INDEX
INY
BCC bC33B
LDX #$03
CPY #$03
BCC bC343
RTS
sC352 TAY
LDA MNEML,Y
STA PARAM2
LDA MNEMR,Y
STA PARAM2H
bC35D LDA #$00
LDY #$05
bC361 ASL PARAM2H
ROL PARAM2
ROL
DEY
BNE bC361
ADC #$3F
JSR CHROUT
DEX
BNE bC35D
JMP sC979
LDA aCEF5
PHA
LDA aCEF4
PHA
LDA #$00
PHA
PHA
PHA
PHA
JMP (NESTIRQ)
sC385 STA a20
PHA
bC388 JSR CHRNCR
JSR sC93F
BNE bC388
PLA
sC391 EOR #$FF
JMP jC2B7
INTMEM LDA #$40
.BYTE $2C
DSPMEM LDA #$00
STA a20
JSR sC438
bC3A0 LDX a29
BNE bC3BB
JSR sC111
BCC bC3BB
BIT a20
BVC bC3B3
JSR sC3BE
JMP jC3B6
bC3B3 JSR sC40E
jC3B6 JSR sC8E5
BNE bC3A0
bC3BB JMP bC256
sC3BE JSR NEWLIN
sC3C1 LDX #$2E
LDA #$27
JSR sC864
JSR sC979
JSR sC84E
LDA #$12
JSR CHROUT
LDY #$08
LDX #$00
bC3D7 JSR sCD49
AND #$7F
CMP #$20
BCS bC3E2
LDA #$2E
bC3E2 JSR CHROUT
CMP #$22
BNE bC3F3
LDA #$14
JSR CHROUT
LDA #$22
JSR CHROUT
bC3F3 JSR sC963
DEY
BNE bC3D7
LDA #$92
JSR CHROUT
LDA CURCMD
SEC
SBC #$08
STA CURCMD
BCS bC409
DEC CURCMDH
bC409 LDA #$08
JMP sC92A
sC40E JSR NEWLIN
sC411 LDX #$2E
LDA #$3A
JSR sC864
JSR sC84E
LDA #$08
JMP sC92A
MODMEM JSR sC836
LDA #$08
JSR sC385
JSR sC597
JSR sC40E
LDA #$3A
STA KEYD
LDA #$00
JMP jC547
sC438 JSR sC836
STA PARAM1
STX PARAM1H
JSR CHRIN
CMP #$0D
BEQ bC449
JSR sC83B
bC449 JMP NEWLIN
ASSEM JSR RDWORD
STA PARAM1
STX PARAM1H
bC453 LDX #$00
STX a34
bC457 JSR CHRNCR
CMP #$20
BEQ bC453
STA f24,X
INX
CPX #$03
BNE bC457
bC465 DEX
BMI bC479
LDA f24,X
SEC
SBC #$3F
LDY #$05
bC46F LSR
ROR a34
ROR FRETOP
DEY
BNE bC46F
BEQ bC465
bC479 LDX #$02
bC47B JSR CHRIN
CMP #$0D
BEQ bC4A2
CMP #$3A
BEQ bC4A2
CMP #$20
BEQ bC47B
JSR sC589
BCS bC49D
JSR HEXBYT
LDY CURCMD
STY CURCMDH
STA CURCMD
LDA #$30
STA FRETOP,X
INX
bC49D STA FRETOP,X
INX
BNE bC47B
bC4A2 STX PARAM2
LDX #$00
STX a29
jC4A8 LDX #$00
STX a20
LDA a29
JSR sC2F5
LDX TXTTAB
STX PARAM2H
TAX
LDA MNEMR,X
JSR sC56F
LDA MNEML,X
JSR sC56F
LDX #$06
bC4C4 CPX #$03
BNE bC4DA
LDY INDEX
BEQ bC4DA
bC4CC LDA TXTTAB
CMP #$E8
LDA #$30
BCS bC4F1
JSR sC56C
DEY
BNE bC4CC
bC4DA ASL TXTTAB
BCC bC4EC
LDA CHAR1,X
JSR sC56F
LDA CHAR2,X
BEQ bC4EC
JSR sC56F
bC4EC DEX
BNE bC4C4
BEQ bC4F7
bC4F1 JSR sC56C
JSR sC56C
bC4F7 LDA PARAM2
CMP a20
BEQ bC500
JMP jC579
bC500 JSR sC877
LDY INDEX
BEQ bC532
LDA PARAM2H
CMP #$9D
BNE bC529
JSR sC111
BCC bC51B
TYA
BNE bC580
LDX RESHO
BMI bC580
BPL bC522
bC51B INY
BNE bC580
LDX RESHO
BPL bC580
bC522 DEX
DEX
TXA
LDY INDEX
BNE bC52C
bC529 LDA CURCMDH,Y
bC52C JSR sCDAB
DEY
BNE bC529
bC532 LDA a29
JSR sCDAB
LDY #$41
STY KEYD
JSR sC597
JSR sC0EA
JSR sC2B5
LDA #$20
jC547 STA a0278
LDA CURCMDH
JSR sC59C
STX a0279
STA a027A
LDA CURCMD
JSR sC59C
STX a027B
STA a027C
LDA #$20
STA a027D
LDA #$07
STA NDX
JMP START
sC56C JSR sC56F
sC56F STX a1F
LDX a20
CMP FRETOP,X
BEQ bC583
PLA
PLA
jC579 INC a29
BEQ bC580
JMP jC4A8
bC580 JMP ERROR
bC583 INX
STX a20
LDX a1F
RTS
sC589 CMP #$30
BCC bC590
CMP #$47
RTS
bC590 SEC
RTS
sC592 CMP a23
BNE bC599
RTS
sC597 LDA #$91
bC599 JMP CHROUT
sC59C PHA
LSR
LSR
LSR
LSR
JSR sC86D
TAX
PLA
AND #$0F
JMP sC86D
STA ACC
PHP
PLA
AND #$EF
STA SR
STX XR
STY YR
PLA
CLC
ADC #$01
STA PCL
PLA
ADC #$00
STA PCH
LDA #$80
STA SUBFLG
BNE bC607
PHA
TXA
PHA
TYA
PHA
TSX
LDA f0104,X
AND #$04
BNE bC5D6
CLI
bC5D6 LDY #$32
LDA (ROBUF),Y
STA aAAAA
NOP
SEI
JSR sCCF9
PLA
STA YR
PLA
STA XR
PLA
STA ACC
CLD
PLA
STA SR
PLA
STA PCL
PLA
STA PCH
LDA INPFLG
STA NMINV ;NMI
LDA TANSGN
STA a0319 ;NMI
JSR SETIRQ
LDA #$20
STA aAAAA
bC607 TSX
STX SP
LDA aAAAA
STA aAAAA
CLI
BIT CHANNL
BPL bC634
LDA LINNUM
STA CURCMD
LDA LINNUMH
STA CURCMDH
LDY #$00
JSR sCD7C
STA a1A
LDA #$00
JSR sCDAB
BIT CHANNL
BVC bC632
STA CHANNL
JMP jC6D9
bC632 STA CHANNL
bC634 BIT SUBFLG
BVC bC650
LDA PCH
CMP LINNUMH
BNE bC696
LDA PCL
CMP LINNUM
BNE bC696
LDA VARTAB
BNE jC694
LDA a2E
BNE jC692
LDA #$80
STA SUBFLG
bC650 BMI bC667
LSR SUBFLG
BCS bC659
JMP bC08A
bC659 LDX SP
TXS
LDA aCEF7
PHA
LDA aCEF6
PHA
JMP jC733
bC667 JSR NEWLIN
LDA PCL
LDX PCH
STA CURCMD
STX CURCMDH
JSR sC979
LDA #$24
STA a23
JSR sC25E
bC67C JSR GETIN ;$FFE4 - get a byte from channel
BEQ bC67C
CMP #$03
BNE bC688
JMP START
bC688 CMP #$4A
BNE jC6D9
LDA #$01
STA SUBFLG
BNE jC6D9
jC692 DEC a2E
jC694 DEC VARTAB
bC696 LDA CIAPRA ;CIA1: Data Port Register A
CMP #$FA
BNE jC6D9
LDX #$53
JMP jC08F
GOTO LDA #$00
BEQ bC6AC
QTRACE LDA #$40
BNE bC6AC
WALK LDA #$80
bC6AC STA SUBFLG
STA STREND
LDY TEMPPT
STY VARTAB
LDY LASTPT
STY a2E
JSR CHRIN
CMP #$0D
BEQ bC6D6
CMP #$20
BEQ bC6C6
JMP jC767
bC6C6 JSR RDWRD3
JSR sC925
JSR CHRIN
CMP #$0D
BEQ bC6D6
JMP jC767
bC6D6 JSR NEWLIN
jC6D9 LDA a1A
CMP #$FF
BEQ bC714
LDX LINNUM
CPX PCL
BNE bC702
LDY LINNUMH
CPY PCH
BNE bC702
STY CURCMDH
STX CURCMD
LDX SUBFLG
BNE bC718
LDY #$00
JSR sCDAB
LDA #$80
STA CHANNL
LDA #$C0
STA CHANNL
BNE bC718
bC702 LDA SUBFLG
BNE bC718
STX CURCMD
LDY LINNUMH
STY CURCMDH
LDY #$00
LDA #$00
TAY
JSR sCDAB
bC714 LDA SUBFLG
BEQ bC72F
bC718 SEI
LDA #$A0
STA aAAAA
LDA #$00
STA aAAAA
LDA aCEF1
STA a0319 ;NMI
LDA aCEF0
STA NMINV ;NMI
bC72F SEI
LDX SP
TXS
jC733 LDA PCH
PHA
LDA PCL
PHA
LDA SR
PHA
LDA ACC
PHA
LDX XR
LDY YR
LDA SUBFLG
ORA CHANNL
PHP
LDA aAAAA
STA a32
JSR RSTIRQ
JSR sCCF9
PLP
BEQ bC765
LDA #$7F
STA aAAAA
LDA #$09
STA TI2BLO ;CIA2: Timer B: Low-Byte
LDA #$00
STA TI2BHI ;CIA2: Timer B: High-Byte
bC765 PLA
RTI
jC767 JMP ERROR
SETBRK JSR RDWORD
STA CURCMD
STX CURCMDH
STA LINNUM
STX LINNUMH
LDY #$00
JSR sCD7C
STA a1A
TYA
LDA #$00
STA TEMPPT
STA LASTPT
JSR RDWRD2
STA TEMPPT
STX LASTPT
JMP START
NEWLOC JSR RD3PAR
STA ARYTAB
STX a30
JSR RDWRD2
STA a24
STX a25
JSR RDWRD2
STA EAL
STX aAF
JSR CHRIN
CMP #$0D
BEQ bC7B2
JSR CHRIN
CMP #$57
BNE bC7B2
INC a23
bC7B2 JSR sC877
bC7B5 LDX a29
BNE bC7D1
JSR sC10A
BCC bC7D1
LDY a23
BNE bC7DC
JSR sCD7C
JSR sC2F5
TAX
LDA MNEML,X
BNE bC7D4
JSR sC0EA
bC7D1 JMP START
bC7D4 LDY INDEX
CPY #$02
BNE bC815
BEQ bC7DE
bC7DC STY INDEX
bC7DE DEY
SEC
JSR sCD7C
TAX
SBC a24
INY
JSR sCD7C
SBC a25
BCC bC815
DEY
JSR sCD7C
STA COUNT
LDA EAL
SBC COUNT
INY
JSR sCD7C
STA COUNT
LDA aAF
SBC COUNT
BCC bC815
DEY
CLC
TXA
ADC ARYTAB
JSR sCDAB
INY
JSR sCD7C
ADC a30
JSR sCDAB
bC815 JSR sC963
DEY
BPL bC815
BMI bC7B5
RD3PAR JSR RDWORD
STA PARAM1
STX PARAM1H
JSR RDWRD2
STA PARAM2
STX PARAM2H
JSR CHRNCR
RD1PAR JSR RDWRD3
bC831 STA CURCMD
STX CURCMDH
RTS
sC836 JSR RDWORD
BCS bC831
sC83B JSR RDWRD3
BCS bC843
sC840 JSR RDWRD2
bC843 STA PARAM1
STX PARAM1H
RTS
JSR sC0FA
JMP RDWRD2
sC84E LDA CURCMDH
JSR sC855
LDA CURCMD
sC855 PHA
LSR
LSR
LSR
LSR
JSR sC86D
TAX
PLA
AND #$0F
JSR sC86D
sC864 PHA
TXA
JSR CHROUT
PLA
JMP CHROUT
sC86D CLC
ADC #$F6
BCC bC874
ADC #$06
bC874 ADC #$3A
RTS
sC877 LDX #$02
bC879 LDA CAS1,X
PHA
LDA CURCMDH,X
STA CAS1,X
PLA
STA CURCMDH,X
DEX
BNE bC879
RTS
RDWORD LDA #$00
STA INBYTE
bC88B JSR CHRNCR
CMP #$20
BEQ bC88B
JSR HEXBYT
BCS bC89F
RDWRD2 JSR CHRNCR
RDWRD3 JSR RDBYTE
BCC bC8A6
bC89F TAX
JSR RDBYTE
BCC bC8A6
RTS
bC8A6 JMP ERROR
RDBYTE LDA #$00
STA INBYTE
JSR CHRNCR
sC8B0 CMP #$20
BNE HEXBYT
JSR CHRNCR
CMP #$20
BNE HEXNYB
CLC
RTS
HEXBYT JSR A2HEX
ASL
ASL
ASL
ASL
STA INBYTE
JSR CHRNCR
HEXNYB JSR A2HEX
ORA INBYTE
SEC
RTS
A2HEX CMP #$3A
PHP
AND #$0F
PLP
BCC bC8DA
ADC #$08
bC8DA RTS
CHRNCR JSR CHRIN
CMP #$0D
BNE bC8DA
JMP START
sC8E5 LDA STKEY
CMP #$FE
BNE bC8F2
PHP
JSR CLRCHN ;$FFCC - restore default devices
STA NDX
PLP
bC8F2 RTS
bC8F3 JSR sC8FC
BIT aAAAA
BMI bC8F3
RTS
sC8FC JSR sC8E5
BNE bC90C
JSR sC90D
LDA #>IERROR
STA DFLTO
LDA #<IERROR
STA DFLTN
bC90C RTS
sC90D PHP
SEI
LDA aAAAA
ORA #$02
STA aAAAA
LDA IRQVECL
STA CINV ;IRQ
LDA IRQVECH
STA CINVL ;IRQ
PLP
RTS
sC925 STA PCL
STX PCH
RTS
sC92A STA a21
LDY #$00
bC92E JSR sC979
JSR sCD7C
JSR sC855
JSR sC963
DEC a21
BNE bC92E
RTS
sC93F JSR RDBYTE
BCC bC950
LDX #$00
JSR sCD57
CMP (VALTYP,X)
BEQ bC950
JMP ERROR
bC950 JSR sC963
DEC a20
RTS
sC956 LDA #<SR
STA CURCMD
LDA #>SR
STA CURCMDH
LDA #$05
INC GARBFL
RTS
sC963 INC CURCMD
BNE bC96D
INC CURCMDH
BNE bC96D
INC a29
bC96D RTS
sC96E TYA
PHA
JSR NEWLIN
PLA
sC974 LDX #$2E
JSR sC864
sC979 LDA #$20
.BYTE $2C
NEWLIN LDA #$0D
JMP CHROUT
DSPREG LDA INDX
CMP #$02
BCC jC9A8
JSR CHRIN
CMP #$42
BNE jC9A8
LDA a1A
CMP #$FF
BEQ jC9A8
LDX LINNUM
LDY LINNUMH
STX CURCMD
STY CURCMDH
LDY #$00
JSR sCDAB
LDA #$FF
STA a1A
JMP START
jC9A8 LDX #$00
bC9AA LDA REGNAM,X
JSR CHROUT
INX
CPX #$16
BNE bC9AA
JSR NEWLIN
LDX #$2E
LDA #$3B
JSR sC864
LDA PCH
JSR sC855
LDA PCL
JSR sC855
JSR sC956
JSR sC92A
DEC GARBFL
bC9D1 JMP START
JMP ERROR
MODREG JSR RDWORD
JSR sC925
JSR sC956
STA a20
bC9E2 JSR CHRNCR
JSR sC93F
BNE bC9E2
DEC GARBFL
BEQ bC9D1
EXITB SEI
JSR RSTIRQ
LDX SP
TXS
JSR sCCF9
JMP (pA002)
bC9FB JMP ERROR
LSV LDY #$01
STY FA
STY SA
DEY
STY FNLEN
STY STATUS
STY KVERCK
LDA #>FRETOP
STA aBC
LDA #<FRETOP
STA FNADR
bCA13 JSR CHRIN
CMP #$20
BEQ bCA13
CMP #$0D
BEQ bCA38
CMP #$22
bCA20 BNE bC9FB
bCA22 JSR CHRIN
CMP #$22
BEQ bCA4F
CMP #$0D
BEQ bCA38
STA (FNADR),Y
INC FNLEN
INY
CPY #$10
bCA34 BEQ bC9FB
BNE bCA22
bCA38 LDA a1E
CMP #$4C
bCA3C BNE bCA20
LDA #$00
JSR LOAD ;$FFD5 - load after call SETLFS,SETNAM
JSR bC8F3
LDA STATUS
AND #$10
bCA4A BNE bCA3C
JMP START
bCA4F JSR CHRIN
CMP #$0D
BEQ bCA38
CMP #$2C
bCA58 BNE bCA4A
JSR RDBYTE
AND #$0F
bCA5F BEQ bCA34
CMP #$03
BEQ bCA5F
STA FA
JSR CHRIN
CMP #$0D
BEQ bCA38
CMP #$2C
bCA70 BNE bCA58
JSR RD1PAR
JSR CHRIN
CMP #$2C
bCA7A BNE bCA70
JSR RDWRD3
STA EAL
STX aAF
bCA83 JSR CHRIN
CMP #$20
BEQ bCA83
CMP #$0D
bCA8C BNE bCA7A
LDA a1E
CMP #$53
BNE bCA8C
JSR NEWLIN
LDA #$00
STA SA
LDX EAL
LDY aAF
LDA #$C1
JSR SAVE ;$FFD8 - save after call SETLFS,SETNAM
JMP START
LDA STREND
BNE bCAAF
LDA NDX
BNE bCAB5
bCAAF PLA
TAY
PLA
TAX
PLA
RTI
bCAB5 LDA KEYD
CMP #$11
BEQ bCABF
JMP jCB55
bCABF LDA TBLX
CMP #$18
BNE bCAAF
LDA PNT
STA PARAM1
LDA aD2
STA PARAM1H
LDA #$19
STA VARTAB
bCAD1 LDY #$01
JSR sCCB3
CMP #$3A
BEQ bCAF3
CMP #$2C
BEQ bCAF3
CMP #$27
BEQ bCAF3
DEC VARTAB
BEQ bCAAF
SEC
LDA PARAM1
SBC #$28
STA PARAM1
BCS bCAD1
DEC PARAM1H
BNE bCAD1
bCAF3 STA a1E
JSR sCC6F
BCS bCAAF
LDA a1E
CMP #$3A
BEQ bCB15
CMP #$27
BNE bCB35
CLC
LDA #$08
ADC CURCMD
STA CURCMD
BCC bCB0F
INC CURCMDH
bCB0F JSR sC3BE
JMP jCB44
bCB15 CLC
LDA CURCMD
ADC #$08
STA CURCMD
BCC bCB20
INC CURCMDH
bCB20 JSR NEWLIN
LDX #$2E
LDA #$3A
JSR sC864
JSR sC84E
LDA #$08
JSR sC92A
JMP jCB44
bCB35 JSR sCC1B
JSR sC2B5
LDA #$00
STA a23
LDY #$2C
JSR sC25B
jCB44 LDA #$00
STA NDX
STA STREND
STA a29
JSR sC597
JSR NEWLIN
JMP bCAAF
jCB55 CMP #$91
BEQ bCB5C
JMP bCAAF
bCB5C LDA TBLX
BEQ bCB63
JMP bCAAF
bCB63 LDA PNT
STA PARAM1
LDA aD2
STA PARAM1H
LDA #$19
STA VARTAB
bCB6F LDY #$01
JSR sCCB3
CMP #$3A
BEQ bCB91
CMP #$2C
BEQ bCB91
CMP #$27
BEQ bCB91
DEC VARTAB
BEQ bCB98
CLC
LDA PARAM1
ADC #$28
STA PARAM1
BCC bCB6F
INC PARAM1H
BNE bCB6F
bCB91 STA a1E
JSR sCC6F
BCC bCB9B
bCB98 JMP bCAAF
bCB9B LDA a1E
CMP #$3A
BEQ bCBB9
CMP #$27
BNE bCBD8
JSR sCC23
SEC
LDA CURCMD
SBC #$08
STA CURCMD
BCS bCBB3
DEC CURCMDH
bCBB3 JSR sC3C1
JMP jCBCA
bCBB9 JSR sCC23
SEC
LDA CURCMD
SBC #$08
STA CURCMD
BCS bCBC7
DEC CURCMDH
bCBC7 JSR sC411
jCBCA LDA #$00
STA NDX
STA STREND
STA a29
JSR sCC6A
JMP bCAAF
bCBD8 JSR sCC23
LDA CURCMD
LDX CURCMDH
STA PARAM1
STX PARAM1H
LDA #$10
STA VARTAB
bCBE7 SEC
LDA PARAM1
SBC VARTAB
STA CURCMD
LDA PARAM1H
SBC #$00
STA CURCMDH
bCBF4 JSR sCC1B
JSR sC2B5
JSR sC111
BEQ bCC05
BCS bCBF4
DEC VARTAB
BNE bCBE7
bCC05 INC INDEX
LDA INDEX
JSR sC391
LDX #$00
STX a23
LDA #$2C
JSR sC974
JSR sC25E
JMP jCBCA
sCC1B LDX #$00
JSR sCD49
JMP sC2F5
sCC23 LDA #<pDB00
STA EAL
LDA #>pDB00
STA aAF
STA aB1
LDA #$07
STA aAD
STA PARAM1H
LDA #$00
STA SAL
LDA #$28
STA PARAM1
STA CMP0
LDY #$BF
LDX #$04
bCC41 LDA (SAL),Y
STA (PARAM1),Y
LDA (EAL),Y
STA (CMP0),Y
DEY
BNE bCC41
LDA (SAL),Y
STA (PARAM1),Y
LDA (EAL),Y
STA (CMP0),Y
DEY
DEC aAD
DEC PARAM1H
DEC aAF
DEC aB1
DEX
BNE bCC41
LDX #$27
LDA #$20
bCC64 STA VICSCN,X
DEX
BPL bCC64
sCC6A LDA #$13
JMP CHROUT
sCC6F CPY #$28
BNE bCC75
SEC
RTS
bCC75 JSR sCCB3
CMP #$20
BEQ sCC6F
DEY
JSR sCC9E
TAX
JSR sCC9E
STA CURCMD
STX CURCMDH
LDA #$FF
STA STREND
STA BLNSW
LDA BLNON
BEQ bCC9C
LDA GDBLN
LDY PNTR
STA (PNT),Y
LDA #$00
STA BLNON
bCC9C CLC
RTS
sCC9E JSR sCCB3
JSR A2HEX
ASL
ASL
ASL
ASL
STA INBYTE
JSR sCCB3
JSR A2HEX
ORA INBYTE
RTS
sCCB3 LDA (PARAM1),Y
INY
AND #$7F
CMP #$20
BCS bCCBE
ORA #$40
bCCBE RTS
ECMD JSR RDWORD
CPX #$04
BCC bCCE9
STA ROBUF
STX aFA
STA KMEMSIZ
STX a0284
STA PARAM1
STX PARAM1H
LDY #$00
bCCD6 LDA #$55
STA (PARAM1),Y
CMP (PARAM1),Y
BNE bCCE9
LDA D6510,Y
STA (PARAM1),Y
INY
BNE bCCD6
JMP START
bCCE9 STX PARAM1
ORA PARAM1
BNE bCCF6
STA ROBUF
STX aFA
JMP START
bCCF6 JMP ERROR
sCCF9 PHA
TXA
PHA
TYA
PHA
LDA aFA
BEQ bCD13
LDY #$00
bCD04 LDA D6510,Y
TAX
LDA (ROBUF),Y
STA D6510,Y
TXA
STA (ROBUF),Y
INY
BNE bCD04
bCD13 PLA
TAY
PLA
TAX
PLA
RTS
SETIRQ LDA CINV ;IRQ
LDX CINVL ;IRQ
CMP IRQVECL
BNE bCD29
CPX IRQVECH
BEQ bCD39
bCD29 STA NESTIRQ
STX NESTIRQH
LDA IRQVECL
LDX IRQVECH
STA CINV ;IRQ
STX CINVL ;IRQ
bCD39 RTS
RSTIRQ LDA NESTIRQ
STA CINV ;IRQ
LDA NESTIRQH
STA CINVL ;IRQ
RTS
sCD45 LDX #$02
BNE bCD4B
sCD49 LDX #$00
bCD4B JSR sCD63
LDX #$00
LDA (VALTYP,X)
RTS
sCD53 LDX #$02
BNE bCD59
sCD57 LDX #$00
bCD59 PHA
JSR sCD63
PLA
LDX #$00
STA (VALTYP,X)
RTS
sCD63 LDA CURCMDH,X
BNE bCD75
CLC
LDA ROBUF
ADC CURCMD,X
STA VALTYP
LDA aFA
ADC CURCMDH,X
STA INTFLG
RTS
bCD75 STA INTFLG
LDA CURCMD,X
STA VALTYP
RTS
sCD7C PHP
PLA
AND #$EF
PHA
STY DIMFLG
TYA
CLC
ADC CURCMD
STA VALTYP
LDA #$00
ADC CURCMDH
STA INTFLG
CMP #$01
BCS bCDA3
LDA GARBFL
BNE bCDA3
LDA VALTYP
ADC ROBUF
STA VALTYP
LDA INTFLG
ADC aFA
STA INTFLG
bCDA3 LDY #$00
LDA (VALTYP),Y
LDY DIMFLG
PLP
RTS
sCDAB PHA
JSR sCD7C
STY DIMFLG
LDY #$00
PLA
STA (VALTYP),Y
LDY DIMFLG
RTS
MODE .BYTE $40,$02,$45,$03,$D0,$08,$40,$09
.BYTE $30,$22,$45,$33,$D0,$08,$40,$09
.BYTE $40,$02,$45,$33,$D0
.BYTE $08,$40,$09,$40,$02,$45,$B3,$D0
.BYTE $08
.BYTE $40,$09,$00,$22,$44,$33,$D0,$8C
.BYTE $44,$00
.BYTE $11,$22,$44,$33,$D0,$8C,$44,$9A
.BYTE $10,$22,$44,$33,$D0,$08,$40,$09
.BYTE $10,$22,$44,$33,$D0,$08
.BYTE $40,$09,$62,$13,$78,$A9
MODE2 .BYTE $00,$21,$81,$82,$00,$00,$59,$4D
.BYTE $91,$92,$86,$4A,$85
CHAR1 .BYTE $9D,$2C,$29,$2C,$23,$28
CHAR2 .BYTE $24,$59,$00,$58,$24,$24,$00
MNEML .BYTE $1C,$8A,$1C,$23,$5D,$8B,$1B,$A1
.BYTE $9D,$8A,$1D,$23,$9D,$8B,$1D,$A1
.BYTE $00,$29,$19,$AE,$69,$A8,$19,$23
.BYTE $24,$53,$1B,$23,$24,$53,$19,$A1
.BYTE $00,$1A,$5B,$5B,$A5,$69,$24,$24
.BYTE $AE,$AE,$A8,$AD,$29,$00,$7C,$00
.BYTE $15,$9C,$6D,$9C,$A5,$69,$29,$53
.BYTE $84,$13,$34,$11,$A5,$69,$23,$A0
MNEMR .BYTE $D8,$62,$5A,$48,$26,$62,$94,$88
.BYTE $54,$44,$C8,$54,$68,$44,$E8,$94
.BYTE $00,$B4,$08,$84,$74,$B4,$28,$6E
.BYTE $74,$F4,$CC,$4A,$72,$F2,$A4,$8A
.BYTE $00,$AA,$A2,$A2,$74,$74,$74,$72
.BYTE $44,$68,$B2,$32,$B2,$00,$22,$00
.BYTE $1A,$1A,$26,$26,$72,$72,$88,$C8
.BYTE $C4,$CA,$26,$48,$44,$44,$A2,$C8
REGNAM .TEXT $0D, " PC SR AC XR YR SP"
CMDCHR .TEXT "ABCDFGHILMNQRSTWX,:;E"
CMDVECH =*+$01
CMDVEC .WORD $C44C,$C76A,$C121,$C241,$C19B
.WORD $C6A2,$C1C4,$C396,$C9FE,$C399
.WORD $C78D,$C6A6,$C981,$C9FE,$C125
.WORD $C6AA,$C9EE,$C44C,$C420,$C9D7
.WORD $CCBF,$C000
IRQVECH =*+$01
IRQVECL .BYTE $74,$C3
aCEF0 .BYTE $C8
aCEF1 .BYTE $C5
BKVEC .BYTE $3F
BKVECH .BYTE $C0
aCEF4 .BYTE $A7
aCEF5 .BYTE $CA
aCEF6 .BYTE $AA
aCEF7 .BYTE $C5,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
.BYTE $AA,$AA,$AA,$AA,$AA,$AA,$AA,$AA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment