microtan work

This commit is contained in:
Michael Steil 2008-10-13 20:26:42 +00:00
parent 8334c8b86a
commit 560815ec48
21 changed files with 187 additions and 56 deletions

View File

@ -3,5 +3,5 @@ Commodore BASIC 1 1977 Y Y CBM
OSI BASIC 1977 1.0 REV 3.2 Y N -
AppleSoft I 1977 1.1 N Y Apple CONFIG_11
KIM BASIC 1977 1.1 N Y - CONFIG_11A
Commodore BASIC 2 1979 Y Y CBM
Commodore BASIC 2 1979 Y Y CBM CONFIG_2
KBD BASIC 1980 Y N KBD

View File

@ -28,7 +28,7 @@ NEG32768:
; ----------------------------------------------------------------------------
MAKINT:
jsr CHRGET
.ifdef CBM2_KBD
.ifdef CONFIG_2
jsr FRMEVL
.else
jsr FRMNUM
@ -39,7 +39,7 @@ MAKINT:
; MUST BE POSITIVE AND LESS THAN 32768
; ----------------------------------------------------------------------------
MKINT:
.ifdef CBM2_KBD
.ifdef CONFIG_2
jsr CHKNUM
.endif
lda FACSIGN

View File

@ -16,6 +16,9 @@ CBM2 := 1
.elseif .def(kbdbasic)
KBD := 1
.include "defines_kbd.s"
.elseif .def(microtan)
MICROTAN := 1
.include "defines_microtan.s"
.endif
.ifdef CONFIG_SMALL

View File

@ -13,7 +13,9 @@ CONFIG_INPUTBUFFER_ORDER := 1 ; ldx/ldy or ldy/ldx
CONFIG_CBM_ALL := 1
CONFIG_11 := 1
CONFIG_11A := 1
CONFIG_2 := 1
CBM2_KBD := 1
CBM2_MICROTAN := 1
CBM2_KIM := 1
CBM2_APPLE := 1
CBM2_KIM_APPLE := 1 ; OUTDO difference
@ -25,6 +27,7 @@ CONFIG_DATAFLAG := 1
; common:
CONFIG_FILE := 1; support PRINT#, INPUT#, GET#, CMD
CONFIG_NO_CR := 1; terminal doesn't need explicit CRs on line ends
CONFIG_NO_LINE_EDITING := 1; support for "@", "_", BEL etc.
CRLF_1 := $0D
CRLF_2 := $0A
@ -94,6 +97,7 @@ Z18 := $0007
GOGIVEAYF := $0008
Z03 := $000E;3 ; same
LINNUM := $0011;0008
Z96 := $00E8-82
POSX := $0118-82
TXPSV = LASTOP

View File

@ -1,5 +1,6 @@
CONFIG_SCRTCH_ORDER := 1
CONFIG_SMALL := 1
CONFIG_2 := 1
CBM2_KBD := 1
KIM_KBD := 1
CONFIG_11 := 1

62
defines_microtan.s Normal file
View File

@ -0,0 +1,62 @@
KIM_KBD := 1
CONFIG_11 := 1
CONFIG_11A := 1
CONFIG_SAFE_NAMENOTFOUND := 1
CBM2_KIM_APPLE := 1 ; OUTDO difference
KIM_APPLE := 1
CBM2_MICROTAN := 1
CONFIG_2 := 1
CONFIG_NULL := 1
CONFIG_PRINT_CR := 1 ; print CR when line end reached
CRLF_1 := $0D
CRLF_2 := $0A
ZP_START = $85
JMPADRS = DSCLEN + 1
LOWTRX = LOWTR
Z00 := $0000
L0001 := $0001
L0002 := $0002
GOWARM := $0003
GOSTROUT := $0006
GOGIVEAYF := $0008
CHARAC := $000A+$1A
ENDCHR := $000B+$1A
EOLPNTR := $000C+$1A
DIMFLG := $000D+$1A
VALTYP := $000E+$1A
DATAFLG := $0010+$1A
SUBFLG := $0011+$1A
INPUTFLG := $0012+$1A
CPRMASK := $0013+$1A
Z14 := $0014+$1A ; Ctrl+O flag
Z15 := $0015+$1A
POSX := $0016+$1A
Z17 := $0017+$1A
Z18 := $0018+$1A
LINNUM := $0019+$1A
TXPSV := $0019+$1A
INPUTBUFFER := $001B+$1A
INPUTBUFFERX := $0000
L1800 := $1800
L1873 := $1873
MONRDKEY := $1E5A
MONCOUT := $1EA0
STACK_TOP := $FE
SPACE_FOR_GOSUB := $3E
NULL_MAX := $F2 ; probably different in original version; the image I have seems to be modified; see PDF
RAMSTART2 := $AAAA
USR := $AAAA
SAVE := $AAAA
LOAD := $AAAA
LE21C := $AAAA

