-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
92 lines (74 loc) · 1.78 KB
/
README
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
Binutils for GameBoy
====================
Build binutils like this:
./configure --target=sm83-gb-coff
make all
# as root:
make install
Example file:
; Handler for RST28 instruction (max. 8 bytes)
.section .rst28
ret
; Handler for interrupt 4 (joypad) (max. 8 bytes)
.section .irq4
reti
; Entry point (max. 4 bytes)
.section .entry
nop
jp start
; GameBoy Header
.section .hdrlogo
.db 0xCE, 0xED, 0x66, 0x66, 0xCC, 0x0D, 0x00, 0x0B, 0x03, 0x73, 0x00, 0x83, 0x00, 0x0C, 0x00, 0x0D
.db 0x00, 0x08, 0x11, 0x1F, 0x88, 0x89, 0x00, 0x0E, 0xDC, 0xCC, 0x6E, 0xE6, 0xDD, 0xDD, 0xD9, 0x99
.db 0xBB, 0xBB, 0x67, 0x63, 0x6E, 0x0E, 0xEC, 0xCC, 0xDD, 0xDC, 0x99, 0x9F, 0xBB, 0xB9, 0x33, 0x3E
.section .hdrname
.db "hram-rw"
.section .hdrgc
.db "TEST"
.section .hdrcgb
.db 0x00
.section .hdrmc
.db "ZZ"
.section .hdrsgb
.db 0x00
.section .hdrtype
.db 0x08
.section .hdrrom
.db 0x00
.section .hdrram
.db 0x02
.section .hdrdest
.db 0x01
.section .hdrver
.db 0x00
; Code for Bank 0 (starts at 0x150)
.section .bank0
start:
.global start
di
call foo ; call routine in bank 1
; Copy routine for initializing HRAM
ld c, _ehdata
ld hl, __load_stop_hdata - 1
loop:
ld a, _hdata - 1
dec c
cp c
jp z, loop2 ; jumps to address 0xff80
ld a, (hld)
ld (c), a
jr loop
; Code loaded into HRAM (starts at 0xff80)
.section .hdata
loop2:
jr loop2
; Code for Bank 1 (starts at 0x4000)
.section bank1
foo:
rst 0x28 ; call reset 0x28 handler
ret
Build example with:
sm83-gb-coff-as -o example.o example.s
sm83-gb-coff-ld -o example.gb example.o
Then use rgbfix from the Rednex Game Boy Development System (rgbds):
rgbfix -fhg example.gb