FAQ  •  Register  •  Login

Radastan Mode

<<

PeekPoke

Posts: 1

Joined: Fri Jul 15, 2016 3:51 pm

Post Fri Jul 15, 2016 3:59 pm

Radastan Mode

Hi to all members of this forum, :D

Are there tutorials on how to use Radastan Mode ( 128 x 96 pixels, 16 colours)
with ZX Basic please ?

Thank you very much.
<<

Uto

Posts: 10

Joined: Sat Jul 16, 2016 12:02 pm

Post Mon Jul 18, 2016 1:24 pm

Re: Radastan Mode

Depends on what you need:

Activating the mode radastan mode needs exactly the same you need with Sinclair Basic, these two OUTs if you are using the latest core version:

OUT 64571,64
OUT 64827,3

Changing palette is also the same, if you are using ULAPlus:

OUT 48955, 64: OUT 65339, 1

and then

OUT 48955, n: OUT 65339, x

per each color from 0 to 15, where n is the color number and x is the GGGRRRBB value.

But if you need using BASIC drawing functions as PLOT, DRAW, CIRCLE, then they won't work at all. Also INK won't work.

I don't think it would be too difficult to build a PLOT primitive with inline assembler, but I'm not sure if such functions make any sense in radastan mode, which is basically made for games, so you will be using sprites rather than lines and circles.
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Mon Jul 18, 2016 1:33 pm

Re: Radastan Mode

Uto wrote:Depends on what you need:

Activating the mode radastan mode needs exactly the same you need with Sinclair Basic, these two OUTs if you are using the latest core version:

OUT 64571,64
OUT 64827,3

Changing palette is also the same, if you are using ULAPlus:

OUT 48955, 64: OUT 65339, 1

and then

OUT 48955, n: OUT 65339, x

per each color from 0 to 15, where n is the color number and x is the GGGRRRBB value.

But if you need using BASIC drawing functions as PLOT, DRAW, CIRCLE, then they won't work at all. Also INK won't work.

I don't think it would be too difficult to build a PLOT primitive with inline assembler, but I'm not sure if such functions make any sense in radastan mode, which is basically made for games, so you will be using sprites rather than lines and circles.

That's strange, because PLOT, DRAW, CIRCLE are built almost inline (no ROM calls). I don't own a ZX Uno, but maybe someone can have a look on what's going on so I can fix it.
Even more, the routines for these are implemented in the library-asm/ draw.asm, circle.asm and plot.asm files. If you can fix them I can include them in future releases.
Just use #ifdef at the beginning, and define your own macro. (i.e. #ifdef ZXUNO )
<<

Uto

Posts: 10

Joined: Sat Jul 16, 2016 12:02 pm

Post Mon Jul 18, 2016 2:41 pm

Re: Radastan Mode

I actually haven't tried, but I doubt they work, cause Radastan mode:

- Represents each pixel with 4 bits, that defines the color (0-15) while normal Spectrum uses 1 bit per pixel, and attributes are located after the first 6144 bytes that define the pixels.

- It's linear, meaning that after the data for 1st line, comes the date for 2nd line. In a normal Spectrum after data for 1st line, comes data for 8th line.

ZesarUX emulator emulates ZX-Uno pretty good, including Radastan mode, so I guess all can be tested, but be ready for a completely different video mode.
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Mon Jul 18, 2016 2:49 pm

Re: Radastan Mode

Uto wrote:I actually haven't tried, but I doubt they work, cause Radastan mode:

- Represents each pixel with 4 bits, that defines the color (0-15) while normal Spectrum uses 1 bit per pixel, and attributes are located after the first 6144 bytes that define the pixels.

- It's linear, meaning that after the data for 1st line, comes the date for 2nd line. In a normal Spectrum after data for 1st line, comes data for 8th line.

ZesarUX emulator emulates ZX-Uno pretty good, including Radastan mode, so I guess all can be tested, but be ready for a completely different video mode.

Nice to know. Then I will check ZesarUX. In the meantime, if anyone "dares" to port the plot.asm circle.asm and draw.asm routines...
<<

