Sevenup internal file format

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
Ralf
Rick Dangerous
Posts: 2283
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Sevenup internal file format

Post by Ralf »

I suppose it's not only me who uses Sevenup utility for graphics in their Spectrum games ;)

Sevenup allows exporting picture data to binary or series of .BYTE commands. But it also has own file format called .sev

Is there any documentation available about this .sev format ? How it stores and organises data ?

I consider reading and parsing Sevenup files in my own PC based tool so this info would be really valuable to me.
User avatar
g0blinish
Manic Miner
Posts: 282
Joined: Sun Jun 17, 2018 2:54 pm

Re: Sevenup internal file format

Post by g0blinish »

According to source:

Code: Select all

        else if (ext=="SEV")
                {               // Load .SEV file
                file.read(LoadBuff,45000);
                file.close();
                flagsure=0;
                if(LoadBuff[0]!='S'||LoadBuff[1]!='e'||LoadBuff[2]!='v'||LoadBuff[3]!='\0')
                        {
                        wxString strg;
                        strg=path+" is an invalid file!";
                        (void)wxMessageBox(strg, "Warning!");
                        OpenGraph->Propied1=0;
                        return;
                        }
                else
                        {
                        if (LoadBuff[4]==0&&LoadBuff[5]==0)
                                {       // v0.0 format
                                delete OpenGraph;
                                int P1=(unsigned char)LoadBuff[6]+256*(unsigned char)LoadBuff[7];
                                int P2=(unsigned char)LoadBuff[8]+256*(unsigned char)LoadBuff[9];
                                int SX=(unsigned char)LoadBuff[10]+256*(unsigned char)LoadBuff[11];
                                int SY=(unsigned char)LoadBuff[12]+256*(unsigned char)LoadBuff[13];
                                if ((P1!=1)||(P2!=0)||(SX>256)||(SY>192))
"sev" - signature
dw P1,p2 -?
dw sx,sy - size?
Ralf
Rick Dangerous
Posts: 2283
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Sevenup internal file format

Post by Ralf »

Thanks. But I hoped for something more friendly than source code ;)

I'm especially interested what is the structure of .sev file for masked sprite.

Btw, anybody knows if Metalbrain, the author of Sevenup is still active on Spectrum scene?

Actually I could have a feature request for Sevenup but being realistic I will have to do it myself so I'm asking about the format ;)
User avatar
Stefan
Manic Miner
Posts: 804
Joined: Mon Nov 13, 2017 9:51 pm
Location: Belgium
Contact:

Re: Sevenup internal file format

Post by Stefan »

hikoki
Manic Miner
Posts: 576
Joined: Thu Nov 16, 2017 10:54 am

Re: Sevenup internal file format

Post by hikoki »

[mention]Metalbrain[/mention] may help explain this point as he is the author of Sevenup :)
Ralf
Rick Dangerous
Posts: 2283
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Sevenup internal file format

Post by Ralf »

Yes :)
I wouldn't expect to find it there, on Zx Modules website.
Jonathan
Drutt
Posts: 11
Joined: Sun Feb 18, 2018 6:55 pm
Contact:

Re: Sevenup internal file format

Post by Jonathan »

I wrote a SevenUp sprite importer for MPAGD, though it doesn't handle masked sprites. The way I figured out the format was to create some basic sprites and save them, then load the file into a Spectrum emulator as a binary and look at the format in denary and hex. It was simple enough to figure out IIRC. A simple shape with a simple mask you can recognise in the data should tell you how it's constructed.
Not on Twitter, left the Spectrum scene on 4th December 2018. Thanks folks, it was a pleasure knowing you.
http://www.spanglefish.com/egghead/
http://arcadegamedesigner.proboards.com/
https://jonathan-cauldwell.itch.io/
Ralf
Rick Dangerous
Posts: 2283
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Sevenup internal file format

Post by Ralf »

You are right, Jonathan . Instead of writing an universal, complicated parser, it would be easier, faster and more efficent to deal just with the case you actually need to use.

I may try this approach, actually I haven't done any job with Sevenup file parsing yet.
User avatar
Metalbrain
Microbot
Posts: 107
Joined: Thu Feb 15, 2018 2:14 pm

Re: Sevenup internal file format

Post by Metalbrain »

Hi Ralf,

Sorry about the late response, I was on vacations. Here's a hurried translation of the format, as I documented it back in 2005, for the es.comp.sistemas.sinclair newsgroup (
https://groups.google.com/forum/#!searc ... v1tqjGe1YJ ). Previously (late 2003 or early 2004) I had written it in english for Tony Thompson, but I lost that email.

------
First is the header, 14 bytes:

00-03 Signature 'Sev',0
04 Mayor version. Valid values: 0
05 Minor version. Valid values: 0,6,8
06-07: Property 1:
In version 0.0: fixed to 1
From 0.6: 1 unmasked, 2 masked
08-09: Property 2:
In versions 0.0 and 0.6, fixed to 0
In version 0.8: Number of frames - 1
10-11: X size, in pixels
12-13: Y size, in pixels

Then come the graphics data, stored with the following "Byte sort priority":

Char line
X Char
Y Char
Mask
Frame

with attributes as 9th byte (Interleave Character)

So, by complete characters with attributes, by rows, each mask (if it exist) right after its graphic (in this case without attribute, 8 bytes instead of 9) and the different graphics (or graphic+mask pairs) of a sprite one after the other.
--------------

I know it's quite sparse, and the information in ZXModules page has more details, so it's probably more useful (and doesn't require a deep knowledge of how the sorting options work).

I'm not active lately, but I'm always willing to help and optimize in Retroworks projects (or fixing some +2A incompatibility).
Ralf
Rick Dangerous
Posts: 2283
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Sevenup internal file format

Post by Ralf »

Thanks for the answer Metabrain.

Actually I didn't do further work with parsing Sevenup files (real life gets in your way, as usual :( ) but I may return to it later and maybe this info will be helpful for someone else too.

So maybe let me write what I'm missing with Sevenup.

I'd like to be able to export correctly pictures containing many tiles or sprites, these things are usually called "sprite sheets" or "tile sheets".
Have a look at part of memory exported from Robocop:

Image

So we have a picture which actually consist of smaller pictures. In case above they are tiles 16x16 pixels big which are stored in memory in most simple, linear way - top left byte, top right byte, 2nd line left byte, 2nd line right byte etc...

The order of the tiles is also important - does it go by rows or by columns. If tile nr 1 is in left top corner then is tile nr 2 is below of it or right to it.

I imagine it working in application like Sevenup like and extra "layer" of data ordering. Currently you can process one tile or sprite and define order of bytes in exported data by making some hierarchy what goes first and what goes later - mask, attributes, characters, rows, columns etc. It's quite confusing, especially for beginners, but with some experience and trial and error you may get what you want:

Image

So as an option you could add "tile sheet". It would require single tile size and tile order in the picture. Th program would export data tile by tile and for a single tile would use existing options as tile data order.

If you ever return to Sevenup Metalbrain, please consider my suggestion :) No hurry definitely but I believe it could be useful and used (at least by me ;) )
Post Reply