3

I have this horizontal smooth scrolling text on line 1 on the screen. the smooth scrolling effect is made using the $d016 hardware scrolling effect by iterating on the 7 lowest bits of $d016). The scroller runs on line 1 of the screen. I have set up two raster interrupts.

The "noScroller" interrupt is the part of the screen that should not be scrolled - which is whole screen except line 1.

The "scroller" is the interrupt that happens on line 1. I have set this interrupt to #50 even though I think it would make sense to set it to #0 since the scroll should only happen on line 1, but if I do set it to #0 then the scrolling text jumps around.

The "noscroller" interrupt is set to happen on line #66 - if I set it to #58 which seems to be the place where line 1 happens then the scrolling text starts to jump around strangely.

My problem is that I don't know what is wrong with my 2 interrupts. I would like to have the $d016 smooth scrolling only happen on line 1 but I have to make a larger area of the screen scroll than just line 1 otherwise the text will jump around. Here is my working code (with a too large scrolling screen area):

            *=$c000
            sei
            lda #$7f
            sta $dc0d
            sta $dd0d
            and $d011
            sta $d011                  
            ldy #50
            sty $d012
            lda #<scroller
            ldx #>scroller
            sta $0314
            stx $0315
            lda #$01
            sta $d01a
            cli
            rts

 noScroller      lda $d016
            and #$f8
            sta $d016
            ldy #50
            sty $d012
            lda #<scroller
            ldx #>scroller
            sta $0314
            stx $0315
            inc $d019
            jmp $ea31        


scroller        lda $d016
            and #$f8
            adc offset
            sta $d016
            dec offset
            bpl continue
            lda #07
            sta offset

 shiftrow        ldx #$00
            lda $0401,x
            sta $0400,x
            inx
            cpx #39
            bne shiftrow+2

 fetchnewchar    ldx nextchar                
            lda message,x
            sta $0427
            inx
            lda message,x
            cmp #255
            bne continue-3
            ldx #00
            stx nextchar

 continue       ldx #66
           stx $d012
           lda #<noScroller
           ldy #>noScroller
           sta $0314
           sty $0315
           inc $d019
           jmp $ea31



 offset          byte 07  
 nextchar        byte 00
 message         byte 011, 009, 012, 018, 015, 025, 032, 023, 001, 019, 032, 006, 009, 014, 001, 012, 012, 025, 032, 008, 005, 018, 005, 032, 032, 032, 032, 032, 032, 255
4

1 回答 1

1

已经很久了;-) 我记得在中断中做实际工作有时会出现问题,因为计算机很忙,你不会及时得到下一个中​​断。当您在该区域时,您确实会更新该$0400区域,它会闪烁。也许这就是您需要增加扫描线窗口的原因。

我建议您尝试将寄存器更改与$d016将文本存储在$0400. noScroller重置后将文本复制移动到第二个中断,$d016因为你有你需要的所有时间。在您再次点击顶部扫描线之前,更改将不可见。$d012如果您可以使该区域与需要的一样小,则再次尝试使用扫描线。

在调试期间,您可以在中断开始时更改屏幕的背景颜色并在结束时将其重置。您应该在屏幕上看到一条短的彩色线,它有点晃动。这将向您显示您的中断发生在“哪里”。如果您发现每 8 次中断花费的时间太长,请尝试shiftrow使用 39 次 LDA/STA 展开循环,这样会更快。

于 2019-03-11T09:00:54.987 回答