mirror of
https://github.com/irmen/prog8.git
synced 2024-11-26 11:49:22 +00:00
added sys.waitrastborder() for c64
This commit is contained in:
parent
129e17b33a
commit
3f30d3aa89
@ -502,6 +502,8 @@ sys {
|
||||
; --- busy wait till the next vsync has occurred (approximately), without depending on custom irq handling.
|
||||
; note: a more accurate way to wait for vsync is to set up a vsync irq handler instead.
|
||||
%asm {{
|
||||
- lda c64.RASTER
|
||||
beq -
|
||||
- lda c64.RASTER
|
||||
bne -
|
||||
bit c64.SCROLY
|
||||
@ -510,6 +512,15 @@ sys {
|
||||
}}
|
||||
}
|
||||
|
||||
inline asmsub waitrastborder() {
|
||||
; --- busy wait till the raster position has reached the bottom screen border (approximately)
|
||||
; note: a more accurate way to do this is by using a raster irq handler instead.
|
||||
%asm {{
|
||||
- bit c64.SCROLY
|
||||
bpl -
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub memcopy(uword source @R0, uword target @R1, uword count @AY) clobbers(A,X,Y) {
|
||||
%asm {{
|
||||
ldx cx16.r0
|
||||
|
@ -105,9 +105,15 @@ sys (part of syslib)
|
||||
|
||||
``waitvsync()``
|
||||
busy wait till the next vsync has occurred (approximately), without depending on custom irq handling.
|
||||
can be used to avoid screen flicker/tearing when updating screen contents.
|
||||
note: a more accurate way to wait for vsync is to set up a vsync irq handler instead.
|
||||
note for cx16: the system irq handler has to be active for this to work (this is not required on c64)
|
||||
|
||||
``waitrastborder()`` (c64 target only)
|
||||
busy wait till the raster position has reached the bottom screen border (approximately)
|
||||
can be used to avoid screen flicker/tearing when updating screen contents.
|
||||
note: a more accurate way to do this is by using a raster irq handler instead.
|
||||
|
||||
``reset_system()``
|
||||
Soft-reset the system back to initial power-on Basic prompt.
|
||||
(called automatically by Prog8 when the main subroutine returns and the program is not using basicsafe zeropage option)
|
||||
|
@ -1,10 +1,26 @@
|
||||
%import textio
|
||||
%zeropage basicsafe
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
|
||||
ubyte color=0
|
||||
ubyte xx
|
||||
uword ptr = $0400
|
||||
|
||||
@($02) = 0
|
||||
|
||||
repeat {
|
||||
sys.waitvsync()
|
||||
%asm {{
|
||||
ldy $02
|
||||
lda #'*'
|
||||
sta $0400,y
|
||||
inc $02
|
||||
}}
|
||||
}
|
||||
txt.print("hello")
|
||||
|
||||
; str filename = "titlescreen.bin"
|
||||
|
Loading…
Reference in New Issue
Block a user