forked from mist64/msbasic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoken.s
181 lines (175 loc) · 3.62 KB
/
token.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
init_token_tables
keyword_rts "END", END
keyword_rts "FOR", FOR
keyword_rts "NEXT", NEXT
keyword_rts "DATA", DATA
.ifdef CONFIG_FILE
keyword_rts "INPUT#", INPUTH
.endif
keyword_rts "INPUT", INPUT
keyword_rts "DIM", DIM
keyword_rts "READ", READ
.ifdef APPLE
keyword_rts "PLT", PLT
.else
keyword_rts "LET", LET
.endif
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
keyword_rts "TEX", TEX, TOKEN_REM
.else
keyword_rts "REM", REM, TOKEN_REM
.endif
keyword_rts "STOP", STOP
keyword_rts "ON", ON
.ifdef CONFIG_NULL
keyword_rts "NULL", NULL
.endif
.ifdef KBD
keyword_rts "PLOD", PLOD
keyword_rts "PSAV", PSAV
keyword_rts "VLOD", VLOD
keyword_rts "VSAV", VSAV
.endif
.ifndef CONFIG_NO_POKE
keyword_rts "WAIT", WAIT
.endif
.ifndef KBD
keyword_rts "LOAD", LOAD
keyword_rts "SAVE", SAVE
.endif
.ifdef CONFIG_CBM_ALL
keyword_rts "VERIFY", VERIFY
.endif
keyword_rts "DEF", DEF
.ifdef KBD
keyword_rts "SLOD", SLOD
.endif
.ifndef CONFIG_NO_POKE
keyword_rts "POKE", POKE
.endif
.ifdef CONFIG_FILE
keyword_rts "PRINT#", PRINTH
.endif
keyword_rts "PRINT", PRINT, TOKEN_PRINT
keyword_rts "CONT", CONT
keyword_rts "LIST", LIST
.ifdef CONFIG_CBM_ALL
keyword_rts "CLR", CLEAR
.else
keyword_rts "CLEAR", CLEAR
.endif
.ifdef CONFIG_FILE
keyword_rts "CMD", CMD
keyword_rts "SYS", SYS
keyword_rts "OPEN", OPEN
keyword_rts "CLOSE", CLOSE
.endif
.ifndef CONFIG_SMALL
keyword_rts "GET", GET
.endif
.ifdef KBD
keyword_rts "PRT", PRT
.endif
keyword_rts "NEW", NEW
count_tokens
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
keyword "#"
.else
keyword "^"
.endif
keyword "AND"
keyword "OR"
keyword ">", TOKEN_GREATER
keyword "=", TOKEN_EQUAL
keyword "<"
.segment "VECTORS"
UNFNC:
keyword_addr "SGN", SGN, TOKEN_SGN
keyword_addr "INT", INT
keyword_addr "ABS", ABS
.ifdef KBD
keyword_addr "VER", VER
.endif
.ifndef CONFIG_NO_POKE
.ifdef CONFIG_RAM
keyword_addr "USR", IQERR
.else
keyword_addr "USR", USR, TOKEN_USR
.endif
.endif
keyword_addr "FRE", FRE
keyword_addr "POS", POS
keyword_addr "SQR", SQR
keyword_addr "RND", RND
keyword_addr "LOG", LOG
keyword_addr "EXP", EXP
.segment "VECTORS"
UNFNC_COS:
keyword_addr "COS", COS
.segment "VECTORS"
UNFNC_SIN:
keyword_addr "SIN", SIN
.segment "VECTORS"
UNFNC_TAN:
keyword_addr "TAN", TAN
.segment "VECTORS"
UNFNC_ATN:
keyword_addr "ATN", ATN
.ifdef KBD
keyword_addr "GETC", GETC
.endif
.ifndef CONFIG_NO_POKE
keyword_addr "PEEK", PEEK
.endif
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 CONFIG_2
keyword "GO", TOKEN_GO
.endif
.segment "KEYWORDS"
.byte 0
.segment "VECTORS"
MATHTBL:
.byte $79
.word FADDT-1
.byte $79
.word FSUBT-1
.byte $7B
.word FMULTT-1
.byte $7B
.word FDIVT-1
.byte $7F
.word FPWRT-1
.byte $50
.word TAND-1
.byte $46
.word OR-1
.byte $7D
.word NEGOP-1
.byte $5A
.word EQUOP-1
.byte $64
.word RELOPS-1