Raster line with open borders to draw a flag

Last Updated or created 2024-06-01

A fun experiment using opening the C64 border and changing colors on certain rasterlines.

Screenshot (only a little artefact on the lefthand side)

Code (acme)

acme borderflag.asm
x64 +drive8truedrive borderflag.prg

!cpu 650rasterline
!to "borderflag.prg",cbm


* = $0801
    !byte $0d,$08,$dc,$07,$9e,$20,$34
    !byte $39,$31,$35,$32,$00,$00,$00

* = $c000
        sei                     ; turn off interrupts

        ldx #1                  ; enable raster interrupts
        stx $d01a

        lda #<irq       	; set raster interrupt vector
        ldx #>irq
        sta $0314
        stx $0315

        ldy #$f0                ; set first interrupt rasterline
        sty $d012
        lda $d011               ; reset rasterline hi bit
        and #%01111111
        sta $d011

        asl $d019               ; ack VIC interrupts
        cli

loop_until_doomsday
        jmp loop_until_doomsday

irq
	asl $d019       	; ack irq

	lda #$01		; set screenframe and background
	sta $d020
	lda #$02
	sta $d021

	lda #$38        	; wait for line $38
	cmp $d012       	
	bne *-3

	lda #$02		; set screenframe and background
	sta $d020
	lda #$01
	sta $d021

	lda #$f9        	; wait for line $f9C
	cmp $d012       	; just below border in 25 row mode
	bne *-3

	lda $d011       	; switch to 24 row mode ($d011 bit 3 = 0)
	and #$f7        	; %11110111
	sta $d011

	lda #$fd        	; wait for line $fd
	cmp $d012       	; just below border in 25 row mode
	bne *-3

	lda $d011       	; switch back to 25 row mode ($d011 bit 3 = 1)
	ora #$08        	; %00001000
	sta $d011

	jmp $ea31		; exit irq
Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *