-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflip.8o
113 lines (97 loc) · 2.08 KB
/
flip.8o
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
: hall-0+0+1
0xf 0xc3 0xe0 0xf4 0x26 0x7 0x83 0xe0 0xf2 0xf3 0x7b 0x3 0xc0 0xe6 0xf7 0xe7 0xe6 0xc0 0x3 0x7b 0xf3 0xf0 0xe0 0xc3 0x7 0x76 0xe0 0xe0 0xc3 0xf 0xff 0xff 0xff 0x3f 0xf 0x43 0x60 0x6a 0xb 0x0 0xa6 0x36 0x14 0x40 0x6b 0x69 0x40 0x4 0xa6 0xb4 0x21 0xa 0x68 0x48 0x43 0xf 0x3f 0xff 0xff 0xff
: hall-0+16+1
0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x3f 0xf 0x63 0x28 0x85 0xb0 0x15 0xc 0x62 0xb 0xa8 0x81 0x28 0x63 0xf 0x3f 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x3f 0x4f 0x53 0x88 0x50 0x23 0x4f 0x3f 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
: main
clear
:unpack 0 hall-0+16+1
copy
v0 := 16
v2 := 15
i := decompression-buffer
render
v0 := 24
render
flip
v0 := 40
v2 := 15
i := decompression-buffer
render
v0 := 32
render
:unpack 0 hall-0+0+1
copy
v0 := 0
v2 := 15
i := decompression-buffer
render
v0 := 8
render
flip
v0 := 56
v2 := 15
i := decompression-buffer
render
v0 := 48
render
jump main
: render
v1 := 1
sprite v0 v1 15
i += v2
v1 := 16
sprite v0 v1 15
i += v2
return
#############################
# Copy 60 bytes from given address to decompression-buffer
# Input: Address unpacked in v0 and v1
# Destroys: Everything except vD
: copy
vE := 0
i := copy-addr
save v1
loop
v2 := 0xA0
v0 |= v2
i := copy-smc
save v1
: copy-smc
0 0
i += vE
load vC
i := decompression-buffer
i += vE
save vC
vE += 12
if vE == 60 then return
i := copy-addr
load v1
again
: copy-addr
0 0
#############################
# Flips all the bytes in the decompression buffer
# Input: none
# Destroys: v0-v3, vF, i
# Size: 38 bytes excluding decompression-buffer
: flip
v3 := 0
i := decompression-buffer
loop # for each byte
load v0
v1 := 0
v2 := 1
loop # for each bit
v0 <<= v0
if vF == 1 then v1 |= v2
v2 <<= v2
if v2 != 0 then again
v0 := v1
i := decompression-buffer
i += v3
save v0
v3 += 1
if v3 != 60 then again
return
: decompression-buffer