Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user zschunky ! (Registered 2019-02-20) You are not logged in 
CSDb User Forums


Forums > C64 Coding > vertical scrolling and rasters
2018-11-05 14:59
Strepto

Registered: Dec 2015
Posts: 3
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
Groepaz

Registered: Dec 2001
Posts: 9021
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: 3
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: 3
Aaaa youre right i didnt consider badlines moving with the scroll. Thank you :)
2018-11-06 15:44
Oswald

Registered: Apr 2002
Posts: 4365
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
Groepaz

Registered: Dec 2001
Posts: 9021
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
Skate/Plush
JackAsser/Booze Design
Zirias/Excess
Guests online: 58
Top Demos
1 Unboxed  (9.7)
2 Uncensored  (9.7)
3 Edge of Disgrace  (9.7)
4 Coma Light 13  (9.6)
5 Comaland 100%  (9.6)
6 The Shores of Reflec..  (9.6)
7 Lunatico  (9.6)
8 Wonderland XII  (9.6)
9 C=Bit 18  (9.6)
10 X Marks the Spot  (9.5)
Top onefile Demos
1 Smile to the Sky  (9.6)
2 Daah, Those Acid Pil..  (9.5)
3 Dawnfall V1.1  (9.4)
4 FMX Music Demo  (9.4)
5 Crystal Gazer  (9.4)
6 Rewind  (9.4)
7 Pandemoniac Part 2 o..  (9.4)
8 Official X2018 Report  (9.4)
9 Arok 20 Invitation  (9.4)
10 Party Horse  (9.3)
Top Groups
1 PriorArt  (9.7)
2 Performers  (9.5)
3 Oxyron  (9.5)
4 Booze Design  (9.4)
5 Censor Design  (9.3)
Top Logo Graphicians
1 Mermaid  (9.3)
2 Pal  (9.2)
3 Elko  (9.1)
4 Yazoo  (9.0)
5 Jailbird  (8.9)

Home - Disclaimer
Copyright © No Name 2001-2019
Page generated in: 0.053 sec.