20 March 2024, 12:06 | #1 |
Registered User
Join Date: Mar 2021
Location: SWEDEN
Posts: 40
|
Shift bitplanes 1 pixel
We would like to move bitplanes left and right on the screen, 1 pixel per frame... but if we shift the memory pointer to the bitplanes, they move 8 pixels on the screen, because memory is organised in bytes (8bits/8pixels).
What if we want to move bitplanes 1 pixel? |
20 March 2024, 12:56 | #2 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,068
|
x = scroll offset (-N, ..., -1, 0, 1, ..., N)
bits = x&15 set $dff102 to (bits<<4)|bits set $dff0ex (bitplane pointers) to bitplane_ptr+(x>>4)*2 Docs: http://amigadev.elowar.com/read/ADCD.../node0022.html Last edited by a/b; 20 March 2024 at 13:17. Reason: forgot to convert back to bytes >< |
20 March 2024, 14:31 | #3 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,331
|
Do NOT poke the hardware directly, even more so as this is a graphics primitive that is easily available from the operating system. The corresponding function is called ScrollRaster() in the graphics.library.
|
20 March 2024, 17:44 | #4 | |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,020
|
Quote:
If the returning copperlist is properly written, hardware scroll values will instantly be reset in any case. A nothing "problem" |
|
20 March 2024, 17:55 | #5 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,331
|
Does not clip on window or screen boundaries. Does not work ideally on interleaved bitmaps. Does not work on RTG graphics. Does not reserve the blitter, so does not work with multitasking. That's >>0 harm that is done here.
Moving a bitplane is something different than panning, and this problem is not related to the copper at all. |
20 March 2024, 18:04 | #6 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,068
|
He didn't explicitely specify whether he's using OS or hw banging, so based on his previous enquiries I'm assuming it's hw banging (also, hw forum ).
|
20 March 2024, 23:41 | #7 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 9,020
|
|
21 March 2024, 01:42 | #8 | ||
Registered User
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,771
|
Quote:
This is the kind of advice that gives neophytes the impression that the Amiga's hardware is underpowered. Quote:
|
||
21 March 2024, 07:41 | #9 | ||
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,388
|
Quote:
Quote:
|
||
21 March 2024, 10:12 | #10 | |
old bearded fool
Join Date: Jan 2010
Location: Bangkok
Age: 57
Posts: 779
|
Quote:
|
|
21 March 2024, 14:31 | #11 | ||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,331
|
Quote:
Quote:
|
||
21 March 2024, 15:36 | #12 |
Registered User
Join Date: Sep 2017
Location: Kansas, USA
Posts: 329
|
|
21 March 2024, 16:33 | #13 | |
Registered User
Join Date: Aug 2010
Location: Germany
Posts: 537
|
Quote:
If there is no need for clipping via the RastPort or the Layer it is a part of, then BltBitMap() might just do the minimum required, and nothing more. Could be worth a try. You may have to call BltBitMap() on the column of pixels which the blit operation did not copy. ScrollRaster() would have filled that column with the current background colour. |
|
21 March 2024, 16:45 | #14 |
Registered User
Join Date: Aug 2010
Location: Germany
Posts: 537
|
First determine what the budget for the operation is. The budget not only includes how much time is spent for the operation to complete, but also for learning how to perform it, debug it and measure the actual performance attainable. You can always reconsider the approach if you know your numbers.
Assuming that the operating system's toolbox, as available to you, will let you down is a shortcut. Not all shortcuts will be to your benefit or advantage It's also possible that just by giving it a shot you might stumble upon something that you did not expect to find and which adds to your own "bag of tricks". And, no, I never felt the acute urge to make use of the Blitter on its own terms. I'm much too lazy for that, especially considering how much can go wrong if you do not know exactly what is called for and lack the patience to debug the smoking ruins. Laziness can be a superpower. Let somebody else solve that problem for you. |
24 March 2024, 19:38 | #15 |
Registered User
Join Date: Mar 2021
Location: SWEDEN
Posts: 40
|
Yes, direct hardware banging if possible... we are trying to make a depth of field parallax effect, where the bitplanes in the background move slowly, and the foreground move fast:
Playfield 1 (foreground) move bitplanes(1,3,5) 6 pixels per frame. Playfield 2 (background) move bitplane6, 1 pixels per frame move bitplane4, 2 pixels per frame move bitplane2, 3 pixels per frame Graphics.lib is loaded but used only to setup a View since we have zero experience with graphics.lib. The game is designed for OCS A500, but should also work on other amigas like A1200. Last edited by REAKTOR BEAR; 24 March 2024 at 19:54. |
24 March 2024, 19:41 | #16 | |
Registered User
Join Date: Mar 2021
Location: SWEDEN
Posts: 40
|
Quote:
PF2H=Playfield 2 horizontal scroll code PF1H=Playfield 1 horizontal scroll code How do we set it to 1pixel scroll? |
|
24 March 2024, 21:03 | #17 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,068
|
Yeah, BPLCON1 ($dff102).
1px scroll? Change x by +/-1. x=-17 => $102 = $000f, $0e0/$0e2 = bpl_ptr1-4, $0e8/$0ea = bpl_ptr3-4, $0f0/$0f2 = bpl_ptr5-4 x=-16 => $102 = $0000, $0e0/$0e2 = bpl_ptr1-2, $0e8/$0ea = bpl_ptr3-2, $0f0/$0f2 = bpl_ptr5-2 ... x=-2 => $102 = $000e, $0e0/$0e2 = bpl_ptr1-2, $0e8/$0ea = bpl_ptr3-2, $0f0/$0f2 = bpl_ptr5-2 x=-1 => $102 = $000f, $0e0/$0e2 = bpl_ptr1-2, $0e8/$0ea = bpl_ptr3-2, $0f0/$0f2 = bpl_ptr5-2 x=0 => $102 = $0000, $0e0/$0e2 = bpl_ptr1+0, $0e8/$0ea = bpl_ptr3+0, $0f0/$0f2 = bpl_ptr5+0 x=1 => $102 = $0001, $0e0/$0e2 = bpl_ptr1+0, $0e8/$0ea = bpl_ptr3+0, $0f0/$0f2 = bpl_ptr5+0 ... x=15 => $102 = $000f, $0e0/$0e2 = bpl_ptr1+0, $0e8/$0ea = bpl_ptr3+0, $0f0/$0f2 = bpl_ptr5+0 x=16 => $102 = $0000, $0e0/$0e2 = bpl_ptr1+2, $0e8/$0ea = bpl_ptr3+2, $0f0/$0f2 = bpl_ptr5+2 ... etc. 2px scroll => change x by +/-2, use the same calcs.. Since you are only scrolling playfield1 you only set $dff102 bits 0-3 and leave bits 4-7 at 0. To scroll everything you also set bits 4-7 (e.g. $0011, $0022, ... $00ff), this is a difference from my first post. |
25 March 2024, 08:58 | #18 |
Registered User
Join Date: Mar 2021
Location: SWEDEN
Posts: 40
|
Awesome, thanks a/b, as a sidenote why was this information not in the Commodore Amiga hardware reference manual (playfields section) .. strange
|
25 March 2024, 11:19 | #19 | |
Registered User
Join Date: Dec 2014
Location: germany
Posts: 442
|
Quote:
|
|
06 April 2024, 14:46 | #20 | |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,698
|
Quote:
This forum is specifically for banging the hardware, algorithms, or writing in Assembly in general (although if you're writing a utility, language or driver in Assembly which uses the OS extensively, coders should ask in Coders.System to get the best advice). I would say that there are a few cases when OS programming advice is very useful in this HW programming forum, such as switching the OS off, on, and semi-on safely, supporting CPU, RAM, and other expansion cards and peripherals in a compatible way, file formats, early boot, media boot, and reset. But generally, this is not the place to say "do it with the OS instead". |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
5 bitplanes ... | chadderack | Coders. Asm / Hardware | 63 | 25 September 2022 00:02 |
Waiting 300 microseconds on a shift/load change or button shift on a CD32 gamepad? | BeamCoder | Coders. Asm / Hardware | 48 | 04 September 2021 18:07 |
Alien Breed II title pixel by pixel logo removal | dex | project.Sprites | 17 | 06 May 2020 15:23 |
bitplanes format | jarre | Coders. General | 3 | 19 January 2019 17:38 |
Using the Copper to mangle the bitplanes. | Andy_C | Coders. General | 7 | 16 March 2011 12:58 |
|
|