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: 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 :)
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: 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.
2018-11-06 16:21
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.
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
Linus/MSL
Krill/Plush
zscs
Derision/Longshot
Fred/Channel 4
X-Raffi/X-Rated
REBEL 1/HF
Paul Bearer
Guests online: 76
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Party Elk 2  (9.6)
4 Cubic Dream  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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