-
Notifications
You must be signed in to change notification settings - Fork 2
/
M7Test.asm
187 lines (139 loc) · 3.38 KB
/
M7Test.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
.setcpu "65816"
.autoimport on
.include "common-macros.inc"
.include "GlobalVars.inc"
.include "ports.inc"
.segment "STARTUP"
; Reset int. (Entry Point) -------------------
.proc Reset ; int handler
; *unsafe* X
; vvv Bootstrap -----------------
sei ; Disable int.
clc ; C=0
xce ; C<->E Native Mode On
phk
plb ; PB -stack-> DB (=0)
rep #$30 ; A,I 16bit
.a16
.i16
; Initialize stack
ldx #$1fff
txs
jsr initRegs
; ^^^ Bootstrap -----------------
stz gRenderFinished
jsr sceneInit
jsr doMainLoop
rti
.endproc
; A16, I16
.proc doMainLoop
.a16
.i16
save_paxy
mloop:
jsr updateScene
stz gRenderFinished
r_wait:
lda gRenderFinished
beq r_wait
bra mloop
restore_paxy
rts
.endproc
.proc VBlank ; int handler
php ; 割り込み前のP保存
set_a16 ; 保存PHAと復帰PLAはA16で統一
.a16
.i16
pha ; Aを16bitで保存
jsr renderScene
jsr updatePadState
inc gRenderFinished
pla ; Aを16bitで復帰
plp ; 割り込み前のPを復帰
rti
.endproc
.proc updatePadState
set_a8
.a8
; Wait until auto-read is finished
: lda $4212
and #$01
bne :-
set_a16
.a16
; Store Pad Status
lda $4218
sta gPadState
rts
.endproc
; ===================================================
; Metadata and Assets
; ===================================================
; Cartridge metadata - - -
.segment "CARTINFO"
; 123456789012345678901
.byte "MODE7TEST " ; Game Title(21Bytes)
.byte $00 ; 0x01:HiRom, 0x30:FastRom(3.57MHz)
.byte $00 ; ROM only
.byte $09 ; 512KB ROM
.byte $00 ; RAM Size (8KByte * N)
.byte $00 ; NTSC
.byte $01 ; Licensee
.byte $00 ; Version
; Embed information (must be replaced with checksum)
.word $CDCD
.word $3232
.byte $ff, $ff, $ff, $ff ; unknown
.word $0000 ; Native:COP
.word $0000 ; Native:BRK
.word $0000 ; Native:ABORT
.word VBlank ; Native:NMI
.word $0000 ;
.word $0000 ; Native:IRQ
.word $0000 ;
.word $0000 ;
.word $0000 ; Emulation:COP
.word $0000 ;
.word $0000 ; Emulation:ABORT
.word $0000 ; Emulation:NMI
.word Reset ; Emulation:RESET
.word $0000 ; Emulation:IRQ/BRK
; DATA SEGMENTS --------------------------------------------------------
.export M7BGData:far
.export SkyBGData:far
.export SkyMapData:far
.export SpriteData:far
.export PaletteBase:far
.export SinTable:far
; - - - - - - - - - - - -
; ROMデータ 画像系_1
.segment "VISASSET1":far
M7BGData:
.incbin "assets/m7map.bin"
.segment "VISASSET2": far
PaletteBase:
.word $0c84, $0000, $7fff, $7bde, $5f38, $4252, $35ef, $216b, $14a5, $10c8, $216f, $0c87, $000c, $0094, $017d, $0e3f
.word $2ca1, $4581, $6f02, $67c7, $67d1, $0614, $0a9a, $033f, $2b7f, $7d18, $2588, $4605, $3e66, $46c8, $430d, $5773
.word $7a3c, $7a3c, $7a3c, $7a3c, $7a3c, $7a3c, $7a3c, $7a3c, $0426, $7a3c, $7a3c, $7a3c, $7a3c, $7a3c, $7a3c, $7a3c
.word $7a3c, $1461, $2d24, $4584, $63bb, $4f50, $7687, $7350, $735f, $71ee, $3544, $03f9, $03f9, $03f9, $03f9, $03f9
.incbin "assets/sp-palette.bin"
.segment "VISASSET3": far
SkyBGData:
.incbin "assets/sky-bg.bin"
SkyMapData:
.incbin "assets/sky-map.bin"
SpriteData:
.incbin "assets/sp-pattern.bin"
.segment "VISASSET4": far
.segment "VISASSET5": far
.segment "MISCASSET": far
SinTable:
.include "sin-table.inc"
.segment "HIRODATA4": far
.segment "HIRODATA5": far
.segment "HIRODATA6": far
.segment "ALTSNDS1": far
.segment "DONTUSE"
.byte "NO-DATA"