Sharp X1 Executables

Post Reply
famiac
New member
Posts: 6
Joined: Mon Jun 27, 2016 6:34 am

Sharp X1 Executables

Post by famiac »

Hey all,

I'm trying to compile a hello world to run on a cassette tape for the Sharp X1, but I'm having some trouble getting the emulator to recognize the program. The header of the compiled binary says it's a tape file, but I could be mistaken.

I'm compiling using:
zcc +x1 -lndos -o hello hello.c

If I try to use -create-app, I get an error.
I did include x1.h in the source code

Thanks for the help.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

There is no create-app provision for the x1 so the output will just consist of a binary.

There are some details on using the binary with an emulator here:

http://www.z88dk.org/wiki/doku.php?id=platform:x1
famiac
New member
Posts: 6
Joined: Mon Jun 27, 2016 6:34 am

Post by famiac »

Thank you. I can't seem to find the Xbrowser88 program mentioned.

I did find some specs about the tap format. They're in Japanese, though. I managed to convert it to UTF-8 and run the file through google translate.

I can upload it if it would be helpful
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

It seems some tools may have disappeared from the internet. Xbrowser88 should have been something that can create disk images.

Yes, some information on the cassette format might be helpful.
famiac
New member
Posts: 6
Joined: Mon Jun 27, 2016 6:34 am

Post by famiac »

Here is the text:
The format of the new ".TAP" file of the T-tune

Header offers a basis to record the beginning of the file.

offset: size:
00H: 4: identification index "TAPE"
04H: 17: tape name of (asciiz)
15H: 5: reserve
1AH: 1: write-protect notch (00H = writable, 10H = write-protected)
1BH: 1: type of recording format (01H = constant speed sampling method)
1CH: 4: sampling frequency (Hz units)
20H: 4: the size of the tape data (in bits)
24H: 4: position of the tape (in bits)
28H:?: Tape of data

※ structure of the C language can be found in the "misc \ new_tap.h".

- Identification index
Old (format of the conventional X1EMU) and for the extension is the same,
On whether the "identification index" is "TAPE", you can identify both.
Old-fashioned in the are recorded the frequency at the "identification index".

Tape name of (asciiz)
Currently, to do not use, I do not even see.

?Reserve
As of reading

- Write-protect notch
Offset, I tried to match the value in d88.
Or much sense there is no?

And type of recording format
Such as write-protected of the master tape, more efficiently
So can be recorded, it may be compressed. . . Speculation that.
If you are writing, as a matter of course "constant speed sampling method".

Sampling frequency (Hz units)
Same as the one that is recorded in the old-style head.
Would say the one bit of length = sampling frequency.

Size of the tape data
The number of bits of the "tape of the data."
The actual file size is, in some cases less than this value.
If it is written in a position that exceeds the file size, file size
We'll extend the.

Tape of position (in bits)
Tape playback position indicates somewhere.
Bit unit offset from the beginning of the "tape of the data."

Tape of data
The actual data from which is recorded.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Is there any more technical information available for the x1?

Which emulator are you using? The main one seems to be: http://www.zophar.net/sharp-x1-turbo/x-millennium.html ?

I expect the tape data has to be put in the form required by the x1 rom code, so I don't think it is just a raw binary. For example, other targets differentiate between basic programs, code data, variable data and they do this by writing header files to tape that identify data type and other parameters. This is solely implemented in the target's ROM code so would be separate from the emulation code.
famiac
New member
Posts: 6
Joined: Mon Jun 27, 2016 6:34 am

Post by famiac »

I am using the X1 emulator available here. It seems to be the latest available software.

http://x1center.org/emu.html

I'm afraid most of the technical documentation is in Japanese. Some more info can be found at http://www.x1center.org/

The boot rom can be found using google. I believe the file is called IPLROM.X1 for the regular Sharp X1 (non-turbo)
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Yes, they are the latest emulator versions I'm aware of.
XBrowser88 was on "x1s.org" in 2013, the website is no longer existing and no good backups exist on archive.org.
By the way I have a copy of the executable: perhaps we can add it in the wiki ?
Otherwise I could reverse-engineer its output to create valid disk images.. building empty disk images containing just a single file shouldn't be too difficult.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

That's one thing I'm noticing a lot of these days - sites vanishing that offered the useful emulator tools.

I'm not adverse to providing storage space and a sub-domain to lodge those effectively orphaned binaries and source code.

@stefano, drop me an email and we can sort something out.
Rink
Member
Posts: 15
Joined: Wed Oct 16, 2013 8:43 pm

Post by Rink »

Ack. Can't believe it's been so long since I found time to do any X1 stuff.

Stefan has given me a kick up the arse - so we'll get XBrowser88 back online and, at some point, updated/debugged/improved. I wrote some code for tapes a while back - not entirely sure where it is - and it was never tested on a real X1 since none of mine have working tape drives (most are disk-based ones). Famiac, what do you need? Or are you fine with disks?

For development, particularly in emulators, I'd recommend the disks.

All the best.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Rink, thank you for showing up ! I'd like to have you aboard.. a simplified C tool would go straight into appmake, if you ever find some time ;)
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

.. in the meanwhile, with the Rink's permission, we're publishing a local copy of the tool.. Famiac, I'll be glad to help on any further question !

http://z88dk.org/wiki/doku.php?id=platf ... ints_tools
Rink
Member
Posts: 15
Joined: Wed Oct 16, 2013 8:43 pm

Post by Rink »

Will get on it this week mate. Won't (initially anyway) have all the same features as XBrowser88 but I can definitely get you something.

