base:double_irq
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | base:double_irq [2015-04-17 04:31] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Double IRQ stable interrupt ====== | ||
+ | Sourcecode by Fungus | ||
+ | < | ||
+ | *= $2000 ;Assemble to $2000 | ||
+ | |||
+ | | ||
+ | lda #$7f ;Disable CIA IRQ's | ||
+ | sta $dc0d | ||
+ | sta $dd0d | ||
+ | |||
+ | lda #$35 ;Bank out kernal and basic | ||
+ | sta $01 ; | ||
+ | |||
+ | lda #< | ||
+ | ldx #> | ||
+ | sta $fffe ; | ||
+ | stx $ffff | ||
+ | |||
+ | |||
+ | lda #$01 ;Enable RASTER IRQs | ||
+ | sta $d01a | ||
+ | lda #$34 ;IRQ on line 52 | ||
+ | sta $d012 | ||
+ | lda #$1b ;High bit (lines 256-311) | ||
+ | sta $d011 | ||
+ | ;NOTE double IRQ | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | |||
+ | lda #$0e ;Set Background | ||
+ | sta $d020 ;and Border colors | ||
+ | lda #$06 | ||
+ | sta $d021 | ||
+ | lda #$00 | ||
+ | sta $d015 ;turn off sprites | ||
+ | |||
+ | jsr clrscreen | ||
+ | jsr clrcolor | ||
+ | jsr printtext | ||
+ | |||
+ | asl $d019 ;Ack any previous | ||
+ | bit $dc0d ; | ||
+ | bit $dd0d | ||
+ | |||
+ | | ||
+ | |||
+ | jmp * ; | ||
+ | |||
+ | |||
+ | irq1 | ||
+ | sta reseta1 ;Preserve A,X and Y | ||
+ | stx resetx1 ;Registers | ||
+ | sty resety1 ;VIA self modifying | ||
+ | ;code | ||
+ | ; | ||
+ | ; | ||
+ | |||
+ | lda #< | ||
+ | ldx #> | ||
+ | ;next part of the | ||
+ | sta $fffe ; | ||
+ | stx $ffff ;ON NEXT LINE! | ||
+ | inc $d012 | ||
+ | asl $d019 ;Ack RASTER IRQ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | nop | ||
+ | | ||
+ | | ||
+ | | ||
+ | nop | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | nop | ||
+ | irq2 | ||
+ | | ||
+ | ; | ||
+ | ldx #$08 ;Wait exactly 1 | ||
+ | | ||
+ | bne *-1 ; | ||
+ | bit $ea ; | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | lda #$35 ;RASTER change yet? | ||
+ | cmp $d012 | ||
+ | beq start ;If no waste 1 more | ||
+ | ; | ||
+ | start | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | lda #$0e ;Colors | ||
+ | ldx #$06 | ||
+ | |||
+ | sta $d021 ;Here is the proof | ||
+ | stx $d021 | ||
+ | |||
+ | lda #< | ||
+ | ldx #> | ||
+ | ldy #$68 ;at line $68 | ||
+ | sta $fffe | ||
+ | stx $ffff | ||
+ | sty $d012 | ||
+ | asl $d019 ;Ack RASTER IRQ | ||
+ | |||
+ | lda #$00 ;Reload A,X,and Y | ||
+ | reseta1 | ||
+ | ldx #$00 | ||
+ | resetx1 | ||
+ | ldy #$00 | ||
+ | resety1 | ||
+ | |||
+ | | ||
+ | |||
+ | irq3 | ||
+ | sta reseta2 ;Preserve A,X,and Y | ||
+ | stx resetx2 ;Registers | ||
+ | sty resety2 | ||
+ | |||
+ | ldx #$0a ;Waste some more | ||
+ | | ||
+ | bne *-1 ;can be seen | ||
+ | nop | ||
+ | |||
+ | lda #$0e ;More colors | ||
+ | ldx #$06 | ||
+ | |||
+ | sta $d021 ; | ||
+ | stx $d021 ; | ||
+ | ; | ||
+ | ; | ||
+ | ; | ||
+ | ;code :-) | ||
+ | |||
+ | ldy #$13 ;Waste time so this | ||
+ | | ||
+ | bne *-1 ;to reoccur on the | ||
+ | ;same line! | ||
+ | |||
+ | lda #< | ||
+ | ldx #> | ||
+ | ldy #$34 ;at line $34 | ||
+ | sta $fffe | ||
+ | stx $ffff | ||
+ | sty $d012 | ||
+ | asl $d019 ;Ack RASTER IRQ | ||
+ | |||
+ | lda #$00 ;Reload A,X,and Y | ||
+ | reseta2 | ||
+ | ldx #$00 | ||
+ | resetx2 | ||
+ | ldy #$00 | ||
+ | resety2 | ||
+ | |||
+ | | ||
+ | |||
+ | ; | ||
+ | ;get back to Turbo | ||
+ | nmi | ||
+ | asl $d019 ;Ack all IRQ's | ||
+ | lda $dc0d | ||
+ | lda $dd0d | ||
+ | lda #$81 ;reset CIA 1 IRQ | ||
+ | ldx #$00 ;remove raster IRQ | ||
+ | ldy #$37 ;reset MMU to roms | ||
+ | sta $dc0d | ||
+ | stx $d01a | ||
+ | sty $01 | ||
+ | ldx #$ff ;clear the stack | ||
+ | txs | ||
+ | | ||
+ | jmp $9000 ;back to Turbo | ||
+ | |||
+ | clrscreen | ||
+ | lda #$20 ;Clear the screen | ||
+ | ldx #$00 | ||
+ | clrscr | ||
+ | sta $0500,x | ||
+ | sta $0600,x | ||
+ | sta $0700,x | ||
+ | dex | ||
+ | bne clrscr | ||
+ | rts | ||
+ | clrcolor | ||
+ | lda #$03 ;Clear color memory | ||
+ | ldx #$00 | ||
+ | clrcol | ||
+ | sta $d900,x | ||
+ | sta $da00,x | ||
+ | sta $db00,x | ||
+ | dex | ||
+ | bne clrcol | ||
+ | rts | ||
+ | |||
+ | printtext | ||
+ | lda #$16 ;C-set = lower case | ||
+ | sta $d018 | ||
+ | |||
+ | ldx #$00 | ||
+ | moretext lda text1,x | ||
+ | |||
+ | bpl lower ; | ||
+ | eor #$80 ;yes | ||
+ | |||
+ | bne lower+2 | ||
+ | |||
+ | lower and #$3f ;lower case | ||
+ | sta $0450,x | ||
+ | inx | ||
+ | cpx #$78 | ||
+ | bne moretext | ||
+ | exit rts | ||
+ | |||
+ | text1 | ||
+ | .text " | ||
+ | .text "e (PAL/ | ||
+ | .text "All Code by Fungus 1996" | ||
+ | .text " | ||
+ | .text "Feel free to use and mo" | ||
+ | .text "dify this code :)" | ||
+ | </ |
base/double_irq.txt · Last modified: 2015-04-17 04:31 by 127.0.0.1