Files created by OPENOUT

Discuss all aspects of programming here. From 8-bit through to modern architectures.
Post Reply
User avatar
Dreamland Fantasy
Posts: 553
Joined: Fri Dec 29, 2006 12:15 am
Location: Glasgow, UK
Contact:

Files created by OPENOUT

Post by Dreamland Fantasy » Wed Jul 11, 2018 7:36 pm

Hi there,

Are there any technical details of the file format used by files created using the OPENOUT command?

Kind regards,

Francis
Dreamland Fantasy Studios
http://www.dfstudios.co.uk

User avatar
dv8
Posts: 140
Joined: Mon Jun 22, 2009 9:07 pm
Contact:

Re: Files created by OPENOUT

Post by dv8 » Wed Jul 11, 2018 9:11 pm

Assuming this is what you mean, the info is in the User Guide entry for the PRINT# keyword on page 328:
Integer variables are written as &40 followed by the two’s complement representation of the integer in four bytes, most significant byte first.

Real variables are written as &FF followed by four bytes of mantissa and one byte exponent. The mantissa is sent lowest significant bit (lsb) first. 31 bits represent the magnitude of the mantissa and 1 bit the sign. The exponent byte is in two’s complement excess 128 form.

String variables are written as &00 followed by a 1 byte “byte count” followed by the characters in the string in reverse order.

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

Re: Files created by OPENOUT

Post by jgharston » Wed Jul 11, 2018 9:42 pm

Dreamland Fantasy wrote:
Wed Jul 11, 2018 7:36 pm
Are there any technical details of the file format used by files created using the OPENOUT command function?
Any files created by any method have no format, they are pure binary. Any internal format of the binary data is entirely and completely down to the programmer chosing what to so with it.
Last edited by jgharston on Wed Jul 11, 2018 9:43 pm, edited 1 time in total.

Code: Select all

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

User avatar
Dreamland Fantasy
Posts: 553
Joined: Fri Dec 29, 2006 12:15 am
Location: Glasgow, UK
Contact:

Re: Files created by OPENOUT

Post by Dreamland Fantasy » Wed Jul 11, 2018 10:19 pm

dv8 wrote:
Wed Jul 11, 2018 9:11 pm
Assuming this is what you mean, the info is in the User Guide entry for the PRINT# keyword on page 328:
Yes, that is exactly what I am looking for. :)

Kind regards,

Francis
Dreamland Fantasy Studios
http://www.dfstudios.co.uk

Coeus
Posts: 956
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Files created by OPENOUT

Post by Coeus » Sat Jul 14, 2018 8:13 pm

jgharston wrote:
Wed Jul 11, 2018 9:42 pm
Dreamland Fantasy wrote:
Wed Jul 11, 2018 7:36 pm
Are there any technical details of the file format used by files created using the OPENOUT command function?
Any files created by any method have no format, they are pure binary. Any internal format of the binary data is entirely and completely down to the programmer chosing what to so with it.
It is true that the filing system API does not impose a structure on file - they are simply a sequence of bytes. BASIC, on the other hand does always write its data types to files in a particular way. Of course, it is still up to the BASIC program which variables to write to the file in what order and what they means.

User avatar
tautology
Posts: 369
Joined: Wed Sep 01, 2010 2:26 pm
Contact:

Re: Files created by OPENOUT

Post by tautology » Sun Jul 29, 2018 11:43 pm

I wrote a basic openup library years ago (my local drive has a date stamp on the files of 2011) and a simple dumper, this can be found on my github page: https://github.com/tautology0/dataconve ... ter/openup

The code is a bit hacky.

User avatar
Dreamland Fantasy
Posts: 553
Joined: Fri Dec 29, 2006 12:15 am
Location: Glasgow, UK
Contact:

Re: Files created by OPENOUT

Post by Dreamland Fantasy » Mon Jul 30, 2018 12:15 am

tautology wrote:
Sun Jul 29, 2018 11:43 pm
I wrote a basic openup library years ago
Thanks for that. I've written my own library sans the floating point stuff since I don't need that at present. Your code might be useful to look at if I do ever need to read/store floating point numbers in the future or even just to add for completeness. :)

Kind regards,

Francis
Dreamland Fantasy Studios
http://www.dfstudios.co.uk

Post Reply