Also: if anyone does use XBrowser88 and finds bugs / has suggestions etc. then feel free to leave them here or drop me a message.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

I checked the current X1 target port and adjusted few small problems.
The updated version now supports an 80 columns mode (see the wiki page at the link above).
There is still a stability problem somewhere, it seems to happen more frequently when the the text scrolls but I still haven't got the bug.
The fact that "vtstone.c" seems to run fine while othello.c gets odd when the display scrolls seems to prove it.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

I now remember the reason for the "stability" problem !
It is most probably consequent to the fact that, when using the big binaries "boot" model, the display page location overlaps the program at $3000 (more or less).
A different memory bank is used, but obviously the paging portion needs to be placed somewhere else and there are probably other side effects I haven't yet fully understood.
I'm now wondering if we now have on the z80asm linker some quick'n'dirty workaround to exclude a memory range ?
Rink
Member
Posts: 15
Joined: Wed Oct 16, 2013 8:43 pm

Post by Rink »

The good news is: I'm working on the command-line tool at last. :-)

What source license model are you using for Z88DK's build tools? I hate asking questions like this on a forum, but I'm not entirely sure where the source is for appmake etc.

Cheers.

R
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Rink wrote:The good news is: I'm working on the command-line tool at last. :-)
Nice :)
What source license model are you using for Z88DK's build tools? I hate asking questions like this on a forum, but I'm not entirely sure where the source is for appmake etc.
The default license is the clarified artistic license:

http://www.z88dk.org/wiki/doku.php?id=t ... nt#license

However there is some source code in the project from other sources with different licenses that are compatible with the points made in that description.


If you're using Visual Studio, you can use the solution file in z88dk/src/win32/z88dk.sln to load up the source code. The platform toolset is v140 which is compatible with VS2015 but you can compile with VS2010 or later if the toolset is changed to v100 for each project in the solution. v140 will be required for the next version of z80asm which is currently being worked on under the z80asm2 moniker (z80asm2 will not compile so don't worry about that).

If you're compiling with mingw or cygwin you should be able to run the batch file in z88dk/src/gccmake.bat

If you're using a unix-like system you can build the executables with the makefile in z88dk/

The source code itself is in z88dk/src and appmake is in z88dk/src/appmake


appmake takes output binaries and transforms them into another form suitable for the target. It is invoked through two different paths -- one way is via the compile chain if "-create-app" is on the compile line and the other way is as a standalone invocation. appmake.c itself only acts like a switch, calling a specific program associated with a target.

If you enter "appmake" on the command line you will get a list of these targets. One is "+zx" which is used for making zx spectrum format files, another is "+rom" which is used to make files meant for storage in rom. You can get help for a specific target by running, eg, "appmake +zx" or "appmake +rom", etc.

If appmake is invoked directly, it will be done as in "appmake +rom ...." and options will provide information on what needs to be done to a binary. If appmake is invoked by the compile chain, the compile chain will fill in those options automatically.

Your task would be to write an x1.c subroutine that will take those options and produce a suitable output file. If you look at the rom.c file as an example (I worked on this most recently so it's fresh) you will see that it's set up to declare static variables with default values for the options, then a struct that describes all acceptable options. Those options are filled in by appmake.c before rom.c (or your x1.c) is called. You read those options to figure out what to do.

The compile chain invokes appmake through this command line:

snprintf(buffer, sizeof(buffer), "%s %s -b %s -c %s", c_appmake_exe, appmakeargs ? appmakeargs : "", outputfile, c_crt0);

It will pass the appmakeargs which are optionally added by the user to the compile line, it will indicate the output binary name with -b and it will supply the crt filename. The crt filename allows rom.c, etc, to look up some compile information like org address.


If you take a look at rom.c and some other implementations in the z88dk/src/appmake directory you will get an idea of how things work.
Rink
Member
Posts: 15
Joined: Wed Oct 16, 2013 8:43 pm

Post by Rink »

I'm happy with any license to be honest. Just wanted to check what you were using, and I'll use the same.

Thanks for all the info about appmake - that's really helpful. I mostly have a standalone command-line tool working now. Been fun - I rarely write for Linux, but have been using Cygwin for this to help with compatibility when code is transferred. I've also uncovered a massive bug in XBrowser88 - it totally miscalculates whether a file will actually fit on a disk. Ooops.

:)
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Wonderful, looking forward to have the files to publish ;)
famiac
New member
Posts: 6
Joined: Mon Jun 27, 2016 6:34 am

Post by famiac »

Rink wrote:Ack. Can't believe it's been so long since I found time to do any X1 stuff.

Stefan has given me a kick up the arse - so we'll get XBrowser88 back online and, at some point, updated/debugged/improved. I wrote some code for tapes a while back - not entirely sure where it is - and it was never tested on a real X1 since none of mine have working tape drives (most are disk-based ones). Famiac, what do you need? Or are you fine with disks?

For development, particularly in emulators, I'd recommend the disks.

All the best.
Goodness, I've been out for a while. I was really busy over the summer and didn't have time to do any programming.

this is all wonderful news. I'll be trying to get my hands on a disk drive model sometime soon, as per your recommendation, but I currently only have a tape-based X1.

Thanks a ton to all of you for helping keep this platform alive.
famiac
New member
Posts: 6
Joined: Mon Jun 27, 2016 6:34 am

Post by famiac »

Rink, sorry to bother you, but could you please check your email when you get the chance? Thank you!
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

For the record, appmake is now able to create boot disk images ;)
Post Reply