aboutsummaryrefslogtreecommitdiff
path: root/init.gbasm
diff options
context:
space:
mode:
authorAstatin <[email protected]>2024-08-03 16:12:57 +0900
committerAstatin <astatin@redacted>2024-08-03 16:12:57 +0900
commit6b0db29bfccbdce4ea4a438f2ccb921173f96afa (patch)
tree4058c787d75e6a2ee1e7e1214abb59bb9b137464 /init.gbasm
Initial commit
Diffstat (limited to 'init.gbasm')
-rw-r--r--init.gbasm52
1 files changed, 52 insertions, 0 deletions
diff --git a/init.gbasm b/init.gbasm
new file mode 100644
index 0000000..1245ce7
--- /dev/null
+++ b/init.gbasm
@@ -0,0 +1,52 @@
+.PADTO 0x0040
+VBlank:
+ CALL =VBLANK_Entrypoint
+ RETI
+
+.PADTO 0x0100
+Start:
+ JP =Empty_VRAM
+
+.PADTO 0x0104
+Nintendo_Logo: ; The Nintendo logo must be stored in bytes 0x104-133
+ .DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D
+ .DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99
+ .DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E
+
+.PADTO 0x0134
+Checksum: ; The bytes 0x134-0x14d need to add up to 0xe7 (= 0xff - 0x19)
+ .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
+ .DB $00,$00,$00,$00,$00,$00,$00,$00,$00,$e7
+
+Empty_VRAM: ; (Clear screen)
+ LD hl, $8000 ; We set the HL register to the start of VRAM
+
+Empty_VRAM.loop:
+ XOR A
+ LD (HL+), a ; We set the memory pointed to by HL to 0 and increase HL
+ LD a, $a0
+ CP h ; Until h has reached $a0 ($a0000 is the end of VRAM)
+ JR NZ, =Empty_VRAM.loop
+
+ ; BG Palette
+ LD DE, $ff47
+ LD A, $e4
+ LD (DE), A
+
+ ; OBJ0 Palette
+ LD DE, $ff48
+ LD A, $e4
+ LD (DE), A
+
+ ; LCDC
+ LD DE, $ff40
+ LD A, (DE)
+ OR $06
+ LD (DE), A
+
+ ; Interrupts
+ LD DE, $ffff
+ LD A, $01
+ LD (DE), A
+
+ JP =Entrypoint