This repository has been archived by the owner on Jan 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbasic.inc
67 lines (61 loc) · 1.75 KB
/
basic.inc
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
.const basic_token_for = $81
.const basic_token_next = $82
.const basic_token_poke = $97
.const basic_token_print = $99
.const basic_token_sys = $9e
.const basic_token_to = $a4
.const basic_token_step = $a9
.const basic_token_addition = $aa
.const basic_token_subtraction = $ab
.const basic_token_multiplication = $ac
.const basic_token_division = $ad
.const basic_token_and = $af
.const basic_token_equals = $b2
.const basic_token_int = $b5
.const basic_token_cos = $be
.const basic_token_sin = $bf
.const basic_token_peek = $c2
.const basic_token_pi = $ff
.macro StartBasicLineWithoutToken(next_addr, line) {
.word next_addr
.word line
}
.macro StartBasicLine(next_addr, line, token) {
StartBasicLineWithoutToken(next_addr, line)
.byte token
}
.macro EndBasicLine() {
.byte $00
}
.macro EndBasicProgram() {
.byte $00, $00
}
.macro EmptyRealVar(name) {
.if(name.size() == 0) {
.error "Variable name cannot be empty"
}
.if(name.size() > 2) {
.error "Variable name must be 1 or 2 characters long: " + name
}
.text name
.if(name.size() == 1) {
.byte $00
}
.fill 5, $00
}
.macro EmptyIntegerVar(name) {
.if(name.size() == 0) {
.error "Variable name cannot be empty"
}
.if(name.size() > 2) {
.error "Variable name must be 1 or 2 characters long: " + name
}
.for(var i = 0; i < 2; i++) {
.var b = $80
.if(i < name.size()) {
.eval b += name.charAt(i)
}
.byte b
}
.fill 5, $00
}