4
eval.s
View File

@ -19,14 +19,14 @@ GERR:
beq JERROR
NEXT3:
txs
.ifndef CBM2_KBD
.ifndef CONFIG_2
inx
inx
inx
inx
.endif
txa
.ifdef CBM2_KBD
.ifdef CONFIG_2
clc
adc #$04
pha

View File

@ -1683,7 +1683,7 @@ DECTBL_END:
.byte $FF,$FF,$FD,$A8
.byte $00,$00,$00,$3C
.endif
.ifdef CBM2_KBD
.ifdef CONFIG_2
C_ZERO = CON_HALF + 2
.endif

14
flow.s
View File

@ -82,13 +82,13 @@ NEWSTT:
jsr ISCNTC
lda TXTPTR
ldy TXTPTR+1
.ifdef CBM2_KBD
.ifdef CONFIG_2
cpy #>INPUTBUFFER
.endif
.ifdef CBM2
nop
.endif
.ifdef CBM2_KBD
.ifdef CONFIG_2
beq LC6D4
.else
beq L2683
@ -112,7 +112,7 @@ LA5DC:
ldy #$02
lda (TXTPTR),y
clc
.ifdef CBM2_KBD
.ifdef CONFIG_2
jeq L2701
.else
beq L2701
@ -156,7 +156,7 @@ EXECUTE_STATEMENT1:
bcc LET1
.endif
cmp #NUM_TOKENS
.ifdef CBM2_KBD
.ifdef CONFIG_2
bcs LC721
.else
bcs SYNERR1
@ -177,7 +177,7 @@ COLON:
SYNERR1:
jmp SYNERR
.endif
.ifdef CBM2_KBD
.ifdef CONFIG_2
LC721:
.ifdef KBD
cmp #$45
@ -267,7 +267,7 @@ END2:
bne RET1
lda TXTPTR
ldy TXTPTR+1
.ifdef CBM2_KBD
.ifdef CONFIG_2
ldx CURLIN+1
inx
.endif
@ -444,7 +444,7 @@ L281E:
POP:
bne L281E
lda #$FF
.ifdef CBM2_KBD
.ifdef CONFIG_2
sta FORPNT+1 ; bugfix, wrong in AppleSoft
.else
sta FORPNT

22
init.s
View File

@ -95,7 +95,7 @@ COLD_START2:
.endif
sta Z18
.endif
.ifdef CBM2_KBD
.ifdef CONFIG_2
lda #$28
sta $0F
lda #$1E
@ -116,7 +116,7 @@ L4098:
sta STRNG2+1,x
dex
bne L4098
.ifdef CBM2_KBD
.ifdef CONFIG_2
lda #$03
sta DSCLEN
.endif
@ -135,7 +135,7 @@ L4098:
.endif
pha
sta Z14
.ifdef CBM2_KBD
.ifdef CONFIG_2
inx
stx $01FD
stx $01FC
@ -172,17 +172,17 @@ L4098:
tay
bne L40EE
.endif
.ifndef CBM2_KBD
.ifndef CONFIG_2
lda #<RAMSTART2
.endif
ldy #>RAMSTART2
.ifdef CBM2_KBD
.ifdef CONFIG_2
sta $28
sty $29
.endif
sta LINNUM
sty LINNUM+1
.ifdef CBM2_KBD
.ifdef CONFIG_2
tay
.else
ldy #$00
@ -196,11 +196,11 @@ L40D7:
cmp #$80
beq L40FA
.endif
.ifdef CBM2_KBD
.ifdef CONFIG_2
bmi L40FA
.endif
L40DD:
.ifdef CBM2_KBD
.ifdef CONFIG_2
lda #$55
.else
lda #$92
@ -317,7 +317,7 @@ L4183:
tya
sta (TXTTAB),y
inc TXTTAB
.ifndef CBM2_KBD
.ifndef CONFIG_2
bne L4192
inc TXTTAB+1
L4192:
@ -325,7 +325,7 @@ L4192:
lda TXTTAB
ldy TXTTAB+1
jsr REASON
.ifdef CBM2_KBD
.ifdef CONFIG_2
lda #<QT_BASIC
ldy #>QT_BASIC
jsr STROUT
@ -392,7 +392,7 @@ QT_BYTES_FREE:
.ifndef CBM_APPLE
.byte $0D,$0A,$0D,$0A
.endif
.ifdef CBM2_KBD
.ifdef CONFIG_2
.byte $0D,$00
.endif
.ifdef APPLE

View File

@ -186,7 +186,7 @@ GETC:
READ:
ldx DATPTR
ldy DATPTR+1
.ifdef CBM2_KBD
.ifdef CONFIG_2
lda #$98 ; AppleSoft, too
.byte $2C
L2ABE:

