I have made a simple VIC-20 program (attached), which waits for the raster beam, changes the color once the line is detected and on the next line it changes it back, so it draws a line. And it should stay like that. It loops forever, but sometimes SOMETHING goes wrong, so the background is filled with line color and itn result it blinks.
I cannot find what can possibly go wrong.
Or could that be caused by the VICE emulator (I have not tested it on real VIC-20)?
I have recorded a video: https://youtu.be/Df-67EqRFkY
Here is the code:
Code: Select all
*=$1001
BYTE $0B, $10, $0A, $00, $9E, $34, $31, $30, $39, $00, $00, $00
SCREEN_COL_BORDER equ $900F ; Screen and border register
RASTER_BEAM_LINE equ $9004 ; Currently drawn raster beam line
program_init:
lda #%01011011 ; Black background and border
ldy #%00001011 ; Red background and border
loop:
ldx #50
red_line: ; Draw red line
cpx RASTER_BEAM_LINE ; Wait for raster line 30
bne red_line
sty SCREEN_COL_BORDER ; Set the red color
ldx #51
rest_black: ; Fill rest with the black color
cpx RASTER_BEAM_LINE ; Wait for raster line 31
bne rest_black
sta SCREEN_COL_BORDER ; Set the red color
jmp loop ; Go tot start