background loading for main menu
This commit is contained in:
parent
2bc8134741
commit
d6c623734f
@ -27,120 +27,16 @@ ScreenMainMenu:
|
|||||||
dw MainMenuTeardown
|
dw MainMenuTeardown
|
||||||
|
|
||||||
MainMenuSetup:
|
MainMenuSetup:
|
||||||
; Turn the LCD off
|
call Async_Kill
|
||||||
ld hl, rLCDC
|
|
||||||
bit 7, [hl]
|
|
||||||
jp z, .screenOff
|
|
||||||
.busyWait
|
|
||||||
ld a, [rLY]
|
|
||||||
cp a, 143
|
|
||||||
;jp c, .busyWait
|
|
||||||
|
|
||||||
.screenOff:
|
|
||||||
ld a, 0
|
|
||||||
ldh [rLCDC], a
|
|
||||||
|
|
||||||
call Async_Kill ; ensure we're not loading anything elsewhere
|
|
||||||
|
|
||||||
ld a, BANK("Main Menu Data")
|
ld a, BANK("Main Menu Data")
|
||||||
ld [rROMB0], a
|
ld [rROMB0], a
|
||||||
|
|
||||||
ld hl, SquaresTileset8
|
ld hl, ZEROES
|
||||||
ld de, _VRAM + $1000 + $10
|
ld de, MY_OAM
|
||||||
ld bc, SquaresTilesetEnd - SquaresTileset8
|
ld bc, $100
|
||||||
;println "the diff is ", SquaresTilesetEnd - SquaresTileset8
|
|
||||||
call CopyRange
|
call CopyRange
|
||||||
|
|
||||||
def spacing equ $12
|
|
||||||
|
|
||||||
ld hl, CardBackSprites24 ; source
|
|
||||||
def TileStartCardBackSprites24 equ 0
|
|
||||||
ld de, $8000 + TileStartCardBackSprites24*$10; destination of copy
|
|
||||||
ld bc, CardBackSprites24End - CardBackSprites24 ; length to copy
|
|
||||||
call CopyRange
|
|
||||||
|
|
||||||
ld hl, CardBackSprites23
|
|
||||||
def TileStartCardBackSprites23 equ TileStartCardBackSprites24 + spacing
|
|
||||||
ld de, $8000 + TileStartCardBackSprites23*$10; destination of copy
|
|
||||||
ld bc, CardBackSprites23End - CardBackSprites23
|
|
||||||
call CopyRange
|
|
||||||
|
|
||||||
ld hl, CardBackSprites22
|
|
||||||
def TileStartCardBackSprites22 equ TileStartCardBackSprites23 + spacing
|
|
||||||
ld de, $8000 + TileStartCardBackSprites22*$10; destination of copy
|
|
||||||
ld bc, CardBackSprites22End - CardBackSprites22
|
|
||||||
call CopyRange
|
|
||||||
|
|
||||||
ld hl, CardBackSprites21
|
|
||||||
def TileStartCardBackSprites21 equ TileStartCardBackSprites22 + spacing
|
|
||||||
ld de, $8000 + TileStartCardBackSprites21*$10; destination of copy
|
|
||||||
ld bc, CardBackSprites21End - CardBackSprites21
|
|
||||||
call CopyRange
|
|
||||||
|
|
||||||
ld hl, CardBackSprites20
|
|
||||||
def TileStartCardBackSprites20 equ TileStartCardBackSprites21 + spacing
|
|
||||||
ld de, $8000 + TileStartCardBackSprites20*$10
|
|
||||||
ld bc, CardBackSprites20End - CardBackSprites20
|
|
||||||
call CopyRange
|
|
||||||
|
|
||||||
ld hl, CardBackSprites19
|
|
||||||
def TileStartCardBackSprites19 equ TileStartCardBackSprites20 + spacing
|
|
||||||
ld de, $8000 + TileStartCardBackSprites19*$10
|
|
||||||
ld bc, CardBackSprites19End - CardBackSprites19
|
|
||||||
call CopyRange
|
|
||||||
|
|
||||||
ld hl, CardBackSprites18
|
|
||||||
def TileStartCardBackSprites18 equ TileStartCardBackSprites19 + spacing
|
|
||||||
ld de, $8000 + TileStartCardBackSprites18*$10
|
|
||||||
ld bc, CardBackSprites18End - CardBackSprites18
|
|
||||||
call CopyRange
|
|
||||||
|
|
||||||
ld hl, CardBackSprites17
|
|
||||||
def TileStartCardBackSprites17 equ TileStartCardBackSprites18 + spacing
|
|
||||||
ld de, $8000 + TileStartCardBackSprites17*$10
|
|
||||||
ld bc, CardBackSprites17End - CardBackSprites17
|
|
||||||
call CopyRange
|
|
||||||
|
|
||||||
def TileStartCardBackSprites16 equ TileStartCardBackSprites17 + spacing
|
|
||||||
|
|
||||||
ld hl, MainUITilemap
|
|
||||||
ld de, _SCRN0
|
|
||||||
ld b, 18
|
|
||||||
ld c, 20
|
|
||||||
call CopyTilesToMap
|
|
||||||
|
|
||||||
ld hl, StringRead
|
|
||||||
ld de, _SCRN0 + 32*11 + 4
|
|
||||||
call PrintString
|
|
||||||
ld hl, StringShuffle
|
|
||||||
ld de, _SCRN0 + 32*13 + 4
|
|
||||||
call PrintString
|
|
||||||
ld hl, StringBrowse
|
|
||||||
ld de, _SCRN0 + 32*15 + 4
|
|
||||||
call PrintString
|
|
||||||
|
|
||||||
|
|
||||||
; clear out the dma source
|
|
||||||
ld hl, MY_OAM
|
|
||||||
ld a, 0
|
|
||||||
:
|
|
||||||
ld [hl+], a
|
|
||||||
cp a, l
|
|
||||||
jp nz, :- ; this was clever. as long as a (0) doesn't equal l (low bit of address) we loop
|
|
||||||
; so this goes until l loops around to 0
|
|
||||||
|
|
||||||
ld de, SAFE_DMA_LOCATION
|
|
||||||
ld a, HIGH(MY_OAM)
|
|
||||||
call RunDMA
|
|
||||||
|
|
||||||
; set LCD and display registers
|
|
||||||
ld a, %11100100
|
|
||||||
ldh [rBGP], a
|
|
||||||
ldh [rOBP0], a
|
|
||||||
|
|
||||||
ld a, LCDCF_BLK21 | LCDCF_ON | LCDCF_BGON | LCDCF_OBJON | LCDCF_OBJ16
|
|
||||||
ldh [rLCDC], a
|
|
||||||
|
|
||||||
ld a, 0
|
ld a, 0
|
||||||
ld [vFrameCount1], a ; first starts at 0
|
ld [vFrameCount1], a ; first starts at 0
|
||||||
ld [vTime], a
|
ld [vTime], a
|
||||||
@ -200,12 +96,96 @@ MainMenuSetup:
|
|||||||
|
|
||||||
ld a, 0
|
ld a, 0
|
||||||
ld [vFrameCountSquares], a
|
ld [vFrameCountSquares], a
|
||||||
|
|
||||||
|
ld hl, MainMenuSetup.asyncTask
|
||||||
|
call Async_Spawn_HL
|
||||||
|
|
||||||
|
ld a, %11100100
|
||||||
; load graphics into vram for deck face
|
ldh [rBGP], a
|
||||||
; set up variables: LFSR stuff
|
ldh [rOBP0], a
|
||||||
|
|
||||||
|
ldh a, [rLCDC]
|
||||||
|
or a, LCDCF_OBJ16 ;LCDCF_BLK21 | LCDCF_ON | LCDCF_BGON | LCDCF_OBJON | LCDCF_OBJ16
|
||||||
|
ldh [rLCDC], a
|
||||||
|
|
||||||
|
ret
|
||||||
|
.asyncTask:
|
||||||
|
ld hl, MainUITilemap
|
||||||
|
ld de, _SCRN0
|
||||||
|
ld b, 18
|
||||||
|
ld c, 20
|
||||||
|
call CopyTilesToMap
|
||||||
|
|
||||||
|
ld hl, StringRead
|
||||||
|
ld de, _SCRN0 + 32*11 + 4
|
||||||
|
call PrintString
|
||||||
|
ld hl, StringShuffle
|
||||||
|
ld de, _SCRN0 + 32*13 + 4
|
||||||
|
call PrintString
|
||||||
|
ld hl, StringBrowse
|
||||||
|
ld de, _SCRN0 + 32*15 + 4
|
||||||
|
call PrintString
|
||||||
|
|
||||||
|
ld hl, SquaresTileset8
|
||||||
|
ld de, _VRAM + $1000 + $10
|
||||||
|
ld bc, SquaresTilesetEnd - SquaresTileset8
|
||||||
|
call CopyRange
|
||||||
|
|
||||||
|
def spacing equ $12
|
||||||
|
|
||||||
|
ld hl, CardBackSprites24 ; source
|
||||||
|
def TileStartCardBackSprites24 equ 0
|
||||||
|
ld de, $8000 + TileStartCardBackSprites24*$10; destination of copy
|
||||||
|
ld bc, CardBackSprites24End - CardBackSprites24 ; length to copy
|
||||||
|
call CopyRange
|
||||||
|
|
||||||
|
ld hl, CardBackSprites23
|
||||||
|
def TileStartCardBackSprites23 equ TileStartCardBackSprites24 + spacing
|
||||||
|
ld de, $8000 + TileStartCardBackSprites23*$10; destination of copy
|
||||||
|
ld bc, CardBackSprites23End - CardBackSprites23
|
||||||
|
call CopyRange
|
||||||
|
|
||||||
|
ld hl, CardBackSprites22
|
||||||
|
def TileStartCardBackSprites22 equ TileStartCardBackSprites23 + spacing
|
||||||
|
ld de, $8000 + TileStartCardBackSprites22*$10; destination of copy
|
||||||
|
ld bc, CardBackSprites22End - CardBackSprites22
|
||||||
|
call CopyRange
|
||||||
|
|
||||||
|
ld hl, CardBackSprites21
|
||||||
|
def TileStartCardBackSprites21 equ TileStartCardBackSprites22 + spacing
|
||||||
|
ld de, $8000 + TileStartCardBackSprites21*$10; destination of copy
|
||||||
|
ld bc, CardBackSprites21End - CardBackSprites21
|
||||||
|
call CopyRange
|
||||||
|
|
||||||
|
ld hl, CardBackSprites20
|
||||||
|
def TileStartCardBackSprites20 equ TileStartCardBackSprites21 + spacing
|
||||||
|
ld de, $8000 + TileStartCardBackSprites20*$10
|
||||||
|
ld bc, CardBackSprites20End - CardBackSprites20
|
||||||
|
call CopyRange
|
||||||
|
|
||||||
|
ld hl, CardBackSprites19
|
||||||
|
def TileStartCardBackSprites19 equ TileStartCardBackSprites20 + spacing
|
||||||
|
ld de, $8000 + TileStartCardBackSprites19*$10
|
||||||
|
ld bc, CardBackSprites19End - CardBackSprites19
|
||||||
|
call CopyRange
|
||||||
|
|
||||||
|
ld hl, CardBackSprites18
|
||||||
|
def TileStartCardBackSprites18 equ TileStartCardBackSprites19 + spacing
|
||||||
|
ld de, $8000 + TileStartCardBackSprites18*$10
|
||||||
|
ld bc, CardBackSprites18End - CardBackSprites18
|
||||||
|
call CopyRange
|
||||||
|
|
||||||
|
ld hl, CardBackSprites17
|
||||||
|
def TileStartCardBackSprites17 equ TileStartCardBackSprites18 + spacing
|
||||||
|
ld de, $8000 + TileStartCardBackSprites17*$10
|
||||||
|
ld bc, CardBackSprites17End - CardBackSprites17
|
||||||
|
call CopyRange
|
||||||
|
|
||||||
|
def TileStartCardBackSprites16 equ TileStartCardBackSprites17 + spacing
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
MainMenuUpdate:
|
MainMenuUpdate:
|
||||||
; if pressing a key and unblocked:
|
; if pressing a key and unblocked:
|
||||||
; signal an animation to start
|
; signal an animation to start
|
||||||
|
7
main.asm
7
main.asm
@ -260,6 +260,13 @@ EntryPoint:
|
|||||||
ld hl, CARD_PRINT_PREP + 2
|
ld hl, CARD_PRINT_PREP + 2
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
|
||||||
|
ld a, %11100100
|
||||||
|
ldh [rBGP], a
|
||||||
|
ldh [rOBP0], a
|
||||||
|
|
||||||
|
ld a, LCDCF_BLK21 | LCDCF_ON | LCDCF_BGON | LCDCF_OBJON
|
||||||
|
ldh [rLCDC], a
|
||||||
|
|
||||||
; set up our scene handle
|
; set up our scene handle
|
||||||
ld hl, ScreenMainMenu
|
ld hl, ScreenMainMenu
|
||||||
call ChangeScene
|
call ChangeScene
|
||||||
|
Loading…
Reference in New Issue
Block a user