07 February 2024, 23:22 | #1 |
Registered User
Join Date: Oct 2019
Location: Eydelstedt / Germany
Age: 44
Posts: 114
|
using copper to change color every 8 pixels
Hi,
i have a question concerning copper waits. If i want to change a color every 8 pixels, i can wait for a line, and use multiple move instructions. What i don't understand is: why do i have to do so many moves (see copper code), before i see the first effect on the left side of my screen? Ok, my screen has 16 pixel hidden space on the left and right side (352x256), but that would only explain 2 extra moves, not 13! And why are the changes not aligned on the bytes (starting at left most pixel). If you look at my sample image, the first green block is only 7 pixel wide, or at least only seven pixels can be seen. Code:
dc.w $2c07,$fffe dc.w $194 BG_C0: dc.w $305 dc.w $194,$f00 ; next 13 moves are not seen on the screen dc.w $194,$0f0 dc.w $194,$00f dc.w $194,$f00 dc.w $194,$0f0 dc.w $194,$00f dc.w $194,$f00 dc.w $194,$0f0 dc.w $194,$00f dc.w $194,$f00 dc.w $194,$0f0 dc.w $194,$00f dc.w $194,$f00 dc.w $194,$0f0 ; from here the changes can be seen on screem dc.w $194,$00f dc.w $194,$f00 dc.w $194,$0f0 dc.w $194,$00f dc.w $194,$f00 dc.w $194,$0f0 dc.w $194,$00f |
08 February 2024, 00:16 | #2 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,053
|
Because of horizontal blanking. From the copper's perspective, visible area typically starts at $81 (lores PAL, no overscan) and ends at $81+320=$(1)c1.
Look at http://amigadev.elowar.com/read/ADCD.../node02D4.html (those numbers are DMA slots, multiply by 2 to get "pixels", e.g. $e0 -> $1c0). |
08 February 2024, 07:11 | #3 |
Registered User
Join Date: Oct 2019
Location: Eydelstedt / Germany
Age: 44
Posts: 114
|
That means it is not possible at all to let the color change start at the first pixel, and have 40 equally spaced bars of 8 pixel widths?
|
08 February 2024, 08:59 | #4 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
|
|
08 February 2024, 09:58 | #5 |
Registered User
Join Date: Oct 2019
Location: Eydelstedt / Germany
Age: 44
Posts: 114
|
|
08 February 2024, 10:17 | #6 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
|
Quote:
If you have a scrolling background you certainly don't have a fixed image in the background (unless you're using dual-playfield, which you didn't mention). And in any case you can adjust the position when writing data to the screen. Unfortunately, without a general idea of what you want to do it is impossible to give precise advice, the copper code you posted does not report anything about the video settings or the viewing window or what will happen on the screen. |
|
08 February 2024, 10:39 | #7 | |
Registered User
Join Date: Oct 2019
Location: Eydelstedt / Germany
Age: 44
Posts: 114
|
Quote:
|
|
08 February 2024, 11:26 | #8 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,488
|
Quote:
You simply 'move' the HUD to the previous word in memory and shift 15 pixels (or if you want to see it from the opposite direction, shift 1 pixel to the left). It's just a question of no longer thinking about having the image aligned in memory and that on the screen it is 'one pixel first'. Of course if you want to have colored and 'centered' columns made with copper |
|
08 February 2024, 13:33 | #9 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,053
|
To put it simple, copper resolution is 4x lower than lores screen resolution. Copper cannot start changing the bg color at any pixel, so you have to align the rest.
Assuming 0-4 bitplanes, copper move takes 8 pixels and the start pixel can be every 4th pixel. Try $2c37, $2c39, ... to find the closest match, and the rest you will have to sort out by scrolling the bitmap with $dff102 as Ross mentioned, or adjusting the assets and baking in the scroll. |
08 February 2024, 14:24 | #10 |
German Translator
Join Date: Aug 2018
Location: Drübeck / Germany
Age: 49
Posts: 193
|
to start a copper move sequence to change the color every 8px at DIWSTRT 0x80
the appropriate wait would be: (to avoid useless copper moves) dc.w $vv3f,$fffe (horizontal waitpos. 0x3e), first color change at: 0x80 dc.w $0180,$0RGB Copper color changes are only possible at even pixel positions. either the screen or the superimposed image must be aligned. And if you change the horizontal wait-position, only four different x-positions are possible within 16 pixels, which corresponds to a 4 pixel accuracy. |
08 February 2024, 19:57 | #11 | |
Registered User
Join Date: Oct 2019
Location: Eydelstedt / Germany
Age: 44
Posts: 114
|
Quote:
Code:
dc.w $8E DiwStart: dc.w $2c80 dc.w $90 DiwStop: dc.w $2cc0 dc.w $92 DdfStart: dc.w $34 dc.w $94 DdfStop: dc.w $cc dc.w $102 BPCON1: dc.w $FF |
|
09 February 2024, 18:11 | #12 | |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,588
|
Quote:
|
|
09 February 2024, 20:44 | #13 |
German Translator
Join Date: Aug 2018
Location: Drübeck / Germany
Age: 49
Posts: 193
|
With a Copper-Move sequence the color can be changed every 8px and the horizontal start of the
sequence can be positioned every 4px on the screen via the horizontal Copper wait. RGB Plasma uses this copper property to change the colors every 8px and thus create dynamically moving images. However, an entire color palette cannot be changed, but only one color register every 8px. |
10 February 2024, 05:53 | #14 |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,588
|
So you cannot simulate an attribute grid like on the ZX spectrum -_-
|
10 February 2024, 14:18 | #15 |
Registered User
Join Date: Jun 2014
Location: milan / italy
Posts: 174
|
Maybe is possible using 2 bitplanes. On bitplane 1 you always emit 0x00FF every 16 pixel. On bitplane 0 you draw monochrome images as usual. Then use Copper to change color 2,3 where bitplane 1 is 0x00 and color 0,1 where is 0xFF.
|
10 February 2024, 15:15 | #16 |
Registered User
Join Date: May 2023
Location: Norwich
Posts: 426
|
I don't think that would work still, the Spectrum can change 2 colours every 8 pixels and whatever you do that's going to be more changes than the Amiga can manage short of just using a 16 colour screen.
|
10 February 2024, 16:22 | #17 | |
Registered User
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,157
|
Quote:
On AGA machines perhaps you could do something using the BPLCON4 register? (If you set up multiple palettes across the 256 colours, you can switch between them with a single copper move.) |
|
10 February 2024, 19:40 | #18 | |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,182
|
Quote:
Wasn't something like this was discussed recently? Anyway, might make for fun challenge (something like, convert zx screen every frame and have it displayed properly). |
|
10 February 2024, 21:30 | #19 | |
J.M.D - Bedroom Musician
Join Date: Apr 2014
Location: los angeles,ca
Posts: 3,588
|
Quote:
|
|
11 February 2024, 14:08 | #20 |
Registered User
Join Date: Dec 2014
Location: germany
Posts: 439
|
IMHO an attribute grid could work with a limited palette of up to 8 colors each for foreground background (16 may work, too, but we are after that Speccy look after all ), using BPLCON4's XOR feature:
Set up a static 256 entry palette in a way that for all even indices, the color is bgcolor << 4, so e.g. color 0x00,0x02,..0x0E are set to bg-color 0, 0x10,0x12..0x1E to bg-color 1, and so on. Then for all odd indices, the color is set to fg-color << 1, so 0x01,0x11,0x21..0xF1 are set to fg-color 0, 0x03,0x13,0x23..0xF3 are set to fg-color 1. Then putting the bg-color <<4 || fg-color <<1 in the XOR-byte of BPLCON4 every 8 pixels selects the color combination; combined with a 8-line copper loop that should give you something like an attribute grid. But even if the logic above is correct, which isn't a given (I just came up with that without testing it), it may not work in practice - IMHO it is not a given that changes to BPLCON4 take effect immediately, the might do so only every 16 pixels, or even more in higher fetch modes. DNK if this is documented somewhere. Last edited by chb; 11 February 2024 at 14:13. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How To Change The Background Color For Input | DrkStarr | Coders. AMOS | 2 | 14 January 2023 18:24 |
Chunk True Color 4 pixels | remz | Coders. Asm / Hardware | 31 | 08 June 2022 13:04 |
Changing 3 registers every 16 horiz. pixels via Copper | Quagliarulo | Coders. Asm / Hardware | 5 | 20 September 2020 10:21 |
change the color 0 in realtime with the copper | Raislin77it | Coders. Blitz Basic | 7 | 09 February 2016 10:46 |
Copper color-changing restrictions? | Dan Locke | Coders. General | 24 | 01 February 2010 03:00 |
|
|