Uto

Posts: 10

Joined: Sat Jul 16, 2016 12:02 pm

Post Mon Jul 18, 2016 3:33 pm

Re: Radastan Mode

This is a fast sample, including a basic implemented plot routine. I'm sure is not the most optimized code, but I hope it's clarifiying:

  Code:


SUB RadastanMode(active as UByte)  '1=activate, 0=deactivate
   OUT 64571,64
   OUT 64827, 3 * active
END SUB

SUB RadastanPalette(color, rgb as UByte) ' color=0-15, rgb = binary GGGRRRBB
   OUT 48955, 64: OUT 65339, 1
   OUT 48955, color: OUT 65339, rgb
END SUB

SUB RadastanPlot(x,y,color as UByte)
  Dim Addr as UInteger
  Dim byteValue, mask as UByte
  LET Addr = 16384 + ((y*128 + x) >>1)
  LET byteValue = PEEK Addr
  LET color = color bAND 00001111b
  IF (x bAND 1) THEN
   LET mask = 11110000b
  ELSE
   LET mask = 00001111b
   LET color = color << 4
  END IF
  POKE Addr, (byteValue bAND mask) bOR color
END SUB



CLS
RadastanMode(1)
RadastanPalette(0,11111111b)
RadastanPalette(1,00011111b)
for x=1 to 50: RadastanPlot(x,x,1): next x
PAUSE 0
RadastanMode(0)
CLS
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Mon Jul 18, 2016 4:06 pm

Re: Radastan Mode

Uto wrote:This is a fast sample, including a basic implemented plot routine. I'm sure is not the most optimized code, but I hope it's clarifiying:

  Code:


SUB RadastanMode(active as UByte)  '1=activate, 0=deactivate
   OUT 64571,64
   OUT 64827, 3 * active
END SUB
[...]

CLS
RadastanMode(1)
RadastanPalette(0,11111111b)
RadastanPalette(1,00011111b)
for x=1 to 50: RadastanPlot(x,x,1): next x
PAUSE 0
RadastanMode(0)
CLS

Definitely, thanks!!
What happens when you use Radastan Mode = 0?
<<

Uto

Posts: 10

Joined: Sat Jul 16, 2016 12:02 pm

Post Mon Jul 18, 2016 4:22 pm

Re: Radastan Mode

boriel wrote:Definitely, thanks!!
What happens when you use Radastan Mode = 0?

Back to normal video mode, otherwise you can't even see the "OK 30:1" message as the routines to print chars aren't prepared either for Radastan mode.
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Mon Jul 18, 2016 4:30 pm

Re: Radastan Mode

Uto wrote:
boriel wrote:Definitely, thanks!!
What happens when you use Radastan Mode = 0?

Back to normal video mode, otherwise you can't even see the "OK 30:1" message as the routines to print chars aren't prepared either for Radastan mode.

Ok. And how can you PRINT in Radastan's mode? Have you got another routine?
<<

Uto

Posts: 10

Joined: Sat Jul 16, 2016 12:02 pm

Post Mon Jul 18, 2016 6:48 pm

Re: Radastan Mode

boriel wrote:
Uto wrote:
boriel wrote:Definitely, thanks!!
What happens when you use Radastan Mode = 0?

Back to normal video mode, otherwise you can't even see the "OK 30:1" message as the routines to print chars aren't prepared either for Radastan mode.

Ok. And how can you PRINT in Radastan's mode? Have you got another routine?


No sorry, in fact I don't have any routines, the ones I posted before I did just in 15-20 mins. The fact is Radastan mode is so different to other modes than nothing that writes to video RAM works the same, so printing fails, draw fails, character fails, etc.

I think there is an SDK for Radastan mode for z88dk C compiler, maybe its source code is helpful.
<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Tue Jul 19, 2016 9:45 pm

Re: Radastan Mode

The mode is similar to SAM Coupe mode 4, so maybe the sprote routine (with masking) can be adapted. The difference is, tat each line has not 128 Bytes, but 64.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!

Return to Help & Support

Who is online

Users browsing this forum: No registered users and 0 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO