fixed some bugs on the spread select screen and unified style some
This commit is contained in:
parent
0b04436b3d
commit
e29a7d47e4
@ -8,7 +8,7 @@ def vAsyncAfter equ $ff8c
|
||||
def vAsyncProgress equ $ff8e
|
||||
|
||||
def SAFE_ASYNC_START EQU 146
|
||||
def SAFE_ASYNC_END EQU 151
|
||||
def SAFE_ASYNC_END EQU 153
|
||||
|
||||
DoInAsyncVBlank:
|
||||
di
|
||||
|
@ -4,24 +4,24 @@ Spreads:
|
||||
db 5 ; length
|
||||
.nospread
|
||||
db 0
|
||||
db 20, " Nothing "
|
||||
db 20, " This is no spread. "
|
||||
db 18, " Nothing "
|
||||
db 18, "This is no spread."
|
||||
.onecard
|
||||
db 1, $21
|
||||
db 20, " One Card Spread "
|
||||
db 20, " Draw a single card."
|
||||
db 18, " One Card Spread "
|
||||
db 18, " Draw one card. "
|
||||
.tencard
|
||||
db 10, $00, $10, $20, $30, $40, $02, $12, $22, $32, $42
|
||||
db 20, " Ten Card Spread "
|
||||
db 20, "Throw more cards on."
|
||||
db 18, " Ten Card Spread "
|
||||
db 18, " More cards! "
|
||||
.fivecard
|
||||
db 5, $11, $20, $22, $31, $41
|
||||
db 20, " Horizontal Cross "
|
||||
db 20, " A little spicy. "
|
||||
db 18, " Horizontal Cross "
|
||||
db 18, " A little spicy. "
|
||||
.threecard
|
||||
db 3, $01, $21, $41
|
||||
db 20, " Three Card Spread "
|
||||
db 20, " Old reliable. "
|
||||
db 18, "Three Card Spread "
|
||||
db 18, " Old reliable. "
|
||||
.end
|
||||
|
||||
Cards:
|
||||
|
@ -253,4 +253,6 @@ CopyRangeUnsafeBy8s:
|
||||
ld a, b
|
||||
or a, c ; check if bc is zero
|
||||
jp nz, CopyRangeUnsafeBy8s
|
||||
nop
|
||||
nop
|
||||
ret
|
@ -287,4 +287,8 @@ CopyTilesToMapThreadsafe:
|
||||
ld a, b
|
||||
cp a, 0
|
||||
jp nz, CopyTilesToMapThreadsafe
|
||||
ei
|
||||
nop
|
||||
nop
|
||||
|
||||
ret
|
@ -31,65 +31,65 @@ MainMenuSetup_ScreenOff:
|
||||
ld a, 0
|
||||
ldh [rLCDC], a
|
||||
|
||||
ld hl, MainMenuUITiles
|
||||
ld de, $8000
|
||||
ld bc, (MainMenuUITilesEnd - MainMenuUITiles)
|
||||
call CopyRangeUnsafe
|
||||
|
||||
ld hl, SquaresTileset8
|
||||
ld de, $8010
|
||||
ld bc, (SquaresTilesetEnd - SquaresTileset8)
|
||||
call CopyRangeUnsafe
|
||||
|
||||
ld hl, MainMenuUITiles
|
||||
ld de, $8000 + 152*16
|
||||
ld bc, (MainMenuUITilesEnd - MainMenuUITiles)
|
||||
call CopyRangeUnsafe
|
||||
|
||||
ld hl, CardBackSprites24 ; source
|
||||
def TileStartCardBackSprites24 equ $6
|
||||
def TileStartCardBackSprites24 equ $a
|
||||
ld de, $8000 + TileStartCardBackSprites24*$10; destination of copy
|
||||
ld bc, CardBackSprites24End - CardBackSprites24 ; length to copy
|
||||
call CopyRangeUnsafe
|
||||
|
||||
ld hl, CardBackSprites23
|
||||
def TileStartCardBackSprites23 equ $18
|
||||
def TileStartCardBackSprites23 equ $1c
|
||||
ld de, $8000 + TileStartCardBackSprites23*$10; destination of copy
|
||||
ld bc, CardBackSprites23End - CardBackSprites23
|
||||
call CopyRangeUnsafe
|
||||
|
||||
ld hl, CardBackSprites22
|
||||
def TileStartCardBackSprites22 equ $2a
|
||||
def TileStartCardBackSprites22 equ $2e
|
||||
ld de, $8000 + TileStartCardBackSprites22*$10; destination of copy
|
||||
ld bc, CardBackSprites22End - CardBackSprites22
|
||||
call CopyRangeUnsafe
|
||||
|
||||
ld hl, CardBackSprites21
|
||||
def TileStartCardBackSprites21 equ $3c
|
||||
def TileStartCardBackSprites21 equ $40
|
||||
ld de, $8000 + TileStartCardBackSprites21*$10; destination of copy
|
||||
ld bc, CardBackSprites21End - CardBackSprites21
|
||||
call CopyRangeUnsafe
|
||||
|
||||
ld hl, CardBackSprites20
|
||||
def TileStartCardBackSprites20 equ $4e
|
||||
def TileStartCardBackSprites20 equ $52
|
||||
ld de, $8000 + TileStartCardBackSprites20*$10
|
||||
ld bc, CardBackSprites20End - CardBackSprites20
|
||||
call CopyRangeUnsafe
|
||||
|
||||
ld hl, CardBackSprites19
|
||||
def TileStartCardBackSprites19 equ $60
|
||||
def TileStartCardBackSprites19 equ $64
|
||||
ld de, $8000 + TileStartCardBackSprites19*$10
|
||||
ld bc, CardBackSprites19End - CardBackSprites19
|
||||
call CopyRangeUnsafe
|
||||
|
||||
ld hl, CardBackSprites18
|
||||
def TileStartCardBackSprites18 equ $72
|
||||
def TileStartCardBackSprites18 equ $76
|
||||
ld de, $8000 + TileStartCardBackSprites18*$10
|
||||
ld bc, CardBackSprites18End - CardBackSprites18
|
||||
call CopyRangeUnsafe
|
||||
|
||||
ld hl, CardBackSprites17
|
||||
def TileStartCardBackSprites17 equ $84
|
||||
def TileStartCardBackSprites17 equ $88
|
||||
ld de, $8000 + TileStartCardBackSprites17*$10
|
||||
ld bc, CardBackSprites17End - CardBackSprites17
|
||||
call CopyRangeUnsafe
|
||||
|
||||
def TileStartCardBackSprites16 equ $90
|
||||
def TileStartCardBackSprites16 equ $9a
|
||||
|
||||
ld hl, SquaresTilemap
|
||||
ld de, $9800
|
||||
@ -962,65 +962,35 @@ SquaresTiles:
|
||||
dw SquaresTileset8
|
||||
|
||||
SquaresTileset1:
|
||||
db $20,$00,$00,$00,$02,$00,$00,$00,$80,$00,$00,$00,$08,$00,$00,$00
|
||||
db $aa,$00,$00,$00,$82,$00,$00,$00,$82,$00,$00,$00,$aa,$00,$00,$00
|
||||
db $28,$00,$00,$00,$82,$00,$00,$00,$82,$00,$00,$00,$28,$00,$00,$00
|
||||
db $ba,$00,$00,$00,$82,$00,$82,$00,$82,$00,$00,$00,$ba,$00,$00,$00
|
||||
db $fe,$00,$82,$00,$82,$00,$82,$00,$82,$00,$82,$00,$fe,$00,$00,$00
|
||||
|
||||
SquaresTileset2:
|
||||
db $00,$00,$10,$00,$00,$00,$01,$00,$00,$00,$40,$00,$00,$00,$04,$00
|
||||
db $00,$00,$14,$00,$00,$00,$41,$00,$00,$00,$41,$00,$00,$00,$14,$00
|
||||
db $00,$00,$55,$00,$00,$00,$41,$00,$00,$00,$41,$00,$00,$00,$55,$00
|
||||
db $00,$00,$5d,$00,$00,$00,$41,$00,$41,$00,$41,$00,$00,$00,$5d,$00
|
||||
db $00,$00,$7f,$00,$41,$00,$41,$00,$41,$00,$41,$00,$41,$00,$7f,$00
|
||||
|
||||
SquaresTileset3:
|
||||
db $02,$00,$00,$00,$08,$00,$00,$00,$80,$00,$00,$00,$20,$00,$00,$00
|
||||
db $0a,$00,$00,$00,$0a,$00,$00,$00,$a0,$00,$00,$00,$a0,$00,$00,$00
|
||||
db $aa,$00,$00,$00,$aa,$00,$00,$00,$a0,$00,$00,$00,$a0,$00,$00,$00
|
||||
db $ae,$00,$00,$00,$ae,$00,$00,$00,$a0,$00,$a0,$00,$a0,$00,$00,$00
|
||||
db $bf,$00,$00,$00,$bf,$00,$a0,$00,$a0,$00,$a0,$00,$a0,$00,$a0,$00
|
||||
|
||||
SquaresTileset4:
|
||||
db $00,$00,$01,$00,$00,$00,$04,$00,$00,$00,$40,$00,$00,$00,$10,$00
|
||||
db $00,$00,$05,$00,$00,$00,$05,$00,$00,$00,$50,$00,$00,$00,$50,$00
|
||||
db $00,$00,$55,$00,$00,$00,$55,$00,$00,$00,$50,$00,$00,$00,$50,$00
|
||||
db $00,$00,$57,$00,$00,$00,$57,$00,$00,$00,$50,$00,$50,$00,$50,$00
|
||||
db $50,$00,$df,$00,$00,$00,$df,$00,$50,$00,$50,$00,$50,$00,$50,$00
|
||||
|
||||
SquaresTileset5:
|
||||
db $08,$00,$00,$00,$80,$00,$00,$00,$02,$00,$00,$00,$20,$00,$00,$00
|
||||
db $28,$00,$00,$00,$82,$00,$00,$00,$82,$00,$00,$00,$28,$00,$00,$00
|
||||
db $28,$00,$00,$00,$aa,$00,$00,$00,$aa,$00,$00,$00,$28,$00,$00,$00
|
||||
db $28,$00,$00,$00,$ab,$00,$00,$00,$ab,$00,$00,$00,$28,$00,$28,$00
|
||||
db $28,$00,$28,$00,$ef,$00,$00,$00,$ef,$00,$28,$00,$28,$00,$28,$00
|
||||
|
||||
SquaresTileset6:
|
||||
db $00,$00,$04,$00,$00,$00,$40,$00,$00,$00,$01,$00,$00,$00,$10,$00
|
||||
db $00,$00,$14,$00,$00,$00,$41,$00,$00,$00,$41,$00,$00,$00,$14,$00
|
||||
db $00,$00,$14,$00,$00,$00,$55,$00,$00,$00,$55,$00,$00,$00,$14,$00
|
||||
db $14,$00,$14,$00,$00,$00,$d5,$00,$00,$00,$d5,$00,$00,$00,$14,$00
|
||||
db $14,$00,$14,$00,$14,$00,$f7,$00,$00,$00,$f7,$00,$14,$00,$14,$00
|
||||
|
||||
SquaresTileset7:
|
||||
db $08,$00,$00,$00,$02,$00,$00,$00,$20,$00,$00,$00,$80,$00,$00,$00
|
||||
db $0a,$00,$00,$00,$0a,$00,$00,$00,$a0,$00,$00,$00,$a0,$00,$00,$00
|
||||
db $0a,$00,$00,$00,$0a,$00,$00,$00,$aa,$00,$00,$00,$aa,$00,$00,$00
|
||||
db $0a,$00,$0a,$00,$0a,$00,$00,$00,$ea,$00,$00,$00,$ea,$00,$00,$00
|
||||
db $0a,$00,$0a,$00,$0a,$00,$0a,$00,$fb,$00,$00,$00,$fb,$00,$0a,$00
|
||||
|
||||
SquaresTileset8:
|
||||
db $00,$00,$04,$00,$00,$00,$01,$00,$00,$00,$10,$00,$00,$00,$40,$00
|
||||
db $00,$00,$05,$00,$00,$00,$05,$00,$00,$00,$50,$00,$00,$00,$50,$00
|
||||
db $00,$00,$05,$00,$00,$00,$05,$00,$00,$00,$55,$00,$00,$00,$55,$00
|
||||
db $00,$00,$05,$00,$05,$00,$05,$00,$00,$00,$75,$00,$00,$00,$75,$00
|
||||
db $05,$00,$05,$00,$05,$00,$05,$00,$05,$00,$fd,$00,$00,$00,$fd,$00
|
||||
|
||||
SquaresTilesetEnd:
|
||||
|
||||
MainMenuUITiles:
|
||||
db $00,$ff,$ff,$ff,$ff,$ff,$ff,$00,$00,$ff,$00,$00,$00,$00,$00,$00
|
||||
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
|
||||
db $05,$00,$05,$00,$05,$00,$05,$00,$05,$00,$fd,$00,$00,$00,$fd,$00
|
||||
db $00,$ff,$ff,$ff,$ff,$ff,$ff,$00,$00,$ff,$00,$00,$00,$00,$00,$00
|
||||
db $70,$e8,$70,$e8,$70,$e8,$70,$e8,$70,$e8,$70,$e8,$70,$e8,$70,$e8
|
||||
db $0e,$17,$0e,$17,$0e,$17,$0e,$17,$0e,$17,$0e,$17,$0e,$17,$0e,$17
|
||||
db $00,$00,$00,$00,$00,$00,$00,$ff,$ff,$00,$ff,$ff,$ff,$ff,$00,$ff
|
||||
@ -1031,23 +1001,23 @@ MainMenuUITiles:
|
||||
MainMenuUITilesEnd:
|
||||
|
||||
SquaresTilemap:
|
||||
db $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05
|
||||
db $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05
|
||||
db $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05
|
||||
db $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05
|
||||
db $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05
|
||||
db $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05
|
||||
db $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05
|
||||
db $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05
|
||||
db $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05
|
||||
db $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05
|
||||
db $05, $05, $9f, $98, $98, $98, $98, $98, $98, $98, $98, $98, $98, $98, $98, $98, $98, $9e, $05, $05
|
||||
db $05, $05, $99, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $9a, $05, $05
|
||||
db $05, $05, $99, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $9a, $05, $05
|
||||
db $05, $05, $99, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $9a, $05, $05
|
||||
db $05, $05, $99, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $9a, $05, $05
|
||||
db $05, $05, $99, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $9a, $05, $05
|
||||
db $05, $05, $9c, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9d, $05, $05
|
||||
db $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05
|
||||
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $09, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $08, $01, $01
|
||||
db $01, $01, $03, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $04, $01, $01
|
||||
db $01, $01, $03, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $04, $01, $01
|
||||
db $01, $01, $03, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $04, $01, $01
|
||||
db $01, $01, $03, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $04, $01, $01
|
||||
db $01, $01, $03, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $04, $01, $01
|
||||
db $01, $01, $06, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $07, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
|
||||
SquaresTilemapEnd:
|
@ -14,7 +14,9 @@ SpreadSelectSetup:
|
||||
ldh [vPreviousSpreadIndex], a
|
||||
ldh [vSelectedSpreadIndex], a
|
||||
|
||||
ld hl, ZEROES
|
||||
call UpdateCurrentSpread
|
||||
|
||||
ld hl, SpreadSelectTilemap
|
||||
ld de, $9800
|
||||
ld b, 18
|
||||
ld c, 20
|
||||
@ -29,24 +31,37 @@ SpreadSelectSetup:
|
||||
ld [vAsyncAfter+1], a
|
||||
call DoInAsyncVBlank
|
||||
|
||||
ld a, HIGH(ZEROES)
|
||||
ld de, $ffc0
|
||||
call RunDMA
|
||||
ret
|
||||
|
||||
.loadUITiles
|
||||
ld hl, UITiles ; source
|
||||
ld de, $8000 + $80*16; destination of copy
|
||||
ld bc, UITilesEnd - UITiles ; length to copy
|
||||
|
||||
|
||||
ld a, LOW(CopyRangeUnsafe)
|
||||
ld [vAsyncNext], a
|
||||
ld a, HIGH(CopyRangeUnsafe)
|
||||
ld [vAsyncNext+1], a
|
||||
ld a, LOW(.zeroOutOAM)
|
||||
ld [vAsyncAfter], a
|
||||
ld a, HIGH(.zeroOutOAM)
|
||||
ld [vAsyncAfter+1], a
|
||||
ret
|
||||
|
||||
.zeroOutOAM
|
||||
|
||||
ld a, LOW(RunDMA)
|
||||
ld [vAsyncNext], a
|
||||
ld a, HIGH(RunDMA)
|
||||
ld [vAsyncNext+1], a
|
||||
ld a, LOW(DrawSpreadAsync)
|
||||
ld [vAsyncAfter], a
|
||||
ld a, HIGH(DrawSpreadAsync)
|
||||
ld [vAsyncAfter+1], a
|
||||
|
||||
ld a, HIGH(ZEROES)
|
||||
ld de, $ffc0 ; arguments to the first following async call
|
||||
|
||||
ret
|
||||
|
||||
SpreadSelectUpdate:
|
||||
@ -70,11 +85,42 @@ SpreadSelectUpdate:
|
||||
ld hl, Spreads
|
||||
call ArrayClampLooping
|
||||
ldh [vSelectedSpreadIndex], a ; load current selected tile index
|
||||
|
||||
ld hl, vTime
|
||||
ldh a, [rDELTAT]
|
||||
ld b, a
|
||||
ldh a, [vTime]
|
||||
add a, b
|
||||
ldh [vTime], a
|
||||
ldh a, [vTime+1]
|
||||
adc a, 0
|
||||
ldh [vTime+1], a ; increment time. when the 16bit time register is greater
|
||||
; than 4096 ($10_00) then one second has passed. so that's satisfied when
|
||||
; vTime+1 is equal to or greater than $10
|
||||
|
||||
ldh a, [vTime+1]
|
||||
cp a, $01
|
||||
jp c, .doneUpdate ; if the timer is less than $0100, skip to end
|
||||
|
||||
;otherwise reset the timer
|
||||
ld a, 0
|
||||
ldh [vTime], a
|
||||
ldh [vTime+1], a
|
||||
|
||||
ld hl, SquaresTiles
|
||||
ldh a, [vFrameCountSquares]
|
||||
inc a
|
||||
call ArrayClampLooping
|
||||
ldh [vFrameCountSquares], a
|
||||
|
||||
ldh a, [vSelectedSpreadIndex]
|
||||
ld hl, vPreviousSpreadIndex
|
||||
cp a, [hl]
|
||||
|
||||
ret z ; we're done if previous index is same as new index
|
||||
|
||||
call UpdateCurrentSpread
|
||||
|
||||
; execute an async call to DrawSpreadAsync.
|
||||
ld a, LOW(DrawSpreadAsync)
|
||||
ld [vAsyncNext], a
|
||||
@ -82,12 +128,11 @@ SpreadSelectUpdate:
|
||||
ld [vAsyncNext+1], a
|
||||
|
||||
call DoInAsyncVBlank
|
||||
|
||||
.doneUpdate
|
||||
ret ; return from main thread. go back to looping.
|
||||
|
||||
DrawSpreadAsync:
|
||||
ldh a, [vSelectedSpreadIndex]
|
||||
ldh [vPreviousSpreadIndex], a
|
||||
|
||||
UpdateCurrentSpread:
|
||||
; find the correct spread address
|
||||
ld hl, Spreads
|
||||
inc hl ; skip length of spreads
|
||||
@ -116,9 +161,14 @@ DrawSpreadAsync:
|
||||
ld [vCurrentSpread], a
|
||||
ld a, h
|
||||
ld [vCurrentSpread+1], a ; save the current spread (hl) into vcurrentspread.
|
||||
ret
|
||||
|
||||
DrawSpreadAsync:
|
||||
ldh a, [vSelectedSpreadIndex]
|
||||
ldh [vPreviousSpreadIndex], a
|
||||
|
||||
ld de, $9800 + 32*4 + 3
|
||||
ld hl, ZEROES
|
||||
ld de, $9800 + 32*5 + 5
|
||||
ld hl, ONES
|
||||
ld b, 8
|
||||
ld c, 10
|
||||
|
||||
@ -143,7 +193,7 @@ DrawSpreadAsync:
|
||||
ld e, [hl]
|
||||
inc e
|
||||
add hl, de
|
||||
ld de, $9800 + 32
|
||||
ld de, $9800 + 32 + 1
|
||||
ld a, LOW(PrintString)
|
||||
ld [vAsyncNext], a
|
||||
ld a, HIGH(PrintString)
|
||||
@ -155,7 +205,7 @@ DrawSpreadAsync:
|
||||
ret
|
||||
|
||||
.afterTitle
|
||||
ld de, $9800 + (32*2)
|
||||
ld de, $9800 + (32*2) + 1
|
||||
ld a, LOW(PrintString)
|
||||
ld [vAsyncNext], a
|
||||
ld a, HIGH(PrintString)
|
||||
@ -168,7 +218,7 @@ DrawSpreadAsync:
|
||||
|
||||
.afterDescription
|
||||
|
||||
ld hl, $9800 + 32*4 + 3
|
||||
ld hl, $9800 + 32*5 + 5
|
||||
ldh a, [vSelectedSpreadCard]
|
||||
ld e, a ; e contains the selected index
|
||||
|
||||
@ -192,7 +242,67 @@ DrawSpreadAsync:
|
||||
ret
|
||||
|
||||
SpreadSelectDraw:
|
||||
ret
|
||||
di
|
||||
ld hl, SquaresTiles + 1
|
||||
ld b, 0
|
||||
ldh a, [vFrameCountSquares]
|
||||
ld c, a
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
ld c, [hl]
|
||||
inc hl
|
||||
ld b, [hl]
|
||||
ld h, b
|
||||
ld l, c
|
||||
ld de, $8010
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl+]
|
||||
ld [de], a
|
||||
reti
|
||||
SpreadSelectTeardown:
|
||||
ret
|
||||
|
||||
@ -207,12 +317,13 @@ DrawSpreadBigAndThreadsafe:
|
||||
ld b, a
|
||||
ld a, [bc]
|
||||
cp a, 0 ; length of spread
|
||||
ret z ; return early if the spread is empty
|
||||
jp z, .doneDrawingSpread ; return early if the spread is empty
|
||||
ld d, a ; length of spread in d
|
||||
inc d
|
||||
.drawCards
|
||||
ei
|
||||
nop
|
||||
nop
|
||||
di
|
||||
dec d
|
||||
jp z, .doneWithSpread ; if we're drawing zero remaining cards, stop drawing
|
||||
@ -245,51 +356,16 @@ DrawSpreadBigAndThreadsafe:
|
||||
ei
|
||||
nop
|
||||
di
|
||||
nop
|
||||
nop
|
||||
call DrawBigCardSelected
|
||||
|
||||
.doneDrawingSpread
|
||||
ei
|
||||
nop
|
||||
nop
|
||||
ret
|
||||
|
||||
|
||||
|
||||
DrawSpreadBig:
|
||||
; hl for location on screen
|
||||
; bc for current spread address
|
||||
; e for index of selected card
|
||||
ld a, [bc]
|
||||
cp a, 0 ; length of spread
|
||||
ret z ; return early if the spread is empty
|
||||
push bc
|
||||
ld d, a ; length of spread in d
|
||||
inc d
|
||||
.drawCards
|
||||
dec d
|
||||
jp z, .doneWithSpread ; if we're drawing zero remaining cards, stop drawing
|
||||
inc bc ; step forward
|
||||
push hl ; need this bc drawsmallcard changes hl
|
||||
ld a, [bc]
|
||||
call DrawBigCard
|
||||
pop hl
|
||||
jp .drawCards
|
||||
.doneWithSpread
|
||||
; stack has spread address
|
||||
; d is zero
|
||||
; e should have currently selected index
|
||||
ld b, h
|
||||
ld c, l ; stash hl in bc for a mo; this should be a location in vram
|
||||
pop hl ; put bc from stack into hl, this is the spread address
|
||||
|
||||
inc e ; skip the tiles length
|
||||
|
||||
add hl, de
|
||||
ld a, [hl]
|
||||
|
||||
ld h, b
|
||||
ld l, c; retrieve
|
||||
;call DrawBigCardSelected
|
||||
|
||||
ret
|
||||
|
||||
DrawBigCard: ; starting from screen location hl, draw a card at
|
||||
;the location described in a
|
||||
; saves de and is therefore not threadsafe
|
||||
@ -314,19 +390,19 @@ DrawBigCard: ; starting from screen location hl, draw a card at
|
||||
jp nz, .stepDown
|
||||
.drawCard
|
||||
ld de, 32
|
||||
ld [hl], $12
|
||||
ld [hl], $a
|
||||
inc hl
|
||||
ld [hl], $1e
|
||||
ld [hl], $e
|
||||
add hl, de
|
||||
ld [hl], $1f
|
||||
ld [hl], $f
|
||||
dec hl
|
||||
ld [hl], $13
|
||||
ld [hl], $b
|
||||
add hl, de
|
||||
ld [hl], $13
|
||||
ld [hl], $b
|
||||
inc hl
|
||||
ld [hl], $1f
|
||||
ld [hl], $f
|
||||
add hl, de
|
||||
ld [hl], $23
|
||||
ld [hl], $1b
|
||||
dec hl
|
||||
ld [hl], $17
|
||||
|
||||
@ -444,4 +520,25 @@ DrawSmallCard: ; starting from screen location hl, draw a card at
|
||||
ld [hl], c
|
||||
|
||||
pop de
|
||||
ret
|
||||
ret
|
||||
|
||||
SpreadSelectTilemap:
|
||||
db $09, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $08
|
||||
db $03, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $04
|
||||
db $03, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $04
|
||||
db $06, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $07
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
SpreadSelectTilemapEnd:
|
17
main.asm
17
main.asm
@ -11,6 +11,7 @@ DEF SCENE_TEARDOWN EQU SCENE_DRAW + 4
|
||||
DEF INTERRUPT_LCD EQU $c111
|
||||
|
||||
def ZEROES equ $D000
|
||||
def ONES equ $D200
|
||||
|
||||
DEF rMYBTN EQU $FFA8
|
||||
DEF rMYBTNP EQU rMYBTN + 1
|
||||
@ -46,6 +47,18 @@ EntryPoint:
|
||||
dec bc
|
||||
jp nz, .buildZeros
|
||||
|
||||
ld a, 1
|
||||
ld hl, ONES
|
||||
ld bc, $200
|
||||
|
||||
.buildOnes
|
||||
ld a, 1
|
||||
ld [hl+], a
|
||||
ld a, b
|
||||
or a, c
|
||||
dec bc
|
||||
jp nz, .buildOnes
|
||||
|
||||
|
||||
; set up the scene and interrupt vectors
|
||||
ld hl, Instructions
|
||||
@ -171,7 +184,7 @@ Loop:
|
||||
; either way it's going to eat into the update timing
|
||||
; at this point we want to make sure that scanline 153 has passed
|
||||
; we should check if we're past there and skip this await if necessary
|
||||
ld b, 5
|
||||
ld b, 10
|
||||
call AwaitLine
|
||||
|
||||
jp Loop
|
||||
@ -240,6 +253,7 @@ PrintBChars: ;write ascii characters. will not respect newlines or anything like
|
||||
; a should be the high byte of where we're DMAing from (ld a, $c0 in my case probably)
|
||||
; de should have the address in hram for where to paste to
|
||||
RunDMA:
|
||||
di
|
||||
push de
|
||||
push af
|
||||
ld hl, run_dma_tail
|
||||
@ -255,6 +269,7 @@ run_dma_tail: ; This part must be in HRAM.
|
||||
.wait
|
||||
dec b
|
||||
jr nz, .wait
|
||||
ei
|
||||
ret z ; Conditional `ret` is 1 M-cycle slower, which avoids
|
||||
; reading from the stack on the last M-cycle of DMA.
|
||||
.run_dma_tail_end
|
||||
|
Binary file not shown.
36
tileset.asm
36
tileset.asm
@ -17,21 +17,21 @@ tileset:
|
||||
|
||||
|
||||
BackgroundCopyCopy:
|
||||
db $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97
|
||||
db $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97
|
||||
db $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97
|
||||
db $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97
|
||||
db $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97
|
||||
db $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97
|
||||
db $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97
|
||||
db $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97
|
||||
db $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97
|
||||
db $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97
|
||||
db $97, $97, $9f, $98, $98, $98, $98, $98, $98, $98, $98, $98, $98, $98, $98, $98, $98, $9e, $97, $97
|
||||
db $97, $97, $99, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $9a, $97, $97
|
||||
db $97, $97, $99, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $9a, $97, $97
|
||||
db $97, $97, $99, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $9a, $97, $97
|
||||
db $97, $97, $99, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $9a, $97, $97
|
||||
db $97, $97, $99, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $96, $9a, $97, $97
|
||||
db $97, $97, $9c, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9b, $9d, $97, $97
|
||||
db $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97, $97
|
||||
db $09, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $08
|
||||
db $03, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $04
|
||||
db $03, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $04
|
||||
db $06, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $05, $07
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
db $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01
|
||||
|
Loading…
Reference in New Issue
Block a user