-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmdDIM.inc
More file actions
62 lines (46 loc) · 1.56 KB
/
Copy pathcmdDIM.inc
File metadata and controls
62 lines (46 loc) · 1.56 KB
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
;-----------------------------------------------------------------------------
cmdDIM: .proc cmdDIM
;-----------------------------------------------------------------------------
;
; Declare one or more variables named with more than one letter.
;
; DIM FOO,bar,Bletch
;
;-----------------------------------------------------------------------------
; DEBUGPRINT "[CMDDIM]\r\n" ;debug
@loop:
CMPEQ tokenPeek CONST_0 @done ; If the token is an EOL, we're done
CMPEQ tokenPeek ASCII_COLON @done ; If the token is an colon, we're done
; Get the variable name
INC tokenMode ; Set the token mode to get a (undeclared) name
CALL GetParsedToken
CMPNE tokenType TT_STRING @tryMore
JMPL0 varIsString @notAstringVariable
MOV CONST_65 @len ; Strings are 64 bytes long + a terminating zero
@notAstringVariable:
; DEBUGPRINT "INT VARIABLE PEEK=" ;debug
; PUSH tokenPeek ;debug
; CALL PrintInteger ;debug
; PRINTCRLF ;debug
CMPNE tokenPeek ASCII_LEFT_PAREN @notArray
@array:
INC pCode
; DEBUGPRINT "pCode=" ;debug
; PUSH pCode ;debug
; CALL PrintInteger ;debug
PUSH pCode
CALL ATOI
PUSH atoiVal
CALL InsertVar
JMP @tryMore
@notArray:
PUSH tokenStr
PUSH CONST_1
CALL InsertVar
@tryMore:
CMPEQ tokenStr+1 ASCII_COMMA @loop ; If comma try getting the next variable
JMP @loop
@done
JMP Statement
@len: .data 0
.endp