Next basic snippets

The Speccy's spritely young offspring. Discuss everything from FPGA to ZX
funkheld
Dizzy
Posts: 55
Joined: Tue May 18, 2021 9:01 pm

Re: Next basic snippets

Post by funkheld »

Hi good afternoon.

The SL2 is a converted BMP.
- BMP with 256 colors 256x192 pixels
- BMP was tilted Vertical
- 1072 bytes were removed from the beginning
- new BMP now has 49152 bytes and can be loaded in NextBasic

Such a conversion program can be done quickly
write yourself.

Greeting
User avatar
Jbizzel
Dynamite Dan
Posts: 1538
Joined: Mon May 04, 2020 4:34 pm
Location: Hull
Contact:

Re: Next basic snippets

Post by Jbizzel »

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?
Image
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.
User avatar
flatduckrecords
Manic Miner
Posts: 819
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: Next basic snippets

Post by flatduckrecords »

PeterJ wrote: Mon May 02, 2022 5:55 pm This time @PaulJ looks at the Home Computer Club.
Geoff's bit in the latest Spectrum Show has a nice intro to palette cycling. I've seen it used for cool stuff on the Megadrive (water, lava effects) and Jon Burton described a really cool technique to turn a handful of (very carefully set up) animation frames that can be smoothed out efficiently by rotating the palette in between frames. I'm not sure to what extent that's applicable in Next BASIC, but it seems like a potentially very useful technique?
User avatar
flatduckrecords
Manic Miner
Posts: 819
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: Next basic snippets

Post by flatduckrecords »

PeterJ wrote: Mon May 02, 2022 5:55 pm This time @PaulJ looks at the Home Computer Club.
Geoff's bit in the latest Spectrum Show has a nice intro to palette cycling. I've seen it used for cool stuff on the Megadrive (water, lava effects) and Jon Burton described a really cool technique to turn a handful of (very carefully set up) animation frames that can be smoothed out efficiently by rotating the palette in between frames. I'm not sure to what extent that's applicable in Next BASIC, but it seems like a potentially very useful technique?
User avatar
Luzie
Manic Miner
Posts: 913
Joined: Fri May 01, 2020 2:07 pm

Re: Next basic snippets

Post by Luzie »

Jbizzel wrote: Sun Apr 03, 2022 7:25 pm @Luzie the problem the tranz Am is that the level background changes, sometimes black, sometimes yellow.
@Jbizzel Only yet find time to test a little bit more on this... Tranz-Am in Night Mode with your Background Image in SpecNext Layer 2 with Transparency and Trees looks bit like Christmas :D :

Image
User avatar
Jbizzel
Dynamite Dan
Posts: 1538
Joined: Mon May 04, 2020 4:34 pm
Location: Hull
Contact:

Re: Next basic snippets

Post by Jbizzel »

Nice!

Does it work for both the yellow background and the black background? Or is that impossible, do you think?
User avatar
Luzie
Manic Miner
Posts: 913
Joined: Fri May 01, 2020 2:07 pm

Re: Next basic snippets

Post by Luzie »

Jbizzel wrote: Tue Dec 06, 2022 10:51 pm Nice!

Does it work for both the yellow background and the black background? Or is that impossible, do you think?
Impossible is nothing :lol:, but for this we need to change the original games code. And I personally prefer Night/Day-Change on Tranz-Am.

I not yet find many time to test further with Transparency/Layer 2. ATM I´m into reading the SpecNext Manual.

Is your Background JUNGLED.SL2/NextBASIC-Code free for distribution? Maybe one could do a "Jungle-Edition-Package" of Games like Silversofts Orbiter or Bug-Bytes Spectral Invaders :D ... like this:

Image

Image
User avatar
Jbizzel
Dynamite Dan
Posts: 1538
Joined: Mon May 04, 2020 4:34 pm
Location: Hull
Contact:

Re: Next basic snippets

Post by Jbizzel »

@Luzie yes of course, have fun! The background looks good for all of those games :)
User avatar
Luzie
Manic Miner
Posts: 913
Joined: Fri May 01, 2020 2:07 pm

Re: Next basic snippets

Post by Luzie »

ATM I´m experiment with some free Background Pictures from royalty free pictures from Images-Site: https://www.publicdomainpictures.net
than cropping them to 256x192 Pixels and than convert them to Nexts .SL2-Format with Remy Sharps Tools at: https://zx.remysharp.com/tools/:

Image
Post Reply