-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpong_review.txt
144 lines (133 loc) · 4.75 KB
/
pong_review.txt
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
0x0200 0x6a02 V[10] = 02
0x0202 0x6b0c V[11] = 12
0x0204 0x6c3f V[12] = 63
0x0206 0x6d0c V[13] = 12
0x0208 0xa2ea I = 2ea (746)
0x020a 0xdab6 DRAW x=02 Y=12 height 6 // draw stick
0x020c 0xdcd6 DRAW x=63 Y=12 height 6 // draw stcik
0x020e 0x6e00 V[14] = 0
0x0210 0x22d4 Call (2d4)
0x0212 0x6603 V[6] = 3
0x0214 0x6802 V[7] = 2
0x0216 0x6060 V[0] = 0x60 (96)
0x0218 0xf015 Set timer delay to value in V[0] 0x60 96
//Loop waiting for just over a second
0x021a 0xf007 Set V[0] to Value in delay timer
0x021c 0x3000 if(V[0] == 0) skip next instruction
0x021e 0x121a Goto 0x21a
0x0220 0xc717 V[7] = random number & 0x17 rand&00010111
0x0222 0x7708 Add 8 to V[7] //V[7] is random number between 8 and 25 random Y position for ball
0x0224 0x69ff V[9] = 0xFF(255)
0x0226 0xa2f0 I = 0x2f0(752) // Ball
0x0228 0xd671 Draw V[6](3) V[7] (rand 8-25) height 1 char at 0x2f0 0b10000000 // Draw ball init
// Main game loop
0x022a 0xa2ea I = 0x2ea(746) // Stick
0x022c 0xdab6 Draw X=V[10] Y=V[11] height 6 // clear stick on left
0x022e 0xdcd6 Draw X=V[12] Y=V[13] heght 6 // clear stick on right
0x0230 0x6001 V[0] = 1
0x0232 0xe0a1 Skip if key V[0] 1 isnt pressed
0x0234 0x7bfe Add 0xfe(254) to V[11] Go up if key pressed
0x0236 0x6004 V[0] = 4
0x0238 0xe0a1 Skip if 4 isnt pressed
0x023a 0x7b02 Add 0x02(2) to V[11] Go Down if key pressed
0x023c 0x601f V[0] = 0x1f(31)
0x023e 0x8b02 V[11] = V[11] & V[0] //e.g. 1&31 11111 make Y position between 0 and 31
0x0240 0xdab6 Draw X=V[10] Y=V[12] height=6 // Draw new positon of left stick
0x0242 0x8d70 V[13] = V[7]
0x0244 0xc00a V[0] = 10
0x0246 0x7dfe V[13] += 0xFE(254)(0b11111110)
0x0248 0x4000 if(V[0] != 00) skip next
0x024a 0x7d02 V[13] += 2
0x024c 0x6000 V[0] = 0
0x024e 0x601f V[0] = 0x1f(31)(0b11111)
0x0250 0x8d02 V[13] = V[13] & V[0]
0x0252 0xdcd6 Draw X=V[12] Y=V[13] Height 6
0x0254 0xa2f0 I = 0x2f0 // Ball
0x0256 0xd671 Draw X=V[6] Y=V[7] height 1 // Remove ball image
0x0258 0x8684 V[6] += V[8] // Move right/left
0x025a 0x8794 V[7] += V[9] // move up/down
0x025c 0x603f V[0] = 0x3f(63) (0b111111)
0x025e 0x8602 V[6] = V[6] & V[0] make width between 0 and 63
0x0260 0x611f V[1] = 0x1f(31)(0b11111)
0x0262 0x8712 V[7] = V[7] & V[1] // make height betwen 0 and 31
0x0264 0x4602 skip if (V[6] != 02) //Horizontal not equal to left paddle
0x0266 0x1278 Goto 0x278
0x0268 0x463f skip if (V[6] != 0x3f(63) // Horizontal not equal to right paddle
0x026a 0x1282 Goto 0x282
0x026c 0x471f skip if (V[7] != 0x1f(31)) // check ball hitting bottom
0x026e 0x69ff V[9] = 0xff(255) //Start going up
0x0270 0x4700 skip if(V[7] != 0) // check ball hitting top
0x0272 0x6901 V[9] = 1 // Start going down
0x0274 0xd671 Draw X=V[6] Y=V[7] height 1 // draw ball at new position
0x0276 0x122a Goto 0x22a // Go back to start of game loop
// Left paddle check ball
0x0278 0x6802 V[8] = 2
0x027a 0x6301 V[3] = 1
0x027c 0x8070 V[0] = V[7]
0x027e 0x80b5 V[0] -= V[11]
0x0280 0x128a Goto 0x28a // check borrow below
// Right paddle check ball
0x0282 0x68fe V[8] = 0xfe(254) 0b11111110
0x0284 0x630a V[3] = 0xa(10)
0x0286 0x8070 V[0] = V[7] // ball height
0x0288 0x80d5 V[0] -= V[13]
// Check someone scored
0x028a 0x3f01 skip if v[15] = 1 // Check if above caused borrow V[0] was < V[13]
0x028c 0x12a2 goto 0x2a2 // remove old score
0x028e 0x6102 V[1] = 2
0x0290 0x8015 V[0] -= V[1]
0x0292 0x3f01 skip if(V[15] == 1) V[0] was < V[1](2)
0x0294 0x12ba Goto 0x2ba // does something
0x0296 0x8015 V[0] -= V[1]
0x0298 0x3f01 skip if(V[15] == 1) V[0] was < 2
0x029a 0x12c8 Goto 0x2c8 // does something
0x029c 0x8015 V[0] -= V[1]
0x029e 0x3f01 skip if(V[15] == 1) V[0] was < 2
0x02a0 0x12c2 Goto 0x2c2
// Was collision on left wall
0x02a2 0x6020 V[0] = 0x20(32)
0x02a4 0xf018 Set sound timer to 18 // play small beep
0x02a6 0x22d4 Call 0x2d4 // Draw Score
0x02a8 0x8e34
0x02aa 0x22d4
0x02ac 0x663e
0x02ae 0x3301
0x02b0 0x6603
0x02b2 0x68fe
0x02b4 0x3301
0x02b6 0x6802
0x02b8 0x1216
0x02ba 0x79ff
0x02bc 0x49fe
0x02be 0x69ff
0x02c0 0x12c8
0x02c2 0x7901
0x02c4 0x4902
0x02c6 0x6901
0x02c8 0x6004
0x02ca 0xf018
0x02cc 0x7601
0x02ce 0x4640
0x02d0 0x76fe
0x02d2 0x126c
// Function Draw Score
0x02d4 0xa2f2 I = 0x2f2
0x02d6 0xfe33 Store V[14] at memory[I] as hundreds tens units increase I by 3
0x02d8 0xf265 Fill V[0] to V[2] with data at memory location 0x2f5
0x02da 0xf129 Set I to the location of character at V[1]
0x02dc 0x6414 V[4] = 0x14 (20)
0x02de 0x6500 V[5] = 0x00 (00)
0x02e0 0xd455 Draw Character from V[1] at X=20 Y=00 height 5
0x02e2 0x7415 Add 0x15(21) to V[4] // V[4] = 41
0x02e4 0xf229 Set I to the location of character at V[2]
0x02e6 0xd455 Draw Character from V[2] at X=41 Y=00
0x02e8 0x00ee Return to caller
0x02ea 0x8080 // 10000000 10000000
0x02ec 0x8080 // 10000000 10000000
0x02ee 0x8080 // 10000000 10000000
0x02f0 0x8000 // 10000000 10000000
0x02f2 000000
0x02f4 000000
0x02f6 000000
0x02f8 000000
0x02fa 000000