added SYM-1

This commit is contained in:
Martin Hoffmann-Vetter 2014-02-14 18:46:36 -08:00 committed by Michael Steil
parent 440442981d
commit 42fd0a2a58
24 changed files with 362 additions and 24 deletions

View File

@ -22,6 +22,9 @@ MICROTAN := 1
.elseif .def(aim65)
AIM65 := 1
.include "defines_aim65.s"
.elseif .def(sym1)
SYM1 := 1
.include "defines_sym1.s"
.endif
.ifdef CONFIG_2C

View File

@ -29,7 +29,7 @@ STACK2 := $0200
; constants
STACK_TOP := $FD
SPACE_FOR_GOSUB := $44
NULL_MAX := $F2 ; probably different in original version; the image I have seems
NULL_MAX := $F2
CRLF_1 := CR
CRLF_2 := LF
WIDTH := 20

57
defines_sym1.s Normal file
View File

@ -0,0 +1,57 @@
; configuration
CONFIG_2A := 1
CONFIG_NULL := 1
CONFIG_PRINT_CR := 1 ; print CR when line end reached
CONFIG_SAFE_NAMENOTFOUND := 1
CONFIG_SCRTCH_ORDER := 1
CONFIG_PEEK_SAVE_LINNUM := 1
CONFIG_SMALL_ERROR := 1
; zero page
ZP_START1 = $00
ZP_START2 = $18
ZP_START3 = $0d
ZP_START4 = $66
;extra ZP variables
USR := $0A
TXPSV := LASTOP
ZD3 := $D3
ZD4 := $D4
GET := IQERR
COS := USR1
SIN := USR1
TAN := USR1
ATN := USR1
; inputbuffer
INPUTBUFFER := $001E
; constants
STACK_TOP := $FE
SPACE_FOR_GOSUB := $3E
NULL_MAX := $F0
CRLF_1 := CR
CRLF_2 := LF
WIDTH := 72
WIDTH2 := 56
; memory layout
RAMSTART2 := $0200
; monitor functions
ASCNIB := $8275
INSTAT := $8386
MONRDKEY := $8A1B
MONCOUT := $8A47
ACCESS := $8B86
L8C78 := $8C78
DUMPT := $8E87
P3L := $A64A
P3H := P3L+1
P2L := $A64C
P2H := P2L+1
P1L := $A64E

99
eval.s
View File

@ -394,6 +394,16 @@ EQUOP:
eor #$FF
jmp GIVAYF
L2D74:
.ifdef SYM1
cmp #TOKEN_USR
bne LCC8A
jmp LCDBD
LCC8A:
cmp #$26
bne LCC91
jmp LCDFE
LCC91:
.endif
cmp #TOKEN_FN
bne L2D7B
jmp L31F3
@ -687,3 +697,92 @@ CMPDONE:
lda #$FF
L2E99:
jmp FLOAT
.ifdef SYM1
LCDBD:
jsr CHRGET
jsr CHKOPN
jsr FRMEVL
jsr CHRGOT
cmp #$29
beq LCDF1
jsr AYINT
lda FAC+4
ldy FAC+3
sta USR+1
sty USR+2
LCDD8:
jsr CHKCOM
jsr FRMEVL
jsr CHRGOT
cmp #$29
beq LCDF1
jsr AYINT
lda FAC+3
pha
lda FAC+4
pha
jmp LCDD8
LCDF1:
jsr CHRGET
jsr AYINT
lda FAC+3
ldy FAC+4
jmp USR
LCDFE:
lda ZD4
pha
lda ZD3
pha
jsr CHRGET
cmp #$22
bne LCE49
jsr CHRGET
jsr LCE2B
tax
jsr CHRGOT
jsr LCE2B
pha
jsr CHRGOT
cmp #$22
bne LCE48
jsr CHRGET
pla
tay
pla
pla
txa
jmp GIVAYF
LCE2B:
jsr ASCNIB
bcs LCE47
pha
jsr CHRGET
jsr ASCNIB
sta FAC+4
bcs LCE46
jsr CHRGET
pla
asl a
asl a
asl a
asl a
ora FAC+4
rts
LCE46:
pla
LCE47:
pla
LCE48:
pla
LCE49:
pla
sta ZD3
pla
sta ZD4
jmp ZERO_FAC
.endif

View File

@ -22,4 +22,8 @@
.ifdef AIM65
.include "aim65_extra.s"
.endif
.ifdef SYM1
.byte 0,0,0
.endif

View File

@ -1197,6 +1197,12 @@ L3B6F:
dex
bpl L3B6F
bcc FIN2
.ifdef SYM1
cmp #$26
bne LDABB
jmp LCDFE
LDABB:
.endif
cmp #$2D
bne L3B7E
stx SERLEN

