Advertisement
EmanueleBonin

RasterLineB&W

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