Jump to content
IGNORED

DLI Question


TGB1718

Recommended Posts

Is it possible to enable horizontal scrolling and change the HSCROL register in a DLI, it appears you can

change it once at the top of the display, but anywhere else produces a garbage screen below the DLI change.

 

Here I'm changing the HSCROL register about 1/2 way down the screen and this is the result :(

 

The program has not crashed, it exits normally on a key press, I'm using the VCOUNT register when it

reaches 60, puts a value into the HSCROL register and that's it, DLI's are enabled on all lines, but this line

is the only one that activates, this is GRAPHIC Mode 7 (Antic $E)

 

I'm beginning to feel that what I'm trying to do is not possible.

 

Link to comment
Share on other sites

8 minutes ago, popmilo said:

Do it right after wsync in previous line and you're safe.

Yes, I am doing it after a WSYNC, the display list is doing an LMS for each line which is 48 bytes wide

with DLI and HSCROL enabled, the playfield is standard width

 

A very simple DLI:-

 

         .proc DLI
         pha
         lda VCOUNT
         cmp #60
         bne xit
        lda #6
        sta WSYNC
        sta HSCROL
xit    pla
       rti
       .endp

Link to comment
Share on other sites

How many DLIs do you have going?

If it's in a known location then why worry about looking at VCOUNT?

 

In wide mode there can be 48 bytes of DMA loss for screen, then you have another 3 for the DList and more again for screen refresh.

Also the cycle losses can be skewed depending on the HSCROL value.

Though your code there does look reasonably tight.  But obviously something is amiss since you're getting corruption.

Generally HScrol corruption is a result of the store occurring partway thruough a scanline, which you normally don't want to be doing.

Link to comment
Share on other sites

14 minutes ago, Rybags said:

How many DLIs do you have going?

If it's in a known location then why worry about looking at VCOUNT?

Every line has DLI enabled, but I only activate one DLI at line 60 that's why I used VCOUNT, my normal code

doesn't use this, I did this just to try to debug/figure out what's going on, so literally I draw stuff on screen

enable the DLI with the code shown and I get garbage below that line, doesn't seem to make sense.

 

I expected just to see the lower 1/2 of the screen offset from the top.

 

There's no VBI's yet, I disabled them to make sure there wasn't any conflict.

 

Guess I'll have to dig a bit deeper to see what's going on.

 

Link to comment
Share on other sites

You should set the hscrol in vbi to the top half value as otherwise the 6 you are setting is just persisting to the next frame.

 

[Edit] could he corruption could be as a result of crossing the 4k screen boundry? Typically that should resolve on the next lms though.

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

7 minutes ago, Wrathchild said:

could he corruption could be as a result of crossing the 4k screen boundry?

no, I created a "createdl" procedure that makes sure the display list aligns correctly to ensure

the 4K boundary is crossed safely.

Without the DLI set, the screen looks correct and a small VBI routine can scroll the screen horizontally with no corruption.

 

It only corrupts if I try any horizontal scrolling in a DLI.

 

Link to comment
Share on other sites

Yes, of course it is possible to change HSCROLL with an DLI - you can even create "italics" fonts by adjusting it from line to line, thus "slanting" the text. From what I see in your video, it seems that you actually damage the display list. What you should not try is to adjust HSCROLL outside the horizontal blank, i.e. you need a STA WSYNC (or find some other way of delaying the write such that it happens outside the visible area).

  • Thanks 1
Link to comment
Share on other sites

@thorfdbg thanks you, you gave me the clue as to what I was doing wrong, I was setting the HSCROL register to 0 outside

of the DLI, but not inside a VBI, my code was just stuffing 0 into HSCROL while waiting for a key press.

 

Pretty obvious really, but sometimes you just overlook something so simple.

 

Fixed now as the screen shot shows, now I can get on with what I was trying to achieve

Thanks to all who helped here

 

image.thumb.png.b33ed92c702446be2628ad73db8ab09b.png

  • Like 4
Link to comment
Share on other sites

WSYNC/horizontal blank isn't sufficient to avoid this problem. The specific requirement is that you can't safely change HSCROL until the playfield DMA clock has finished, and at wide fetch that extends into horizontal blank. You have to burn at least 7 cycles after STA WSYNC to be safe -- 1 for the extra cycle you may or may not get before RDY is pulled, and 6 to clear the farthest that the DMA clock can run.

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, phaeron said:

You have to burn at least 7 cycles after STA WSYNC to be safe -- 1 for the extra cycle you may or may not get before RDY is pulled, and 6 to clear the farthest that the DMA clock can run.

@phaeron thank you I will take that into account if thing look a bit screwed up :)

 

EDIT: Spot on, it looked a bit garbled, I added a few NOP's after the WSYNC and it now look really good. 🤩

Edited by TGB1718
  • Like 3
Link to comment
Share on other sites

Solving such problem always feels nice :)

Altirra debugger is your friend there...
"ba w HSCROL" in console will make a breakpoint on any write of hscrol reg.
 

You would see strange things happening right away. Problem is that it's easy to be clever after you solve bugs like these :)
Good luck, wish you least amount of bugs possible in the future :)


 

  • Like 2
Link to comment
Share on other sites

On 9/8/2023 at 3:29 PM, phaeron said:

(...) You have to burn at least 7 cycles after STA WSYNC to be safe (...)

Oh boy, how many trials and errors when we were young and no phaeron to help. I never got the real understanding before, just moving bits and pieces until it somewhat worked 😮

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...