diff --git a/NOTES.txt b/NOTES.txt index 28ef36f..823c8fd 100644 --- a/NOTES.txt +++ b/NOTES.txt @@ -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 diff --git a/array.s b/array.s index 93c0296..ed1d846 100644 --- a/array.s +++ b/array.s @@ -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 diff --git a/defines.s b/defines.s index fa2b9be..822d38e 100644 --- a/defines.s +++ b/defines.s @@ -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 diff --git a/defines_cbm.s b/defines_cbm.s index 6ec7664..b601978 100644 --- a/defines_cbm.s +++ b/defines_cbm.s @@ -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 diff --git a/defines_kbd.s b/defines_kbd.s index 10264ab..ffee7b9 100644 --- a/defines_kbd.s +++ b/defines_kbd.s @@ -1,5 +1,6 @@ CONFIG_SCRTCH_ORDER := 1 CONFIG_SMALL := 1 +CONFIG_2 := 1 CBM2_KBD := 1 KIM_KBD := 1 CONFIG_11 := 1 diff --git a/defines_microtan.s b/defines_microtan.s new file mode 100644 index 0000000..554803e --- /dev/null +++ b/defines_microtan.s @@ -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 \ No newline at end of file diff --git a/eval.s b/eval.s index 44f87f1..8123cc7 100644 --- a/eval.s +++ b/eval.s @@ -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 diff --git a/float.s b/float.s index 6dca3e9..b4ed01b 100644 --- a/float.s +++ b/float.s @@ -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 diff --git a/flow.s b/flow.s index 31e62a2..20d8d6e 100644 --- a/flow.s +++ b/flow.s @@ -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 diff --git a/init.s b/init.s index fe482c7..97f9d6c 100644 --- a/init.s +++ b/init.s @@ -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 -.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 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 diff --git a/input.s b/input.s index b214830..dd33323 100644 --- a/input.s +++ b/input.s @@ -186,7 +186,7 @@ GETC: READ: ldx DATPTR ldy DATPTR+1 -.ifdef CBM2_KBD +.ifdef CONFIG_2 lda #$98 ; AppleSoft, too .byte $2C L2ABE: diff --git a/make.sh b/make.sh index 8722365..2bfff4b 100755 --- a/make.sh +++ b/make.sh @@ -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 && diff --git a/message.s b/message.s index 90d1354..20c5085 100644 --- a/message.s +++ b/message.s @@ -47,6 +47,9 @@ QT_BREAK: .byte $54,$D0 ; ??? .else .byte $0D,$0A +.ifdef MICROTAN + .byte " " +.endif .byte "BREAK" .byte $00 .endif diff --git a/microtan.cfg b/microtan.cfg new file mode 100644 index 0000000..9ff8c96 --- /dev/null +++ b/microtan.cfg @@ -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 +} + diff --git a/misc2.s b/misc2.s index 6afdd8a..cd924db 100644 --- a/misc2.s +++ b/misc2.s @@ -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 diff --git a/orig/microtan.bin b/orig/microtan.bin new file mode 100644 index 0000000..f36c395 Binary files /dev/null and b/orig/microtan.bin differ diff --git a/print.s b/print.s index 8a86469..aca67b3 100644 --- a/print.s +++ b/print.s @@ -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 diff --git a/program.s b/program.s index 9d07ae6..87b4f22 100644 --- a/program.s +++ b/program.s @@ -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 #