Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can respond to changes in <code>$d012</code> by using a raster IRQ handler. I'll throw in a couple of specifics from my game code because it can be hairy to get this to work if you use the wrong combination of incantations. This should also give you enough stuff to google. </p> <p>In particular, you might want to look at installing your int handler in <code>$0314</code> like the code mentions, in which case your IRQ handler will be chained with the commie's own default handlers, and you need to skip the <code>pha ... pha</code> bit at the start of your handler. This can be useful if you need to use some of its I/O code.</p> <pre><code>;;; ----------------------------------------------------------------------------- ;;; install raster interrupt handler ;;; ----------------------------------------------------------------------------- sei ; turn off interrupts ldx #1 ; enable raster interrupts stx $d01a lda #&lt;int_handler ; set raster interrupt vector ldx #&gt;int_handler sta $fffe stx $ffff ldy #$f0 ; set scanline on which to trigger interrupt sty $d012 lda $d011 ; scanline hi bit and #%01111111 sta $d011 lda #$35 ; disable kernal and BASIC memory ($e000 - $ffff) sta $01 asl $d019 ; acknowledge VIC interrupts cli loop_pro_semper jmp loop_pro_semper </code></pre> <p>Then you handle these interrupts like this:</p> <pre><code>;;; ----------------------------------------------------------------------------- ;;; raster IRQ handler ;;; ----------------------------------------------------------------------------- int_handler pha ; needed if our raster int handler is set in fffe instead of 0314 txa pha tya pha ; ... do your stuff here ... </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload