Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Multi-utility for SC3000/SF7000

Reply to topic
Author Message
  • Joined: 23 Feb 2013
  • Posts: 10
Reply with quote
Multi-utility for SC3000/SF7000
Post Posted: Thu Nov 21, 2013 2:33 pm
Hello everybody,
i'm writing a tool with some utility for sc3000/7000 and i'm asking if could be useful for someone.
At the moment this are main functions:

    + Conversion from SC/SG RomDump To .Basic (to allow sc3000 write directly on disk)
    + Conversion from SF7000 basci Dump To .SF7 format
    + Conversion from .SF7 Image To .DSK (to use with CPCDISKXP to write disk from pc)
    + Conversion from SC/SG RomDump to .SF7 (not yet working)
    + Send basic program to sf7000 through serial port (in alpha test)
    + Receive basic program from sf7000 through serial port (in alpha test)


Some suggestion or ideas to add?
Thank you
  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Sun Dec 01, 2013 10:58 pm
It would be nice to have a program running on SF-7000 to read and export a floppy disk via the serial port without relying on basic functions (that are slow). So we can devise a serial port compatible format (ascii or binary) to transfer the disk data as fast as possible.

I used the Windows terminal to read output from the SF-7000.
  View user's profile Send private message Visit poster's website
  • Joined: 03 Oct 2011
  • Posts: 186
  • Location: New Zealand
Reply with quote
Post Posted: Sat Dec 07, 2013 6:25 pm
Hi Giancarlo

Sorry - I keep forgetting to send this through to you. Here is the source from my SF7DSK command line utility for converting .SF7 images to .DSK so you can write them to an actual physical 3" disk with CPCDISKXP. It is C++ code written on top of the original standard libraries so you should be able to get it compile pretty easily on most compilers.

As a side note, the extended DSK format would be a good one for Sega SF-7000 emulators to implement because from memory it already has most of the necessary structures to represent copy-protected disks (whereas the .SF7 is just a simple 40 track / 16 sector binary dump).

Cheers
sf7dsk.rar (6.17 KB)

  View user's profile Send private message Visit poster's website
  • Joined: 23 Feb 2013
  • Posts: 10
Reply with quote
Post Posted: Mon Dec 09, 2013 10:29 am
Hi guys, thank you all for the replies.
My software is almonst working, also with sf72dks and dsktosf7.
I see basic is very slow to write data on disk... serial comm @9600 is accettable because to transfer 160kb takes few minutes but to write the disk takes about 8 hours :(
to speed up times i've connected a spare 3"drive to my pc so with cpcdiskxp i need only 25seconds to write or backup a disk :)
Thank you honestbob for sources... now i'll check if i miss something my conversion from Sf7ToDsk :)
Now i'm triying to create o tool to generate a sf7/dks with disk-menu for multi games on disk... i'have found an old disk with a a simple menu to study :)
someone have some disk with menu to take infos? (not compressed as Charlie/Jacker disk)
thank you
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14690
  • Location: London
Reply with quote
Post Posted: Mon Dec 09, 2013 11:12 am
I have a full disassembly of a pirate multi-ROM-game disk which I think matches what you want. There's some discussion here: http://www.smspower.org/htdocs/forums/viewtopic.php?t=8843
  View user's profile Send private message Visit poster's website
  • Joined: 23 Feb 2013
  • Posts: 10
Reply with quote
Post Posted: Mon Dec 09, 2013 11:54 am
thank you Maxim, i get same infos and "errors" with original bytes comparison with the original games dump.
in these days i'll compile a new disk with new games :)
i'll post good news, i hope :)

thank you
  View user's profile Send private message
  • Joined: 03 Oct 2011
  • Posts: 186
  • Location: New Zealand
Reply with quote
Post Posted: Mon Dec 09, 2013 9:44 pm
Quote
someone have some disk with menu to take infos?


Here's another project I haven't had time to complete. Try the attached .SF7 image in an emulator. It is a self-booting disk with a modern menu system for the SG-1000 ROMs. It is a cut-down version of the menu system I used for the SC-3000 Multicart (which in turn was built on top of Maxim's excellent disassembly of the SF-7000 IPL).

The downside is you waste a bit of disk space (those original pirate disks only required around 1-2 sectors for the menu code and data from memory). But it looks a lot nicer :)

The plan was to write a third party utility that just overwrites the menu data section with the ROM track / sector layout and menu items on disk. That way you could have a standard .SF7 menu code block, modify the menu data section, and merge the ROM images into a .SF7 image without having to reassemble anything.

So that sounds exactly like what you want :)

I'll see if I can find the assembler source, and I may have half written the utility program too. Not sure where that is though...


Quote
(not compressed as Charlie/Jacker disk)


Update. Ah - I just read that bit again. It sounds like I've sent that to you previously :) If I can find the source it should be easy enough to modify though. All you need to know is the data structure for the menu and you can overwrite it with new information.

Update 2. I've found most of the source. The assembler for the menu system is embarrassingly messy, and I only just started writing the command line utility.

I should have a couple of days over the Christmas break, so I'll see if I can finish off the command line utility. The idea is that you should not have to compile any assembler - just replace the menu data block. If I get that working, then it should be simple to add to your utility.

Cheers
SegaGames_CircusCharlie_Drol_ElevatorAction_Exerion_StarJacker.rar (78.38 KB)
Modern boot menu system for SF7 disks

  View user's profile Send private message Visit poster's website
  • Joined: 23 Feb 2013
  • Posts: 10
Reply with quote
Post Posted: Tue Dec 10, 2013 9:31 am
thank you honestbob,
your modern menu is very cool but, i think, compressed from asm, so is complicated to only "replace" games.
in "original" disk menu it's easy to replace game names and data block... but they takes 16kb instead of 32kb of many other games... i'm trying to find the way to find and change the address to "jump" from menu.
someone have the B side of disk ? some games has 32kb data...maybe useful to decompile :)
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14690
  • Location: London