View File

@ -311,6 +311,7 @@ NULL:
bcs L2739
dex
stx Z15
L2738:
rts
L2739:
jmp IQERR

View File

@ -8,3 +8,6 @@
jmp RESTART
.word AYINT,GIVAYF
.endif
.ifdef SYM1
jmp PR_WRITTEN_BY
.endif

37
init.s
View File

@ -11,13 +11,18 @@ PR_WRITTEN_BY:
.ifndef KBD
.ifndef CONFIG_CBM_ALL
.ifndef AIM65
.ifndef SYM1
lda #<QT_WRITTEN_BY
ldy #>QT_WRITTEN_BY
jsr STROUT
.endif
.endif
.endif
.endif
COLD_START:
.ifdef SYM1
jsr ACCESS
.endif
.ifdef KBD
lda #<LFD81
sta $03A0
@ -72,6 +77,11 @@ COLD_START:
sta GOSTROUT
sta JMPADRS
.endif
.ifdef SYM1
sta USR1
sta USR3
sta USR2
.endif
.if (!.def(CONFIG_RAM)) && (!.def(CONFIG_CBM_ALL))
sta USR
.endif
@ -93,6 +103,18 @@ COLD_START:
.else
sta USR+1
sty USR+2
.ifdef SYM1
sta USR1+1
sty USR1+2
lda #<DUMPT
ldy #>DUMPT
sta USR2+1
sty USR2+2
lda #<L8C78
ldy #>L8C78
sta USR3+1
sty USR3+2
.endif
.endif
.endif
.ifndef CBM1
@ -156,10 +178,12 @@ L4098:
sta Z14
.ifndef CBM2
.ifndef AIM65
.ifndef SYM1
.ifndef MICROTAN
lda #$03
sta DSCLEN
.endif
.endif
.endif
.ifndef CONFIG_11
lda #$2C
@ -192,8 +216,10 @@ L4098:
sty TXTPTR+1
jsr CHRGET
.ifndef AIM65
.ifndef SYM1
cmp #$41
beq PR_WRITTEN_BY
.endif
.endif
tay
bne L40EE
@ -267,7 +293,7 @@ L40FA:
ldy LINNUM+1
sta MEMSIZ
sty MEMSIZ+1
.if !(.def(MICROTAN) || .def(AIM65))
.if !(.def(MICROTAN) || .def(AIM65) || .def(SYM1))
sta FRETOP
sty FRETOP+1
.endif
@ -424,7 +450,7 @@ QT_WANT:
.endif
QT_WRITTEN_BY:
.ifndef CONFIG_CBM_ALL
.ifndef AIM65
.if !(.def(AIM65) || .def(SYM1))
.ifdef APPLE
asc80 "COPYRIGHT 1977 BY MICROSOFT CO"
.byte CR,0
@ -442,7 +468,7 @@ QT_MEMORY_SIZE:
.byte "MEMORY SIZE"
.byte 0
QT_TERMINAL_WIDTH:
.ifndef AIM65
.if !(.def(AIM65) || .def(SYM1))
.byte "TERMINAL "
.endif
.byte "WIDTH"
@ -471,6 +497,9 @@ QT_BASIC:
.ifdef AIM65
.byte " AIM 65 BASIC V1.1"
.endif
.ifdef SYM1
.byte "BASIC V1.1"
.endif
.ifdef CBM1
.byte $13 ; HOME
.byte "*** COMMODORE BASIC ***"
@ -491,6 +520,8 @@ QT_BASIC:
.elseif .def(AIM65)
.byte 0
.byte "(C) 1978 MICROSOFT"
.elseif .def(SYM1)
.byte "COPYRIGHT 1978 SYNERTEK SYSTEMS CORP."
.else
.byte "COPYRIGHT 1977 BY MICROSOFT CO."
.endif

View File

@ -99,10 +99,7 @@ L2443:
.endif
sta INPUTBUFFER,x
inx
.ifdef OSI
.byte $2C
.elseif .def(AIM65)
.if .def(OSI) || .def(AIM65)
.byte $2C
.else
bne INLIN2
@ -152,7 +149,11 @@ RDKEY:
jsr LFD0C
and #$7F
.endif
.ifdef SYM1
cmp #$14
.else
cmp #$0F
.endif
bne L2465
pha
lda Z14

20
input.s
View File

