Fast graphics path screen fill working

This commit is contained in:
blondie7575 2017-07-29 14:47:17 -07:00
parent 4c8be2d8aa
commit 2e8dfde290
7 changed files with 171 additions and 39 deletions

View File

@ -11,7 +11,7 @@
CL65=cl65 CL65=cl65
AC=AppleCommander.jar AC=AppleCommander.jar
ADDR=6000 ADDR=800
PGM=gscats PGM=gscats

Binary file not shown.

View File

@ -1,10 +1,12 @@
TEXTCOLOR = $c022 TEXTCOLOR = $e0c022
NEWVIDEO = $c029 NEWVIDEO = $e0c029
BORDERCOLOR = $c034 BORDERCOLOR = $e0c034
CLOCKCTL = $c034 CLOCKCTL = $e0c034
SHADOW = $e0c035
STACKCTL = $e0c068
KBD = $e0c000
KBDSTROBE = $e0c010
COUT = $fded COUT = $fded
KBD = $c000
KBDSTROBE = $c010
; Zero page locations we use (unused by Monitor, Applesoft, or ProDOS) ; Zero page locations we use (unused by Monitor, Applesoft, or ProDOS)

View File

@ -1,19 +1,31 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; colorFill ; colorFill
; Fills the screen with a color (or two). Not very fast. ; Fills the screen with a color (or two). Pretty fast, but not fastest possible
; A 4:4:4:4 = Palette entries ; A 4:4:4:4 = Palette entries
;
; Trashes Y
colorFill: colorFill:
phx FASTGRAPHICS
ldx #32000
lda #$9d00-1 ; Point stack to end of VRAM
tcs
ldy #200
colorFillLoop: colorFillLoop:
sta $e11ffe,x ; 80 PHXs, for 1 line
dex ; We could do the entire screen with PHXs, but this is a
dex ; balance between speed and super-verbose code
bne colorFillLoop .byte $da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da
plx .byte $da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da
.byte $da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da
.byte $da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da
dey
bne colorFillLoop
SLOWGRAPHICS
rts rts
@ -30,7 +42,7 @@ initSCBs:
initSCBsLoop: initSCBsLoop:
dex dex
dex dex
sta $e19cfe,x sta $e19d00,x
bne initSCBsLoop bne initSCBsLoop
rts rts
@ -87,8 +99,19 @@ setPaletteLoop:
iny iny
inx inx
inx inx
cmp #16 cpx #32
bne setPaletteLoop bne setPaletteLoop
RESTORE_XY RESTORE_XY
rts rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; caches
shadowRegister:
.byte 0
stackRegister:
.byte 0
stackPtr:
.word 0

Binary file not shown.

View File

@ -10,13 +10,49 @@
.include "equates.s" .include "equates.s"
.org $6000 .org $800
main: main:
NATIVE NATIVE
mainCopyStart:
ldx #0
lda #mainBank2
sta mainCopyDest+1
mainCopyLoop:
lda mainBank2,x
mainCopyDest:
sta $020800,x
inx
cpx #endMainBank2-mainBank2
bne mainCopyLoop
lda #returnToProDOS
sta proDOSLongJump
lda #mainBank2
sta mainLongJump
jml (mainLongJump)
returnToProDOS:
SYNCDBR
EMULATION
rts
mainLongJump:
.byte 00,08,02
proDOSLongJump:
.byte 00,00,00
mainBank2:
SYNCDBR
BITS8
lda #$f0 lda #$f0
sta TEXTCOLOR sta TEXTCOLOR
BITS16
jsr initSCBs jsr initSCBs
SHRVIDEO SHRVIDEO
@ -26,14 +62,13 @@ main:
lda #0 lda #0
jsr setPalette jsr setPalette
lda #$3333 ldx #$1111
jsr colorFill jsr colorFill
jsr kbdWait jsr kbdWait
CLASSICVIDEO CLASSICVIDEO
EMULATION jml (proDOSLongJump)
rts
@ -62,6 +97,8 @@ basePalette:
.include "graphics.s" .include "graphics.s"
endMainBank2:
; Suppress some linker warnings - Must be the last thing in the file ; Suppress some linker warnings - Must be the last thing in the file
; This is because Quinn doesn't really know how to use ca65 properly ; This is because Quinn doesn't really know how to use ca65 properly

104
macros.s
View File

@ -1,44 +1,114 @@
.macro OP8
.i8
.a8
.endmacro
.macro OP16
.i16
.a16
.endmacro
.macro BITS8
sep #%00110000
OP8
.endmacro
.macro BITS16
rep #%00110000
OP16
.endmacro
.macro DBR bankNum
BITS8
lda bankNum
pha
plb
BITS16
.endmacro
.macro SYNCDBR
phk
plb
.endmacro
.macro EMULATION .macro EMULATION
sec ; Enable 8-bit mode sec ; Enable 8-bit mode
xce xce
.i8 OP8
.a8
.endmacro .endmacro
.macro NATIVE .macro NATIVE
clc ; Enable 16-bit mode clc ; Enable 16-bit mode
xce xce
rep #$30 BITS16
.i16
.a16
.endmacro .endmacro
.macro SHRVIDEO .macro SHRVIDEO
sep #$30 BITS8
.i8
.a8
lda NEWVIDEO lda NEWVIDEO
ora #%11000001 ora #%11000001
sta NEWVIDEO sta NEWVIDEO
rep #$30 BITS16
.i16
.a16
.endmacro .endmacro
.macro CLASSICVIDEO .macro CLASSICVIDEO
sep #$30 BITS8
.i8
.a8
lda NEWVIDEO lda NEWVIDEO
and #%00111111 and #%00111111
sta NEWVIDEO sta NEWVIDEO
rep #$30 BITS16
.i16
.a16
.endmacro .endmacro
.macro FASTGRAPHICS
sei
sep #%00100000 ; 16-bit A only, to preserve X/Y
.a8
lda SHADOW
sta shadowRegister
lda #0
sta SHADOW
lda STACKCTL
sta stackRegister
ora #$30
sta STACKCTL
rep #%00100000
.a16
tsc
sta stackPtr
.endmacro
.macro SLOWGRAPHICS
sep #%00100000 ; 16-bit A only, to preserve X/Y
.a8
lda shadowRegister
sta SHADOW
lda stackRegister
sta STACKCTL
rep #%00100000
.a16
lda stackPtr
tcs
cli
.endmacro
;;;;;;;;;; ;;;;;;;;;;