how can we cross-compile to .cas and .dsk instead of .rom?

Página 1/2
| 2

Por nitrofurano

Champion (287)

Imagen del nitrofurano

29-04-2016, 22:34

Hi! Some of you might know my humble experiences on cross-compiling to MSX .rom files with Boriel’s ZX-Basic Compiler in these years: http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Pr...

My question is: how can i do the same for .cas and .dsk files, instead of .rom?

The process i used on that was using bash scripts on GNU/Linux (the .sh files you might find on the links from the url above), and i wanted to do the same for .cas or .dsk (as imaginable, GNU/Linux binaries, or Python/Perl/Lua/Ruby scripts are preferable - using dos or ms-windows for that task would be a pain )

Or in the case that these tools that doesn’t exist (binary file embedders for .cas or .dsk), where from can we find technical info that might help us to code such tools?

And in the case that .rom converters to .cas, or to .dsk, might exist (also GNU/Linux binaries or Python/Perl/Lua/Ruby scripts ), where from can we find them?

thanks in advance!
(btw, i guess the same question i guess would also apply to all other cross-compilers, like Pasmo, z88dk, wla-dx, and others)

Login sesión o register para postear comentarios

Por tvalenca

Paladin (728)

Imagen del tvalenca

29-04-2016, 22:47

.CAS and .DSK aren't native formats of MSX. Neither of those file formats could be directly loaded on MSX, both need special loaders (and DSK need an external device to do it).

But if you're using emulators to develop (And I think you are because you're asking for those file formats), both openMSX and blueMSX have an useful feature called "dir as disk". You place your binary files on a folder, then you tell your emulator to use that folder as disk and that's all. IMHO, this is as easy(and useful) as it can possibly be.

Por zPasi

Champion (474)

Imagen del zPasi

29-04-2016, 23:07

Z88dk supports rom, cas, bin (bloadable), msxdos com and dsk, right from the box. It does that via a tool called appmake. It might be possible to use that tool with other compilers' binaries as well.

But I don't use that dsk much, beacuse that dir as disk feature does very good.

Por nitrofurano

Champion (287)

Imagen del nitrofurano

29-04-2016, 23:21

tvalenca wrote:

.CAS and .DSK aren't native formats of MSX. Neither of those file formats could be directly loaded on MSX, both need special loaders (and DSK need an external device to do it).

.cas can be converted to .wav, and .dsk can be extracted into real floppies, can’t they? that was the idea as well, besides emulation

Quote:

But if you're using emulators to develop (And I think you are because you're asking for those file formats), both openMSX and blueMSX have an useful feature called "dir as disk". You place your binary files on a folder, then you tell your emulator to use that folder as disk and that's all. IMHO, this is as easy(and useful) as it can possibly be.

i remember that exist (easily available from openmsx-catapult somewhere, i guess), but it is a quite toilsome process for what i needed - i just wanted to create everything from a bash script automatically, without needing to drag or browse anything, just like what i do for .rom files, and i can imagine it is or can be perfectly possible

Por nitrofurano

Champion (287)

Imagen del nitrofurano

29-04-2016, 23:33

zPasi wrote:

Z88dk supports rom, cas, bin (bloadable), msxdos com and dsk, right from the box. It does that via a tool called appmake. It might be possible to use that tool with other compilers' binaries as well.

thanks, and i'm now seeing https://github.com/dex4er/deb-z88dk/blob/master/src/appmake/... - isn’t that appmake only for converting a binary file into a “bloadable” one? embedding a bloadable into a .cas or .dsk i think is a quite more complex process (and .com is another thing i might be going to try later, not for this case yet)

Quote:

But I don't use that dsk much, beacuse that dir as disk feature does very good.

yes it is quite often useful on lots of other situations, but not exactly for what i’m needing there

Por Manuel

Ascended (15835)

Imagen del Manuel

29-04-2016, 23:48

A bloadable file shouldn't be that hard to convert to any of these container formats, should it?

Por NYYRIKKI

Enlighted (5401)

Imagen del NYYRIKKI

30-04-2016, 03:42

Latest version of Disk Manager has a very welcome feature that you can insert files from commandline... It is easy to include it now to your make-script.

For CAS-files I don't know if there is such a handy tool since I don't use those... How ever it is not hard to include CAS-file header to your project... Practically you need to know that in CAS-file the header is replaced with:#1F, #A6, #DE, #BA, #CC, #13, #7D, #74 and this is always stored in address that can be divided by 8.

