Jump to content
Sign in to follow this  
Heaven/TQA

LMS changes on raster line basis?

Recommended Posts

I spend few minutes in trying to replicate the 8x8 scroller similar to this one:

 

http://de.youtube.com/watch?v=MwIY6nGG-oA

 

but via hardware... is there any chance to change the LMS of a char line via DLI? in standard mode via DLI/WSYNC I am confusing ANTIC but what about the "vscroll trick"? Having the possibility to have a LMS for every scanline in a charmode could make this possible... and via hardware support...so no need to shift around tons of bytes...

 

I am thinking of the 40x38 Gr.0 mode...what if we use a 40x8 "1 scanline" Gr.0 mode with the $d405 trick? or any other ideas to fool Antic so we can reload the adress for each scanline?

Share this post


Link to post
Share on other sites
I spend few minutes in trying to replicate the 8x8 scroller similar to this one:

 

http://de.youtube.com/watch?v=MwIY6nGG-oA

 

but via hardware... is there any chance to change the LMS of a char line via DLI? in standard mode via DLI/WSYNC I am confusing ANTIC but what about the "vscroll trick"? Having the possibility to have a LMS for every scanline in a charmode could make this possible... and via hardware support...so no need to shift around tons of bytes...

 

I am thinking of the 40x38 Gr.0 mode...what if we use a 40x8 "1 scanline" Gr.0 mode with the $d405 trick? or any other ideas to fool Antic so we can reload the adress for each scanline?

Could you not use graphics mode instead of text mode?

Share this post


Link to post
Share on other sites

AFAIK, it can't be done. ed - to clarify, you can't force another LMS part way through a chracter display without VScrol tricks.

 

The only non-standard such tricks relating to Display List fetch I'm aware of are:

- disabling/re-enabling character cell DMA at the right times can force Antic to reuse the previous character data, not really a useful option since you get a blank line.

 

- you can disable Display List DMA fetch. Antic will then just reuse whatever it previously fetched. However, I'm not sure if that is graphics mode only, or also extends to DLI request, or if it redos an LMS. I would guess that if you had an LMS then disabled DList DMA before the next one was due, that it would just continue displaying the mode without reusing the address you've supplied.

 

 

I did a program which used the VScrol trick to get Antic to only display line 0 of Graphics 0, repeated 238 times or so. It was in a thread discussing RAM Refresh.

I guess you could do a Kernal to do the trick using a DList with LMS for each instruction, only difference being you'd be losing the 2 extra cycles per scanline in addition to the 82 or so cycles you're already losing (40 chr, 40 chrmap, 1 refresh, 1 DList).

Edited by Rybags

Share this post


Link to post
Share on other sites

Looking at that demo, aren't there already others on the 8-bit around that alter HScrol on a per-scanline basis throughout a character line?

 

So far as doing something like that on the A8 - I guess you'd want your default HScrol value to be set at 8 - that then gives you the ability to "flex" subsequent scanlines backwards as well as forwards by up to 7 colour clocks.

Share this post


Link to post
Share on other sites

