Opening Top and Bottom Borders on the Commodore 64


Opening up the top and bottom border is of course a trick any seasoned C64 demo writer knows. But anyone who started with BASIC before switching to 6510 probably remembers how much fun it was to get that extra space for sprites and even some simple graphics. So this posting is not telling anything new to most of you. I am just reminiscing my own youthful awe when I made the switch.

The program below shows how to do this. Set up a raster interrupt right before the bottom border start. Then toggle between 24 and 25 lines of text. This tricks the VIC into forgetting to turn on the border. The opened border can be used to display sprites. By manipulating the last address of the VIC page ($3fff by default), you can even get some interesting graphics. For example, Pasi Ojala posted an article Opening the Borders with some truly amazing effects! 

Of course, opening up the side borders is the next challenge!




; little demo to open up the border
; for win2c64 by Aart Bik
; https://www.aartbik.com/

scroly   =   $d011
raster   =   $d012
vicirq   =   $d019
irqmsk   =   $d01a
ciaicr   =   $dc0d
ci2icr   =   $dd0d
garbage  =   $3fff

;
; encode SYS 2064 line
; in BASIC program space
;
        .org  $0801                          
        .byte     $0c $08 $0a $00 $9e $20 $32 
        .byte $30 $36 $34 $00 $00 $00 $00 $00

lab2064 sei            ; disable irq
        ldx #$7f       ;
        stx ciaicr     ; disable timer irq CIA 1
        stx ci2icr     ; disable timer irq CIA 2
        ldx #$01       ;
        stx irqmsk     ; enable raster irq
        ldx #<nearend  ;
        stx $0314      ;
        ldx #>nearend  ;
        stx $0315      ; set handler
        ldx #$1b       ;
        stx scroly     ; 25 rows
        ldx #$f9       ;
        stx raster     ; irq at raster $f9
        ldx #$00       ;
        stx garbage    ; clear "garbage"
        cli            ; enable irq
        rts            ; done
;
; NEAR END HANDLER
;
nearend ldx #$13       ;
        stx scroly     ; 24 rows
delay   inx            ;
        bne delay      ;
        ldx #$1b       ;
        stx scroly     ; 25 rows
        ldx #$01       ;
        stx vicirq     ; ack irq
        jmp $ea31      ; continue

Comments

Popular posts from this blog

Connecting Chess for Android to a Remote Server

Connecting with the DGT Board

Chessbase compatible engines