CC65 to DSK

Questions, bug reports, features requests, ... about the Oric Software Development Kit. Please indicate clearly in the title the related element (OSDK for generic questions, PictConv, FilePack, XA, Euphoric, etc...) to make it easy to locate messages.

User avatar
8bit-Dude
Pilot Officer
Posts: 74
Joined: Tue Mar 14, 2017 1:33 pm
Location: Japan

CC65 to DSK

Post by 8bit-Dude » Tue Dec 18, 2018 3:44 pm

Hey Guyz,

I just released a new online game for the Apple//e, Atari, and C64 (see: viewtopic.php?f=23&t=1904)

The game was programmed with CC65, and I am now starting the ATMOS port. I have a few questions, the first of which is: what is the best way to pack the output of CC65 (TAP file with BASIC loader) into a disk?

Should I use the floppy builder utility? There is a documentation page, but it is rather obscure and seem to rely on some boot files that require building OSDK first of all (http://osdk.org/index.php?page=document ... ppybuilder).

Any help would be greatly appreciated, as I can only spend spare time on this project. So I am eager to overcome this first hurdle quickly.

User avatar
iss
Squad Leader
Posts: 852
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: CC65 to DSK

Post by iss » Tue Dec 18, 2018 4:47 pm

To create working DSK you need to use some tools from OSDK.
But first I think it's good idea to compile with CC65 a "plain" binary (i.e. no tap header, no basic loader).
For this you need to adjust the cfg file (attached you can find my cfg files - atmosA.cfg for assembler only projects and atmosC.cfg - for C/asm mixed projects).
You can use FloppyBuilder as in documentation page.
Or you can use 'header' and 'tap2dsk' utilities from OSDK to create Sedoric DSK file.
Attachments
atmos.cfgs.zip
(1.61 KiB) Downloaded 28 times

User avatar
Chema
Game master
Posts: 2447
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: CC65 to DSK

Post by Chema » Tue Dec 18, 2018 6:22 pm

FloppyBuilder is intended for demos and specific games, such as my Blake's 7. It does not have a filesystem.

I'd recommend using tap2dsk, as it builds a sedoric disk that can be opened, dir'd and copied with no problems.

If you plan to access data I can provide some working routines and ideas, which are also available as sources in the repository (Space:1999 and 1337 use this technique).

User avatar
Dbug
Site Admin
Posts: 2930
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: CC65 to DSK

Post by Dbug » Tue Dec 18, 2018 7:23 pm

As said previously by ISS and Chema, you have (mostly) two options: Tap2DSK and FloppyBuilder

FloppyBuilder was designed to allow you to extract every single byte of memory, but that obviously comes with a lot of specific restrictions, such as a custom build model where the Build System and FloppyBuilder interact to know the exact size of what is being built, etc... custom file format, etc...

Since you are doing that casually, and using CC65, Tap2DSK is probably the best way to get your started.

One thing to remember is that Tap2DSK generates old style DSK files, you need to convert them with old2mfm to get the final DSK file in the modern format.

Assuming you game is called SUPRSPRINT.TAP, you can just do that:

Code: Select all

tap2dsk -iCLS:SUPRSPRINT  SUPRSPRINT.TAP SUPRSPRINT.DSK
old2mfm SUPRSPRINT.DSK

User avatar
8bit-Dude
Pilot Officer
Posts: 74
Joined: Tue Mar 14, 2017 1:33 pm
Location: Japan

Re: CC65 to DSK

Post by 8bit-Dude » Wed Dec 19, 2018 1:10 am

@iss: Thanks for the config file.
It worked after I set a value for the __START_ADDRESS__ ($0501)
It is long winded, but with the following commands I can get a working disk:

cl65 -o hello.bin -Cl -O -t atmos -C atmosc.cfg hello.c
header hello.bin hello.bin $0501
tap2dsk -iHELLO.COM hello.bin hello.dsk
old2mfm hello.dsk

@Chema: Thanks for the offer of help. CC65 does not support fopen(), fread() for the atmos.
My game needs to load bitmap files into HIRES memory, as well as load navigation files into single bytes and ints.
Any code snippets for that purpose will be awesome!

User avatar
Chema
Game master
Posts: 2447
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: CC65 to DSK

Post by Chema » Wed Dec 19, 2018 8:45 am

I know. You can try the Sedoric() function, which is a hack, and tries ro execute a sedoric command such as "!LOAD ..." (I have no experience with this, but it was quite straightforward), or take a long path using custom routines to load sectors and create the disk so you know which sectors your data is in.

If the former does not suit you, let me know and I'll try to provide further help.

User avatar
Chema
Game master
Posts: 2447
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: CC65 to DSK

Post by Chema » Wed Dec 19, 2018 8:46 am

Oops... Sedoric is in the OSDK C library. You should look there for an implementation to use with another compiler.

User avatar
iss
Squad Leader
Posts: 852
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: CC65 to DSK

Post by iss » Wed Dec 19, 2018 10:04 am

In the attached file you can find sources and compiled (with CC65 + OSDK tools) DSK file for Sedoric compatible 'save' and 'load' functions. After boot the test saves first 4 lines of the screen to a file 'TEST.TXT' then screen is CLSed, after key press these 4 lines are restored from file. In the zip file I added just for reference 'libsedoric-cc65_preprocessed.s' which is 'libsedoric.s' but preprocessed/converted to more ca65 fompatible format.

I hope this will help and boost your game to the 'FINISH' :).
Attachments
libsedoric-cc65.zip
(34.68 KiB) Downloaded 29 times

