This commit is contained in:
Michael Steil 2008-10-07 08:03:36 +00:00
parent cc055bcdd7
commit 2cc8d61b63
3 changed files with 279 additions and 91 deletions

View File

@ -24,6 +24,7 @@ LINNUM := $0008
INPUTBUFFER := $000A INPUTBUFFER := $000A
TEMPPT := $0065 TEMPPT := $0065
LASTPT := $0066 LASTPT := $0066
TEMPST := $0068
INDEX := $0071 INDEX := $0071
DEST := $0073 DEST := $0073
RESULT := $0075 RESULT := $0075
@ -79,31 +80,32 @@ TXTPTR := $00C9
L00CF := $00CF L00CF := $00CF
RNDSEED := $00DA RNDSEED := $00DA
.else .else
Z00 := $0000 Z00 := $0200;0000
L0001 := $0001 L0001 := $0001
L0002 := $0002 L0002 := $0002
GOWARM := $0003 GOWARM := $0003
Z03 := $000E;3 ; same
GOSTROUT := $0006
GOGIVEAYF := $0008
CHARAC := $005A
ENDCHR := $005B
EOLPNTR := $005C
DIMFLG := $005D
VALTYP := $005E
DATAFLG := $0060
SUBFLG := $0061
INPUTFLG := $0062
CPRMASK := $0063
Z14 := $000D;64 ; Ctrl+O flag
Z15 := $0004 Z15 := $0004
Z16 := $0005 Z16 := $0005
Z17 := $0006 Z17 := $0006
GOSTROUT := $0006
Z18 := $0007 Z18 := $0007
LINNUM := $0008 LINNUM := $0011;0008
INPUTBUFFER := $000A GOGIVEAYF := $0008
INPUTBUFFER := $0200;00A
Z03 := $000E;3 ; same
CHARAC := $005A-82-5
ENDCHR := $005B-82-5
EOLPNTR := $005C-82-5
DIMFLG := $005D-82-5
VALTYP := $005E-82-5
DATAFLG := $0060-82-5
SUBFLG := $0061-82-5
INPUTFLG := $0062-82-5
CPRMASK := $0063-82-5
Z14 := $0064-82-5 ; Ctrl+O flag
TEMPPT := $0065-82 TEMPPT := $0065-82
LASTPT := $0066-82 LASTPT := $0066-82
TEMPST := $0068-82
INDEX := $0071-82 INDEX := $0071-82
DEST := $0073-82 DEST := $0073-82
RESULT := $0075-82 RESULT := $0075-82
@ -162,7 +164,6 @@ RNDSEED := $00DA-82
BYTES_PER_FRAME := $12 BYTES_PER_FRAME := $12
SPACE_FOR_GOSUB := $36 SPACE_FOR_GOSUB := $36
TEMPST := $68
FOR_STACK1 := $0F FOR_STACK1 := $0F
FOR_STACK2 := $09 FOR_STACK2 := $09
NUM_TOKENS := $23 NUM_TOKENS := $23
@ -212,3 +213,10 @@ LE7F3 := $E7F3
MONCOUT := CHROUT MONCOUT := CHROUT
MONRDKEY := GETIN MONRDKEY := GETIN
L0011 := $AA
LC392 := $AAAAA
LC71E := $AAAAA

20
make.sh
View File

