Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > vertical scrolling and rasters
2018-11-05 14:59
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
2018-11-05 15:04
chatGPZ

Registered: Dec 2001
Posts: 11108
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 :)
2018-11-05 16:20
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.
2018-11-05 16:23
Strepto

Registered: Dec 2015
Posts: 11
Aaaa youre right i didnt consider badlines moving with the scroll. Thank you :)
2018-11-06 15:44
Oswald

Registered: Apr 2002
Posts: 5017
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.
2018-11-06 16:21
chatGPZ

Registered: Dec 2001
Posts: 11108
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.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Scooby/G★P/Light
DKT/Samar
Matt
Freddie
Guests online: 137
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Webmasters
1 Slaygon  (9.7)
2 Perff  (9.6)
3 Morpheus  (9.5)
4 Sabbi  (9.5)
5 CreaMD  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.052 sec.