Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Radastan Mode
#1
Hi to all members of this forum, Big Grin

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

Thank you very much.
Reply
#2
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.
Reply
#3
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 )
Reply
#4
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.
Reply
#5
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...
Reply
#6
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
Reply
#7
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?
Reply
#8
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.
Reply
#9
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?
Reply
#10
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.
Reply
#11
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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)