mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-11-26 02:49:16 +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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMTable.py; sourceTree = "<group>"; };
|
||||||
@ -60,6 +61,7 @@
|
|||||||
700F21DE1F43E31300D7007D /* input.s */,
|
700F21DE1F43E31300D7007D /* input.s */,
|
||||||
706DF1641F2D39F700AA6680 /* loader.s */,
|
706DF1641F2D39F700AA6680 /* loader.s */,
|
||||||
701E708E2A67844B0030C35D /* loaderGraphics.s */,
|
701E708E2A67844B0030C35D /* loaderGraphics.s */,
|
||||||
|
701E708F2A69CE520030C35D /* loadingBar.s */,
|
||||||
70E9D8611F2BD95400555C19 /* gscats.s */,
|
70E9D8611F2BD95400555C19 /* gscats.s */,
|
||||||
70E9D8601F2BD95400555C19 /* graphics.s */,
|
70E9D8601F2BD95400555C19 /* graphics.s */,
|
||||||
70E9D8621F2BD95400555C19 /* macros.s */,
|
70E9D8621F2BD95400555C19 /* macros.s */,
|
||||||
|
107
loader.s
107
loader.s
@ -34,6 +34,13 @@ MAINENTRY = $020000
|
|||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
LOADSTEP = 3
|
||||||
|
|
||||||
|
.macro addProgress amount
|
||||||
|
lda #amount
|
||||||
|
jsr advanceLoadingBar
|
||||||
|
jsr renderLoadingBar
|
||||||
|
.endmacro
|
||||||
|
|
||||||
main:
|
main:
|
||||||
BITS16
|
BITS16
|
||||||
@ -50,14 +57,7 @@ main:
|
|||||||
BITS16
|
BITS16
|
||||||
|
|
||||||
; Throw up a loading screen
|
; Throw up a loading screen
|
||||||
lda #loaderPalette
|
jsr showLoadingScreen
|
||||||
sta PARAML0
|
|
||||||
lda #0
|
|
||||||
jsr setPalette
|
|
||||||
; jsr initSCBs
|
|
||||||
BORDER_COLOR #$7
|
|
||||||
lda #$1111
|
|
||||||
jsr slowColorFill
|
|
||||||
|
|
||||||
EMULATION
|
EMULATION
|
||||||
|
|
||||||
@ -67,6 +67,10 @@ main:
|
|||||||
.addr fileOpenCode
|
.addr fileOpenCode
|
||||||
bne ioError
|
bne ioError
|
||||||
|
|
||||||
|
NATIVE
|
||||||
|
addProgress LOADSTEP
|
||||||
|
EMULATION
|
||||||
|
|
||||||
; Load first half of code into bank 0
|
; Load first half of code into bank 0
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
.byte $ca
|
.byte $ca
|
||||||
@ -74,12 +78,16 @@ main:
|
|||||||
bne ioError
|
bne ioError
|
||||||
NATIVE
|
NATIVE
|
||||||
|
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
; Copy code into bank 2
|
; Copy code into bank 2
|
||||||
ldx fileReadLen
|
ldx fileReadLen
|
||||||
lda #2
|
lda #2
|
||||||
ldy #0
|
ldy #0
|
||||||
jsr copyBytes
|
jsr copyBytes
|
||||||
|
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
EMULATION
|
EMULATION
|
||||||
|
|
||||||
; Load rest of code into bank 0 (needed if code size exceeds BUFFERSIZE)
|
; Load rest of code into bank 0 (needed if code size exceeds BUFFERSIZE)
|
||||||
@ -88,6 +96,10 @@ main:
|
|||||||
.addr fileRead
|
.addr fileRead
|
||||||
bne ioError
|
bne ioError
|
||||||
|
|
||||||
|
NATIVE
|
||||||
|
addProgress LOADSTEP
|
||||||
|
EMULATION
|
||||||
|
|
||||||
; Close the file
|
; Close the file
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
.byte $cc
|
.byte $cc
|
||||||
@ -100,12 +112,16 @@ ioError:
|
|||||||
mainContinue:
|
mainContinue:
|
||||||
NATIVE
|
NATIVE
|
||||||
|
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
; Copy rest of code into bank 2 (needed if code size exceeds BUFFERSIZE)
|
; Copy rest of code into bank 2 (needed if code size exceeds BUFFERSIZE)
|
||||||
ldx fileReadLen
|
ldx fileReadLen
|
||||||
lda #2
|
lda #2
|
||||||
ldy #BUFFERSIZE
|
ldy #BUFFERSIZE
|
||||||
jsr copyBytes
|
jsr copyBytes
|
||||||
|
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
EMULATION
|
EMULATION
|
||||||
|
|
||||||
; Open the sprite bank file
|
; Open the sprite bank file
|
||||||
@ -114,18 +130,27 @@ mainContinue:
|
|||||||
.addr fileOpenSprites
|
.addr fileOpenSprites
|
||||||
bne ioError
|
bne ioError
|
||||||
|
|
||||||
|
NATIVE
|
||||||
|
addProgress LOADSTEP
|
||||||
|
EMULATION
|
||||||
|
|
||||||
; Load the compiled sprites into bank 0
|
; Load the compiled sprites into bank 0
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
.byte $ca
|
.byte $ca
|
||||||
.addr fileRead
|
.addr fileRead
|
||||||
bne ioError
|
bne ioError
|
||||||
|
|
||||||
|
NATIVE
|
||||||
|
addProgress LOADSTEP
|
||||||
|
EMULATION
|
||||||
|
|
||||||
; Close the file
|
; Close the file
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
.byte $cc
|
.byte $cc
|
||||||
.addr fileClose
|
.addr fileClose
|
||||||
|
|
||||||
NATIVE
|
NATIVE
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
; Copy sprites into bank 3
|
; Copy sprites into bank 3
|
||||||
ldx fileReadLen
|
ldx fileReadLen
|
||||||
@ -133,21 +158,28 @@ mainContinue:
|
|||||||
ldy #0
|
ldy #0
|
||||||
jsr copyBytes
|
jsr copyBytes
|
||||||
|
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
EMULATION
|
EMULATION
|
||||||
|
|
||||||
; Open the sound file
|
; Open the sound file
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
.byte $c8
|
.byte $c8
|
||||||
.addr fileOpenSound
|
.addr fileOpenSound
|
||||||
bne ioError
|
bne ioErrorJmp2
|
||||||
|
|
||||||
|
NATIVE
|
||||||
|
addProgress LOADSTEP
|
||||||
|
EMULATION
|
||||||
|
|
||||||
; Load the sound data into bank 0
|
; Load the sound data into bank 0
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
.byte $ca
|
.byte $ca
|
||||||
.addr fileRead
|
.addr fileRead
|
||||||
bne ioError
|
bne ioErrorJmp2
|
||||||
|
|
||||||
NATIVE
|
NATIVE
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
; Copy sound data into bank 4
|
; Copy sound data into bank 4
|
||||||
ldx fileReadLen
|
ldx fileReadLen
|
||||||
@ -157,13 +189,19 @@ mainContinue:
|
|||||||
ldy #0
|
ldy #0
|
||||||
jsr copyBytes
|
jsr copyBytes
|
||||||
|
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
EMULATION
|
EMULATION
|
||||||
|
|
||||||
; Load rest of sound data into bank 4 (needed if sound size exceeds BUFFERSIZE)
|
; Load rest of sound data into bank 4 (needed if sound size exceeds BUFFERSIZE)
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
.byte $ca
|
.byte $ca
|
||||||
.addr fileRead
|
.addr fileRead
|
||||||
bne ioError
|
bne ioErrorJmp2
|
||||||
|
|
||||||
|
NATIVE
|
||||||
|
addProgress LOADSTEP
|
||||||
|
EMULATION
|
||||||
|
|
||||||
; Close the file
|
; Close the file
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
@ -171,6 +209,13 @@ mainContinue:
|
|||||||
.addr fileClose
|
.addr fileClose
|
||||||
|
|
||||||
NATIVE
|
NATIVE
|
||||||
|
bra mainContinue2
|
||||||
|
|
||||||
|
ioErrorJmp2:
|
||||||
|
jmp ioError
|
||||||
|
|
||||||
|
mainContinue2:
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
; Copy rest of sound data into bank 4 (needed if sound size exceeds BUFFERSIZE)
|
; Copy rest of sound data into bank 4 (needed if sound size exceeds BUFFERSIZE)
|
||||||
ldx fileReadLen
|
ldx fileReadLen
|
||||||
@ -182,6 +227,8 @@ mainContinue:
|
|||||||
ldy #BUFFERSIZE
|
ldy #BUFFERSIZE
|
||||||
jsr copyBytes
|
jsr copyBytes
|
||||||
|
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
EMULATION
|
EMULATION
|
||||||
|
|
||||||
; Open the font file
|
; Open the font file
|
||||||
@ -190,6 +237,10 @@ mainContinue:
|
|||||||
.addr fileOpenFonts
|
.addr fileOpenFonts
|
||||||
bne ioErrorJmp
|
bne ioErrorJmp
|
||||||
|
|
||||||
|
NATIVE
|
||||||
|
addProgress LOADSTEP
|
||||||
|
EMULATION
|
||||||
|
|
||||||
; Load the font data into bank 0
|
; Load the font data into bank 0
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
.byte $ca
|
.byte $ca
|
||||||
@ -197,6 +248,7 @@ mainContinue:
|
|||||||
bne ioErrorJmp
|
bne ioErrorJmp
|
||||||
|
|
||||||
NATIVE
|
NATIVE
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
; Copy font data into bank 5
|
; Copy font data into bank 5
|
||||||
ldx fileReadLen
|
ldx fileReadLen
|
||||||
@ -204,6 +256,8 @@ mainContinue:
|
|||||||
ldy #0
|
ldy #0
|
||||||
jsr copyBytes
|
jsr copyBytes
|
||||||
|
|
||||||
|
addProgress LOADSTEP
|
||||||
|
|
||||||
; EMULATION
|
; EMULATION
|
||||||
|
|
||||||
; Load rest of font data into bank 0 (needed if font size exceeds BUFFERSIZE)
|
; Load rest of font data into bank 0 (needed if font size exceeds BUFFERSIZE)
|
||||||
@ -251,9 +305,6 @@ ioErrorJmp:
|
|||||||
jmp ioError
|
jmp ioError
|
||||||
|
|
||||||
|
|
||||||
loaderPalette:
|
|
||||||
.word $0aef,$06af,$0080,$0861,$0c93,$0eb4,$0d66,$0f9a,$0777,$0f00,$0bbb,$ddd,$007b,$0a5b,$0000,$0fff
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; copyBytes
|
; copyBytes
|
||||||
@ -265,11 +316,6 @@ loaderPalette:
|
|||||||
; A = Bank number of destination
|
; A = Bank number of destination
|
||||||
; loadOffet : offset to start of copy 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:
|
copyBytes:
|
||||||
sty copyBytesDest+1
|
sty copyBytesDest+1
|
||||||
sty copyBytesDest2+1
|
sty copyBytesDest2+1
|
||||||
@ -362,4 +408,27 @@ soundPath:
|
|||||||
fontPath:
|
fontPath:
|
||||||
pstring "/GSAPP/FONTBANK"
|
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 "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