From e29a7d47e407869a260d038da223945db621bcfc Mon Sep 17 00:00:00 2001 From: shoofle Date: Tue, 14 Jan 2025 23:48:23 -0500 Subject: [PATCH] fixed some bugs on the spread select screen and unified style some --- Async.inc | 2 +- CardLibrary.inc | 20 ++-- CopyRangeSafe.inc | 2 + CopyTilesSafe.inc | 4 + ScreenMainMenu.inc | 102 +++++++------------ ScreenSpreadSelect.inc | 225 +++++++++++++++++++++++++++++------------ main.asm | 17 +++- screendesigns.aseprite | Bin 4502 -> 4716 bytes tileset.asm | 36 +++---- 9 files changed, 248 insertions(+), 160 deletions(-) diff --git a/Async.inc b/Async.inc index dd205c6..f434c4f 100644 --- a/Async.inc +++ b/Async.inc @@ -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 diff --git a/CardLibrary.inc b/CardLibrary.inc index c641df8..de214a1 100644 --- a/CardLibrary.inc +++ b/CardLibrary.inc @@ -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: diff --git a/CopyRangeSafe.inc b/CopyRangeSafe.inc index b2a9019..a5a9819 100644 --- a/CopyRangeSafe.inc +++ b/CopyRangeSafe.inc @@ -253,4 +253,6 @@ CopyRangeUnsafeBy8s: ld a, b or a, c ; check if bc is zero jp nz, CopyRangeUnsafeBy8s + nop + nop ret \ No newline at end of file diff --git a/CopyTilesSafe.inc b/CopyTilesSafe.inc index 4fd37fa..a13b4be 100644 --- a/CopyTilesSafe.inc +++ b/CopyTilesSafe.inc @@ -287,4 +287,8 @@ CopyTilesToMapThreadsafe: ld a, b cp a, 0 jp nz, CopyTilesToMapThreadsafe + ei + nop + nop + ret \ No newline at end of file diff --git a/ScreenMainMenu.inc b/ScreenMainMenu.inc index 1d4fcf3..730679d 100644 --- a/ScreenMainMenu.inc +++ b/ScreenMainMenu.inc @@ -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: \ No newline at end of file diff --git a/ScreenSpreadSelect.inc b/ScreenSpreadSelect.inc index 9b3a884..41a7ccb 100644 --- a/ScreenSpreadSelect.inc +++ b/ScreenSpreadSelect.inc @@ -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 \ No newline at end of file + 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: \ No newline at end of file diff --git a/main.asm b/main.asm index 09eab13..89c6711 100644 --- a/main.asm +++ b/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 diff --git a/screendesigns.aseprite b/screendesigns.aseprite index 8b1a9752ea3e7521c46a0234093a58a7e5df975d..8287face9e347bbde6e4d5b6837ceda3ff183569 100644 GIT binary patch delta 594 zcmV-Y0&%>ZNo007OgjXDYs3;_TDBOn3*000I6000-0 z)(Rwl)c^nhc$}q_3lfAN2tWnzf9EBB34(3AG}8-IKwuiW6H1VL$-JMRWne8r+_N% z&&eADY2G%*<9Qriy7}$GYnD#hTC&aSOLl%*U$B&}U%Bp`-+cdEpXK}=)4(^Im##0N z+V5`AM^l%XXm*Umt$s7n?1-oS;V2pBuPnf@n-0CF6R37XkadvT(!;9&vJ>% zU?UC#dcb%HAR$T3en83ZgFD#QBlZqr0)qSh&N_v~54bK%gdgxa7f_G6pO51Ed<>>d ziU}DDS?qE(?_|7DyFo(?>srf-=uePKPUL>{SoXXCCY1v@3IG5AARqt$000UA z005I;0$`Jl3?czAld%jHv+)d70S90J000Fb0h6%~F+byEU|?XP66OG6W(Mj378;nx z2E?pX!t6lIIEqK{C?3T$!T_i<0mE(p000Fb0ssI27y$nR000000000029pjCAw6}- z#}R-q5CE|wV{$O`Un(lV?2JBJMMO=*#LPlVN6*U1R`^fhU%cE5j3hEUNBs8zT%Z9r gZvX%Q1t0^HR1a delta 450 zcmaE(GEJFjn&3pHI$kkB28LfB4>F`MFfbh4*lWeb-UehTD=gMTF6p`x)Ai%`)zsf-j2x2} H2%Z4|Z32js diff --git a/tileset.asm b/tileset.asm index c40c63b..38c5cad 100644 --- a/tileset.asm +++ b/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