A.D.A. Amiga Demoscene Archive

        Welcome guest!

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / Question about blitter shifting in descending mode

 

Author Message
HM Kaiser
Member
#1 - Posted: 16 Jan 2012 23:14
Reply Quote
Hi all !
Since a few evenings I experiment with the blitter. So far I've managed to clear a given area of screen, and scroll from left to right. (It took me some time to debug my cls routine : I had to put a waitblit before the rts, otherwise I had very strange behaviors - and for my scrollroutine I did not understand immediately that I had to put the corrects minterms for a shift, I thought that was for copy only).

But, I have problems for scrolling from right to left. I thought I just had to use descending mode (bit 1 of btlcon1), but when I put this bit to 1, the blit operation just does nothing (at least, not visible on the screen).

move.l #$19F00002,bltcon0(a6) ;A and D, 1 bit shift, descending mode
move.l #$ffffffff,bltafwm(a6) ;bltafwm + bltalwm
move.l #0,bltamod(a6) ;bltamod + bltdmod
move.l bitplan,bltapt(a6)
move.l bitplan,bltdpt(a6)
move.w #(8<<6)+25,bltsize(a6) ;scroll 8 pixels height on a 400 pixels wide bitplan

These lines works perfectly in normal (not descending) mode.
I suspect the mistake is in the address pointers, but I can't get it work.
The hardware reference manual says "Thus, for a standard memory copy, the only difference in blitter setup
(assuming no shifting or masking ) is to initialize the address pointer registers to point to the last word in a block"
As I do a shifting, I assume the address pointer is the same than for normal (not descending) mode. (I tried to point the address registers at the last word of the block, the result is the same : nothing moves).

Anyone has an idea / explanation ?
Thanks :-)
d0DgE
Member
#2 - Posted: 17 Jan 2012 10:52 - Edited
Reply Quote
OHAI

the descending mode of the Blitter is mostly used in combination with the Fill- function, or rephrased in a better way: the descending bit is mandatory for the Blitter-fill.
In order to blit the right stuff in descending mode you have to set the start of the affected memory to the end (i.e. bitplan+[sizeOfMemToBlit] ). Same would go for the destination memory unless you want to experience strange behavior (Blitter seems to be a living being :)
As the term "descending" suggests, the copy will start "bottom up" instead of "top down" as it is done in the default "ascending" mode.

Thus, the descending mode will not exactly help you in moving (scrolling) a BlitObject.

Some time ago I also had some issues regarding the Blitter functions ( more or less filling-related). The corresponding thread is here.
When I get home I'll look through my Blitter Macros, maybe I've got a good example in there b/c it's not so long ago since I had to boil over the Hardware Reference figuring out how to "cookie cut" and "scroll" stuff.
pmc
Member
#3 - Posted: 17 Jan 2012 11:46
Reply Quote
As said, to scroll right to left using blitter descending mode, set all your blitter regs exactly as you would normally, except:

first (obviously) set the blitter to descending mode (set bit 1 (BLITREVERSE) of bltcon1) and second, initialise the pointers to the last word of your data.

This can be done pretty easily with something like this:

	lea	scroll_plane_end-2(pc),a0
move.l a0,$dff050 ;BLTAPTH
move.l a0,$dff054 ;BLTDPTH

scroll_plane: dcb.b 10240,0
scroll_plane_end:
HM Kaiser
Member
#4 - Posted: 17 Jan 2012 14:17
Reply Quote
Hi and thanks for your answers.

I just understood my mistake : I reserve memory with allocmem, and in bitplan I store the address of allocated memory, so bitplan is just a pointer to the bitplane, not the bitplane data itself. In ascending mode, it worked because I made no addition, but here, bitplan+XXXX points to everything except the bitplane :-)

(it's a mistake I still often do : make a lea , instead of a move on bitplan for exemple...)

So I had to do this:

move.l bitplan,a0
add.l #$3198,a0 (400*256 px screen, -2 to point on the last word) for a scrolltext at the bottom of screen, for instance.

and then write the blitter address pointers and bltsize.
And that works fine now.
What a silly mistake :-p
pmc
Member
#5 - Posted: 18 Jan 2012 08:40
Reply Quote
Making mistakes, realising them and understanding how to resolve them is the best way to learn! :)

Keep it up HM Kaiser! :)

 

  Please log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0