Reply with quote
Post Posted: Tue Dec 10, 2013 11:12 am
Last edited by Maxim on Wed Dec 11, 2013 9:44 am; edited 1 time in total
Compression will let you get maybe twice as many games on each disk.

The "diskcartgames" disk stores the sector start and sector count for each game, allowing games of varying lengths to be stored relatively efficiently. I have dug up a broken WLA DX version of the disassembly I made, I need to get to my other computer to find the original Brass version, but here's the hacking details:

- Game names are stored at $0230, $0250, etc
- Corresponding data is stored at $02c0, $02d2, etc, in the format:
.dw load_addr ; where in RAM to copy the data
.db start_track, start_sector, end_track, end_sector ; where on the disk the data is stored

ROM data is stored from track 1 onwards (offset $1000 in the .sf7 disk image). Each disk track can hold 4KB. The original disk always starts games on sector 1, but sometimes finishes early to make loading faster. I think the code should support starting on any sector so you can pack things in a bit better.

I'll have a go at getting it compiling in WLA DX again (I didn't figure out how to make it build a full disk image with sensible bank/slot facilities or specify arbitrary code execution memory addresses) and post the code later, but the above should be enough to get it working now.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14690
  • Location: London
Reply with quote
Post Posted: Tue Dec 10, 2013 8:05 pm
I posted my disassembly:

http://www.smspower.org/forums/viewtopic.php?p=77124#77124
  View user's profile Send private message Visit poster's website
  • Joined: 03 Oct 2011
  • Posts: 186
  • Location: New Zealand
Reply with quote
Post Posted: Tue Dec 10, 2013 9:01 pm
giancarlo wrote
thank you honestbob,
your modern menu is very cool but, i think, compressed from asm, so is complicated to only "replace" games.
in "original" disk menu it's easy to replace game names and data block...


It is simple to replace games. It doesn't matter whether you are using my menu system or the old pirate menu style system. They are both data driven, so the concept is exactly the same. You just need to know where the data for the menu items is stored and overwrite that. So your utility doesn't have to assemble anything.

All you need is the default binary for the menu system, and know where the data for the menu is stored. In WLA-DX, my menu data structure also has a list of menu items with strings for the game names, start track / sector and end track / sector.

That menu data will always be stored at a fixed location. So all your utility needs to do is:

1. Ask for a list of SG-1000 ROMs to add. Get a short text name for each game.

2. Figure out how to pack that into the remaining track / sectors. Each sector is 256 bytes, and there are 16 sectors per track (16 * 256 = 4KB per track). Every SG-1000 ROM should start in a new track / sector. Make sure the total file size won't exceed 163840 bytes when added to your boot menu code / data (40 tracks).

Example:

Tracks are numbered 0..39. Sectors are numbered 1..16

You will have a boot sector (256 bytes) that loads your menu binary system. So you will have used up Track 0, sector 1 for the initial boot loader.

If your menu system is 2KB, that will then go from Track 0, sector 2 to Track 0, sector 9.

If you then add a 16KB SG-1000 ROM image, that will go from Track 0, sector 10 to Track 4, sector 9.

If you then add a 32KB SG-1000 ROM image, that will go from Track 4, sector 10 to Track 12, sector 9.

You can keep adding SG-1000 ROMs until you go past Track 39, sector 16.

There might be some mistakes in my maths above :) But you should get the idea anyway.

I half written C++ code to do those calculations. I just need time to see how far I got through writing it.


3. Overwrite the menu data block with the text descriptions and the start track / sector and end track / sector

4. Append the SG-1000 ROMs to the end of your modified menu and menu data block. Pad out any empty space within tracks / sectors with $FF

5. Pad out any unused tracks / sectors with with $FF (there are 40 tracks).

You now have a working .SF7 image. No assembly required :) So you can write the utility in whatever language you like. And you can easily replace the menu system as this technique would work with both my menu system and the original 'pirate' disk menu system.

I will send through the source for my menu once I have had a chance to clean it up.


Maxim wrote
Compression will let you get maybe twice as many games on each disk.


Yes, compression works well. From memory those SG-1000 ROMs will compress down to about 60% of their original size, on average. But write your first pass without compression to get it working.

I used the aplib library for packing all the SC-3000 tape images on the multi-cart, and it works really well. That example disk I posted doesn't use compression on the SG-1000 ROM images, but because the SF-7000 has 64KB of RAM, and the SG-1000 ROM images are only 32KB maximum, you can copy the data from disk to $8000, then decompress it back to $0000.

Cheers
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14690
  • Location: London
Reply with quote
Post Posted: Tue Dec 10, 2013 9:49 pm
Lots of tape era games used compression that allowed decompression in place. I'm not sure any suitable software exists that's over 32KB, though.

It might be fun to try to fit the menu system into the 256b bootloader, but I suspect you won't get compression too in the space available. Abusing the IPL saves a lot of space, though.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Feb 2013
  • Posts: 10
Reply with quote
Post Posted: Wed Feb 05, 2014 9:05 am
first i want to say a BIG THANK YOU to HONESTBOB :)

after 2 months of many problems and too much works, i have some time to continue my multi-tool and with your precious asm code now it's easy :)

thank you
  View user's profile Send private message
  • Joined: 25 Jul 2022
  • Posts: 25
Reply with quote
Post Posted: Fri Aug 12, 2022 11:09 am
sorry for resuming this old post, but i can't compile in windows the sf7dsk converter...
i get many errors and include's files missing: anyone can post the exe file?
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!