-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmulti-sprite-dli.INC
100 lines (72 loc) · 1.57 KB
/
multi-sprite-dli.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
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
meter=$80 ; y position div 8 of sprite position
regA=$81
regX=$82
data = $83 ; 2 bytes
spr_flag = $85
nr_sprite = $86
block_y = $87
block_dy = $88
last_sprite = $89
; Multi sprite interrupt, must be called every 8 screen lines (in gr.0 or gr.12 every Displaylist line!)
@multi_sprite_dli_sub
; sta regA
stx regX
; Just for tests
; lda #8
; sta colbk
ldx meter ; y position div 8
lda block_x0,x ;player 0
beq ?no_sprite0
sta hposp0
lda block_c0,x
sta colpm0
?no_sprite0
lda block_x1,x ;player 1
beq ?no_sprite1
sta hposp1
lda block_c1,x
sta colpm1
?no_sprite1
lda block_x2,x ;player 2
beq ?no_sprite2
sta hposp2
lda block_c2,x
sta colpm2
?no_sprite2
lda block_x3,x ;player 3
beq ?no_sprite3
sta hposp3
lda block_c3,x
sta colpm3
?no_sprite3
lda #0 ; clear the current block
sta block_x0,x
sta block_x1,x
sta block_x2,x
sta block_x3,x
sta block_status,x
inc meter
?dli_end
; lda #0
; sta colbk
ldx regX
; lda regA
rts
; pla
; rti
; reset the meter value, must be called in NMI!
@reset_meter
lda #3
sta meter
rts
; for every DLI we need such 9 bytes
.align 32
block_status .dc 32 0 ; help table for determining the occupation of sprites
block_x0 .dc 32 0 ; Sprite Positionen 0
block_x1 .dc 32 0 ; Sprite Positionen 1
block_x2 .dc 32 0 ; Sprite Positionen 2
block_x3 .dc 32 0 ; Sprite Positionen 3
block_c0 .dc 32 0 ; Sprite color 0
block_c1 .dc 32 0
block_c2 .dc 32 0
block_c3 .dc 32 0