Skip to content

Instantly share code, notes, and snippets.

@SelvinPL
Last active September 16, 2024 11:02
Show Gist options
  • Select an option

  • Save SelvinPL/2dc15fe453316248ddbc1206a3721afc to your computer and use it in GitHub Desktop.

Select an option

Save SelvinPL/2dc15fe453316248ddbc1206a3721afc to your computer and use it in GitHub Desktop.
gfx-bin
       ÿ ÿ       0 ` ` ` ` 0        *  >  *   >     0 >       0 ` @ > c o { c >  ? >  > ` `  ?    c >   6 f    ` ~  c > > ` ~ c c >      > c > c c > > c c ?  >         0   > ~ >      | ~ |        > c c  c c ~ c ~ c c ~ > c ` ` c > | f c c f | ~ ` | ` `   ` | ` ` ` > ` g c c > c c  c c c ? ?     c > f l x l f c ` ` ` ` `  c w  k c c c s { o g c > c c c c > ~ c c c ~ ` > c c c f ; ~ c c c ~ c > ` >   ~ ÿ      c c c c c > c c c 6   c c k  w c c 6   6 c à f <       0  ü æ ã ã æ ü æ ã < v ã ã ã ã ~ à ü æ ã ã ã ã þ   >       >   K – - Z ´ i Ò ¥ >  ? c ? ` ~ c c c ~ ? ` ` ` ?  ? c c c ? > c  ` ?  0 0 0 | 0 0 ? c c ?  ~ ` ~ c c c c      c c > ` n x l f c   w  k k c ~ c c c c > c c c > ~ c c c ~ ` ? c c c ?  ~ c ` ` ` ? ` >  ~       c c c c ? c c 6   c k k  w 3   3 c c c ?  ~    0  ? ` Ç Ì Ì Ç ` ? À ` 0 0 0 0 ` À ? ` Î Û Û Ï ` ? ? h Î Ë Ë Î ` ? ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ
; From https://gbdev.io/gb-asm-tutorial/part1/hello_world.html
INCLUDE "hardware.inc"
SECTION "Header", ROM0[$100]
jp EntryPoint
ds $150 - @, 0 ; Make room for the header
EntryPoint:
; Shut down audio circuitry
ld a, 0
ld [rNR52], a
; Do not turn the LCD off outside of VBlank
WaitVBlank:
ld a, [rLY]
cp 144
jp c, WaitVBlank
; Turn the LCD off
ld a, 0
ld [rLCDC], a
; Copy the tile data
ld de, Tiles
ld hl, $9000
ld bc, TilesEnd - Tiles
CopyTiles:
ld a, [de]
ld [hli], a
inc de
dec bc
ld a, b
or a, c
jp nz, CopyTiles
; Copy the tilemap
ld de, Tilemap
ld hl, $9800
ld bc, TilemapEnd - Tilemap
CopyTilemap:
ld a, [de]
ld [hli], a
inc de
dec bc
ld a, b
or a, c
jp nz, CopyTilemap
; Turn the LCD on
ld a, LCDCF_ON | LCDCF_BGON
ld [rLCDC], a
; During the first (blank) frame, initialize display registers
ld a, %11100100
ld [rBGP], a
Done:
jp Done
Tiles:
INCBIN "temp.bin"
TilesEnd:
Tilemap:
DB $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F, $10, $11, $12, $13, 0,0,0,0,0,0,0,0,0,0,0,0
DB $00, $14, $15, $16, $17, $18, $19, $1A, $1B, $1C, $1D, $1E, $1F, $20, $21, $22, $23, $24, $25, $25, 0,0,0,0,0,0,0,0,0,0,0,0
DB $27, $28, $29, $2A, $2B, $2C, $2D, $2E, $2F, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3A, 0,0,0,0,0,0,0,0,0,0,0,0
DB $3B, $3C, $3D, $3E, $3F, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E, 0,0,0,0,0,0,0,0,0,0,0,0
DB $4F, $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5A, $5B, $5C, $5D, $5E, $5F
TilemapEnd:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment