-
Notifications
You must be signed in to change notification settings - Fork 20
/
pmtest.bas
45 lines (37 loc) · 990 Bytes
/
pmtest.bas
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
' P/M test program
graphics 0 ' Setups graphics mode
pmgraphics 2 ' And P/M mode
P0Mem = pmadr(0) ' Get player 0 address
oldPos = P0Mem ' and into "old position"
mset P0Mem, 128, 0 ' Clears P/M 0 Memory
setcolor -4, 1, 15
' P/M data and blank (to clear P/M)
DATA PMdata() byte = $38,$44,$54,$44,$38
' Initial Conditions
xPos = 6400 : yPos = 2560
xSpd = 64 : ySpd = 0
repeat
xPos = xPos + xSpd : yPos = yPos + ySpd
ySpd = ySpd + 2
if (ySpd > 0) and (yPos > 12800)
ySpd = -ySpd
xSpd = Rand(512) - 256
endif
if xSpd > 0
if xPos > 25600 Then xSpd = -xSpd
else
if xPos < 6400 Then xSpd = -xSpd
endif
@MovePm ' Move P/M Graphics
until Key()
graphics 0
END
proc MovePm
x = xPos / 128 : y = P0Mem + yPos / 128
poke $D01A,$74 ' Change background color
pause
pmhpos 0, x ' Set new horizontal position
mset oldPos, 5, 0 ' Clear old sprite
move adr(PMdata), y, 5 ' Draw at new vertical pos.
oldPos = y
endproc