home *** CD-ROM | disk | FTP | other *** search
- ;Alain BROBECKER (aka baah/Arm's Tech), ??sep1997
- ;This c64 proggy uses interrupt to draw a raster bar while BASIC is available
- #name c64IrqX
- #type &064
- #list
- #base &801-2
-
- ;---- C64 specific part... loading adress+BASIC stuff --------------------------
- #rw &0801 ; Load adress (C64)
- #rw BasicEnd,1997 ; Adress of next line + line number
- #b &9e,&32,&30,&36,&32 ; Basic "SYS2062" instruction
- #b 0 ; End of basic line
- .BasicEnd
- #b 0,0,0 ; End of basic program
- ;---- Assembly language ForEVER ------------------------------------------------
- sei
- lda #&7f ; Enable Timer A & B, Clock, Serial Port ... IRQs
- sta &dc0d ; CIA Interrupt Control Register
- lda #&1b ; 7th bit=bit 8 of raster compare, set to 0
- sta &d011 ; VIC Control Register
- lda #1 ; Enable Raster Compare interrupt
- sta &d01a ; IRQ Mask Register
- lda #128 ; Compare IRQ at line 128
- sta &d012 ; Raster Value for Compare IRQ
- lda #irq AND &ff ; Low byte of IRQ routine
- sta &314 ; Hardware IRQ Interrupt Address ($EA31)
- lda #irq>>8 ; High byte of IRQ routine
- sta &315
- cli
- rts ; Return to BASIC
-
- .irq
- sei
- pha
- lda &d019 ; A Raster Compare IRQ occured?
- and #1
- beq end_irq
- lda &d019 ; Reset VIC's IRQ flags.
- and #&fe
- sta &d019
- lda &d012 ; Raster value
- cmp #128 ; IRQ at line 128?
- beq raster128
- .raster138
- lda #128 ; Compare IRQ at line 128
- sta &d012 ; Raster Value for Compare IRQ
- lda #0 ; Border=black
- .end_raster
- sta &d020
- sta &d021
- .end_irq
- pla
- jmp &ea31 ; Kernal routine to return from an interrupt.
-
- .raster128
- lda #138 ; Compare IRQ at line 138
- sta &d012 ; Raster Value for Compare IRQ
- lda #6 ; Border=light blue
- bne end_raster ; We always branch
-