Skip to content

Commit 2ab6545

Browse files
committed
Added a few more GB test roms, GB docs, and Wonderswan docs
1 parent 237eaed commit 2ab6545

14 files changed

+5548
-0
lines changed

Gameboy/DMG_Bootrom_Disassembly.txt

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
LD SP,$fffe ; $0000 Setup Stack
2+
3+
XOR A ; $0003 Zero the memory from $8000-$9FFF (VRAM)
4+
LD HL,$9fff ; $0004
5+
Addr_0007:
6+
LD (HL-),A ; $0007
7+
BIT 7,H ; $0008
8+
JR NZ, Addr_0007 ; $000a
9+
10+
LD HL,$ff26 ; $000c Setup Audio
11+
LD C,$11 ; $000f
12+
LD A,$80 ; $0011
13+
LD (HL-),A ; $0013
14+
LD ($FF00+C),A ; $0014
15+
INC C ; $0015
16+
LD A,$f3 ; $0016
17+
LD ($FF00+C),A ; $0018
18+
LD (HL-),A ; $0019
19+
LD A,$77 ; $001a
20+
LD (HL),A ; $001c
21+
22+
LD A,$fc ; $001d Setup BG palette
23+
LD ($FF00+$47),A ; $001f
24+
25+
LD DE,$0104 ; $0021 Convert and load logo data from cart into Video RAM
26+
LD HL,$8010 ; $0024
27+
Addr_0027:
28+
LD A,(DE) ; $0027
29+
CALL $0095 ; $0028
30+
CALL $0096 ; $002b
31+
INC DE ; $002e
32+
LD A,E ; $002f
33+
CP $34 ; $0030
34+
JR NZ, Addr_0027 ; $0032
35+
36+
LD DE,$00d8 ; $0034 Load 8 additional bytes into Video RAM
37+
LD B,$08 ; $0037
38+
Addr_0039:
39+
LD A,(DE) ; $0039
40+
INC DE ; $003a
41+
LD (HL+),A ; $003b
42+
INC HL ; $003c
43+
DEC B ; $003d
44+
JR NZ, Addr_0039 ; $003e
45+
46+
LD A,$19 ; $0040 Setup background tilemap
47+
LD ($9910),A ; $0042
48+
LD HL,$992f ; $0045
49+
Addr_0048:
50+
LD C,$0c ; $0048
51+
Addr_004A:
52+
DEC A ; $004a
53+
JR Z, Addr_0055 ; $004b
54+
LD (HL-),A ; $004d
55+
DEC C ; $004e
56+
JR NZ, Addr_004A ; $004f
57+
LD L,$0f ; $0051
58+
JR Addr_0048 ; $0053
59+
60+
; === Scroll logo on screen, and play logo sound===
61+
62+
Addr_0055:
63+
LD H,A ; $0055 Initialize scroll count, H=0
64+
LD A,$64 ; $0056
65+
LD D,A ; $0058 set loop count, D=$64
66+
LD ($FF00+$42),A ; $0059 Set vertical scroll register
67+
LD A,$91 ; $005b
68+
LD ($FF00+$40),A ; $005d Turn on LCD, showing Background
69+
INC B ; $005f Set B=1
70+
Addr_0060:
71+
LD E,$02 ; $0060
72+
Addr_0062:
73+
LD C,$0c ; $0062
74+
Addr_0064:
75+
LD A,($FF00+$44) ; $0064 wait for screen frame
76+
CP $90 ; $0066
77+
JR NZ, Addr_0064 ; $0068
78+
DEC C ; $006a
79+
JR NZ, Addr_0064 ; $006b
80+
DEC E ; $006d
81+
JR NZ, Addr_0062 ; $006e
82+
83+
LD C,$13 ; $0070
84+
INC H ; $0072 increment scroll count
85+
LD A,H ; $0073
86+
LD E,$83 ; $0074
87+
CP $62 ; $0076 $62 counts in, play sound #1
88+
JR Z, Addr_0080 ; $0078
89+
LD E,$c1 ; $007a
90+
CP $64 ; $007c
91+
JR NZ, Addr_0086 ; $007e $64 counts in, play sound #2
92+
Addr_0080:
93+
LD A,E ; $0080 play sound
94+
LD ($FF00+C),A ; $0081
95+
INC C ; $0082
96+
LD A,$87 ; $0083
97+
LD ($FF00+C),A ; $0085
98+
Addr_0086:
99+
LD A,($FF00+$42) ; $0086
100+
SUB B ; $0088
101+
LD ($FF00+$42),A ; $0089 scroll logo up if B=1
102+
DEC D ; $008b
103+
JR NZ, Addr_0060 ; $008c
104+
105+
DEC B ; $008e set B=0 first time
106+
JR NZ, Addr_00E0 ; $008f ... next time, cause jump to "Nintendo Logo check"
107+
108+
LD D,$20 ; $0091 use scrolling loop to pause
109+
JR Addr_0060 ; $0093
110+
111+
; ==== Graphic routine ====
112+
113+
LD C,A ; $0095 "Double up" all the bits of the graphics data
114+
LD B,$04 ; $0096 and store in Video RAM
115+
Addr_0098:
116+
PUSH BC ; $0098
117+
RL C ; $0099
118+
RLA ; $009b
119+
POP BC ; $009c
120+
RL C ; $009d
121+
RLA ; $009f
122+
DEC B ; $00a0
123+
JR NZ, Addr_0098 ; $00a1
124+
LD (HL+),A ; $00a3
125+
INC HL ; $00a4
126+
LD (HL+),A ; $00a5
127+
INC HL ; $00a6
128+
RET ; $00a7
129+
130+
Addr_00A8:
131+
;Nintendo Logo
132+
.DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D
133+
.DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99
134+
.DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E
135+
136+
Addr_00D8:
137+
;More video data
138+
.DB $3C,$42,$B9,$A5,$B9,$A5,$42,$3C
139+
140+
; ===== Nintendo logo comparison routine =====
141+
142+
Addr_00E0:
143+
LD HL,$0104 ; $00e0 ; point HL to Nintendo logo in cart
144+
LD DE,$00a8 ; $00e3 ; point DE to Nintendo logo in DMG rom
145+
146+
Addr_00E6:
147+
LD A,(DE) ; $00e6
148+
INC DE ; $00e7
149+
CP (HL) ; $00e8 ;compare logo data in cart to DMG rom
150+
JR NZ,$fe ; $00e9 ;if not a match, lock up here
151+
INC HL ; $00eb
152+
LD A,L ; $00ec
153+
CP $34 ; $00ed ;do this for $30 bytes
154+
JR NZ, Addr_00E6 ; $00ef
155+
156+
LD B,$19 ; $00f1
157+
LD A,B ; $00f3
158+
Addr_00F4:
159+
ADD (HL) ; $00f4
160+
INC HL ; $00f5
161+
DEC B ; $00f6
162+
JR NZ, Addr_00F4 ; $00f7
163+
ADD (HL) ; $00f9
164+
JR NZ,$fe ; $00fa ; if $19 + bytes from $0134-$014D don't add to $00
165+
; ... lock up
166+
167+
LD A,$01 ; $00fc
168+
LD ($FF00+$50),A ; $00fe ;turn off DMG rom

0 commit comments

Comments
 (0)