Iapetus/Algarbi/Wood
Registered: Dec 2004 Posts: 71 |
stable rasters (again...)
I have been playing with double irq for some time and I can't put the code to work, can someone please have a look
and tell me why I can't get my raster bars stable, thanks.
I use kickassembler and the code is an adaptation of the one here: http://codebase64.org/doku.php?id=base:fli_displayer
.pc = $0801 "Basic Program"
:BasicUpstart($1000)
.pc = $1000
jmp start
irq0:
dec $d019
inc $d012
lda #<irq1
sta $fffe // set up 2nd IRQ to get a stable IRQ
cli
// Following here: A bunch of NOPs which allow the 2nd IRQ
// to be triggered with either 0 or 1 clock cycle delay
// resulting in an "almost" stable IRQ.
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
irq1:
nop
nop
nop
nop
nop
nop
nop
nop
nop
bit $ea
lda #$2d
sta $d012
lda #<irq0
sta $fffe // switch IRQ back to first stabilizer IRQ
lda $d012
cmp $d012 // stabilize last jittering cycle
beq delay2 // if equal, 2 cycles delay. else 3 cycles delay
delay2:
ldx #$00 //2
v: lda rastercols,x //4
sta $d020 //4
// sta $d021 //4
//nop
//nop
bit $ea
ldy delay,x //4
dey //2
bne *-1 //2 or 3
inx //2
cpx #48 //2
bne v //2 or 3 = 30
bit $ea
/*
ldx #$10
wait: dex
bne wait
*/
// Following here is the main FLI loop which forces the VIC-II to read
// new color data each rasterline. The loop is exactly 23 clock cycles
// long so together with 40 cycles of color DMA this will result in
// 63 clock cycles which is exactly the length of a PAL C64 rasterline.
asl $d019
nmi:
rti
start:
sei
lda #$35
sta $01 // disable all ROMs
lda #$7f
sta $dc0d // no timer IRQs
lda $dc0d // clear timer IRQ flags
lda #$1b
sta $d011
lda #$2d
sta $d012
lda #$00 //Set Background
ldx #BLACK //and Border colors
sta $d020 //turn off sprites
stx $d021
lda #<irq0
sta $fffe
lda #>irq0
sta $ffff
lda #<nmi
sta $fffa
lda #>nmi
sta $fffb // dummy NMI to avoid crashing due to RESTORE
lda #$01
sta $d01a // enable raster IRQs
dec $d019 // clear raster IRQ flag
cli
jmp * // that's it, no more action needed
.pc = $0c00
rastercols: .byte BLUE, PURPLE, GREEN, LIGHT_RED, PURPLE, BLACK, WHITE, ORANGE
.byte BLUE, PURPLE, GREEN, LIGHT_RED, PURPLE, BLACK, WHITE, ORANGE
.byte BLUE, PURPLE, GREEN, LIGHT_RED, PURPLE, BLACK, WHITE, BLACK
.byte BLUE, PURPLE, GREEN, LIGHT_RED, PURPLE, BLACK, WHITE, ORANGE
.byte BLUE, PURPLE, GREEN, LIGHT_RED, PURPLE, BLACK, WHITE, ORANGE
.byte BLUE, PURPLE, GREEN, LIGHT_RED, PURPLE, BLACK, WHITE, BLACK
.pc = $0d00
delay: .byte $08,$01,$08,$08,$08,$08, $08, $08
.byte $08,$01,$08,$08,$08,$08, $08, $08
.byte $08,$01,$08,$08,$08,$08, $08, $08
.byte $08,$01,$08,$08,$08,$08, $08, $08
.byte $08,$01,$08,$08,$08,$08, $08, $08
.byte $08,$01,$08,$08,$08,$08, $08, $08
.byte $08,$01,$08,$08,$08,$08, $08, $08
.byte $08,$01,$08,$08,$08,$08, $08, $08
|