@ -1,22 +1,26 @@
# 1.0
ca65 -D OSI msbasic.s -o osi.o && ca65 -D OSI msbasic.s -o osi.o &&
ld65 -C osi.cfg osi.o -o osi-new.bin ld65 -C osi.cfg osi.o -o osi-new.bin
xxd -g 1 osi.bin > osi.bin.txt xxd -g 1 osi.bin > osi.bin.txt
xxd -g 1 osi-new.bin > osi-new.bin.txt xxd -g 1 osi-new.bin > osi-new.bin.txt
diff -u osi.bin.txt osi-new.bin.txt | head diff -u osi.bin.txt osi-new.bin.txt | head
ca65 -D KIM -D CONFIG_11 msbasic.s -o kb9.o && # 1.1
ld65 -C kb9.cfg kb9.o -o kb9-new.bin && ca65 -D CBM -D CBM1 msbasic.s -o cbmbasic1.o &&
xxd -g 1 kb9.bin > kb9.bin.txt
xxd -g 1 kb9-new.bin > kb9-new.bin.txt
diff -u kb9.bin.txt kb9-new.bin.txt | head
ca65 -D CBM -D CBM1 -D CONFIG_11 msbasic.s -o cbmbasic1.o &&
ld65 -C cbmbasic.cfg cbmbasic1.o -o cbmbasic1-new.bin && ld65 -C cbmbasic.cfg cbmbasic1.o -o cbmbasic1-new.bin &&
xxd -g 1 cbmbasic1.bin > cbmbasic1.bin.txt xxd -g 1 cbmbasic1.bin > cbmbasic1.bin.txt
xxd -g 1 cbmbasic1-new.bin > cbmbasic1-new.bin.txt xxd -g 1 cbmbasic1-new.bin > cbmbasic1-new.bin.txt
diff -u cbmbasic1.bin.txt cbmbasic1-new.bin.txt | head diff -u cbmbasic1.bin.txt cbmbasic1-new.bin.txt | head
ca65 -D CBM -D CBM2 -D CONFIG_11 msbasic.s -o cbmbasic2.o && # 2
ca65 -D KIM -D CONFIG_2 msbasic.s -o kb9.o &&
ld65 -C kb9.cfg kb9.o -o kb9-new.bin &&
xxd -g 1 kb9.bin > kb9.bin.txt
xxd -g 1 kb9-new.bin > kb9-new.bin.txt
diff -u kb9.bin.txt kb9-new.bin.txt | head
# 2
ca65 -D CBM -D CBM2 -D CONFIG_2 msbasic.s -o cbmbasic2.o &&
ld65 -C cbmbasic.cfg cbmbasic2.o -o cbmbasic2-new.bin && ld65 -C cbmbasic.cfg cbmbasic2.o -o cbmbasic2-new.bin &&
#xxd -g 1 cbmbasic2.bin > cbmbasic2.bin.txt #xxd -g 1 cbmbasic2.bin > cbmbasic2.bin.txt
#xxd -g 1 cbmbasic2-new.bin > cbmbasic2-new.bin.txt #xxd -g 1 cbmbasic2-new.bin > cbmbasic2-new.bin.txt

308
msbasic.s
View File