@ -8,6 +8,7 @@
INPUTERR:
lda INPUTFLG
beq RESPERR ; INPUT
.ifndef SYM1
.ifndef CONFIG_SMALL
.ifdef CONFIG_10A
; without this, it treats GET errors
@ -18,6 +19,7 @@ INPUTERR:
L2A63:
.endif
.endif
.endif
.ifdef CONFIG_CBM1_PATCHES
jsr PATCH5
nop
@ -52,6 +54,7 @@ RTS20:
; "GET" STATEMENT
; ----------------------------------------------------------------------------
.ifndef CONFIG_SMALL
.ifndef SYM1
GET:
jsr ERRDIR
; CBM: if GET#, then switch input
@ -83,6 +86,7 @@ LCAB6:
.endif
rts
.endif
.endif
; ----------------------------------------------------------------------------
; "INPUT#" STATEMENT
@ -105,6 +109,12 @@ LCAD8:
LCAE0:
.endif
.ifdef SYM1
LC9B0:
jsr OUTQUES ; '?'
jsr OUTSP
jmp L2A9E
.endif
; ----------------------------------------------------------------------------
; "INPUT" STATEMENT
; ----------------------------------------------------------------------------
@ -118,7 +128,11 @@ INPUT:
jsr LCFFA
.endif
cmp #$22
.ifdef SYM1
bne LC9B0
.else
bne L2A9E
.endif
jsr STRTXT
lda #$3B
jsr SYNCHR
@ -130,6 +144,8 @@ L2A9E:
LCAF8:
.ifdef APPLE
jsr INLINX
.elseif .def(SYM1)
jsr INLIN
.else
jsr NXIN
.endif
@ -233,6 +249,7 @@ PROCESS_INPUT_ITEM:
bne INSTART
bit INPUTFLG
.ifndef CONFIG_SMALL ; GET
.ifndef SYM1
bvc L2AF0
.ifdef MICROTAN
jsr MONRDKEY2
@ -271,6 +288,7 @@ PROCESS_INPUT_ITEM:
bne L2AF8 ; always
.endif
L2AF0:
.endif
.endif
bmi FINDATA
.ifdef CONFIG_FILE
@ -294,6 +312,7 @@ INSTART:
bit VALTYP
bpl L2B34
.ifndef CONFIG_SMALL ; GET
.ifndef SYM1
bit INPUTFLG
bvc L2B10
.ifdef CONFIG_CBM1_PATCHES
@ -308,6 +327,7 @@ INSTART:
beq L2B1C
.endif
L2B10:
.endif
.endif
sta CHARAC
cmp #$22

View File

@ -23,4 +23,7 @@
.ifdef AIM65
.include "aim65_iscntc.s"
.endif
.ifdef SYM1
.include "sym1_iscntc.s"
.endif
;!!! runs into "STOP"

View File

@ -11,4 +11,7 @@
.endif
.ifdef AIM65
.include "aim65_loadsave.s"
.endif
.ifdef SYM1
.include "sym1_loadsave.s"
.endif

View File

@ -2,7 +2,7 @@ if [ ! -d tmp ]; then
mkdir tmp
fi
for i in cbmbasic1 cbmbasic2 kbdbasic osi kb9 applesoft microtan aim65; do
for i in cbmbasic1 cbmbasic2 kbdbasic osi kb9 applesoft microtan aim65 sym1; do
echo $i
ca65 -D $i msbasic.s -o tmp/$i.o &&

BIN
orig/sym1.bin Normal file

Binary file not shown.

12
print.s
View File

@ -104,7 +104,7 @@ L29B9:
sty INPUTBUFFER,x
ldx #LINNUM+1
.endif
.ifdef MICROTAN
.if .def(MICROTAN) || .def(SYM1)
bne CRDO2
.endif
.endif
@ -132,11 +132,7 @@ CRDO2:
jsr OUTDO
PRINTNULLS:
.ifdef KBD
lda #$00
sta POSX
eor #$FF
.elseif .def(AIM65)
.if .def(KBD) || .def(AIM65)
lda #$00
sta POSX
eor #$FF
@ -154,7 +150,11 @@ PRINTNULLS:
pha
ldx Z15
beq L29D9
.ifdef SYM1
lda #$FF
.else
lda #$00
.endif
L29D3:
jsr OUTDO
dex

View File

