Hello,
I'm doing test with double buffer to avoid some blinks, and I read it will remove the problem, but not
The code I have is:
loop:
ld a, #30
call set_video_page ; show from #c000 to #FFFF
; now, I work on other page
; delete previous sprite
ld de, #8000
DeleteSprite WIDTH, HEIGHT ; macro that draw a box with background colour
; draw the new sprite
ld de, #8000
ld hl, sprite
DrawSprite WIDTH, HEIGHT ; macro that draw the sprite
ld a, #20
call set_video_page ; it shows from to #8000 to #BFFF
; now, I work on other page
; delete previous sprite
ld de, #c000
DeleteSprite WIDTH, HEIGHT
; draw the sprite
ld de, #c000
ld hl, sprite
DrawSprite WIDTH, HEIGHT
jp loop
I don't understand why I get some blinks. I delete the previous sprite, then I put the new sprite at same position, and finally I change the address of video memory to show the changes.
That function is:
set_video_page:
ld bc, #BC0C
out (c), c
inc b
out (c), a
ret
Where is the problem? What am I doing wrong?
Thank you.
I'm "desperate".
I did not look into your code. But are you aware, that if you want to avoid blink, you have to swap between the two buffers at VBL (or at a position when nothing is drawn)?
sure you need to wait vertical blank before changing video offset
ld b,#F5
wait_vbl
in a,(c)
rra
jr nc,wait_vbl
ret
Sure I need wait vertical sync? I miss a lot of frames per second.
Quote from: roudoudou on 11:59, 22 April 21
sure you need to wait vertical blank before changing video offset
ld b,#F5
wait_vbl
in a,(c)
rra
jr nc,wait_vbl
ret
Quote from: Fran123 on 12:16, 22 April 21
Sure I need wait vertical sync? I miss a lot of frames per second.
if you do not want to wait VBL, you need triple buffer
with double buffer, you have to wait that screen is fully displayed before erasing/updating your sprite
The correct VBL wait is here : - compatibility with all crtcs and GA/ASIC !
Quote; ---------------------------
wait_vbl:
vbl_wait:
; ---------------------------
ld b,#f5
wait_vbl_loop
in a,(c)
rra
jr c,wait_vbl_loop
wait_vbl_synchro_loop
in a,(c)
rra
jr nc,wait_vbl_synchro_loop
ret