-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSAMPLE.Z80
129 lines (115 loc) · 2.67 KB
/
SAMPLE.Z80
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
;------------
; LEGIONS GBC EDITION
; by yuyat
; tab 8
INCLUDE "HARDWARE.INC"
AdressLD: MACRO
ld a,[\1]
ld h,a
ld a,[\1 + 1]
ld l,a
ENDM
SECTION "CALL HL",ROM0[$18]
jp hl ;$18
SECTION "V Blank",ROM0[$40]
call VblankMethod
reti
SECTION "LCDC Status Interupt",ROM0[$48]
reti
SECTION "Timer Interupt",ROM0[$50]
reti
SECTION "Serial Interupt",ROM0[$58]
reti
SECTION "Keypad Interupt",ROM0[$60]
reti
SECTION "Org $100",ROM0[$100]
nop ; ????? SP=$FFFE
jp begin
NINTENDO_LOGO ; Nintendo graphic logo
;Rom Header Info
; 123456789abcdef
DB "SAMPLE" ; Game Name
DB 0,0,0,0,0 ; Padding to 15 characters
DB $80 ; 0 - MGB / $80 - Color compatible /
DB 0,0 ; Game Maker Code
DB 0 ; Game Unit Code
DB CART_ROM_MBC1_RAM ; Cart type
DB CART_ROM_256K ; ROM Size (in bits)
DB CART_RAM_NONE ; RAM Size (in bits)
DB 0,1 ; Maker ID
DB 0 ; Version=0
DB $00 ; Complement check (important)
DW $0000 ; Checksum (not important)
SECTION "Main Code",ROM0[$150]
begin:
di
call Initialize
call ScreenOff
ld bc,40*16
ld de,_VRAM
ld hl,TileData
call LDIR
call ScreenOnVB
ei
ld b,0
ld c,0
ld d,8
ld e,16
ld hl,Player_Stand
call SpriteAdd
ld b,1
ld c,0
ld d,32
ld e,16
ld hl,Player_Stand
call SpriteAdd
ld b,2
ld c,0
ld d,56
ld e,16
ld hl,Player_Stand
call SpriteAdd
ld b,3
ld c,0
ld d,8
ld e,40
ld hl,Player_Stand
call SpriteAdd
ld b,4
ld c,0
ld d,32
ld e,40
ld hl,Player_Stand
call SpriteAdd
main:
ldh a,[rLY]
cp 2
jr nc,main
call SpriteDraw
halt
jp main
VblankMethod:
call $FF80 ;スプライト描画用ルーチン
call ReadJoystick
ret
include "gb_routine.z80"
include "Sprite.z80"
include "SpriteData.z80"
include "GraphicData.z80"
SECTION "Work RAM",WRAM0[$C000]
OAM_BUFFER0 ds 160 ;OAMバッファ
Seed db ;ランダムシード
Decimal ds 5 ;5桁のBCDの返り値
;スプライトグループ管理変数
SECTION "SpriteGroup",WRAM0[$C100]
SP_ROMBank ds 16 ;指定アニメデータアドレス(バンク1byteアドレス2byte)
SP_Adress ds 32
SP_XPosition ds 16 ;X座標
SP_YPosition ds 16 ;Y座標
SP_Pattern ds 16 ;基準となるスプライトパターン
SP_Wait ds 16 ;ウェイト数
SP_EndPlay ds 16 ;再生終了したか? FFで再生終了
SECTION "HI-RAM",HRAM[$FF80]
SPRITE_ROUTINE ds SpriteRoutineEnd - SpriteRoutine ;スプライト描画用ルーチン
_Pad db ;現在のボタン情報
_PadDebounce db ;押したときのボタン情報