07 September 2021, 20:00 | #1 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 666
|
HELP with blitter vertical shift
I'm trying to scroll a portion of a plane vertically using blitter, so far I have no problem going up but as soon as I change direction I'm getting some unexplicable (for me!) results.
This routine is executed at every frame. Source and destination match, the shift is obtained by adding the size of a line to the source (A3) so the image moves up 1px every frame. 1 is also subtracted from H so the size of operation don't mess with next bitplane. As long as SCROLL_DIR_Y=0 the scroll works OK and when it's 1 the size of a line is added to the destination (A4) instead, to obtain the opposite direction. But as soon as this is triggered the result of the blit is as in second image, without any scrolling in-between. Using modulos of 0 and scrolling the whole area have the same results. I'm obviously missing something, maybe an expert eye can give me a hint? Code:
__SCROLL_BG_Y: MOVEM.L D0-A6,-(SP) ; SAVE TO STACK BTST.B #6,DMACONR ; for compatibility MOVE.W #%0000100111110000,BLTCON0 ; ## MAIN BLIT #### MOVE.L BGPLANE0,A3 MOVE.L BGPLANE0,A4 MOVE.B SCROLL_DIR_Y,D5 TST.B D5 BEQ.S .goUp ADD.L #336/16*2,A4 ; POSITION Y BRA.S .goBlit .goUp: ADD.L #336/16*2,A3 ; POSITION Y .goBlit: bsr WaitBlitter MOVE.W #$FFFF,BLTAFWM ; BLTAFWM MOVE.W #$FFFF,BLTALWM ; BLTALWM MOVE.W #%0000000000000000,BLTCON1 ; BLTCON1 MOVE.W #bpl-wblit,BLTAMOD ; BLTAMOD MOVE.W #bpl-wblit,BLTDMOD ; BLTDMOD MOVE.L A3,BLTAPTH ; BLTAPT SRC MOVE.L A4,BLTDPTH ; DESC MOVE.W #(h-1)*64+160/16,BLTSIZE ; BLTSIZE ; ## MAIN BLIT #### MOVEM.L (SP)+,D0-A6 ; FETCH FROM STACK RTS Going down: |
07 September 2021, 20:06 | #2 |
Registered User
Join Date: Jun 2020
Location: Druidia
Posts: 386
|
Are you using descending mode for the appropriate blit?
http://amigadev.elowar.com/read/ADCD.../node0120.html |
07 September 2021, 20:15 | #3 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 666
|
Should I? I'm not using the blitter shift.
|
07 September 2021, 20:26 | #4 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 666
|
OH maybe i see now, source is overwritten! Thanks I'll give a try with decending mode!
|
07 September 2021, 20:27 | #5 |
Registered User
Join Date: Jun 2020
Location: Druidia
Posts: 386
|
It's unrelated to shifting.
If you're moving memory forward into an overlapping region then you need to use descending mode. Otherwise you want to use the normal ascending mode. If you don't then you are going to end up overwriting the region you are also reading from which will be bad. |
07 September 2021, 20:28 | #6 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,039
|
Yeah, otherwise you rewrite the next line with the one you copy every time, so you end up copying the same (first) line over all the other lines.
In that scenario you have to copy bottom-up and use descending mode. |
08 September 2021, 01:40 | #7 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 666
|
and solution was as simple as DESC mode, thanks!
|
05 January 2022, 21:06 | #8 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 666
|
Sorry for resuming but today I was doing some more tests on this and I'm realizing it's not possible to shift vertically+horizontally in any direction *with the same blit*, just up/right or down/left, right? Or is there some trick?
|
06 January 2022, 12:35 | #9 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
I suppose you could "fake" it by e.g. in ascending mode shift right by 15 pixels then set the dest address one word earlier, in order to shift left by one pixel.
|
07 January 2022, 18:54 | #10 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 666
|
Thanks, something similar to a scroll happens but "a word earlier" means let blitter mess with adjacent part of memory, which is trouble
|
07 January 2022, 19:46 | #11 | |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 666
|
On AHRM there's something on the topic but it seems more confused than I am:
Quote:
If anyone could point to a working example maybe I can figure this out. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Make blitter shift value a variable? | Brick Nash | Coders. Asm / Hardware | 2 | 22 April 2021 14:31 |
Arithmetic shift right with the blitter | Ernst Blofeld | Coders. General | 16 | 19 December 2020 11:31 |
Blitter shift eats 1px away | KONEY | Coders. Asm / Hardware | 64 | 04 November 2020 17:48 |
Blitter shift BACKWARDS | KONEY | Coders. Asm / Hardware | 3 | 29 January 2020 21:50 |
Blitter Mask shift during copy | LeCaravage | Coders. Asm / Hardware | 6 | 18 March 2018 22:50 |
|
|