View File

@ -1,5 +1,5 @@
# 1.0
for i in cbmbasic1 cbmbasic2 kbdbasic osi kb9 applesoft; do
for i in cbmbasic1 cbmbasic2 kbdbasic osi kb9 applesoft microtan; do
echo $i
ca65 -D $i msbasic.s -o tmp/$i.o &&

View File

@ -47,6 +47,9 @@ QT_BREAK:
.byte $54,$D0 ; ???
.else
.byte $0D,$0A
.ifdef MICROTAN
.byte " "
.endif
.byte "BREAK"
.byte $00
.endif

19
microtan.cfg Normal file
View File

@ -0,0 +1,19 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $C000, size = $3F00, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}

View File

@ -49,7 +49,7 @@ ERRDIR:
inx
bne RTS9
ldx #ERR_ILLDIR
.ifdef CBM2_KBD
.ifdef CONFIG_2
.byte $2C
LD288:
ldx #ERR_UNDEFFN
@ -102,18 +102,18 @@ L31F3:
pla
sta FNCNAM+1
ldy #$02
.ifndef CBM2_KBD
.ifndef CONFIG_2
ldx #ERR_UNDEFFN
.endif
lda (FNCNAM),y
.ifndef CBM2_KBD
.ifndef CONFIG_2
beq L31AF
.endif
sta VARPNT
tax
iny
lda (FNCNAM),y
.ifdef CBM2_KBD
.ifdef CONFIG_2
beq LD288
.endif
sta VARPNT+1

BIN
orig/microtan.bin Normal file

Binary file not shown.

View File

@ -15,7 +15,7 @@ PRINT2:
cmp #TOKEN_TAB
beq L29F5
cmp #TOKEN_SPC
.ifdef CBM2_KBD
.ifdef CONFIG_2
clc ; also AppleSoft II
.endif
beq L29F5
@ -185,7 +185,7 @@ L29F5:
jsr GTBYTC
cmp #')'
.ifdef CONFIG_11A
.ifdef CBM2_KBD
.ifdef CONFIG_2
bne SYNERR4
.else
jne SYNERR
@ -289,7 +289,7 @@ OUTDO:
bit Z14
bmi L2A56
.endif
.ifndef CBM2_KBD
.ifndef CONFIG_2
pha
.endif
.ifdef CBM1
@ -335,7 +335,7 @@ L2A4C:
inc POSX
.endif
L2A4E:
.ifndef CBM2_KBD
.ifndef CONFIG_2
pla
.endif
.ifdef KIM

View File

