RISC OS Sprite format

Discuss all aspects of programming here. From 8-bit through to modern architectures.
User avatar
geraldholdsworth
Posts: 294
Joined: Tue Nov 04, 2014 9:42 pm
Location: Inverness, Scotland
Contact:

RISC OS Sprite format

Postby geraldholdsworth » Thu Jul 06, 2017 1:08 pm

Following on from my other thread:
viewtopic.php?f=54&t=13352
and trying to get my head around the RISC OS Sprite format. However the PRMs (on the ROOL website) gloss over the bit about the palettes. In particular, it mentions that 256 colour palettes may only have 64 palette entries - OK, so how does one translate a colour number (from the sprite data) into a palette entry when the colour number is in the range of 0..255? (bear in mind I'm not doing this on RISC OS, so I can't use any SWI calls to translate colour numbers).

Also, the format of the palette file appears to be 6 bytes per colour. The first always seems to be 0x13 (19 in decimal), followed by the colour number, then 0x10 (16 in decimal), followed by R, G, and B (probably not in that order). I can only assume that each six bytes is a VDU19 sequence. As they all appear to be like this (that I've seen), I'm assuming I can safely ignore the 0x13 and 0x10 (and, to a large extent, the colour number)?

Cheers,

Gerald.
Gerald Holdsworth
Repton Resource Page
www.reptonresourcepage.co.uk

User avatar
davidb
Posts: 1832
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: RISC OS Sprite format

Postby davidb » Thu Jul 06, 2017 1:43 pm

Everything I knew about palettes in RISC OS sprites I coded into my spritefile Python module. The 64 palette entries appear to repeat after each run of 64 colours, but it looks like I did some bit manipulation, merging the logical colour number with the palette entry using a bitwise OR operation. I've no idea if that's correct!

The PRMs would be the place to look for this information. I think pages 1-558 and 1-559 look relevant:

Code: Select all

Bit     Meaning
0       Bit 0 of palette index
1       Bit 1 of palette index
2       Bit 2 of palette index
3       Bit 3 of palette index
4       Red bit 3 (high)
5       Green bit 2
6       Green bit 3 (high)
7       Blue bit 3 (high)

where the palette index (0 - 15) controls which VIDC palette entry is used, but with some bits of the palette entry then being overridden by the top 4 bits of the memory byte.


This probably wasn't where I got my information because I didn't have access to the PRMs when I wrote my module.

User avatar
geraldholdsworth
Posts: 294
Joined: Tue Nov 04, 2014 9:42 pm
Location: Inverness, Scotland
Contact:

Re: RISC OS Sprite format

Postby geraldholdsworth » Thu Jul 06, 2017 2:44 pm

I think I have different PRMs to you as 1-558 and 1-559 refer to something else. I think I've got the older ones somewhere, I'll need to dig out.

I did find details of the VDU19 sequence though - and the palette files certainly do appear to be what I suspected (with 0x10 being the 'mode' of programming, in which this case is program both the flashing colours to the same).
Gerald Holdsworth
Repton Resource Page
www.reptonresourcepage.co.uk

User avatar
geraldholdsworth
Posts: 294
Joined: Tue Nov 04, 2014 9:42 pm
Location: Inverness, Scotland
Contact:

Re: RISC OS Sprite format

Postby geraldholdsworth » Thu Jul 06, 2017 8:21 pm

geraldholdsworth wrote:I think I have different PRMs to you as 1-558 and 1-559 refer to something else.

Found it on pages 1-538 and 1-539 (and the surrounding pages).
Think I'll need to create some test sprites and look at the files they produce, at byte level.
Gerald Holdsworth
Repton Resource Page
www.reptonresourcepage.co.uk

User avatar
jgharston
Posts: 2661
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: RISC OS Sprite format

Postby jgharston » Thu Jul 06, 2017 10:16 pm

Most of the RISC OS file formats that are VDU related are just a pure VDU stream, palette files are a stream of VDU 19 sequences, BBCFont files are just a stream of VDU 23 sequences, etc. It means the run action can be simply *PRINT %0

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_


Return to “programming”

Who is online

Users browsing this forum: No registered users and 1 guest