SHARE
TWEET

Raster line black and white

a guest Oct 22nd, 2019 113 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; asm 6502/6510 - C64
  2. FIRST   = 58
  3.  
  4.     *=$C000
  5.  
  6.         sei                   ; disabling interrupts
  7.  
  8.         ldy #$7f              ; $7f = %01111111
  9.         sty $dc0d             ; disabling CIA's interrupts
  10.         sty $dd0d             ; settings $DC0D and $DD0D
  11.         lda $dc0d             ; ... so wipe the queue
  12.         lda $dd0d             ; of unprocessed interrupts
  13.  
  14.         lda #<RasterIrq       ; Interrupts now points to myroutine
  15.         ldx #>RasterIrq       ;
  16.  
  17.         sta $314              ; Lo-Byte
  18.         stx $315              ; Hi-Byte
  19.  
  20.  
  21.         lda newRow            ; Set line of raster that triggers interrupt
  22.         sta $d012             ; placing it in $d012
  23.  
  24.         lda $d011             ; bit 7 of D011 + gli i bit di $D012 identifies
  25.         and #$7f              ; the whole raster line, infact raster line number
  26.         sta $d011             ; could be > 255, so this bit must be set in
  27.                               ; right way according to purpose
  28.                               ; this time must be reset
  29.  
  30.  
  31.         lda #$01              ; Interrupt mask setting
  32.         sta $d01a             ; for raster interrupt manage
  33.  
  34.         cli                   ; re-enabling interrupts
  35.  
  36.         rts
  37.  
  38.  
  39. BufPtr  byte $00
  40. newRow  byte FIRST
  41. color   byte $00
  42.  
  43.  
  44. RasterIrq
  45.        
  46.         lda color          
  47.         and #$01            ; test if odd or even
  48.         bne RI_Odd
  49.         lda #$01            ; White for Even
  50.         jmp RI_IncColoc
  51. RI_Odd
  52.         lda #$00            ; Black for Odd
  53. RI_IncColoc
  54.         inc color
  55.        
  56.         sta $d021           ; Set Background
  57.                             ; Irq pointers doesn't change
  58.         lda newRow          ; Load Newrow byte
  59.         clc
  60.         adc #$08            ; add 8
  61.         cmp #$FA            ;
  62.         bcc RI_SetD012      ; if not beyond last line it'OK
  63.         lda #FIRST          ; else set next interrupt to first text line
  64. RI_SetD012
  65.         sta newRow
  66.         sta $d012           ; set next interrupt raster line
  67.         asl $d019           ; "Acknowledge" the interrupt by clearing the VIC's interrupt flag.
  68.  
  69.         jmp $ea31           ; return to basic 8)
  70.  
  71.  
  72.  
  73.  
  74.  
  75. ;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top