User avatar
8bit-Dude
Pilot Officer
Posts: 74
Joined: Tue Mar 14, 2017 1:33 pm
Location: Japan

Re: CC65 to DSK

Post by 8bit-Dude » Wed Dec 19, 2018 10:08 am

Sweet!!! Thanks a lot ISS! :D
Please can you also take a look at the Network thread? I have a question about ACK.

User avatar
8bit-Dude
Pilot Officer
Posts: 74
Joined: Tue Mar 14, 2017 1:33 pm
Location: Japan

Re: CC65 to DSK

Post by 8bit-Dude » Thu Dec 20, 2018 2:07 am

The library seems to work just fine, but now the question is: how to add data files to a DSK in the first place?

tap2sdk seems to only allow 1 file as input (I cannot append a list of data files to the DSK).

I tried generating a DSK header+tap2dsk+old2mfm, then used this JAVA app (viewtopic.php?t=1804) to add the data files. But the resulting DSK does not work correctly, the atmos does not load sedoric...

romualdl
Officer Cadet
Posts: 52
Joined: Tue Jan 17, 2006 9:42 pm
Location: France

Re: CC65 to DSK

Post by romualdl » Thu Dec 20, 2018 8:05 am

You can use :

tap2dsk file1.tap file2.tap file3.tap fileN.tap dskname.dsk

And remember old dsk format so you need to use old2mfm but Dbug or others have already told you about that.

If you use DSK manager you should tick the "boot" box just left to the diskname and it should be a sedoric bootable disk.

User avatar
8bit-Dude
Pilot Officer
Posts: 74
Joined: Tue Mar 14, 2017 1:33 pm
Location: Japan

Re: CC65 to DSK

Post by 8bit-Dude » Thu Dec 20, 2018 10:02 am

Alright, but say I have a just a memory buffer (8000 bytes of screen data).
How should I make this into a tap file? Does it need a load address as the first 2 bytes??

User avatar
Dbug
Site Admin
Posts: 2930
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: CC65 to DSK

Post by Dbug » Thu Dec 20, 2018 10:07 am

Tap2DSK requires valid Tape files with the correct header.

If you have a binary file in the format you want, you can just use Header.exe (from the OSDK)
-> http://www.osdk.org/index.php?page=docu ... age=header

In the specific case of a picture, you could also use PictConv which will convert your picture and save it to a TAP file with the correct header
-> http://www.osdk.org/index.php?page=docu ... e=pictconv

User avatar
8bit-Dude
Pilot Officer
Posts: 74
Joined: Tue Mar 14, 2017 1:33 pm
Location: Japan

Re: CC65 to DSK

Post by 8bit-Dude » Thu Dec 20, 2018 10:36 am

I see! I will try header on the binary file tonight.
By the way, the AIC mode in PictConv seems broken. Using the -f7 flag, I only get B/W images.

User avatar
Dbug
Site Admin
Posts: 2930
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: CC65 to DSK

Post by Dbug » Thu Dec 20, 2018 11:46 am

8bit-Dude wrote:
Thu Dec 20, 2018 10:36 am
By the way, the AIC mode in PictConv seems broken. Using the -f7 flag, I only get B/W images.
In -f7 mode, the attributes are not saved, to leave you the option of choosing whatever combination of INK you want, it also makes it easier to generate bitmap blocks without wasting room.

Maybe that's your problem?

To see if it worked, just put black PAPER in column zero, and then alternate between YELLOW and CYAN ink

Here are some examples of AIC graphics:
metro_station.png
metro_station.png (2.25 KiB) Viewed 1994 times
metro_station.png
metro_station.png (2.25 KiB) Viewed 1994 times
Attachments
metro_train_front.png
metro_train_front.png (1.86 KiB) Viewed 1994 times

Post Reply