-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
73 lines (62 loc) · 1.26 KB
/
test.js
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
// @header
const header = ['NES',{a: 0x1a}, 0x02, 0x01, 0b00000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0];
let a = 2;
if (a >= 2) {
let a = 1;
} else if (a == 0) {
let a = 2;
} else {
let a = 3;
}
// @char
let mario = "mario.chr"//, notMario = null; <- throws error, so good
{
let a = 0;
}
// @zeropage
const entity = {
// @.byte <- doesn't work, because of the tree-like structure of asts
xpos: undefined
}
let appleH = 0x01;
let snakeHeadL = 0x10;
let snakeHeadH = 0x11;
let snakeBodyStart = 0x12;
let snakeDirection = 0x02;
let snakeLength = 0x03;
let movingUp = 0b00000001;
let movingRight = 0b00000010;
let movingDown = 0b00000100;
let movingLeft = 0b00001000;
let ASCII_w = 0x77;
let ASCII_a = 0x61;
let ASCII_s = 0x73;
let ASCII_d = 0x64;
let sysRandom = 0xfe;
let sysLastKey = 0xff;
function initSnake() {
snakeDirection = movingRight;
snakeLength = 4;
snakeHeadL = 0x11;
snakeBodyStart = 0x10;
/* what is this shit
lda #$0f
sta $14 ; body segment 1
lda #$04
sta snakeHeadH
sta $13 ; body segment 1
sta $15 ; body segment 2
rts */
return;
}
function generateApplePosition() {
appleL = sysRandom;
appleH = sysRandom & 0x03 + 2;
return;
}
function init() {
initSnake();
generateApplePosition();
return;
}
init();