; Written in 2019 by Rob McMullen, https://playermissile.com/scrolling_tutorial/ ; Copyright and related rights waived via CC0: https://creativecommons.org/publicdomain/zero/1.0/ *= $3000 .include "hardware.s" delay = 5 ; number of VBLANKs between scrolling updates vert_scroll_max = 8 ; ANTIC mode 4 has 8 scan lines horz_scroll_max = 4 ; ANTIC mode 4 has 4 color clocks delay_count = $80 ; counter for scrolling updates tmp_counter = $81 ; counter for use in loops ; two bytes per variable, one per region vert_scroll = $90 ; variable used to store VSCROL value horz_scroll = $92 ; variable used to store HSCROL value scroll_dy = $a2 ; down = 1, up=$ff, no movement = 0 scroll_dx = $a4 ; right = 1, left=$ff, no movement = 0 init lda #0 ; initialize horizontal scrolling value sta horz_scroll sta horz_scroll+1 sta HSCROL ; initialize hardware register lda #0 ; initialize vertical scrolling value sta vert_scroll sta vert_scroll+1 sta VSCROL ; initialize hardware register lda #1 sta scroll_dx lda #$ff sta scroll_dy sta scroll_dx+1 lda #1 sta scroll_dy+1 lda #delay ; number of VBLANKs to wait sta delay_count jsr init_font lda #dlist sta SDLSTL+1 ; load display list interrupt address lda #dli sta VDSLST+1 ; load deferred vertical blank address ldx #>vbi ldy #dlist ; JVB ends display list .include "util_font.s" .include "util_scroll.s" .include "font_data_antic4.s" ; tell DOS where to run the program when loaded * = $2e0 .word init