@ -654,7 +654,7 @@ LB4BF:
php
jmp LE21C ; patch
LC57E:
.elseif .def(AIM65)
.elseif .def(AIM65) || .def(SYM1)
php
jsr LINGET
LC57E:
@ -667,12 +667,12 @@ L2581:
jsr LINGET
.endif
jsr FNDLIN
.if .def(MICROTAN) || .def(AIM65)
.if .def(MICROTAN) || .def(AIM65) || .def(SYM1)
plp
beq L2598
.endif
jsr CHRGOT
.if .def(MICROTAN) || .def(AIM65)
.if .def(MICROTAN) || .def(AIM65) || .def(SYM1)
beq L25A6
.else
beq L2598
@ -680,7 +680,7 @@ L2581:
cmp #TOKEN_MINUS
bne L2520
jsr CHRGET
.if .def(MICROTAN) || .def(AIM65)
.if .def(MICROTAN) || .def(AIM65) || .def(SYM1)
beq L2598
jsr LINGET
beq L25A6
@ -690,7 +690,7 @@ L2581:
bne L2520
.endif
L2598:
.if !(.def(MICROTAN) || .def(AIM65))
.if !(.def(MICROTAN) || .def(AIM65) || .def(SYM1))
pla
pla
lda LINNUM
@ -701,7 +701,7 @@ L2598:
sta LINNUM
sta LINNUM+1
L25A6:
.if .def(MICROTAN) || .def(AIM65)
.if .def(MICROTAN) || .def(AIM65) || .def(SYM1)
pla
pla
.endif
@ -764,7 +764,7 @@ LA519:
lda (LOWTRX),y
stx LOWTRX
sta LOWTRX+1
.if .def(MICROTAN) || .def(AIM65)
.if .def(MICROTAN) || .def(AIM65) || .def(SYM1)
bne L25A6X
.else
bne L25A6

View File

@ -5,7 +5,7 @@ if [ ! -d orig ]; then
exit;
fi
for i in cbmbasic1 cbmbasic2 kbdbasic osi kb9 applesoft microtan aim65; do
for i in cbmbasic1 cbmbasic2 kbdbasic osi kb9 applesoft microtan aim65 sym1; do
echo $i
ca65 -D $i msbasic.s -o tmp/$i.o &&

19
sym1.cfg Normal file
View File

@ -0,0 +1,19 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $C000, size = $2000, 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
}

8
sym1_iscntc.s Normal file
View File

@ -0,0 +1,8 @@
.segment "CODE"
ISCNTC:
jsr INSTAT
bcc RET1
lda #$03
cmp #$03
;!!! runs into "STOP"

70
sym1_loadsave.s Normal file
View File

@ -0,0 +1,70 @@
.segment "CODE"
SAVE:
beq L2739
sta P1L
jsr CHRGET
bne NULL-1
lda TXTTAB
ldy TXTTAB+1
sta P2L
sty P2H
lda VARTAB
ldy VARTAB+1
sta P3L
sty P3H
ldy #$80
jsr USR2
bcs LC6DD
lda #<SAVED
ldy #>SAVED
jmp STROUT
LOADED:
.byte "LOADED",CR,LF
.byte "OK",CR,LF,0
SAVED:
.byte "SAVED",CR,LF,0
LOAD:
beq L2739
sta $A64E
jsr CHRGET
bne L2738
ldy #$80
jsr USR3
bcs LC6EF
lda #<LOADED
ldy #>LOADED
jsr STROUT
ldx P3L
ldy P3H
txa
stx VARTAB
sty VARTAB+1
jmp FIX_LINKS
LC6DD:
lda #<BAD_SAVE
ldy #>BAD_SAVE
jmp STROUT
BAD_SAVE:
htasc "BAD SAVE"
.byte CR,LF,0
LC6EF:
lda #<BAD_LOAD
ldy #>BAD_LOAD
jsr STROUT
jsr SCRTCH
jmp RESTART
BAD_LOAD:
htasc "BAD LOAD"
.byte CR,LF,0

View File

@ -116,7 +116,7 @@ UNFNC:
.ifdef CONFIG_RAM
keyword_addr "USR", IQERR
.else
keyword_addr "USR", USR
keyword_addr "USR", USR, TOKEN_USR
.endif
.endif
keyword_addr "FRE", FRE

2
trig.s
View File

@ -1,5 +1,6 @@
.segment "CODE"
.ifndef SYM1
SIN_COS_TAN_ATN:
; ----------------------------------------------------------------------------
; "COS" FUNCTION
@ -200,4 +201,5 @@ POLY_ATN:
.if .def(CONFIG_11A) && (!.def(CONFIG_2))
.byte $00 ; XXX
.endif
.endif
.endif

View File

@ -186,6 +186,14 @@ ATN:
ZBE:
.res 1
.endif
.ifdef SYM1
USR1:
.res 3
USR2:
.res 3
USR3:
.res 3
.endif
CHRGET:
TXTPTR = <(GENERIC_TXTPTR-GENERIC_CHRGET + CHRGET)
CHRGOT = <(GENERIC_CHRGOT-GENERIC_CHRGET + CHRGET)