mirror of
https://github.com/irmen/prog8.git
synced 2025-02-19 11:31:07 +00:00
screen clear routines optimized
This commit is contained in:
parent
d203bfaf25
commit
f803b4edc1
@ -23,7 +23,8 @@
|
|||||||
uword anglez
|
uword anglez
|
||||||
while(true) {
|
while(true) {
|
||||||
rotate_vertices(msb(anglex), msb(angley), msb(anglez))
|
rotate_vertices(msb(anglex), msb(angley), msb(anglez))
|
||||||
c64scr.clear_screen(32,1)
|
c64scr.clear_screenchars(32)
|
||||||
|
c64scr.print("\uf1203d cube!")
|
||||||
draw_edges()
|
draw_edges()
|
||||||
anglex+=1000
|
anglex+=1000
|
||||||
angley+=433
|
angley+=433
|
||||||
|
@ -538,36 +538,53 @@ _raster_irq_handler
|
|||||||
; ---- this block contains (character) Screen and text I/O related functions ----
|
; ---- this block contains (character) Screen and text I/O related functions ----
|
||||||
|
|
||||||
|
|
||||||
asmsub clear_screen (ubyte char @ A, ubyte color @ Y) -> clobbers(A,X) -> () {
|
asmsub clear_screen (ubyte char @ A, ubyte color @ Y) -> clobbers(A) -> () {
|
||||||
; ---- clear the character screen with the given fill character and character color.
|
; ---- clear the character screen with the given fill character and character color.
|
||||||
; (assumes screen is at $0400, could be altered in the future with self-modifying code)
|
; (assumes screen and color matrix are at their default addresses)
|
||||||
; @todo some byte var to set the SCREEN ADDR HI BYTE
|
|
||||||
|
|
||||||
%asm {{
|
%asm {{
|
||||||
sta _loop + 1 ; self-modifying
|
pha
|
||||||
stx c64.SCRATCH_ZPB1
|
tya
|
||||||
ldx #0
|
jsr clear_screencolors
|
||||||
_loop lda #0
|
pla
|
||||||
sta c64.Screen,x
|
jsr clear_screenchars
|
||||||
sta c64.Screen+$0100,x
|
|
||||||
sta c64.Screen+$0200,x
|
|
||||||
sta c64.Screen+$02e8,x
|
|
||||||
tya
|
|
||||||
sta c64.Colors,x
|
|
||||||
sta c64.Colors+$0100,x
|
|
||||||
sta c64.Colors+$0200,x
|
|
||||||
sta c64.Colors+$02e8,x
|
|
||||||
inx
|
|
||||||
bne _loop
|
|
||||||
|
|
||||||
lda _loop+1 ; restore A and X
|
|
||||||
ldx c64.SCRATCH_ZPB1
|
|
||||||
rts
|
rts
|
||||||
}}
|
}}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
asmsub clear_screenchars (ubyte char @ A) -> clobbers(Y) -> () {
|
||||||
|
; ---- clear the character screen with the given fill character (leaves colors)
|
||||||
|
; (assumes screen matrix is at the default address)
|
||||||
|
%asm {{
|
||||||
|
ldy #0
|
||||||
|
_loop sta c64.Screen,y
|
||||||
|
sta c64.Screen+$0100,y
|
||||||
|
sta c64.Screen+$0200,y
|
||||||
|
sta c64.Screen+$02e8,y
|
||||||
|
iny
|
||||||
|
bne _loop
|
||||||
|
rts
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
asmsub clear_screencolors (ubyte color @ A) -> clobbers(Y) -> () {
|
||||||
|
; ---- clear the character screen colors with the given color (leaves characters).
|
||||||
|
; (assumes color matrix is at the default address)
|
||||||
|
%asm {{
|
||||||
|
ldy #0
|
||||||
|
_loop sta c64.Colors,y
|
||||||
|
sta c64.Colors+$0100,y
|
||||||
|
sta c64.Colors+$0200,y
|
||||||
|
sta c64.Colors+$02e8,y
|
||||||
|
iny
|
||||||
|
bne _loop
|
||||||
|
rts
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
asmsub scroll_left_full (ubyte alsocolors @ Pc) -> clobbers(A, X, Y) -> () {
|
asmsub scroll_left_full (ubyte alsocolors @ Pc) -> clobbers(A, X, Y) -> () {
|
||||||
; ---- scroll the whole screen 1 character to the left
|
; ---- scroll the whole screen 1 character to the left
|
||||||
; contents of the rightmost column are unchanged, you should clear/refill this yourself
|
; contents of the rightmost column are unchanged, you should clear/refill this yourself
|
||||||
|
Loading…
x
Reference in New Issue
Block a user