@ -202,7 +202,7 @@ L23AD:
.endif
; ----------------------------------------------------------------------------
PUT_NEW_LINE:
.ifdef CBM2
.ifdef CBM2_MICROTAN
jsr SETPTRS
jsr LE33D
lda INPUTBUFFER
@ -254,7 +254,7 @@ L23E6:
; ----------------------------------------------------------------------------
FIX_LINKS:
jsr SETPTRS
.ifdef CBM2_KBD
.ifdef CONFIG_2
jsr LE33D
jmp L2351
LE33D:
@ -267,7 +267,7 @@ LE33D:
L23FA:
ldy #$01
lda (INDEX),y
.ifdef CBM2_KBD
.ifdef CONFIG_2
beq RET3
.else
bne L2403
@ -334,12 +334,12 @@ RET3:
rts
.endif
.ifdef CBM2
.ifdef CBM2_MICROTAN
RET3:
rts
.endif
.if .def(CBM1) || .def(OSI) || .def(KIM)
.if .def(CBM1) || .def(OSI) || .def(KIM) || .def(MICROTAN)
L2420:
.ifdef OSI
jsr OUTDO
@ -380,23 +380,35 @@ L0C32:
ldx #$00
INLIN2:
jsr GETLN
.ifndef CONFIG_CBM_ALL
.ifndef CONFIG_NO_LINE_EDITING
cmp #$07
beq L2443
.endif
cmp #$0D
beq L2453
.ifndef CONFIG_CBM_ALL
.ifndef CONFIG_NO_LINE_EDITING
cmp #$20 ; line editing
bcc INLIN2
.ifdef MICROTAN
cmp #$80
.else
cmp #$7D
.endif
bcs INLIN2
cmp #$40 ; @
beq L2423
.ifdef MICROTAN
cmp #$7F ; _
.else
cmp #$5F ; _
.endif
beq L2420
L2443:
.ifdef MICROTAN
cpx #$4F
.else
cpx #$47
.endif
bcs L244C
.endif
sta INPUTBUFFER,x
@ -407,7 +419,7 @@ L2443:
bne INLIN2
.endif
L244C:
.ifndef CONFIG_CBM_ALL
.ifndef CONFIG_NO_LINE_EDITING
lda #$07
jsr OUTDO
bne INLIN2
@ -420,7 +432,7 @@ L2453:
.ifndef KBD
.ifndef APPLE
GETLN:
.ifdef CONFIG_CBM_ALL
.ifdef CONFIG_FILE
jsr CHRIN
ldy Z03
bne L2465
@ -514,7 +526,7 @@ L2498:
jsr GET_UPPER
.else
lda INPUTBUFFERX,x
.ifndef CBM2
.ifndef CBM2_MICROTAN
cmp #$20
beq L2497
.endif
@ -669,7 +681,7 @@ SCRTCH:
iny
sta (TXTTAB),y
lda TXTTAB
.ifdef CBM2_KBD
.ifdef CONFIG_2
clc
.endif
adc #$02
@ -716,7 +728,7 @@ STKINI:
ldx #TEMPST
stx TEMPPT
pla
.ifdef CBM2_KBD
.ifdef CONFIG_2
tay
.else
.ifdef APPLE
@ -726,7 +738,7 @@ STKINI:
.endif
.endif
pla
.ifndef CBM2_KBD
.ifndef CONFIG_2
.ifdef APPLE
sta STACK+250
.else
@ -735,7 +747,7 @@ STKINI:
.endif
ldx #STACK_TOP
txs
.ifdef CBM2_KBD
.ifdef CONFIG_2
pha
tya
pha
@ -758,6 +770,8 @@ STXTPT:
adc #$FF
sta TXTPTR+1
rts
; ----------------------------------------------------------------------------
.ifdef KBD
LE4C0:
ldy #<LE444
@ -778,11 +792,13 @@ LE4D4:
cmp JMPADRS+1
LE4DE:
rts
.endif
; ----------------------------------------------------------------------------
; "LIST" STATEMENT
; ----------------------------------------------------------------------------
LIST:
.ifdef KBD
jsr LE440
bne LE4DE
pla
@ -790,30 +806,53 @@ LIST:
L25A6:
jsr CRDO
.else
LIST:
.ifdef MICROTAN
php
jmp LE21C
LC57E:
.else
bcc L2581
beq L2581
cmp #TOKEN_MINUS
bne L256A
L2581:
jsr LINGET
.endif
jsr FNDLIN
.ifdef MICROTAN
plp
beq LC598
.endif
jsr CHRGOT
beq L2598
cmp #TOKEN_MINUS
bne L2520
jsr CHRGET
.ifdef MICROTAN
beq LC598
jsr LINGET
beq L25A6
rts
LC598:
.else
jsr LINGET
bne L2520
.endif
L2598:
.ifndef MICROTAN
pla
pla
lda LINNUM
ora LINNUM+1
bne L25A6
.endif
lda #$FF
sta LINNUM
sta LINNUM+1
.ifdef MICROTAN
pla
pla
.endif
L25A6:
.endif
ldy #$01

View File

@ -117,7 +117,7 @@ PUTEMP:
ldy #$00
stx FAC_LAST-1
sty FAC_LAST
.ifdef CBM2_KBD
.ifdef CONFIG_2
sty FACEXTENSION
.endif
dey
@ -189,7 +189,7 @@ FINDHIGHESTSTRING:
sta FRETOP+1
ldy #$00
sty FNCNAM+1
.ifdef CBM2_KBD
.ifdef CONFIG_2
sty FNCNAM
.endif
lda STREND
@ -356,7 +356,7 @@ L33FA:
; TO TOP AND GO BACK FOR ANOTHER
; ----------------------------------------------------------------------------
MOVE_HIGHEST_STRING_TO_TOP:
.ifdef CBM2_KBD
.ifdef CONFIG_2
lda FNCNAM+1
ora FNCNAM
.else
@ -616,7 +616,7 @@ MIDSTR:
jsr GETBYT
L353F:
jsr SUBSTRING_SETUP
.ifdef CBM2_KBD
.ifdef CONFIG_2
beq GOIQ
.endif
dex
@ -665,7 +665,7 @@ SUBSTRING_SETUP:
.endif
ldy #$00
txa
.ifndef CBM2_KBD
.ifndef CONFIG_2
beq GOIQ
.endif
.ifndef CONFIG_11

View File

@ -142,7 +142,7 @@ UNFNC:
keyword_addr "LEFT$", LEFTSTR, TOKEN_LEFTSTR
keyword_addr "RIGHT$", RIGHTSTR
keyword_addr "MID$", MIDSTR
.ifdef CBM2_KBD
.ifdef CONFIG_2
keyword "GO"
.endif
.segment "KEYWORDS"

2
var.s
View File

@ -155,7 +155,7 @@ LD015:
rts
; ----------------------------------------------------------------------------
.ifndef CBM2_KBD
.ifndef CONFIG_2
C_ZERO:
.byte $00,$00
.endif