Now just replace the BIN-file first header-byte (#FE) with: "cassette header", #D0 * 10, "program name" (6 characters), "cassette header"

You can use ie. this template:

	output "EXMPLE.CAS"
macro header
     db #1F, #A6, #DE, #BA, #CC, #13, #7D, #74
endmacro

	header
	db #D0,#D0,#D0,#D0,#D0,#D0,#D0,#D0,#D0,#D0
	db "EXMPLE"
	header
	dw begin,end,start
	
	org #c000
begin:
start:
	ret
end:

Por Alcoholics_Anonymous

Resident (39)

Imagen del Alcoholics_Anonymous

30-04-2016, 03:41

nitrofurano wrote:
zPasi wrote:

Z88dk supports rom, cas, bin (bloadable), msxdos com and dsk, right from the box. It does that via a tool called appmake. It might be possible to use that tool with other compilers' binaries as well.

thanks, and i'm now seeing https://github.com/dex4er/deb-z88dk/blob/master/src/appmake/... - isn’t that appmake only for converting a binary file into a “bloadable” one? embedding a bloadable into a .cas or .dsk i think is a quite more complex process (and .com is another thing i might be going to try later, not for this case yet)

Most copies of the z88dk repository are many years old. You should go to the source instead:

http://z88dk.cvs.sourceforge.net/viewvc/z88dk/z88dk/src/appm...

It does the formats listed as well as create a wav file that you can record to tape.

appmake can take any binary, generated by z88dk or not, and create a wide variety of output formats expected by different z80 machines.

Por zPasi

Champion (474)

Imagen del zPasi

30-04-2016, 13:33

But beware: if you're making a bloadable, currently the starting address for that is fixed to 40000 (= &H9C40). You can change the starting org by #pragma output myzorg in C, and it works, but you have to handle the bloading address in BASIC.

For example: i have
#pragma output myzorg=34816 // = 8800
in my main C program, then I use
BLOAD"mybin.msx",-&H1440
to load the binary in &H8800.

In z80asm that would be defc myzorg = 34816

But if you're not using the C runtime, just simply ORG or whatever your compiler uses.

Por Timmy

Expert (114)

Imagen del Timmy

30-04-2016, 14:52

zPasi wrote:

Z88dk supports rom, cas, bin (bloadable), msxdos com and dsk, right from the box. It does that via a tool called appmake.

I really appreciate that there is a choice of file formats z88dk can compile to. That being said, I don't think I will make anything other than rom files now that z88dk can make them.

My first tests were made with cas files and I had (and still have) no idea how to load them.

Por Alcoholics_Anonymous

Resident (39)

Imagen del Alcoholics_Anonymous

30-04-2016, 18:01

Appmake's msx target could probably use a little love. I think cas format is purely an emulator format and the tape format for a real machine is supposed to go via audio recording of the wav output.

"appmake +msx" shows what you can do for the msx target:

appmake +msx (bin2msx)

(C) 2001 Stefano Bodrato

Adds a file header to enable the program to be loaded using 'bload "file.bin",r

Options:

-h   --help            (bool)    Display this help
-b   --binfile         (string)  Linked binary file
-c   --crt0file        (string)  crt0 file used in linking
-o   --output          (string)  Name of output file
     --fmsx            (bool)    fMSX CAS format
     --audio           (bool)    Create also a WAV file
     --fast            (bool)    Tweak the audio tones to run a bit faster
     --dumb            (bool)    Just convert to WAV a tape file
     --loud            (bool)    Louder audio volume

There's no way to set an org there.

In contrast the spectrum as target can do:

appmake +zx

appmake +zx (bin2tap)

(C) 2000,2003 Dominic Morris & Stefano Bodrato

Generates a .TAP file complete with BASIC header, optional WAV file

Options:

-h   --help            (bool)    Display this help
-b   --binfile         (string)  Linked binary file
-c   --crt0file        (string)  crt0 file used in linking
-o   --output          (string)  Name of output file
     --audio           (bool)    Create also a WAV file
     --ts2068          (bool)    TS2068 BASIC relocation (if possible)
     --turbo           (bool)    Turbo tape loader
     --extreme         (bool)    Extremely fast save (RLE)
     --patchpos        (integer) Turbo tape patch position
     --patchdata       (string)  Turbo tape patch (i.e. cd7fff..)
     --screen          (string)  Title screen file name
     --fast            (bool)    Create a fast loading WAV
     --dumb            (bool)    Just convert to WAV a tape file
     --noloader        (bool)    Don't create the loader block
     --merge           (string)  Merge a custom loader from external TAP file
     --org             (integer) Origin of the binary
     --blockname       (string)  Name of the code block in tap file

where it's possible to set an org.

The reason why this is important is because spectrum tap files include a short basic loader that loads the binary to the right address and executes it.

If the msx version doesn't generate any auto loader then maybe org doesn't apply.

Anyway, the msx appmake target probably needs some attention to produce convenient output formats for current emulators and the real machine. The msx doesn't get as much attention as it should in z88dk because there aren't any msx experts in the z88dk project.

Quote:

For example: i have
#pragma output myzorg=34816 // = 8800
in my main C program, then I use
BLOAD"mybin.msx",-&H1440
to load the binary in &H8800.

In the classic library, the myzorg thing is only supported by a few target crts. It's really an adhoc thing that was added to some targets as it was seen necessary.

The new library does things much better I think with lots of pragmas to control execution environment at compile time:

http://www.z88dk.org/wiki/doku.php?id=temp:front#crt_configu...

So you would use "#pragma output CRT_ORG_CODE = 30000" to set org address if the default for the target is not what is wanted.

There is quite a bit going on in the classic library now to make it compatible with sdcc but once that's done, I think adopting the crts from the new c lib into the classic c lib as targets are added is probably the way to go. Hopefully the other devs see it the same way :)

Página 1/2
| 2