diff --git a/applesoft.cfg b/applesoft.cfg index dbc4c75..8014167 100644 --- a/applesoft.cfg +++ b/applesoft.cfg @@ -9,5 +9,6 @@ SEGMENTS { VECTORS: load = BASROM, type = ro; KEYWORDS: load = BASROM, type = ro; CODE: load = BASROM, type = ro; + DUMMY: load = BASROM, type = zp; # don't include } diff --git a/cbmbasic1.cfg b/cbmbasic1.cfg index ea746f3..979099b 100644 --- a/cbmbasic1.cfg +++ b/cbmbasic1.cfg @@ -9,5 +9,6 @@ SEGMENTS { VECTORS: load = BASROM, type = ro; KEYWORDS: load = BASROM, type = ro; CODE: load = BASROM, type = ro; + DUMMY: load = BASROM, type = zp; # don't include } diff --git a/cbmbasic2.cfg b/cbmbasic2.cfg index ea746f3..979099b 100644 --- a/cbmbasic2.cfg +++ b/cbmbasic2.cfg @@ -9,5 +9,6 @@ SEGMENTS { VECTORS: load = BASROM, type = ro; KEYWORDS: load = BASROM, type = ro; CODE: load = BASROM, type = ro; + DUMMY: load = BASROM, type = zp; # don't include } diff --git a/defines_apple.s b/defines_apple.s index 7148de7..e1784d7 100644 --- a/defines_apple.s +++ b/defines_apple.s @@ -41,25 +41,6 @@ BYTES_FP := 5 MANTISSA_BYTES := BYTES_FP-1 MAX_EXPON = 10 -TOKEN_GOTO := $88 -TOKEN_GOSUB := $8C -TOKEN_REM := $8E -TOKEN_PRINT := $96 -TOKEN_TAB := $9C -TOKEN_TO := $9D -TOKEN_FN := $9E -TOKEN_SPC := $9F -TOKEN_THEN := $A0 -TOKEN_NOT := $A1 -TOKEN_STEP := $A2 -TOKEN_PLUS := $A3 -TOKEN_MINUS := $A4 -TOKEN_GREATER := $AA -TOKEN_EQUAL := $AB -TOKEN_SGN := $AD -TOKEN_LEFTSTR := $C1 - - RAMSTART3 := $2A00 RAMSTART2 := $2A00 LF689 := $F689 diff --git a/defines_cbm.s b/defines_cbm.s index a3bc6c9..a903c2e 100644 --- a/defines_cbm.s +++ b/defines_cbm.s @@ -85,25 +85,6 @@ MAX_EXPON = 10 RAMSTART2 := $0400 RAMSTART3 := $0400 -TOKEN_GOTO := $89 -TOKEN_GOSUB := $8D -TOKEN_REM := $8F -TOKEN_PRINT := $99 -TOKEN_TAB := $A3 -TOKEN_TO := $A4 -TOKEN_FN := $A5 -TOKEN_SPC := $A6 -TOKEN_THEN := $A7 -TOKEN_NOT := $A8 -TOKEN_STEP := $A9 -TOKEN_PLUS := $AA -TOKEN_MINUS := $AB -TOKEN_GREATER := $B1 -TOKEN_EQUAL := $B2 -TOKEN_SGN := $B4 -TOKEN_LEFTSTR := $C8 - - OPEN := $FFC0 CLOSE := $FFC3 diff --git a/defines_kbd.s b/defines_kbd.s index eaec0d3..0b55789 100644 --- a/defines_kbd.s +++ b/defines_kbd.s @@ -24,66 +24,8 @@ SUBFLG := $000C;61 INPUTFLG := $000D;62 CPRMASK := $000E;63 Z14 := $000F;64 ; Ctrl+O flag -;TEMPPT := $0015;65 -;LASTPT := $0016;;66 -;TEMPST := $0018;68 -;INDEX := $0021;71 -;DEST := $0023;73 -;RESULT := $0025;75 -;RESULT_LAST := $0028;78 -;TXTTAB := $0029;79 -;VARTAB := $002B;7B -;ARYTAB := $002D;7D -;STREND := $002F;7F -;FRETOP := $0031;81 -;FRESPC := $0033;83 -;MEMSIZ := $0035;;85 -;CURLIN := $0037;87 -;OLDLIN := $0039;89 -;OLDTEXT := $003B;8B -;Z8C := $003D;8D -;DATPTR := $003F;8F -;INPTR := $0041;91 -;VARNAM := $0043;93 -;VARPNT := $0045;95 -;FORPNT := $0047;97 -;LASTOP := $0049;99 -;CPRTYP := $004B;9B -;FNCNAM := $004C;9C -;TEMP3 := $004C;;9C ; same -;DSCPTR := $004E;9E -;DSCLEN := $0050;A0 JMPADRS := $0093;A1 -; -LENGTH := $0094 - -;Z52 := $0052; - -;TEMP1 := $0053;A3 -;ARGEXTENSION := $0053;;A3 ; same! -;HIGHDS := $0054;A4 -;HIGHTR := $0056;A6 -;INDX := $0058;;A8 -;TEMP2 := $0058;;A8 ; same! -;TMPEXP := $0058;;A8 ; same -;EXPON := $0059;A9 -;LOWTR := $005A;AA ; $AB also EXPSGN? LOWTRX := $0094;AA ; $AB also EXPSGN? -;EXPSGN := $005B;;AB -;FAC := $005C;AC -;FAC_LAST := $005F;;AF -;FACSIGN := $0060;B0 -;SERLEN := $0061;B1 -;SHIFTSIGNEXT := $0062;B2 -;ARG := $0063;B3 -;ARG_LAST := $0066;;B6 -;ARGSIGN := $0067;B7 -;STRNG1 := $0068;B8 ; TODO: also SGNCPR -;FACEXTENSION := $0069;;B9 -;STRNG2 := $006A;BA -;CHRGET := $006C;BC -;CHRGOT := $0072;C2 -;TXTPTR := $0073;C3 RNDSEED := $00D4 @@ -112,24 +54,6 @@ MAX_EXPON = 10 RAMSTART3 := $0300 CONST_MEMSIZ := $3FFF -TOKEN_GOTO := $88 -TOKEN_GOSUB := $8C -TOKEN_REM := $8E -TOKEN_PRINT := $97 -TOKEN_TAB := $9D -TOKEN_TO := $9E -TOKEN_FN := $9F -TOKEN_SPC := $A0 -TOKEN_THEN := $A1 -TOKEN_NOT := $A2 -TOKEN_STEP := $A3 -TOKEN_PLUS := $A4 -TOKEN_MINUS := $A5 -TOKEN_GREATER := $AB -TOKEN_EQUAL := $AC -TOKEN_SGN := $AE -TOKEN_LEFTSTR := $C2 - RAMSTART2 := $0300 LC000 = $C000 diff --git a/defines_kim.s b/defines_kim.s index a8680d9..8d0d33b 100644 --- a/defines_kim.s +++ b/defines_kim.s @@ -42,21 +42,3 @@ BYTES_FP := 5 MANTISSA_BYTES := BYTES_FP-1 MAX_EXPON = 10 -TOKEN_GOTO := $88 -TOKEN_GOSUB := $8C -TOKEN_REM := $8E -TOKEN_PRINT := $97 -TOKEN_TAB := $9D -TOKEN_TO := $9E -TOKEN_FN := $9F -TOKEN_SPC := $A0 -TOKEN_THEN := $A1 -TOKEN_NOT := $A2 -TOKEN_STEP := $A3 -TOKEN_PLUS := $A4 -TOKEN_MINUS := $A5 -TOKEN_GREATER := $AB -TOKEN_EQUAL := $AC -TOKEN_SGN := $AE -TOKEN_LEFTSTR := $C2 - diff --git a/defines_osi.s b/defines_osi.s index 34d3ae8..d7980cf 100644 --- a/defines_osi.s +++ b/defines_osi.s @@ -24,62 +24,6 @@ SUBFLG := $0061 INPUTFLG := $0062 CPRMASK := $0063 Z14 := $0064 ; Ctrl+O flag -;TEMPPT := $0065 -;LASTPT := $0066 -;TEMPST := $68 -;INDEX := $0071 -;DEST := $0073 -;RESULT := $0075 -;RESULT_LAST := $0078 -;TXTTAB := $0079 -;VARTAB := $007B -;ARYTAB := $007D -;STREND := $007F -;FRETOP := $0081 -;FRESPC := $0083 -;MEMSIZ := $0085 -;CURLIN := $0087 -;OLDLIN := $0089 -;OLDTEXT := $008B -;Z8C := $008D -;DATPTR := $008F -;INPTR := $0091 -;VARNAM := $0093 -;VARPNT := $0095 -;FORPNT := $0097 -;LASTOP := $0099 -;CPRTYP := $009B -;FNCNAM := $009C -;TEMP3 := $009C ; same -;DSCPTR := $009E -;DSCLEN := $00A0 -;JMPADRS := $00A1 -;Z52 := $00A2 -;TEMP1 := $00A3 -;ARGEXTENSION := $00A3 ; same! -;HIGHDS := $00A4 -;HIGHTR := $00A6 -;INDX := $00A8 -;TEMP2 := $00A8 ; same! -;TMPEXP := $00A8 ; same -;EXPON := $00A9 -;LOWTR := $00AA ; $AB also EXPSGN? -;LOWTRX := $00AA ; $AB also EXPSGN? -;EXPSGN := $00AB -;FAC := $00AC -;FAC_LAST := $00AF -;FACSIGN := $00B0 -;SERLEN := $00B1 -;SHIFTSIGNEXT := $00B2 -;ARG := $00B3 -;ARG_LAST := $00B6 -;ARGSIGN := $00B7 -;STRNG1 := $00B8 ; TODO: also SGNCPR -;FACEXTENSION := $00B9 -;STRNG2 := $00BA -;CHRGET := $00BC -;CHRGOT := $00C2 -;TXTPTR := $00C3 RNDSEED := $00D4 @@ -106,23 +50,4 @@ MANTISSA_BYTES := BYTES_FP-1 MAX_EXPON = 10 RAMSTART3 := $0300 - -TOKEN_GOTO := $88 -TOKEN_GOSUB := $8C -TOKEN_REM := $8E -TOKEN_PRINT := $97 -TOKEN_TAB := $9C -TOKEN_TO := $9D -TOKEN_FN := $9E -TOKEN_SPC := $9F -TOKEN_THEN := $A0 -TOKEN_NOT := $A1 -TOKEN_STEP := $A2 -TOKEN_PLUS := $A3 -TOKEN_MINUS := $A4 -TOKEN_GREATER := $AA -TOKEN_EQUAL := $AB -TOKEN_SGN := $AD -TOKEN_LEFTSTR := $C1 - RAMSTART2 := $0300 \ No newline at end of file diff --git a/kb9.cfg b/kb9.cfg index c72a30c..850db68 100644 --- a/kb9.cfg +++ b/kb9.cfg @@ -9,5 +9,6 @@ SEGMENTS { VECTORS: load = BASROM, type = ro; KEYWORDS: load = BASROM, type = ro; CODE: load = BASROM, type = ro; + DUMMY: load = BASROM, type = zp; # don't include } diff --git a/kbdbasic.cfg b/kbdbasic.cfg index 0cd2c3a..1e5d778 100644 --- a/kbdbasic.cfg +++ b/kbdbasic.cfg @@ -9,5 +9,6 @@ SEGMENTS { VECTORS: load = BASROM, type = ro; KEYWORDS: load = BASROM, type = ro; CODE: load = BASROM, type = ro; + DUMMY: load = BASROM, type = zp; # don't include } diff --git a/macros.s b/macros.s index 9be51eb..6f9d047 100644 --- a/macros.s +++ b/macros.s @@ -8,3 +8,43 @@ .endrep .byte .strat(str,.strlen(str)-1) | $80 .endmacro + +.macro keyword_addr key, vec, token + .segment "VECTORS" + .addr vec + .segment "KEYWORDS" + htasc key + define_token token +.endmacro + +.macro define_token token + .segment "DUMMY" + .ifnblank token + token := <(*-DUMMY_START)+$80 + .endif + .res 1 +.endmacro + +.macro keyword_rts key, vec, token + .segment "VECTORS" + .word vec-1 + .segment "KEYWORDS" + htasc key + define_token token +.endmacro + +.macro keyword key, token + .segment "KEYWORDS" + htasc key + define_token token +.endmacro + +;.macro define_token name +; .segment "VECTORS" +; name := <(*-TOKEN_ADDRESS_TABLE)/2+$80 +;.endmacro + +.macro define_token_init + .segment "DUMMY" +DUMMY_START: +.endmacro diff --git a/msbasic.s b/msbasic.s index c6ddc19..d98ae19 100644 --- a/msbasic.s +++ b/msbasic.s @@ -169,9 +169,6 @@ DSCLEN: JMPADRS: .endif .res 1 -.ifndef CONFIG_SMALL -LENGTH: -.endif Z52: .res 1 ARGEXTENSION: @@ -256,165 +253,152 @@ STACK := $0100 .byte $00,$13,$56 .endif + define_token_init + .segment "VECTORS" TOKEN_ADDRESS_TABLE: .segment "KEYWORDS" TOKEN_NAME_TABLE: -.macro keyvec key, vec -;.local label - .segment "VECTORS" -;label: -;.out label - .addr vec - .segment "KEYWORDS" - htasc key -.endmacro -.macro keyrts key, vec - .segment "VECTORS" - .word vec-1 - .segment "KEYWORDS" - htasc key -.endmacro - - keyrts "END", END - keyrts "FOR", FOR - keyrts "NEXT", NEXT - keyrts "DATA", DATA + keyword_rts "END", END + keyword_rts "FOR", FOR + keyword_rts "NEXT", NEXT + keyword_rts "DATA", DATA .ifdef CONFIG_CBM_ALL - keyrts "INPUT#", INPUTH + keyword_rts "INPUT#", INPUTH .endif - keyrts "INPUT", INPUT - keyrts "DIM", DIM - keyrts "READ", READ + keyword_rts "INPUT", INPUT + keyword_rts "DIM", DIM + keyword_rts "READ", READ .ifdef APPLE - keyrts "PLT", PLT + keyword_rts "PLT", PLT .else - keyrts "LET", LET + keyword_rts "LET", LET .endif - keyrts "GOTO", GOTO - keyrts "RUN", RUN - keyrts "IF", IF - keyrts "RESTORE", RESTORE - keyrts "GOSUB", GOSUB - keyrts "RETURN", POP + keyword_rts "GOTO", GOTO, TOKEN_GOTO + keyword_rts "RUN", RUN + keyword_rts "IF", IF + keyword_rts "RESTORE", RESTORE + keyword_rts "GOSUB", GOSUB, TOKEN_GOSUB + keyword_rts "RETURN", POP .ifdef APPLE - keyrts "TEX", TEX + keyword_rts "TEX", TEX, TOKEN_REM .else - keyrts "REM", REM + keyword_rts "REM", REM, TOKEN_REM .endif - keyrts "STOP", STOP - keyrts "ON", ON + keyword_rts "STOP", STOP + keyword_rts "ON", ON .ifdef CONFIG_NULL - keyrts "NULL", NULL + keyword_rts "NULL", NULL .endif .ifdef KBD - keyrts "PLOD", PLOD - keyrts "PSAV", PSAV - keyrts "VLOD", VLOD - keyrts "VSAV", VSAV + keyword_rts "PLOD", PLOD + keyword_rts "PSAV", PSAV + keyword_rts "VLOD", VLOD + keyword_rts "VSAV", VSAV .else - keyrts "WAIT", WAIT - keyrts "LOAD", LOAD - keyrts "SAVE", SAVE + keyword_rts "WAIT", WAIT + keyword_rts "LOAD", LOAD + keyword_rts "SAVE", SAVE .endif .ifdef CONFIG_CBM_ALL - keyrts "VERIFY", VERIFY + keyword_rts "VERIFY", VERIFY .endif - keyrts "DEF", DEF + keyword_rts "DEF", DEF .ifdef KBD - keyrts "SLOD", SLOD + keyword_rts "SLOD", SLOD .else - keyrts "POKE", POKE + keyword_rts "POKE", POKE .endif .ifdef CONFIG_CBM_ALL - keyrts "PRINT#", PRINTH + keyword_rts "PRINT#", PRINTH .endif - keyrts "PRINT", PRINT - keyrts "CONT", CONT - keyrts "LIST", LIST + keyword_rts "PRINT", PRINT, TOKEN_PRINT + keyword_rts "CONT", CONT + keyword_rts "LIST", LIST .ifdef CONFIG_CBM_ALL - keyrts "CLR", CLEAR + keyword_rts "CLR", CLEAR .else - keyrts "CLEAR", CLEAR + keyword_rts "CLEAR", CLEAR .endif .ifdef CONFIG_CBM_ALL - keyrts "CMD", CMD - keyrts "SYS", SYS - keyrts "OPEN", OPEN - keyrts "CLOSE", CLOSE + keyword_rts "CMD", CMD + keyword_rts "SYS", SYS + keyword_rts "OPEN", OPEN + keyword_rts "CLOSE", CLOSE .endif .ifndef CONFIG_SMALL - keyrts "GET", GET + keyword_rts "GET", GET .endif .ifdef KBD - keyrts "PRT", PRT + keyword_rts "PRT", PRT .endif - keyrts "NEW", NEW + keyword_rts "NEW", NEW .segment "KEYWORDS" - htasc "TAB(" - htasc "TO" - htasc "FN" - htasc "SPC(" - htasc "THEN" - htasc "NOT" - htasc "STEP" - htasc "+" - htasc "-" - htasc "*" - htasc "/" + keyword "TAB(", TOKEN_TAB + keyword "TO", TOKEN_TO + keyword "FN", TOKEN_FN + keyword "SPC(", TOKEN_SPC + keyword "THEN", TOKEN_THEN + keyword "NOT", TOKEN_NOT + keyword "STEP", TOKEN_STEP + keyword "+", TOKEN_PLUS + keyword "-", TOKEN_MINUS + keyword "*" + keyword "/" .ifdef KBD - htasc "#" + keyword "#" .else - htasc "^" + keyword "^" .endif - htasc "AND" - htasc "OR" - htasc ">" - htasc "=" - htasc "<" + keyword "AND" + keyword "OR" + keyword ">", TOKEN_GREATER + keyword "=", TOKEN_EQUAL + keyword "<" .segment "VECTORS" UNFNC: - keyvec "SGN", SGN - keyvec "INT", INT - keyvec "ABS", ABS + keyword_addr "SGN", SGN, TOKEN_SGN + keyword_addr "INT", INT + keyword_addr "ABS", ABS .ifdef KBD - keyvec "VER", VER + keyword_addr "VER", VER .else .ifdef KIM - keyvec "USR", IQERR + keyword_addr "USR", IQERR .else - keyvec "USR", USR + keyword_addr "USR", USR .endif .endif - keyvec "FRE", FRE - keyvec "POS", POS - keyvec "SQR", SQR - keyvec "RND", RND - keyvec "LOG", LOG - keyvec "EXP", EXP - keyvec "COS", COS - keyvec "SIN", SIN - keyvec "TAN", TAN - keyvec "ATN", ATN + keyword_addr "FRE", FRE + keyword_addr "POS", POS + keyword_addr "SQR", SQR + keyword_addr "RND", RND + keyword_addr "LOG", LOG + keyword_addr "EXP", EXP + keyword_addr "COS", COS + keyword_addr "SIN", SIN + keyword_addr "TAN", TAN + keyword_addr "ATN", ATN .ifdef KBD - keyvec "GETC", GETC + keyword_addr "GETC", GETC .else - keyvec "PEEK", PEEK + keyword_addr "PEEK", PEEK .endif - keyvec "LEN", LEN - keyvec "STR$", STR - keyvec "VAL", VAL - keyvec "ASC", ASC - keyvec "CHR$", CHRSTR - keyvec "LEFT$", LEFTSTR - keyvec "RIGHT$", RIGHTSTR - keyvec "MID$", MIDSTR + keyword_addr "LEN", LEN + keyword_addr "STR$", STR + keyword_addr "VAL", VAL + keyword_addr "ASC", ASC + keyword_addr "CHR$", CHRSTR + keyword_addr "LEFT$", LEFTSTR, TOKEN_LEFTSTR + keyword_addr "RIGHT$", RIGHTSTR + keyword_addr "MID$", MIDSTR .ifdef CBM2_KBD - htasc "GO" + keyword "GO" .endif - .byte 0 + .segment "KEYWORDS" + .byte 0 .segment "VECTORS" MATHTBL: diff --git a/osi.cfg b/osi.cfg index 576e4d3..eeb6a1c 100644 --- a/osi.cfg +++ b/osi.cfg @@ -9,5 +9,6 @@ SEGMENTS { VECTORS: load = BASROM, type = ro; KEYWORDS: load = BASROM, type = ro; CODE: load = BASROM, type = ro; + DUMMY: load = BASROM, type = zp; # don't include }