News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Targhan

FDC Tools V1.1

Started by Targhan, 15:33, 21 June 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Targhan

A new version of FDC Tools has been released, thanks to Christophe Kohler and @Arnaud, which reported me a bug as well as converted the sources to SDCC.

It is also good reminder of what this old (yet probably not well-known enough) tool is about:
Thanks to FDC Tools, you can:

  • Read AMSDOS files from any assembler production, WITHOUT the use of the system. Any regular file can be read, so you will be able to use 100% of the CPC memory even if you need to load files.
  • Read files written sector by sector. Modern tools exist to write such files on a DSK, but you can also use the included DISK Writter program that will load a regular AMSDOS file and write it sectors by sectors on disk.

I hope you will find this tool useful!

http://www.julien-nevo.com/arkos/fdc-tools/
Targhan/Arkos

Arkos Tracker 3.2.6 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Arnaud

It includes a full example for CPCTelera and the code was used for Ninja Carnage by @Kristof.

Kristof

Yeah very handy piece of code to load data without firmware. Ninja Carnage (expect intro) is fully running with cpc telera without firmware. (and the while game is data driven, levels data are inside one binary file, directly loaded from disk to memory. The data are automatically mapped to C pointer and ready to use without any additionnal code. That's really nice).

Typhon

I know this is a bit of necropost, but can I ask a clarifying question? Can I use these routines to write a "loader" in CPCTelera that sits at say 0x1000 and does the following:

1. loads say a game Intro binary from disc into say 0x2000,
2. Then passing control to said code to run the intro
3. On return from said code, overwrite the intro with main game code also loaded into 0x2000.
4. Then pass control to said code to run the main game?

If so, that's kinda incredible. How would you in CPCTelera handle this? Would you setup a parameter less stub function at say 0x2000, that you would just execute, and even if overwritten by the game intro, or the game main code, just execute it? In other words, how do you simulate calling an int main() of another binary? 

ITDLR: using these tools to load code to executed instead of just data. 

Typhon

I guess what I'm after is, how can I make use of ALL the memory space up to 0xC000 (having moved the stack to say 0x01FF); once firmware is disabled, 

But to disable firmware requires firmware to load the program to do so.

Unless I restructure my code so that everything BUT graphics is loaded; then simply disable firmware at start as usual, and THEN load graphics data on demand into the now available space vacated by the firmware?

Am I making any kjnd of sense?

Typhon

Ah, right, so basically, is there a way of emulating the basic functionality of CHAIN MERGE with CPCTelera?

arnoldemu

Yes you are making sense.

The easiest would be to have all code in your program and then load the graphics as you need them. You could also load the music as needed if you compile the player and music at a fixed known address which you can call via __asm in your interrupts.

Loading and running code is more difficult.  I have done it in asm but not with cpctelera.

I had 1 program which is the 'kernel' with the common game code and loader code inside. This code then loads each bit of code. Then I had each bit that could be loaded built separately. I used JP tables in the main code and JP tables in the loaded code so I could communicate between them.

The key points to be careful of here:
* stack location
* interrupt handler location

Be careful of any function that can be called in the game code being left on the stack when the game code has been unloaded or new code loaded over the top.

Let the main program be director otherwise you need to use JP in the game code to call the loader. If you used CALL it would push an address on the stack you can't go back to.

For cpctelera it kind of makes sense that the main bit is compiled into one bin, and each part compiled into another.

I'm also not sure how to setup the game code because it may need a custom crt0. For cpctelera it might be possible to build a lib from the main bin and link the game bins against it but not sure how to do that with cpctelera.

I hope I've helped in some way :)

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Powered by SMFPacks Menu Editor Mod