Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INCLUDE "constants.asm"
- SECTION "rst 00", ROM0 [$00]
- ClearVRAM:
- .clearVRAMLoop
- ld [hld], a
- bit 7, h
- jr nz, .clearVRAMLoop
- ret
- SECTION "rst 08", ROM0 [$08]
- HandleCommand:
- and b
- jr z, .done
- cp b
- ret z
- add l
- ld l, a
- ld [hl], b
- ret
- .done
- xor a
- ld [$98a0], a
- ld hl,rLCDC
- ld [hl], %11010011
- jr @
- SECTION "rst 20", ROM0 [$20]
- push de
- ld de, $20
- add hl, de
- pop de
- ret
- SECTION "Entry", ROM0 [$100]
- db $18,$4e ; jr Start0150
- SECTION "Header", ROM0 [$104]
- ; The header is generated by rgbfix.
- ; The space here is allocated to prevent code from being overwritten.
- ds $150 - $104
- Start0150:
- di
- ld sp, $fffe
- ; palettes
- xor a
- ld [rSCX], a
- ld [rSCY], a
- ld a, $e4
- ld [rBGP], a
- .waitForVBlank
- ld a, [rLY]
- cp $90
- jr nz, .waitForVBlank
- xor a
- ld c, a
- ld [rLCDC], a
- ld hl, $fe9f
- .clearOAMLoop
- ld [hl], a
- dec l
- jr nz, .clearOAMLoop
- ld hl, $9fff
- rst $00
- ld hl, $800f
- dec a
- rst $00
- ld hl, $9800
- ld de, HelloWorldOffsets
- ld b, $f
- ld [hl], b
- push hl
- .loadBytemapIntoVRAMLoop
- ld a, [de]
- ld c, a
- swap a
- rst $08
- jr nz, .notNextLine
- pop hl
- rst $20
- push hl
- ld [hl], b
- .notNextLine
- ld a, c
- rst $08
- inc de
- jr nz, .loadBytemapIntoVRAMLoop
- pop hl
- rst $20
- push hl
- ld [hl], b
- jr .loadBytemapIntoVRAMLoop
- HelloWorldOffsets::
- ; commands:
- ; $01 - $0e = add offset to current pointer
- ; $00 = stop execution
- ; $0f = go to next line
- dn $02,$02, $01,$02, $03,$03, $01,$01
- dn $0f,$02, $02,$03, $03,$03, $02,$0f
- dn $01,$01, $02,$01, $02,$03, $03,$02
- dn $0f,$02, $02,$03, $03,$03, $02,$0f
- dn $02,$02, $01,$02, $01,$02, $01,$02, $01,$01
- dn $0f,$0f
- dn $02,$02, $02,$01, $01,$02, $01,$03, $03,$01
- dn $0f,$02, $02,$02, $02,$02, $02,$02, $03,$02
- dn $0f,$02, $02,$02, $02,$02, $01,$03, $03,$02
- dn $0f,$01, $01,$01, $03,$01, $01,$02, $02,$02, $01,$02, $01,$00
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement