TGB1718 Posted December 26, 2021 Share Posted December 26, 2021 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 dliscroll.mp4 vbiscroll.mp4 Quote Link to comment Share on other sites More sharing options...
pps Posted December 26, 2021 Share Posted December 26, 2021 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. Quote Link to comment Share on other sites More sharing options...
Rybags Posted December 26, 2021 Share Posted December 26, 2021 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) Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted December 26, 2021 Author Share Posted December 26, 2021 (edited) 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 December 26, 2021 by TGB1718 Quote Link to comment Share on other sites More sharing options...
Rybags Posted December 26, 2021 Share Posted December 26, 2021 (edited) 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 December 26, 2021 by Rybags 1 Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted December 26, 2021 Author Share Posted December 26, 2021 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 Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted December 26, 2021 Author Share Posted December 26, 2021 (edited) Thanks @Rybags this is a quote from the Altirra manual There's a bit more on the subject, I'm going to try a few thing to see if it helps In my code, the display list is not being corrupted, but I do get the garbled playfield Edited December 26, 2021 by TGB1718 Quote Link to comment Share on other sites More sharing options...
pps Posted December 26, 2021 Share Posted December 26, 2021 (edited) 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 December 26, 2021 by pps Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted December 26, 2021 Author Share Posted December 26, 2021 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, Quote Link to comment Share on other sites More sharing options...
pps Posted December 26, 2021 Share Posted December 26, 2021 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. 1 Quote Link to comment Share on other sites More sharing options...
Rybags Posted December 26, 2021 Share Posted December 26, 2021 If you push all 3 registers then there's a real chance of overrun - your WSYNC could occur after the deadline and your register stores occur a scanline too late. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.