!to "colorbars.prg", cbm
*=$0801
!word nextline ;start basic listing
!word 2009 ;2009
!byte $9e ;sys
!text "2061" ;2061
!byte 0
nextline:
!word 0 ;end basic listing
start:
lda #$00 ;choose black color
sta $d020 ;set border color
;sta $d021 ;set background color
;lda #$01 ;chose white color
;jsr $e536 ;set character color & clear screen
jsr prepare_irq ;prepare irq
end:
jmp end ;endless loop
prepare_irq:
sei ;disable interrupts
lda #$7f
sta $dc0d ;disable cia interrupts
lda $d01a
ora #$01
sta $d01a ;activate raster irq
lda $d011
and #$7f
sta $d011 ;irq raster line < 256
lda #$00
sta $d012 ;irq raster line = 0
lda #<irq_routine
sta $0314
lda #>irq_routine
sta $0315 ;set irq routine address
lda #$01
sta $d019
cli ;enable interrupts
rts
irq_routine:
inc $d019 ;irq ok, prepare for the next one
lda #$00
jsr wait_raster ;wait for raster line
jsr draw_colorbar ;draw color bar
lda $dc01 ;read keypress
cmp #$ef ;if not space
bne continue ;continue, else
sei ;disable interrupt
jsr $ff81
jsr $ff84
lda #$31
sta $0314 ;restore lo byte
lda #$ea
sta $0315 ;restore hi byte
cli ;enable interrupts
jmp $a474 ;exit program
continue:
jmp $ea31 ;give the control to the cpu
wait_raster:
cmp $d012 ;compare $d012 with register a
bne wait_raster ;wait for raster line
rts
wait_timer:
dey ;decrement register y
bne wait_timer ;until it reaches zero
rts
draw_colorbar:
ldx #$00 ;reset counter
loop:
ldy #$21 ;delay timer = 33
jsr wait_timer ;wait timer to finish
stx $d020 ;change border color
;stx $d021 ;change background color
inx ;increment counter
bne loop ;loop
rtsUstalardan yorumları bekliyorum. 🙂Not: Ekran görüntüsü koyamadım. Dosya upload sistemi yazma izinlerindeki bir hatadan ötürü çalışmıyor sanırım.