A dungeon delver roguelike using Pathfinder 2nd edition rules
at gb 89 lines 2.1 kB view raw
1INCLUDE "hardware.inc/hardware.inc" 2 rev_Check_hardware_inc 4.0 3 4SECTION "GameVariables", WRAM0 5 6wLastKeys:: db 7wCurKeys:: db 8wNewKeys:: db 9wGameState:: db 10 11SECTION "Header", ROM0[$100] 12 13 ; This is your ROM's entry point 14 ; You have 4 bytes of code to do... something 15 di 16 jp EntryPoint 17 18 ; Make sure to allocate some space for the header, so no important 19 ; code gets put there and later overwritten by RGBFIX. 20 ; RGBFIX is designed to operate over a zero-filled header, so make 21 ; sure to put zeros regarless of the padding value. (This feature 22 ; was introduced in RGBDS 0.4.0, but the -MG etc flags were also 23 ; introduced in that version.) 24 ds $150 - @, 0 25 26SECTION "Entry point", ROM0 27 28EntryPoint: 29 ; Shut down audio circuitry 30 xor a 31 ld [rNR52], a 32 ld [wGameState], a 33 34 ; Wait for VBlank phase before initiating the library 35 call WaitForOneVBlank 36 37 ; Turn the LCD off 38 xor a 39 ld [rLCDC], a 40 41 ; Load our common text font into VRAM 42 call LoadTextFontIntoVRAM 43 44 ; Turn the LCD on 45 ld a, LCDCF_ON | LCDCF_BGON | LCDCF_OBJON 46 ld [rLCDC], a 47 48 ; During the first (blank) frame, intialize display registers 49 ld a, %11100100 50 ld [rBGP], a 51 ld [rOBP0], a 52 53NextGameState:: 54 ; Do not turn the LCD off outside of VBlank 55 call WaitForOneVBlank 56 call ClearBackground 57 58 ; Turn the LCD off 59 xor a 60 ld [rLCDC], a 61 62 ld [rSCX], a 63 ld [rSCY], a 64 ld [rWX], a 65 ld [rWY], a 66 ld [wCurKeys], a 67 ; disable interrupts 68 ; call DisableInterrupts 69 70 ; Clear all sprites 71 ; call ClearAllSprites 72 73 ; Initiate the next state 74 ld a, [wGameState] 75 cp 2 ; 2 = Gameplay 76 call z, InitGameplayState 77 cp 1 ; 1 = Generate Dungeon 78 call z, InitDungeonGeneration 79 ld a, [wGameState] 80 and a ; 0 = Menu 81 call z, InitTitleScreenState 82 83 ; Update the next state 84 ld a, [wGameState] 85 cp 2 ; 2 = Gameplay 86 jp z, UpdateGameplayState 87 cp 1 ; 1 = Generate Dungeon 88 jp z, UpdateDungeonGeneration 89 jp UpdateTitleScreenState