-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmdINPUT.inc
More file actions
42 lines (35 loc) · 984 Bytes
/
Copy pathcmdINPUT.inc
File metadata and controls
42 lines (35 loc) · 984 Bytes
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
;-----------------------------------------------------------------------------
cmdINPUT: .proc cmdINPUT
;-----------------------------------------------------------------------------
;
; Read a value from the user and store it in a variable
;
; INPUT A
;
;-------|-----------------------------------|-------------------------------------
CALL GetParsedToken
MOV tokenAddr @var1 ; Get the address of the variable to receive the input data
CALL InputString
CMPEQ tokenType TT_VARINT @isInt
CMPEQ tokenType TT_VARSTR @isString
JMP SyntaxError
@isString:
MOV buf @src
@isStringLoop:
INDEXEDRD @src @ch
INDEXEDWR @ch @var1
INC @src
INC @var1
JMPN0 @ch @isStringLoop
JMP @done
@isInt:
PUSH buf
CALL ATOI
INDEXEDWR atoiVal @var1
@done:
PRINTCRLF
JMP Statement
@var1: .data 0
@src: .data 0
@ch: .data 0
.endp