-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmdFOR.inc
More file actions
45 lines (32 loc) · 1.26 KB
/
Copy pathcmdFOR.inc
File metadata and controls
45 lines (32 loc) · 1.26 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
;-----------------------------------------------------------------------------
cmdFOR: .proc cmdFOR
;-----------------------------------------------------------------------------
;
; Implement a FOR-loop
;
; FOR A = 1 TO 10
;
;-------|-----------------------------------|-------------------------------------
CALL GetParsedToken ; Get the variable name
MOV tokenAddr @var1
CALL GetParsedToken ; Get the equals sign
MOV tokenAddr @var2
CALL ParseExpression ; Get the start value
MOV expression @var3
INDEXEDWR @var3 @var1 ; Store the start value in the variable
CALL GetParsedToken ; Get the TO keyword
MOV tokenAddr @var4
CALL ParseExpression ; Get the end value
MOV expression @var5
PUSH @var1 ; Push the variable address
PUSH @var5 ; Push the end value
PUSH pCode ; Push the loop address
JMP Statement
@var1: .data 0
@var2: .data 0
@var3: .data 0
@var4: .data 0
@var5: .data 0
@var6: .data 0
@var7: .data 0
.endp