Rybags, you are correct. Set the HScrol to a default 8 instead of 0, then turn on dli for the each character line(bit 8 in the display list byte(. This will give you a dli for each character at the first line. You can then use WSYNC within the dli code to set HSCROL every line.

 

I tested the following code with ANTIC mode 4 and DLI on. This gives a shimmery effect based on modifying HSCROL from the

poly counter.

 

If you want the text to scroll too, then you can keep track of HSCROL and modify the display list LMS at the correct time (maybe once every 16 HSCROL updates. I think that the display list byte for DLI, HSCROL, and LMS for mode 4 would be $d4.

 

dli_scroll:
pha 
lda $d20a
and #$03
and $d404
sta $d404
sta $d40a; WSYNC
lda $d20a
and #$03
and $d404
sta $d404
sta $d40a; WSYNC
lda $d20a
and #$03
and $d404
sta $d404
sta $d40a; WSYNC
lda $d20a
and #$03
and $d404
sta $d404
sta $d40a; WSYNC
lda $d20a
and #$03
and $d404
sta $d404
sta $d40a; WSYNC
lda $d20a
and #$03
and $d404
sta $d404
sta $d40a; WSYNC
lda $d20a
and #$03
and $d404
sta $d404
sta $d40a; WSYNC
lda $d20a
and #$03
and $d404
sta $d404
sta $d40a; WSYNC

pla
rti

Share this post


Link to post
Share on other sites

I don't get this idea of "keeping an eye on HScrol" concept.

 

By far the better way of scrolling around a "game world", or doing a banner, is to just treat the co-ordinate system as if it was the origin point within a huge bitmap.

 

So then, e.g. for a 1 line banner.

 

Have X values ranging, say from 0 to 1023.

The low 2 bits then get ANDed out to be used in the HScrol value. Of course, HScrol works kinda back to front, so you subtract that number from 8.

 

The high bits get shifted right twice to cancel out the fine-scroll value. The result then becomes the offset which you have to add to the LMS address.

Share this post


Link to post
Share on other sites

Rybags... yup...

 

but the idea is to achieve something like this:

 

http://de.youtube.com/watch?v=mHAYQZwApn4

 

so...actually... I want to distort more than delta 16 pixel (-8/+8)... I know how to do this the "hard way" but I still have the dream since for 20 years to use the damned hardware for it... ;) or at least support it little bit:

Edited by Heaven/TQA

Share this post


Link to post
Share on other sites

OK...

 

We have those annoying limitations though. We can do VScrol -> 7, then 0 -> VScrol, which only helps in that we can choose to only display the first or last few scanlines of a character.

 

If the wave effect doesn't deviate by more than 16 pixels either side between 2 scanlines, then you could use something like 2 pixel high characters.

 

Then, have multiple character set representations, which show us different parts of each character (vertically) in the first and last 2 rows.

You can save RAM... since you're only using the first 1 or 2 bytes of each character definition, you can set CHACT to flip characters upside-down so that you can also use the bottom bytes in the chset.

 

If you want free reign such that you can independantly scroll every single line by any amount horizontally... it should be doable. Not sure if there's enough free cycles though, you might have to do it in narrowscreen mode since enabling HScrolling in 40 columns adds more DMA burden, not to mention the DList instructions also have an extra 2 fetches since they'd be all LMS instructions.

Share this post


Link to post
Share on other sites

Rybags... yes... that's what came into my mind when mentioning the "vscroll"-trick and the 40x38 mode... of course you would need max. 8 fonts for each char line.

 

but does the vscroll mode work with LMS in the display list on every charline? i thought Fox and Eru wanted to avoid exactly that... but I will play around tonight...

Edited by Heaven/TQA

Share this post


Link to post
Share on other sites

* Brain Explosion *

 

I just thought of another method you could employ, although it involves a compromise also...

 

Narrow-screen mode.

By toggling between normal and narrow-screen DMA, you are effectively shifting characters another 4 positions to the right.

 

You'd probably also want to use 2 players as masks on the left/right of the screen to mask out what's going on.

 

I've played with toggling between widths - pretty sure that Antic should behave "normally" ie display everything as it should appear.

 

Pretty sure you can even toggle from narrow to standard halfway through a line, and Antic will display the right-hand side for you.

Although, doing this is probably not possible in the hires character modes since you lose all the cycles until almost the end of the display.

Share this post


Link to post
Share on other sites

OK. Tested that (in the emu). Seems to work fine.

 

So, you have a setup like this, for "Super H-Scrolling":

 

			1   1   2   2   2   3   3   4   4  4
0---4---8---2---6---0---4---8---2---6---0---4--7
[ standard screen					  ]
	[ narrow screen				]

 

The range for scrolling then goes through 0-15 in standard, which will cause e.g. a character in position 4 to be visible in it's normal position with HScrol=00, and overlapping positions 7 and 8 (with 6 pixels in position 8 ).

 

To get the extended range, start at HScrol = 0 in narrow-screen. Our character in position 4 with HScrol=0 then becomes visible in position 8. Increasing HScrol to 15 puts the character in positions 11 and 12 (with 6 pixels in position 12).

 

Overall, scrolling range without needing to tamper with LMS is doubled.

Share this post


Link to post
Share on other sites

Re your other question - the VScrol trick works fine with the LMS on every line (IIRC, I used it in the CIN+ mode that I've mentioned before but not yet fully released).

Share this post


Link to post
Share on other sites

Just wondering...

 

Have you coded anything up yet?

 

Would be real interesting to see a scrolly using this effect.

However, stretching standard sized characters by more than 2 pixels or so per scanline makes the things near unreadable.

 

I think this technique would probably be well suited to something like 4x4 cell-sized characters though.

Share this post


Link to post
Share on other sites

I've just done a quick and dirty Photoshop enlargement of the default Atari font (using Bicubic resample to smooth it out, then adjust levels and turn into a 1-bit BMP with Paint).

 

Now have a slightly mutated looking 32x32 chset in a BMP file. Just gotta import it and get some chsets made.

 

Might whip up a quick scrolly myself to see what it looks like.

Share this post


Link to post
Share on other sites

ok...spend few hours trying to figure out how the damned thing works in charmode+hscrol enabled...

 

Rybags...any tips for me as I do not understand it right now... maybe you can explain little bit more as you already managed it in your Cin++

 

;Distorter based on Vscrol-Trick

	org $4000

font1	equ $8000
font2	equ $8400
coltab  equ $8800

linewsk	equ $b0
fontwsk equ $b2


init   mva >font2 fontwsk
   mva #2 linewsk

   jsr tabinit
   jsr fontcopy
   jsr wait_vbl

   mva #0 $d40e
   mwa #dli	512
   mwa #dlist 560
   mwa #vbl 546
   mva #$c0 $d40e

loop   jmp loop

wait_vbl mva #1 540
wait0	lda 540
	 bne wait0
	 rts

vbl	  mva >font2 fontwsk
	 mva #3 linewsk
	 inc dlist+2
	 dec dlist+5
	 inc dlist+8
	 jmp $e45f


tabinit	ldx #0
tabinit0   mva 53770 coltab,x+
	   bne tabinit0
	   rts

dli			pha
		sta $d40a
		lda fontwsk
		sta $d409
		eor #2
		sta fontwsk
	
		lda #2
		sta $d405

		sta $d40a
		lda fontwsk
		sta $d409
		eor #2
		sta fontwsk
		
		lda #5
		sta $d405

		pla
		rti

fontcopy ldx #0
fontcopy0 lda #255
	sta font1,x
	sta font1+256,x
	sta font1+512,x
	sta font1+768,x
	sta font2,x
	sta font2+256,x
	sta font2+512,x
	sta font2+768,x
	inx
	bne fontcopy0
	   rts



	org $5000
screen  dta d'DISTORT FX BY HEAVEN MADE ON 1ST NOVEMBER 2008'

dlist  dta $a0,$f2,a(screen)
	dta $d2,a(screen),$f2,a(screen)
;:19	dta $82,$a2
   dta $41,a(dlist)

	org font1
	ins 'tmcprog.fnt'

	run init

 

info here: http://atariwiki.strotmann.de/

 

it does not work yet, I do not fully understand how the 2 $d405 values relate to each other...

Edited by Heaven/TQA

Share this post


Link to post
Share on other sites

My CIN+ mode doesn't really use the VScrol trick since it interleaves Mode F (with GTIA Colour mode set) and Mode 4 + VScrol enabled with value 7.

 

Since it only has each second line using VScrol, it doesn't need to toggle the VScrol register value. So you get one scanline of GTIA colour in bitmap mode, followed by one scanline of character mode which is used to control luma, giving 6 possible shades (Background, PMG underlay, 3 normal PF colours, 1 alternate PF colour)

 

For the super-HScrol, you just maintain two tables with DMACTL values in one, and HScrol values in the second.

 

So then, you have 32 possible HScrol offsets. HScrol = 0 thru 0F with DMACTL = $22, then HScrol = 0 thru 0F with DMACTL = $21.

Then you need to use 2 solid black Players at the left/right of the screen to mask the areas such that you only see the narrow screen area.

 

Of course, all we've done is to extend the amount we can scroll, we still can't do an LMS earlier. If you really wanted, you might be able to use VScrol tricks to create shorter characters (like the 48 row mode you made the demo of years ago).

 

Unsure what time constraints would exist then - if you have an LMS every scanline in Mode 2, it doesn't leave many free cycles. Since HScrol in standard effectively means you're using 96 cycles just for character/map fetches it means you don't have many cycles left.

Share this post


Link to post
Share on other sites

Rybags... in 40x39 mode Jaskier used to toggle Vscroll to have 6 lines high chars... so I did it in the same way with LMS + hscrol enabled and it showed the wanted fx... now I wanted to reduce the size to f.e. 2 pixel or 4 pixel but did not get it to work...

Share this post


Link to post
Share on other sites

Hmmm...

 

I wonder if having HScrol enabled causes any problems?

 

In standard mode, don't we only have something like a 4 cycle window to effect the VScrol change for it to work... ie STA WSYNC, then LDA #<scrollvalue>, STA VSCROL

 

Might be some timing issue that's messing things up.

 

Also, remember to have the DList set up right (Vscroll on, Vscroll off alternating), and use the correct values to plug VScrol.

 

Actually, not sure if I've ever tried the trick with HScrol also enabled... let's hope it still works.

 

 

ed - on a different note, when I was playing around with this stuff, I was wondering... what if we change from wide or normal to narrow mode mid-scanline... C-64 does similar to do sprites in the side border, wonder if the Atari can generate some strange effects by doing the same.

Although I've played a bit with that sort of stuff before, but I think it was more along the lines of disabling DMA part way through a line.

Edited by Rybags

Share this post


Link to post
Share on other sites

the vscroll values for the 2 lines are the ones which would be interesting for me... ;)

 

maybe I have to draw it on graph paper... ;)

Share this post


Link to post
Share on other sites

VScrol trick for shorter characters seems to work fine with HScrol also enabled, regardless of screen width.

 

Remembering, to get the height you want...

 

Set VSCROL = ( 7 - HEIGHT + 1 ) in the DLI immediately before the VScrol enabled line in the Display List, and in the lines with VScrol not enabled.

 

Set VSCROL = ( HEIGHT - 1 ) in the DLI triggered by the line with VScrol enabled.

 

 

Using the same DLI code, you can easily get the alternating values you need by EOR with #7 to toggle back and forth.

Share this post


Link to post
Share on other sites

Could be timing?

 

I'm pretty sure if you do LDA #4, STA WSYNC, STA VSCROL that it doesn't work properly.

 

You need that couple of cycles delay after WSYNC, so don't preload as you would if doing colours etc.

Share this post


Link to post
Share on other sites

;Distorter based on Vscrol-Trick

	org $4000

font1	equ $8000
font2	equ $8400
coltab  equ $8800

linewsk	equ $b0
fontwsk equ $b2


init   mva >font2 fontwsk
   mva #6 linewsk

   jsr tabinit
   jsr fontcopy
   jsr wait_vbl

   mva #0 $d40e
   mwa #dli	512
   mwa #dlist 560
   mwa #vbl 546
   mva #$c0 $d40e

loop   jmp loop

wait_vbl mva #1 540
wait0	lda 540
	 bne wait0
	 rts

vbl	  mva >font2 fontwsk
	 mva #6 linewsk
	 inc dlist+2
	 dec dlist+5
	 inc dlist+8
	 jmp $e45f


tabinit	ldx #0
tabinit0   mva 53770 coltab,x+
	   bne tabinit0
	   rts

dli			pha
		sta $d40a
		lda fontwsk
		sta $d409
		eor #2
		sta fontwsk
	
		lda linewsk
		eor #7
		sta $d405
		sta linewsk

		sta $d40a
		lda fontwsk
		sta $d409
		eor #2
		sta fontwsk
		
		lda #5
		sta $d405

		pla
		rti

fontcopy ldx #0
fontcopy0 lda #255
	sta font1,x
	sta font1+256,x
	sta font1+512,x
	sta font1+768,x
	sta font2,x
	sta font2+256,x
	sta font2+512,x
	sta font2+768,x
	inx
	bne fontcopy0
	  rts



	org $5000
screen  dta d'DISTORT FX BY HEAVEN MADE ON 1ST NOVEMBER 2008'

dlist  dta $a0,$f2,a(screen)
:4		dta $d2,a(screen),$f2,a(screen)
;:19	dta $82,$a2
   dta $41,a(dlist)


	run init

 

still do not work??? what I am doing wrong? (sorry, it is just a quick hack...)

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...