mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-11-25 10:30:49 +00:00
Basic loading bar working
This commit is contained in:
parent
df1a141d8b
commit
b8a35d4d26
@ -16,6 +16,7 @@
|
||||
701E708A2A649A230030C35D /* tinyNumbers.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = tinyNumbers.s; sourceTree = "<group>"; };
|
||||
701E708B2A660CEB0030C35D /* progressBar.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = progressBar.s; sourceTree = "<group>"; };
|
||||
701E708E2A67844B0030C35D /* loaderGraphics.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = loaderGraphics.s; sourceTree = "<group>"; };
|
||||
701E708F2A69CE520030C35D /* loadingBar.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = loadingBar.s; sourceTree = "<group>"; };
|
||||
705456862A43E03B00A2B866 /* GeneratePixelCircle.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GeneratePixelCircle.py; sourceTree = "<group>"; };
|
||||
705456882A4D336200A2B866 /* animation.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = animation.s; sourceTree = "<group>"; };
|
||||
7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMTable.py; sourceTree = "<group>"; };
|
||||
@ -60,6 +61,7 @@
|
||||
700F21DE1F43E31300D7007D /* input.s */,
|
||||
706DF1641F2D39F700AA6680 /* loader.s */,
|
||||
701E708E2A67844B0030C35D /* loaderGraphics.s */,
|
||||
701E708F2A69CE520030C35D /* loadingBar.s */,
|
||||
70E9D8611F2BD95400555C19 /* gscats.s */,
|
||||
70E9D8601F2BD95400555C19 /* graphics.s */,
|
||||
70E9D8621F2BD95400555C19 /* macros.s */,
|
||||
|
107
loader.s
107
loader.s
@ -34,6 +34,13 @@ MAINENTRY = $020000
|
||||
RESTORE_AXY
|
||||
.endmacro
|
||||
|
||||
LOADSTEP = 3
|
||||
|
||||
.macro addProgress amount
|
||||
lda #amount
|
||||
jsr advanceLoadingBar
|
||||
jsr renderLoadingBar
|
||||
.endmacro
|
||||
|
||||
main:
|
||||
BITS16
|
||||
@ -50,14 +57,7 @@ main:
|
||||
BITS16
|
||||
|
||||
; Throw up a loading screen
|
||||
lda #loaderPalette
|
||||
sta PARAML0
|
||||
lda #0
|
||||
jsr setPalette
|
||||
; jsr initSCBs
|
||||
BORDER_COLOR #$7
|
||||
lda #$1111
|
||||
jsr slowColorFill
|
||||
jsr showLoadingScreen
|
||||
|
||||
EMULATION
|
||||
|
||||
@ -67,6 +67,10 @@ main:
|
||||
.addr fileOpenCode
|
||||
bne ioError
|
||||
|
||||
NATIVE
|
||||
addProgress LOADSTEP
|
||||
EMULATION
|
||||
|
||||
; Load first half of code into bank 0
|
||||
jsr PRODOS
|
||||
.byte $ca
|
||||
@ -74,12 +78,16 @@ main:
|
||||
bne ioError
|
||||
NATIVE
|
||||
|
||||
addProgress LOADSTEP
|
||||
|
||||
; Copy code into bank 2
|
||||
ldx fileReadLen
|
||||
lda #2
|
||||
ldy #0
|
||||
jsr copyBytes
|
||||
|
||||
addProgress LOADSTEP
|
||||
|
||||
EMULATION
|
||||
|
||||
; Load rest of code into bank 0 (needed if code size exceeds BUFFERSIZE)
|
||||
@ -88,6 +96,10 @@ main:
|
||||
.addr fileRead
|
||||
bne ioError
|
||||
|
||||
NATIVE
|
||||
addProgress LOADSTEP
|
||||
EMULATION
|
||||
|
||||
; Close the file
|
||||
jsr PRODOS
|
||||
.byte $cc
|
||||
@ -100,12 +112,16 @@ ioError:
|
||||
mainContinue:
|
||||
NATIVE
|
||||
|
||||
addProgress LOADSTEP
|
||||
|
||||
; Copy rest of code into bank 2 (needed if code size exceeds BUFFERSIZE)
|
||||
ldx fileReadLen
|
||||
lda #2
|
||||
ldy #BUFFERSIZE
|
||||
jsr copyBytes
|
||||
|
||||
addProgress LOADSTEP
|
||||
|
||||
EMULATION
|
||||
|
||||
; Open the sprite bank file
|
||||
@ -114,18 +130,27 @@ mainContinue:
|
||||
.addr fileOpenSprites
|
||||
bne ioError
|
||||
|
||||
NATIVE
|
||||
addProgress LOADSTEP
|
||||
EMULATION
|
||||
|
||||
; Load the compiled sprites into bank 0
|
||||
jsr PRODOS
|
||||
.byte $ca
|
||||
.addr fileRead
|
||||
bne ioError
|
||||
|
||||
NATIVE
|
||||
addProgress LOADSTEP
|
||||
EMULATION
|
||||
|
||||
; Close the file
|
||||
jsr PRODOS
|
||||
.byte $cc
|
||||
.addr fileClose
|
||||
|
||||
NATIVE
|
||||
addProgress LOADSTEP
|
||||
|
||||
; Copy sprites into bank 3
|
||||
ldx fileReadLen
|
||||
@ -133,21 +158,28 @@ mainContinue:
|
||||
ldy #0
|
||||
jsr copyBytes
|
||||
|
||||
addProgress LOADSTEP
|
||||
|
||||
EMULATION
|
||||
|
||||
; Open the sound file
|
||||
jsr PRODOS
|
||||
.byte $c8
|
||||
.addr fileOpenSound
|
||||
bne ioError
|
||||
bne ioErrorJmp2
|
||||
|
||||
NATIVE
|
||||
addProgress LOADSTEP
|
||||
EMULATION
|
||||
|
||||
; Load the sound data into bank 0
|
||||
jsr PRODOS
|
||||
.byte $ca
|
||||
.addr fileRead
|
||||
bne ioError
|
||||
bne ioErrorJmp2
|
||||
|
||||
NATIVE
|
||||
addProgress LOADSTEP
|
||||
|
||||
; Copy sound data into bank 4
|
||||
ldx fileReadLen
|
||||
@ -157,13 +189,19 @@ mainContinue:
|
||||
ldy #0
|
||||
jsr copyBytes
|
||||
|
||||
addProgress LOADSTEP
|
||||
|
||||
EMULATION
|
||||
|
||||
; Load rest of sound data into bank 4 (needed if sound size exceeds BUFFERSIZE)
|
||||
jsr PRODOS
|
||||
.byte $ca
|
||||
.addr fileRead
|
||||
bne ioError
|
||||
bne ioErrorJmp2
|
||||
|
||||
NATIVE
|
||||
addProgress LOADSTEP
|
||||
EMULATION
|
||||
|
||||
; Close the file
|
||||
jsr PRODOS
|
||||
@ -171,6 +209,13 @@ mainContinue:
|
||||
.addr fileClose
|
||||
|
||||
NATIVE
|
||||
bra mainContinue2
|
||||
|
||||
ioErrorJmp2:
|
||||
jmp ioError
|
||||
|
||||
mainContinue2:
|
||||
addProgress LOADSTEP
|
||||
|
||||
; Copy rest of sound data into bank 4 (needed if sound size exceeds BUFFERSIZE)
|
||||
ldx fileReadLen
|
||||
@ -182,6 +227,8 @@ mainContinue:
|
||||
ldy #BUFFERSIZE
|
||||
jsr copyBytes
|
||||
|
||||
addProgress LOADSTEP
|
||||
|
||||
EMULATION
|
||||
|
||||
; Open the font file
|
||||
@ -190,6 +237,10 @@ mainContinue:
|
||||
.addr fileOpenFonts
|
||||
bne ioErrorJmp
|
||||
|
||||
NATIVE
|
||||
addProgress LOADSTEP
|
||||
EMULATION
|
||||
|
||||
; Load the font data into bank 0
|
||||
jsr PRODOS
|
||||
.byte $ca
|
||||
@ -197,6 +248,7 @@ mainContinue:
|
||||
bne ioErrorJmp
|
||||
|
||||
NATIVE
|
||||
addProgress LOADSTEP
|
||||
|
||||
; Copy font data into bank 5
|
||||
ldx fileReadLen
|
||||
@ -204,6 +256,8 @@ mainContinue:
|
||||
ldy #0
|
||||
jsr copyBytes
|
||||
|
||||
addProgress LOADSTEP
|
||||
|
||||
; EMULATION
|
||||
|
||||
; Load rest of font data into bank 0 (needed if font size exceeds BUFFERSIZE)
|
||||
@ -251,9 +305,6 @@ ioErrorJmp:
|
||||
jmp ioError
|
||||
|
||||
|
||||
loaderPalette:
|
||||
.word $0aef,$06af,$0080,$0861,$0c93,$0eb4,$0d66,$0f9a,$0777,$0f00,$0bbb,$ddd,$007b,$0a5b,$0000,$0fff
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; copyBytes
|
||||
@ -265,11 +316,6 @@ loaderPalette:
|
||||
; A = Bank number of destination
|
||||
; loadOffet : offset to start of copy destination
|
||||
;
|
||||
|
||||
;TODO: Make this work for copying ALL of a 64k bank of code
|
||||
;in chunks, as required by loader (which is using a bank 00 buffer)
|
||||
|
||||
|
||||
copyBytes:
|
||||
sty copyBytesDest+1
|
||||
sty copyBytesDest2+1
|
||||
@ -362,4 +408,27 @@ soundPath:
|
||||
fontPath:
|
||||
pstring "/GSAPP/FONTBANK"
|
||||
|
||||
|
||||
loaderPalette:
|
||||
.word $0aef,$06af,$0800,$0861,$0c93,$0eb4,$0d66,$0f9a,$0777,$0f00,$0bbb,$ddd,$007b,$0a5b,$0000,$0fff
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; showLoadingScreen
|
||||
;
|
||||
;
|
||||
showLoadingScreen:
|
||||
lda #loaderPalette
|
||||
sta PARAML0
|
||||
lda #0
|
||||
jsr setPalette
|
||||
; jsr initSCBs
|
||||
BORDER_COLOR #$7
|
||||
lda #$1111
|
||||
jsr slowColorFill
|
||||
jsr renderLoadingBar
|
||||
rts
|
||||
|
||||
|
||||
|
||||
.include "loaderGraphics.s"
|
||||
.include "loadingBar.s"
|
||||
|
138
loadingBar.s
Normal file
138
loadingBar.s
Normal file
@ -0,0 +1,138 @@
|
||||
;
|
||||
; loadingBar
|
||||
; A simple GUI element to show loading progress
|
||||
;
|
||||
; Created by Quinn Dunki on 7/20/23
|
||||
;
|
||||
|
||||
BORDER = $FF
|
||||
FILL = $22
|
||||
EMPTY = $ee
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; advanceLoadingBar
|
||||
;
|
||||
; A = Bytes to advance
|
||||
;
|
||||
; Trashes SCRATCHL
|
||||
;
|
||||
advanceLoadingBar:
|
||||
sta SCRATCHL
|
||||
lda currentLoadingBar+CBR_CURRENT
|
||||
clc
|
||||
adc SCRATCHL
|
||||
cmp currentLoadingBar+CBR_FINAL
|
||||
beq advanceLoadingBarDone
|
||||
bcs advanceLoadingBarClamp
|
||||
|
||||
advanceLoadingBarDone:
|
||||
sta currentLoadingBar+CBR_CURRENT
|
||||
rts
|
||||
|
||||
advanceLoadingBarClamp:
|
||||
lda currentLoadingBar+CBR_FINAL
|
||||
bra advanceLoadingBarDone
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; renderLoadingBar
|
||||
;
|
||||
; Not very fast
|
||||
;
|
||||
renderLoadingBar:
|
||||
SAVE_AXY
|
||||
ldy #0
|
||||
ldx currentLoadingBar+CBR_VRAM
|
||||
|
||||
BITS8A
|
||||
lda #BORDER ; Left border
|
||||
sta VRAMBANK,x
|
||||
sta VRAMBANK+160,x
|
||||
sta VRAMBANK+160*2,x
|
||||
sta VRAMBANK+160*3,x
|
||||
sta VRAMBANK+160*4,x
|
||||
sta VRAMBANK+160*5,x
|
||||
sta VRAMBANK+160*6,x
|
||||
sta VRAMBANK+160*7,x
|
||||
sta VRAMBANK+160*8,x
|
||||
sta VRAMBANK+160*9,x
|
||||
sta VRAMBANK+160*10,x
|
||||
sta VRAMBANK+160*11,x
|
||||
sta VRAMBANK+160*12,x
|
||||
sta VRAMBANK+160*13,x
|
||||
sta VRAMBANK+160*14,x
|
||||
sta VRAMBANK+160*15,x
|
||||
inx
|
||||
renderLoadingBarLoop:
|
||||
lda #BORDER
|
||||
sta VRAMBANK,x ; Top border
|
||||
sta VRAMBANK+160*15,x ; Bottom border
|
||||
|
||||
cpy currentLoadingBar+CBR_CURRENT
|
||||
bcc renderLoadingBarFillReady
|
||||
jmp renderLoadingBarEmpty
|
||||
|
||||
renderLoadingBarFillReady:
|
||||
lda #FILL
|
||||
|
||||
renderLoadingBarFill:
|
||||
sta VRAMBANK+160*1,x ; Bar
|
||||
sta VRAMBANK+160*2,x
|
||||
sta VRAMBANK+160*3,x
|
||||
sta VRAMBANK+160*4,x
|
||||
sta VRAMBANK+160*5,x
|
||||
sta VRAMBANK+160*6,x
|
||||
sta VRAMBANK+160*7,x ; Bar
|
||||
sta VRAMBANK+160*8,x
|
||||
sta VRAMBANK+160*9,x
|
||||
sta VRAMBANK+160*10,x
|
||||
sta VRAMBANK+160*11,x
|
||||
sta VRAMBANK+160*12,x
|
||||
sta VRAMBANK+160*13,x
|
||||
sta VRAMBANK+160*14,x
|
||||
inx
|
||||
iny
|
||||
cpy currentLoadingBar+CBR_FINAL
|
||||
bne renderLoadingBarLoop
|
||||
|
||||
lda #BORDER ; Right border
|
||||
sta VRAMBANK,x
|
||||
sta VRAMBANK+160,x
|
||||
sta VRAMBANK+160*2,x
|
||||
sta VRAMBANK+160*3,x
|
||||
sta VRAMBANK+160*4,x
|
||||
sta VRAMBANK+160*5,x
|
||||
sta VRAMBANK+160*6,x
|
||||
sta VRAMBANK+160*7,x
|
||||
sta VRAMBANK+160*8,x
|
||||
sta VRAMBANK+160*9,x
|
||||
sta VRAMBANK+160*10,x
|
||||
sta VRAMBANK+160*11,x
|
||||
sta VRAMBANK+160*12,x
|
||||
sta VRAMBANK+160*13,x
|
||||
sta VRAMBANK+160*14,x
|
||||
sta VRAMBANK+160*15,x
|
||||
|
||||
BITS16
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
||||
renderLoadingBarEmpty:
|
||||
.a8
|
||||
lda #EMPTY
|
||||
jmp renderLoadingBarFill
|
||||
|
||||
CBR_ACTIVE = 0
|
||||
CBR_CURRENT = 2
|
||||
CBR_FINAL = 4
|
||||
CBR_VRAM = 6
|
||||
|
||||
|
||||
currentLoadingBar:
|
||||
.word 0 ; Active
|
||||
.word 0 ; Current progress in bytes
|
||||
.word 57 ; Final progress in bytes
|
||||
.word $5eb4 ; VRAM position (top left)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user