Jump to content
IGNORED

Horizontal scrolling in a DLI


TGB1718

Recommended Posts

Is there a reason why you can't do horizontal scrolling in a DLI, I'm experimenting with a demo I'm writing and

wanted to do hscroll on individual lines, but I get some form of scrolling but with the screen jumping and also garbage

I've got 2 videos showing the problem, the VBL one works fine, the only difference between the two pieces of code

is HSCROL is commented out in the DLI and inserted in the VBI in one and the reverse in the other.

I've tried all sorts the stop it happening, but nothing seems to fix it, I'm thinking it a limit in the hardware ?

 

I did try the code on an 800XL and it does exactly the same (thumbs up for Altirra's accuracy ?.)

 

Sorry about the colour changing, forgot to remove it :)

 

Link to comment
Share on other sites

Using hscroll is possilbe everywhere, but esp. in the DLI it is positioned best. So you can set the value in every screen line with individual number that suits to scroll state of the line.

 

Your garbage looks like something that writes into the display list. But without code it is just a speculation.

Link to comment
Share on other sites

Timing can be a problem - HScrolling in normal DMA mode means it's fetching extra character codes and the amount and timing can vary depending on HScrol value.

Generally in the DLI you'd want to push registers, preload the HScrol value, store WSYNC then store the HScrol value (from memory you sometimes need a couple of extra cycles delay if doing VScrol changes)

 

If you're doing DList LMS changes as well, then you can get away with just using a subset of HScrol values (e.g. just the lower 2 bits)

Though when doing this the effect of incrementing is different - incrementing your LMS moves data to the left where incrementing HScrol moves data to the right.

To overcome this you can just invert the lower bits so you get the following results for HScrol so that data moves right to left:

00 11

01 10

10 01

11 00

 

Then with the higher bits, shift right twice which will give a character offset value (note this refers to doing 40 column text mode scrolling - 20 character and bitmap can be different)

Link to comment
Share on other sites

47 minutes ago, pps said:

Your garbage looks like something that writes into the display list. But without code it is just a speculation.

I thought that too, but I've checked and the display list is untouched, originally the DLI was the whole screen, but to

try eliminate/debug the issue, I restricted the DLI to the first 16 lines.

 

31 minutes ago, Rybags said:

If you're doing DList LMS changes as well,

Not yet, that may come later, for the moment it's just incrementing the value stored into the HSCROL register for each line.

 

31 minutes ago, Rybags said:

Generally in the DLI you'd want to push registers, preload the HScrol value, store WSYNC then store the HScrol value

Yes, I tried that too, appears the same with or without WSYNC being written to.

 

Thanks for the replies though, at least I know it should be possible, I'll re-examine the code and maybe change a few things

to see if I can improve matters.

 

EDIT:- I should have said, the display list is a WIDE 64 bytes/line so has an LMS for each line

 

This is the code that's failing, lots commented out trying to debug, it's so simple, DLI loads value that's incremented by the VBL

strange.

mydli    pha ; actual DLI processing 
        ldx hsstart
        sta WSYNC
        sta HSCROL
        pla
        rti

 

VB                    ; do the vb stuff here
        inc hsstart
        lda hsstart
        cmp #16 ; reset after 16 lines
        beq xt1
        JMP XITVBV        
xt1     lda #0
        sta hsstart
        jmp XITVBV

 

Edited by TGB1718
Link to comment
Share on other sites

ldx?  You've not saved X.

 

Wide mode is 48 bytes per line, unless you're doing LMS every line in which case it can be custom to your specs.

 

Also, I believe there's a mode or two (bitmap) where you can invoke a bug with large HScrol values which causes glitches - that should be in the Altirra HW manual also.

Edited by Rybags
  • Like 1
Link to comment
Share on other sites

8 minutes ago, Rybags said:

ldx?  You've not saved X.

sorry, I removed some of the code to make it simpler, the real code does txa, pha etc.

 

9 minutes ago, Rybags said:

Also, I believe there's a mode or two (bitmap) where you can invoke a bug with large HScrol values which causes glitches - that should be in the Altirra HW manual also.

thanks, will have a read

 

9 minutes ago, Rybags said:

Wide mode is 48 bytes per line, unless you're doing LMS every line in which case it can be custom to your specs

Yes, display list is created in the code, there's an LMS on every line

Link to comment
Share on other sites

ldx is used, but then you sta the value? As rybags mentioned, you just saved and reset the accu, but not the x register.

1 hour ago, TGB1718 said:

mydli    pha ; actual DLI processing 

        ldx hsstart
        sta WSYNC
        sta HSCROL
        pla
        rti

 

VB                    ; do the vb stuff here
        inc hsstart
        lda hsstart
        cmp #16 ; reset after 16 lines
        beq xt1
        JMP XITVBV        
xt1     lda #0
        sta hsstart
        jmp XITVBV

 

Next thing is, that hscroll just reacts with values from 0 to 7 or 0 to 3 depending on the graphics resolution (0..7 highres, 0..3 lowres) you use.

Edited by pps
Link to comment
Share on other sites

4 minutes ago, pps said:

Next thing is, that hscroll just reacts with values from 0 to 7 or 0 to 3 depending on the graphics resolution (0..7 highres, 0..3 lowres) you use.

@pps  thanks, That's improved things considerably, in this GR mode, it does allow shifting 16 bits which is what I wanted, but reducing to 7 does

make it more stable, now I have to figure out how to move it 16 bits in a DLI given the limited time to do a coarse scroll, 

Link to comment
Share on other sites

When 8 Bits are scrolled, you simply set lms in DL +1 or scroll all of your line by 1 byte to the left, and reset the hscroll register and start over again.

Copy routine should not be in the DLI, just set the hscroll register there. Copy can be made during VBI as long as you don't copy to many bytes. If so, you should make the copy in "normal" programme area.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...