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
AC=AppleCommander.jar
ADDR=6000
ADDR=800
PGM=gscats

Binary file not shown.

View File

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

View File

@ -1,19 +1,31 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 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
;
; Trashes Y
colorFill:
phx
ldx #32000
FASTGRAPHICS
lda #$9d00-1 ; Point stack to end of VRAM
tcs
ldy #200
colorFillLoop:
sta $e11ffe,x
dex
dex
bne colorFillLoop
plx
; 80 PHXs, for 1 line
; We could do the entire screen with PHXs, but this is a
; balance between speed and super-verbose code
.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
.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
@ -30,7 +42,7 @@ initSCBs:
initSCBsLoop:
dex
dex
sta $e19cfe,x
sta $e19d00,x
bne initSCBsLoop
rts
@ -87,8 +99,19 @@ setPaletteLoop:
iny
inx
inx
cmp #16
cpx #32
bne setPaletteLoop
RESTORE_XY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; caches
shadowRegister:
.byte 0
stackRegister:
.byte 0
stackPtr:
.word 0

Binary file not shown.

View File

@ -10,13 +10,49 @@
.include "equates.s"
.org $6000
.org $800
main:
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
sta TEXTCOLOR
BITS16
jsr initSCBs
SHRVIDEO
@ -26,14 +62,13 @@ main:
lda #0
jsr setPalette
lda #$3333
ldx #$1111
jsr colorFill
jsr kbdWait
CLASSICVIDEO
EMULATION
rts
jml (proDOSLongJump)
@ -62,6 +97,8 @@ basePalette:
.include "graphics.s"
endMainBank2:
; 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

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
sec ; Enable 8-bit mode
xce
.i8
.a8
OP8
.endmacro
.macro NATIVE
clc ; Enable 16-bit mode
xce
rep #$30
.i16
.a16
BITS16
.endmacro
.macro SHRVIDEO
sep #$30
.i8
.a8
BITS8
lda NEWVIDEO
ora #%11000001
sta NEWVIDEO
rep #$30
.i16
.a16
BITS16
.endmacro
.macro CLASSICVIDEO
sep #$30
.i8
.a8
BITS8
lda NEWVIDEO
and #%00111111
sta NEWVIDEO
rep #$30
.i16
.a16
BITS16
.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
;;;;;;;;;;