Luzie wrote: ↑Sun Apr 03, 2022 4:36 pm
Jbizzel wrote: ↑Wed Mar 23, 2022 10:52 pm
This code loads lets you select an .SL2 image and a tap game, and then it adds a layer 2 BG. Black is transparent.
@Jbizzel How can we change the transparency colour from NextBASIC? Maybe with the "Global Transparency Register" $14 ?
https://wiki.specnext.dev/Global_Transparency_Register
Short Description Sets the "transparent" colour for Layer 2, ULA and LoRes pixel data.
is this the way to maybe change transparency colour to bright yellow for displaying a Layer 2 picture under Tranz Am´s brihgt yellow (ATTR=112 dez/01110000 bin
http://www.overtakenbyevents.com/lets-t ... en-layout/) Playfield?
This from FB, in case it helps others here:
These are the Next palette indexes for the standard ULA colours.
Dim Ink: 0..7
Bright Ink: 8..15
Dim Paper: 16..23
Bright Paper: 24..31
Within those sets of eight the normal Spectrum colour sequence applies: black (0), blue (1), red (2), magenta (3), green (4), cyan (5), yellow (6) and white (7).
Running programs use the ULA first palette (palette 0).
The global transparency colour can be read from and written to REG 20. The default value in BASIC is 227, which is a shade of magenta that's not used anywhere else in the ULA palette. So this is a good value to use.
What you want to do is decide which background colour(s) the game uses, and work out the palette indexes for those colour(s), and redefine them as the global transparency colour.
So for example, if the game uses dim blue paper for its background colour, the palette index for that would would be 16 (dim paper) + blue (1) = 17. So write this program:
10 REG 20, 227; Set global transparency
20 REG 67, 0; Select palette 0 (ULA first palette)
30 REG 64, 17; Select index 16 (dim blue paper)
40 REG 65, 226; Set palette value same as global transparency
50 ; Load your game here
Note that REG 20 returns an 8bit colour not 9bit, and we're also using REG 65 to write 8bit colours. The transparency doesn't match on the 9th bit anyway, so although we could use 9 bit colours and they would work, it's not necessary and just results in longer code.