| |
Strepto
Registered: Dec 2015 Posts: 11 |
vertical scrolling and rasters
I'm trying to do a simple vertical scroll, with a raster.
My problem is that when $d011 is at scroll position 6, the raster interrupt fires a rasterline later then in case of the other scroll values.
As a result my rater is jumping one pixel up/down every time the vertical scroll hits value 6.
What am I doing wrong, why am I experiencing this?
Please help, thank you.
.const start = $2000
.pc =$0801 "Basic Upstart Program"
:BasicUpstart(start)
.var ZP_3 = $03 // $d011 value
.pseudocommand irqStart {
sta _ds_irqa
stx _ds_irqx
sty _ds_irqy
}
.pseudocommand irqEnd nextIrqYpos : nextIrq {
.if (nextIrqYpos.getType()!=AT_NONE) {
mb nextIrqYpos : $d012
}
.if (nextIrq.getType()!=AT_NONE) {
mw nextIrq : $fffe
}
lsr $d019
lda _ds_irqa
ldx _ds_irqx
ldy _ds_irqy
rti
}
//------------------------------------------------------------------------------ ---------------------------------------
//general scripts...
.function _16bit_nextArgument(arg) {
.if (arg.getType()==AT_IMMEDIATE) .return CmdArgument(arg.getType(), >arg.getValue())
.return CmdArgument(arg.getType(),arg.getValue()+1)
}
.pseudocommand mb arg1:arg2 { //move byte
lda arg1
sta arg2
}
.pseudocommand mw src:tar { //move word
lda src
sta tar
.if (src.getType() == AT_IZEROPAGEY) {
iny
lda src
} else {
lda _16bit_nextArgument(src)
}
.if (tar.getType() == AT_IZEROPAGEY) {
.if (src.getType() != AT_IZEROPAGEY) iny
sta tar
} else {
sta _16bit_nextArgument(tar)
}
}
.pc = start "Main Code"
lda #$00
sta ZP_3
sei
bit $d011
bpl *-3
bit $d011
bmi *-3
lda ZP_3
ora #$10
sta $d011
lda #$00
sta $d020
sta $d021
lda #$35
sta $01
lda #$01
sta $d019
sta $d01a
lda #$00
sta $d015
lda #$7f
sta $dc0d
lda $dc0d
lda #200
sta $d012
lda #<irq
ldy #>irq
sta $fffe
sty $ffff
lda #<nmi
ldy #>nmi
sta $fffa
sty $fffb
cli
jmp *
//---------------------------------------------------------
irq:
{
irqStart
inc $d020
inc $d021
irqEnd #238 : #irq2
}
//---------------------------------------------------------
irq2:
{
irqStart
dec $d020
dec $d021
dec ZP_3
bpl !+
lda #$07
sta ZP_3
!:
lda ZP_3
ora #$10
sta $d011
irqEnd #200 : #irq
}
nmi:
rti
_ds_irqa: .byte $00
_ds_irqx: .byte $00
_ds_irqy: .byte $00
|
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
it happens because every 8 lines there is a so called "bad line" where the VIC fetches the characters and in that line you have 40 less cycles.
what exactly do you want to do there? there might be different ways to solve the problem :) |
| |
Strepto
Registered: Dec 2015 Posts: 11 |
My raster interrupt position doesnt change its allways on the same line, but for some reason as d011 scroll changes the interrupt in y scroll pos 6 fires about 30 cycles later than in the other positions. I dont think this is a bad line issue. |
| |
Strepto
Registered: Dec 2015 Posts: 11 |
Aaaa youre right i didnt consider badlines moving with the scroll. Thank you :) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
with d011 finescroll you also scroll those bad lines. because badline is always first pixel row of a character row. So at finescroll #6 a badline probably coincides with your irq routine.
try to change the irq pos from 200 to 208 then it will be probably fine. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
one solution could be: "scroll" the line where the irq fires in the same way as you scroll d011 - then the badlines are always at the same place relative to the line where the irq routine starts. |