@ -260,7 +260,7 @@ ERROR_MESSAGES:
.define ERRSTR_FRMCPX "FORMULA TOO COMPLEX" .define ERRSTR_FRMCPX "FORMULA TOO COMPLEX"
.define ERRSTR_CANTCONT "CAN'T CONTINUE" .define ERRSTR_CANTCONT "CAN'T CONTINUE"
.define ERRSTR_UNDEFFN "UNDEF'D FUNCTION" .define ERRSTR_UNDEFFN "UNDEF'D FUNCTION"
.endif /* ! CONFIG_11 */ .endif
ERR_NOFOR := <(*-ERROR_MESSAGES) ERR_NOFOR := <(*-ERROR_MESSAGES)
htasc ERRSTR_NOFOR htasc ERRSTR_NOFOR
@ -488,7 +488,7 @@ L2351:
stx TXTPTR stx TXTPTR
sty TXTPTR+1 sty TXTPTR+1
jsr CHRGET jsr CHRGET
.ifdef KIM .ifdef CONFIG_2
tax tax
.endif .endif
beq L2351 beq L2351
@ -545,12 +545,20 @@ L23AD:
dex dex
bne L23AD bne L23AD
PUT_NEW_LINE: PUT_NEW_LINE:
.ifdef CBM2
jsr SETPTRS
jsr FIX_LINKS
lda $0200
beq L2351
clc
.else
lda INPUTBUFFER lda INPUTBUFFER
beq FIX_LINKS beq FIX_LINKS
lda MEMSIZ lda MEMSIZ
ldy MEMSIZ+1 ldy MEMSIZ+1
sta FRETOP sta FRETOP
sty FRETOP+1 sty FRETOP+1
.endif
lda VARTAB lda VARTAB
sta HIGHTR sta HIGHTR
adc EOLPNTR adc EOLPNTR
@ -562,6 +570,12 @@ PUT_NEW_LINE:
L23D6: L23D6:
sty HIGHDS+1 sty HIGHDS+1
jsr BLTU jsr BLTU
.ifdef CBM2
lda L0011
ldy $12
sta $01FE
sty $01FF
.endif
lda STREND lda STREND
ldy STREND+1 ldy STREND+1
sta VARTAB sta VARTAB
@ -569,12 +583,17 @@ L23D6:
ldy EOLPNTR ldy EOLPNTR
dey dey
L23E6: L23E6:
lda Z17,y lda INPUTBUFFER-4,y
sta (LOWTR),y sta (LOWTR),y
dey dey
bpl L23E6 bpl L23E6
FIX_LINKS: FIX_LINKS:
jsr SETPTRS jsr SETPTRS
.ifdef CBM2
jsr LC442
jmp $AAAA; XXX LC392
LC442:
.endif
lda TXTTAB lda TXTTAB
ldy TXTTAB+1 ldy TXTTAB+1
sta INDEX sta INDEX
@ -584,7 +603,9 @@ L23FA:
ldy #$01 ldy #$01
lda (INDEX),y lda (INDEX),y
bne L2403 bne L2403
.ifndef CBM2
jmp L2351 jmp L2351
.endif
L2403: L2403:
ldy #$04 ldy #$04
L2405: L2405:
@ -607,14 +628,18 @@ L2405:
L2420: L2420:
.ifdef OSI .ifdef OSI
jsr OUTDO jsr OUTDO
.endif /* ! CONFIG_11 */ .endif
.ifdef CBM2
rts
.else
dex dex
bpl INLIN2 bpl INLIN2
L2423: L2423:
.ifdef OSI .ifdef OSI
jsr OUTDO jsr OUTDO
.endif /* ! CONFIG_11 */ .endif
jsr CRDO jsr CRDO
.endif
INLIN: INLIN:
ldx #$00 ldx #$00
INLIN2: INLIN2:
@ -677,7 +702,7 @@ GETLN:
nop nop
nop nop
and #$7F and #$7F
.endif /* ! CONFIG_11 */ .endif
cmp #$0F cmp #$0F
bne L2465 bne L2465
pha pha
@ -734,8 +759,10 @@ L2497:
inx inx
L2498: L2498:
lda Z00,x lda Z00,x
.ifndef CBM2
cmp #$20 cmp #$20
beq L2497 beq L2497
.endif
sec sec
sbc TOKEN_NAME_TABLE,y sbc TOKEN_NAME_TABLE,y
beq L2496 beq L2496
@ -747,8 +774,8 @@ L24AA:
L24AC: L24AC:
inx inx
iny iny
sta Z16,y sta INPUTBUFFER-5,y
lda Z16,y lda INPUTBUFFER-5,y
beq L24EA beq L24EA
sec sec
sbc #$3A sbc #$3A
@ -773,7 +800,7 @@ L24C8:
beq L24AC beq L24AC
L24D0: L24D0:
iny iny
sta Z16,y sta INPUTBUFFER-5,y
inx inx
bne L24C8 bne L24C8
L24D7: L24D7:
@ -788,8 +815,13 @@ L24DB:
lda Z00,x lda Z00,x
bpl L24AA bpl L24AA
L24EA: L24EA:
sta Z18,y sta INPUTBUFFER-3,y
.ifdef CBM2
dec TXTPTR+1
lda #$FF
.else
lda #INPUTBUFFER-1 lda #INPUTBUFFER-1
.endif
sta TXTPTR sta TXTPTR
rts rts
FNDLIN: FNDLIN:
@ -835,6 +867,9 @@ SCRTCH:
iny iny
sta (TXTTAB),y sta (TXTTAB),y
lda TXTTAB lda TXTTAB
.ifdef CBM2
clc
.endif
adc #$02 adc #$02
sta VARTAB sta VARTAB
lda TXTTAB+1 lda TXTTAB+1
@ -842,7 +877,7 @@ SCRTCH:
sta VARTAB+1 sta VARTAB+1
SETPTRS: SETPTRS:
jsr STXTPT jsr STXTPT
.ifdef KIM .ifdef CONFIG_2
lda #$00 lda #$00
CLEAR: CLEAR:
bne L256A bne L256A
@ -866,11 +901,26 @@ STKINI:
ldx #TEMPST ldx #TEMPST
stx TEMPPT stx TEMPPT
pla pla
.ifdef CBM2
tay
.else
sta STACK+253 sta STACK+253
.endif
pla pla
.ifndef CBM2
sta STACK+254 sta STACK+254
.endif
.ifdef CBM2
ldx #$FA
.else
ldx #$FC ldx #$FC
.endif
txs txs
.ifdef CBM2
pha
tya
pha
.endif
lda #$00 lda #$00
sta OLDTEXT+1 sta OLDTEXT+1
sta SUBFLG sta SUBFLG
@ -913,7 +963,7 @@ L25A6:
ldy #$01 ldy #$01
.ifndef KIM .ifndef KIM
sty DATAFLG sty DATAFLG
.endif /* ! CONFIG_11 */ .endif
lda (LOWTR),y lda (LOWTR),y
beq L25E5 beq L25E5
jsr ISCNTC jsr ISCNTC
@ -945,9 +995,9 @@ L25CE:
eor #$FF eor #$FF
sta DATAFLG sta DATAFLG
LA519: LA519:
.endif /* ! CONFIG_11 */ .endif
iny iny
.ifdef KIM .ifdef CONFIG_2
beq L25E5 beq L25E5
.endif .endif
lda (LOWTR),y lda (LOWTR),y
@ -969,7 +1019,7 @@ L25E8:
beq L25CE beq L25CE
bit DATAFLG bit DATAFLG
bmi L25CE bmi L25CE
.endif /* ! CONFIG_11 */ .endif
sec sec
sbc #$7F sbc #$7F
tax tax
@ -1051,13 +1101,20 @@ NEWSTT:
jsr ISCNTC jsr ISCNTC
lda TXTPTR lda TXTPTR
ldy TXTPTR+1 ldy TXTPTR+1
.ifdef CBM2
cpy #$02
nop
beq LC6D4
.else
beq L2683 beq L2683
.endif
sta OLDTEXT sta OLDTEXT
sty OLDTEXT+1 sty OLDTEXT+1
LC6D4:
ldy #$00 ldy #$00
L2683: L2683:
lda (TXTPTR),y lda (TXTPTR),y
.ifndef KIM .ifndef CONFIG_2
beq LA5DC beq LA5DC
cmp #$3A cmp #$3A
beq NEWSTT2 beq NEWSTT2
@ -1070,7 +1127,13 @@ LA5DC:
ldy #$02 ldy #$02
lda (TXTPTR),y lda (TXTPTR),y
clc clc
.ifdef CBM2
bne LC6E4
jmp L2701
LC6E4:
.else
beq L2701 beq L2701
.endif
iny iny
lda (TXTPTR),y lda (TXTPTR),y
sta CURLIN sta CURLIN
@ -1087,7 +1150,7 @@ NEWSTT2:
jsr EXECUTE_STATEMENT jsr EXECUTE_STATEMENT
jmp NEWSTT jmp NEWSTT
EXECUTE_STATEMENT: EXECUTE_STATEMENT:
.ifndef KIM .ifndef CONFIG_2
beq RET1 beq RET1
sec sec
.else .else
@ -1095,7 +1158,7 @@ EXECUTE_STATEMENT:
.endif .endif
EXECUTE_STATEMENT1: EXECUTE_STATEMENT1:
sbc #$80 sbc #$80
.ifndef KIM .ifndef CONFIG_2
bcs LA609 bcs LA609
jmp LET jmp LET
LA609: LA609:
@ -1111,7 +1174,7 @@ LA609:
lda TOKEN_ADDRESS_TABLE,y lda TOKEN_ADDRESS_TABLE,y
pha pha
jmp CHRGET jmp CHRGET
.ifdef KIM .ifdef CONFIG_2
LET1: LET1:
jmp LET jmp LET
COLON: COLON:
@ -1120,6 +1183,15 @@ COLON:
SYNERR1: SYNERR1:
jmp SYNERR jmp SYNERR
.endif .endif
.ifdef CBM2
cmp #$4B
bne SYNERR1
jsr CHRGET
lda #$A4
jsr SYNCHR
jmp GOTO
LC730:
.endif
RESTORE: RESTORE:
sec sec
lda TXTTAB lda TXTTAB
@ -1164,6 +1236,10 @@ END2:
bne RET1 bne RET1
lda TXTPTR lda TXTPTR
ldy TXTPTR+1 ldy TXTPTR+1
.ifdef CBM2
ldx $37
inx
.endif
beq END4 beq END4
sta OLDTEXT sta OLDTEXT
sty OLDTEXT+1 sty OLDTEXT+1
@ -1200,6 +1276,7 @@ L271C:
sty CURLIN+1 sty CURLIN+1
RET1: RET1:
rts rts
.ifndef CBM2
NULL: NULL:
jsr GETBYT jsr GETBYT
bne RET1 bne RET1
@ -1211,11 +1288,13 @@ NULL:
rts rts
L2739: L2739:
jmp IQERR jmp IQERR
.ifndef KIM .endif
.ifndef CONFIG_2
CLEAR: CLEAR:
bne RET1 bne RET1
jmp CLEARC jmp CLEARC
.else .endif
.ifdef KIM
SAVE: SAVE:
tsx tsx
stx INPUTFLG stx INPUTFLG
@ -1391,7 +1470,7 @@ L2866:
beq L2852 beq L2852
iny iny
cmp #$22 cmp #$22
.ifndef KIM .ifndef CONFIG_2
beq L285E beq L285E
bne L2866 bne L2866
.else .else
@ -1518,9 +1597,13 @@ PUTSTR:
bne LC92B bne LC92B
jsr FREFAC jsr FREFAC
cmp #$06 cmp #$06
.ifdef CBM2
bne IQERR1
.else
beq LC8E2 beq LC8E2
jmp IQERR jmp IQERR
LC8E2: LC8E2:
.endif
ldy #$00 ldy #$00
sty $B0 sty $B0
sty $B5 sty $B5
@ -1548,7 +1631,11 @@ LC902:
sei sei
LC912: LC912:
lda $B2,x lda $B2,x
.ifdef CBM2
sta $8D,x
.else
sta $0200,x sta $0200,x
.endif
dex dex
bpl LC912 bpl LC912
cli cli
@ -1557,6 +1644,7 @@ LC91C:
lda (INDEX),y lda (INDEX),y
jsr L00CF jsr L00CF
bcc LC926 bcc LC926
IQERR1:
jmp IQERR jmp IQERR
LC926: LC926:
sbc #$2F sbc #$2F
@ -1644,6 +1732,9 @@ PRINT2:
cmp #TOKEN_TAB cmp #TOKEN_TAB
beq L29F5 beq L29F5
cmp #TOKEN_SPC cmp #TOKEN_SPC
.ifdef CBM2
clc
.endif
beq L29F5 beq L29F5
cmp #',' cmp #','
.ifdef KIM .ifdef KIM
@ -1671,22 +1762,31 @@ L29B1:
jsr OUTSP jsr OUTSP
bne L297E bne L297E
L29B9: L29B9:
.ifdef CBM2
lda #$00
sta $0200,x
ldx #$FF
ldy #$01
.else
ldy #$00 ldy #$00
sty INPUTBUFFER,x sty INPUTBUFFER,x
.endif
.ifdef OSI .ifdef OSI
ldx #$12 ldx #$12
.endif .endif
.ifdef KIM .ifdef KIM
ldx #$1A ldx #$1A
.endif .endif
.ifdef CBM .ifdef CBM1
ldx #$09 ldx #$09
.endif
.ifdef CBM
lda Z03 lda Z03
bne L29DD bne L29DD
LC9D2: LC9D2:
.endif .endif
CRDO: CRDO:
.ifdef CBM .ifdef CBM1
lda Z03 lda Z03
bne LC9D8 bne LC9D8
sta $05 sta $05
@ -1700,6 +1800,7 @@ LC9D8:
lda #$0A lda #$0A
jsr OUTDO jsr OUTDO
PRINTNULLS: PRINTNULLS:
.ifndef CBM2
.ifdef CBM .ifdef CBM
lda Z03 lda Z03
bne L29DD bne L29DD
@ -1717,6 +1818,9 @@ L29D9:
stx Z16 stx Z16
pla pla
tax tax
.else
eor #$FF
.endif
L29DD: L29DD:
rts rts
L29DE: L29DE:
@ -1740,43 +1844,47 @@ L29EB:
adc #$01 adc #$01
bne L2A08 bne L2A08
L29F5: L29F5:
.ifndef KIM .ifndef CONFIG_2
pha pha
.else .else
php php
.endif .endif
jsr GTBYTC jsr GTBYTC
cmp #$29 cmp #$29
.ifndef KIM .ifndef CONFIG_2
bne L2A00 bne SYNERR4
pla pla
cmp #TOKEN_TAB cmp #TOKEN_TAB
bne L2A0A bne L2A0A
.else
.ifdef CBM2
bne SYNERR4
.else .else
beq @1 beq @1
jmp SYNERR jmp SYNERR
@1: @1:
.endif
plp ;; XXX c64 has this plp ;; XXX c64 has this
bcc L2A09 bcc L2A09
.endif .endif
txa txa
sbc Z16 sbc Z16
bcc L2A0D bcc L2A0D
.ifndef KIM .ifndef CONFIG_2
beq L2A0D beq L2A0D
.endif /* ! CONFIG_11 */ .endif
L2A08: L2A08:
tax tax
.ifdef KIM .ifdef CONFIG_2
L2A09: L2A09:
inx inx
.endif .endif
L2A0A: L2A0A:
.ifndef KIM .ifndef CONFIG_2
jsr OUTSP jsr OUTSP
.endif /* ! CONFIG_11 */ .endif
dex dex
.ifndef KIM .ifndef CONFIG_2
bne L2A0A bne L2A0A
.else .else
bne L2A13 bne L2A13
@ -1784,7 +1892,7 @@ L2A0A:
L2A0D: L2A0D:
jsr CHRGET jsr CHRGET
jmp PRINT2 jmp PRINT2
.ifdef KIM .ifdef CONFIG_2
L2A13: L2A13:
jsr OUTSP jsr OUTSP
bne L2A0A bne L2A0A
@ -1807,6 +1915,13 @@ L2A22:
jsr PRINTNULLS jsr PRINTNULLS
jmp L2A22 jmp L2A22
OUTSP: OUTSP:
.ifdef CBM2
lda $0E
beq LCA40
lda #$20
.byte $2C
LCA40:
.endif
.ifdef CBM .ifdef CBM
lda #$1D lda #$1D
.else .else
@ -1818,6 +1933,7 @@ OUTQUES:
OUTDO: OUTDO:
bit Z14 bit Z14
bmi L2A56 bmi L2A56
.ifndef CBM2
pha pha
.ifdef CBM .ifdef CBM
cmp #$1D cmp #$1D
@ -1852,6 +1968,7 @@ L2A4C:
.endif .endif
L2A4E: L2A4E:
pla pla
.endif
.ifdef KIM .ifdef KIM
sty DIMFLG sty DIMFLG
.endif .endif
@ -1871,13 +1988,13 @@ L2A56:
L2A59: L2A59:
lda INPUTFLG lda INPUTFLG
beq L2A6E beq L2A6E
.ifdef KIM .ifdef CONFIG_2
bmi L2A63 bmi L2A63
ldy #$FF ldy #$FF
bne L2A67 bne L2A67
L2A63: L2A63:
.endif .endif
.ifdef CBM .ifdef CBM1
jsr PATCH5 jsr PATCH5
nop nop
.else .else
@ -1887,7 +2004,7 @@ L2A63:
L2A67: L2A67:
sta CURLIN sta CURLIN
sty CURLIN+1 sty CURLIN+1
L2A00: SYNERR4:
jmp SYNERR jmp SYNERR
L2A6E: L2A6E:
.ifdef CBM .ifdef CBM
@ -1920,8 +2037,13 @@ GET:
LCAB6: LCAB6:
.endif .endif
ldx #<(INPUTBUFFER+1) ldx #<(INPUTBUFFER+1)
ldy #$00 ldy #>(INPUTBUFFER+1)
.ifdef CBM2
lda #$00
sta INPUTBUFFER+1
.else
sty INPUTBUFFER+1 sty INPUTBUFFER+1
.endif
lda #$40 lda #$40
jsr PROCESS_INPUT_LIST jsr PROCESS_INPUT_LIST
.ifdef CBM .ifdef CBM
@ -1958,13 +2080,17 @@ INPUT:
L2A9E: L2A9E:
jsr ERRDIR jsr ERRDIR
lda #$2C lda #$2C
sta LINNUM+1 sta INPUTBUFFER-1
LCAF8: LCAF8:
jsr NXIN jsr NXIN
.ifdef CBM .ifdef CBM
lda Z03 lda Z03
beq LCB0C beq LCB0C
.ifdef CBM2
lda $96
.else
lda $020C lda $020C
.endif
and #$02 and #$02
beq LCB0C beq LCB0C
jsr LCAD6 jsr LCAD6
@ -1976,7 +2102,12 @@ LCB0C:
.ifdef CBM .ifdef CBM
lda Z03 lda Z03
bne LCAF8 bne LCAF8
.ifdef CBM2
clc
jmp CONTROL_C_TYPED
.else
jmp PATCH1 jmp PATCH1
.endif
NXIN: NXIN:
lda Z03 lda Z03
bne LCB21 bne LCB21
@ -1992,9 +2123,16 @@ LCB21:
READ: READ:
ldx DATPTR ldx DATPTR
ldy DATPTR+1 ldy DATPTR+1
.ifdef CBM2
lda #$98
.byte $2C
L2ABE:
lda #$00
.else
.byte $A9 .byte $A9
L2ABE: L2ABE:
tya tya
.endif
PROCESS_INPUT_LIST: PROCESS_INPUT_LIST:
sta INPUTFLG sta INPUTFLG
stx INPTR stx INPTR
@ -2018,12 +2156,12 @@ PROCESS_INPUT_ITEM:
bvc L2AF0 bvc L2AF0
jsr MONRDKEY jsr MONRDKEY
sta INPUTBUFFER sta INPUTBUFFER
.ifdef CBM .ifdef CBM1
ldy #0 ldy #>(INPUTBUFFER-1)
ldx #<INPUTBUFFER-1 ldx #<(INPUTBUFFER-1)
.else .else
ldx #<INPUTBUFFER-1 ldx #<(INPUTBUFFER-1)
ldy #0 ldy #>(INPUTBUFFER-1)
.endif .endif
bne L2AF8 bne L2AF8
L2AF0: L2AF0:
@ -2046,7 +2184,7 @@ INSTART:
.ifndef OSI .ifndef OSI
bit INPUTFLG bit INPUTFLG
bvc L2B10 bvc L2B10
.ifdef CBM .ifdef CBM1
lda #$00 lda #$00
jsr PATCH4 jsr PATCH4
nop nop
@ -2180,11 +2318,21 @@ GERR:
beq JERROR beq JERROR
NEXT3: NEXT3:
txs txs
.ifndef CBM2
inx inx
inx inx
inx inx
inx inx
.endif
txa txa
.ifdef CBM2
clc
adc #$04
pha
adc #$06
sta $21
pla
.else
inx inx
inx inx
inx inx
@ -2194,6 +2342,7 @@ NEXT3:
inx inx
.endif .endif
stx DEST stx DEST
.endif
ldy #>STACK ldy #>STACK
jsr LOAD_FAC_FROM_YA jsr LOAD_FAC_FROM_YA
tsx tsx
@ -2496,9 +2645,18 @@ FRM_VARIABLE_CALL = *-1
ldx VALTYP ldx VALTYP
beq L2DB1 beq L2DB1
.ifdef CBM .ifdef CBM
.ifdef CBM1
jmp PATCH2 jmp PATCH2
clc clc
LCE3B: LCE3B:
.else
ldx #$00
stx $6D
bit $62
bpl LCE53
cmp #$54
bne LCE53
.endif
cpy #$C9 cpy #$C9
bne LCE53 bne LCE53
jsr LCE76 jsr LCE76
@ -2527,13 +2685,22 @@ L2DB1:
jmp GIVAYF jmp GIVAYF
L2DC2: L2DC2:
.endif .endif
.ifdef CBM .ifdef CBM1
jmp PATCH3 jmp PATCH3
.else .endif
.ifndef CBM
jmp LOAD_FAC_FROM_YA jmp LOAD_FAC_FROM_YA
.endif .endif
.ifdef CBM .ifdef CBM2
bit $62
bpl LCE82
cmp #$54
bne LCE82
.endif
.ifdef CBM1
.byte $19 .byte $19
.endif
.ifdef CBM
LCE69: LCE69:
cpy #$49 cpy #$49
bne LCE82 bne LCE82
@ -2554,7 +2721,11 @@ LCE82:
bne LCE90 bne LCE90
cpy #$54 cpy #$54
bne LCE90 bne LCE90
.ifdef CBM2
lda $96
.else
lda $020C lda $020C
.endif
jmp FLOAT jmp FLOAT
LCE90: LCE90:
lda $B3 lda $B3
@ -2808,7 +2979,9 @@ LD015:
ldy #>C_ZERO ldy #>C_ZERO
rts rts
C_ZERO: C_ZERO:
.ifndef CBM2
.byte $00,$00 .byte $00,$00
.endif
MAKENEWVARIABLE: MAKENEWVARIABLE:
.ifdef CBM .ifdef CBM
lda $94 lda $94
@ -2900,6 +3073,9 @@ MKINT:
lda FACSIGN lda FACSIGN
bmi MI1 bmi MI1
AYINT: AYINT:
.ifdef CBM2
jsr CHKNUM
.endif
lda FAC lda FAC
cmp #$90 cmp #$90
bcc MI2 bcc MI2
@ -3836,7 +4012,7 @@ L353F:
SUBSTRING_SETUP: SUBSTRING_SETUP:
jsr CHKCLS jsr CHKCLS
pla pla
.ifndef KIM .ifndef CONFIG_2
sta JMPADRS+1 sta JMPADRS+1
pla pla
sta JMPADRS+2 sta JMPADRS+2
@ -3853,7 +4029,7 @@ SUBSTRING_SETUP:
sta DSCPTR sta DSCPTR
pla pla
sta DSCPTR+1 sta DSCPTR+1
.ifdef KIM .ifdef CONFIG_2
lda TEMPX lda TEMPX
pha pha
tya tya
@ -3862,7 +4038,7 @@ SUBSTRING_SETUP:
ldy #$00 ldy #$00
txa txa
beq GOIQ beq GOIQ
.ifndef KIM .ifndef CONFIG_2
inc JMPADRS+1 inc JMPADRS+1
jmp (JMPADRS+1) jmp (JMPADRS+1)
.else .else
@ -3884,7 +4060,7 @@ ASC:
ldy #$00 ldy #$00
lda (INDEX),y lda (INDEX),y
tay tay
.ifndef KIM .ifndef CONFIG_2
jmp SNGFLT1 jmp SNGFLT1
.else .else
jmp SNGFLT jmp SNGFLT
@ -4145,7 +4321,7 @@ NORMALIZE_FAC5:
NORMALIZE_FAC6: NORMALIZE_FAC6:
inc FAC inc FAC
beq OVERFLOW beq OVERFLOW
.ifndef KIM .ifndef CONFIG_2
ror FAC+1 ror FAC+1
ror FAC+2 ror FAC+2
ror FAC+3 ror FAC+3
@ -4258,7 +4434,7 @@ SHIFT_RIGHT:
tay tay
lda FACEXTENSION lda FACEXTENSION
bcs SHIFT_RIGHT5 bcs SHIFT_RIGHT5
.ifndef KIM .ifndef CONFIG_2
LB588: LB588:
asl 1,x asl 1,x
bcc LB58E bcc LB58E
@ -4388,7 +4564,7 @@ LOG2:
FMULT: FMULT:
jsr LOAD_ARG_FROM_YA jsr LOAD_ARG_FROM_YA
FMULTT: FMULTT:
.ifndef KIM .ifndef CONFIG_2
beq L3903 beq L3903
.else .else
bne L3876 bne L3876
@ -4441,7 +4617,7 @@ L38A7:
adc ARG+1 adc ARG+1
sta RESULT sta RESULT
L38C3: L38C3:
.ifndef KIM .ifndef CONFIG_2
ror RESULT ror RESULT
ror RESULT+1 ror RESULT+1
ror RESULT+2 ror RESULT+2
@ -4942,7 +5118,7 @@ FIN3:
beq FIN4 beq FIN4
bne FIN6 bne FIN6
L3BA6: L3BA6:
.ifndef KIM .ifndef CONFIG_2
ror EXPSGN ror EXPSGN
.else .else
lda #$00 lda #$00
@ -4965,7 +5141,7 @@ FIN6:
sbc EXPON sbc EXPON
jmp FIN8 jmp FIN8
FIN10: FIN10:
.ifndef KIM .ifndef CONFIG_2
ror LOWTR ror LOWTR
.else .else
lda #$00 lda #$00
@ -5723,7 +5899,7 @@ L4058:
.ifdef OSI .ifdef OSI
.byte $80,$4F,$C7,$52 .byte $80,$4F,$C7,$52
.endif .endif
.ifdef KIM .ifdef CONFIG_2
.byte $80,$4F,$C7,$52,$58 .byte $80,$4F,$C7,$52,$58
.endif .endif
.ifdef CBM .ifdef CBM
@ -5771,7 +5947,7 @@ COLD_START2:
ldy #$AE ldy #$AE
sta $0B sta $0B
sty $0C sty $0C
.endif /* ! CONFIG_11 */ .endif
.ifdef CBM .ifdef CBM
lda #<IQERR lda #<IQERR
ldy #>IQERR ldy #>IQERR
@ -5800,17 +5976,17 @@ L4098:
.endif .endif
sta LASTPT+1 sta LASTPT+1
sta Z15 sta Z15
.ifndef KIM .ifndef CONFIG_2
sta Z16 sta Z16
.endif /* ! CONFIG_11 */ .endif
pha pha
sta Z14 sta Z14
lda #$03 lda #$03
sta DSCLEN sta DSCLEN
.ifndef KIM .ifndef CONFIG_2
lda #$2C lda #$2C
sta LINNUM+1 sta LINNUM+1
.endif /* ! CONFIG_11 */ .endif
jsr CRDO jsr CRDO
ldx #TEMPST ldx #TEMPST
stx TEMPPT stx TEMPPT
@ -5856,7 +6032,7 @@ L40DD:
beq L40D7 beq L40D7
bne L40FA bne L40FA
.endif .endif
.ifdef KIM .ifdef CONFIG_2
bne L40FA bne L40FA
beq L40D7 beq L40D7
.endif .endif
@ -6195,7 +6371,7 @@ RAMSTART2:
.byte $08,$29,$25,$20,$60,$2A,$E5,$E4 .byte $08,$29,$25,$20,$60,$2A,$E5,$E4
.byte $20,$66,$24,$65,$AC,$04,$A4 .byte $20,$66,$24,$65,$AC,$04,$A4
.endif /* KIM */ .endif /* KIM */
.ifdef CBM .ifdef CBM1
PATCH1: PATCH1:
clc clc
jmp CONTROL_C_TYPED jmp CONTROL_C_TYPED