-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkworld.asm
134 lines (118 loc) · 2.72 KB
/
kworld.asm
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
;==============================================================================
; mzxrules 2021
;==============================================================================
KERNEL_WORLD: SUBROUTINE ; rKERNEL_WORLD
VKERNEL1 WorldSprBank
lda #SLOT_F0_SPR0
sta BANK_SLOT
VKERNEL1 BgColor
lda #0 ;#COLOR_PF_PATH
sta COLUBK
VKERNEL1 FgColor
lda #0 ;#COLOR_PF_GREEN
sta COLUPF
VKERNEL1 EnColor
lda #COLOR_EN_GREEN
sta COLUP1
VKERNEL1 PlColor
lda #COLOR_PLAYER_00
sta COLUP0
VKERNEL1 NUSIZ1_T
lda #0
sta NUSIZ1
VKERNEL1 NUSIZ0_T
lda #0
sta NUSIZ0
VKERNEL1 REFP1_T
lda #0
sta REFP1
VKERNEL1 blInitENABL
lda #0
sta ENABL
lda #0
tax
sta WSYNC ; 3
sta CXCLR ; 3
KERNEL_LOOP: SUBROUTINE ; 76 cycles per scanline
sta ENAM0 ; 3
stx GRP1 ; 3
ldx roomDY ; 3
lda rPF1RoomL,x ; 4
sta PF1 ; 3
lda rPF2Room,x ; 4
sta PF2 ; 3
; Player ; CYCLE 15
VKERNEL1 PLH
lda #7 ; 2 player height
dcp plDY ; 5
bcs .DrawP0 ; 2/3
lda #0 ; 2
.byte $2C ; 4-5 BIT compare hack to skip 2 byte op
.DrawP0:
lda (plSpr),y ; 5
sta GRP0 ; 3
; PF1R first line
lda rPF1RoomR,x ; 4
sta PF1 ; 3
; Ball
VKERNEL1 BLH
lda #7 ; 2 ball height
dcp blDY ; 5
lda #1 ; 2
adc #0 ; 2
sta ENABL ; 3
; Enemy Missile ; CYCLE 15
VKERNEL1 M1H
lda #7 ; 3 enM height
dcp m1DY ; 5
lda #1 ; 2
adc #0 ; 2
;sta WSYNC
sta ENAM1 ; 3
lda rPF1RoomL,x ; 4
sta PF1 ; 3
lda rPF1RoomR,x ; 4
pha ; 3
; Enemy ; CYCLE 15
VKERNEL1 ENH
lda #7 ; 2 enemy height
dcp enDY ; 5
bcs .DrawE0 ; 2/3
lda #0 ; 2
.byte $2C ; 4-5 BIT compare hack to skip 2 byte op
.DrawE0:
lda (enSpr),y ; 5
tax ; 2
pla ; 4
sta PF1 ; 3
; Playfield
tya ; 2
and #3 ; 2
beq .PFDec ; 2/3
.byte $2C ; 4-5
.PFDec
dec roomDY ; 5
; Player Missile ; CYCLE 15
VKERNEL1 M0H
lda #7 ; 2 plM height
dcp m0DY ; 5
lda #1 ; 2
adc #0 ; 2
dey ; 2
sta WSYNC ; 3
bpl KERNEL_LOOP ; 3/2
lda rFgColor
sta COLUBK
lda #0
sta PF1
sta PF2
sta GRP1
sta GRP0
sta ENAM0
sta ENAM1
sta PF0
VKERNEL1 WorldSprBank_DEFAULT
lda #SLOT_F0_SPR0
sta wWorldSprBank
rts
LOG_SIZE "-KERNEL WORLD-", KERNEL_WORLD