News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_reidrac

Using disc via firmware

Started by reidrac, 09:06, 14 August 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

reidrac

Hi,

I'm trying to implement disc access using the firmware, but that limits a bit too much the amount of memory I have available if I have to leave the firmware mapped all the time.

My usual approach is to disable the firmware once the full game is loaded in memory, patch the int handler so the firmware is "disabled" (classic ei/ret in 0x0038) and disable upper/lower ROMs with:

        ld bc, #0x7f8c
        out (c), c


So far, so good. It is my preference so I have al the 64k available.

I was wondering, would it be possible to restore the int handler and get the ROM back so I can temporarily use the firmware for disc operations? Then, when finished, I would switch it off to have that memory back.

For this to work I'm assuming the "disc code" should be in the "safe" memory area (after 0x4000).

Would this work? I'm trying it, but I'm probably making a mistake or (most likely) there's something I don't know and, well... it could be making this actually inviable.

Any pointers/comments would be appreciated! Thanks :)
Released The Return of Traxtor, Golden Tail, Magica, The Dawn of Kernel, Kitsune`s Curse, Brick Rick and Hyperdrive for the CPC.

If you like my games and want to show some appreciation, you can always buy me a coffee.

Targhan

One thing you can do is reinit the ROM disc just before a disc operation. This little snippet, courtesy of @TomEtJerry, will allow you to do that. Click on "Initialisation du système disque".

I believe this is what I do on Demoniak 7.
Targhan/Arkos

Arkos Tracker 2.0.1 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

johnlobo

Hi,

This is not an exact answer to your queswtion, but just in case it may help...

Have you checked FDC tools library form Targhan?? (http://www.julien-nevo.com/arkos/fdc-tools/)

If you just need to read files, maybe you don't need to use the fimware.

Regards.

reidrac

Quote from: johnlobo on 10:38, 14 August 21
Hi,

This is not an exact answer to your queswtion, but just in case it may help...

Have you checked FDC tools library form Targhan?? (http://www.julien-nevo.com/arkos/fdc-tools/)

If you just need to read files, maybe you don't need to use the fimware.

Regards.

I really want to use the firmware, hoping that would make the code compatible with the M4, for example (at least, that was the case for my previously released games).
Released The Return of Traxtor, Golden Tail, Magica, The Dawn of Kernel, Kitsune`s Curse, Brick Rick and Hyperdrive for the CPC.

If you like my games and want to show some appreciation, you can always buy me a coffee.

reidrac

#4
Quote from: Targhan on 10:00, 14 August 21
One thing you can do is reinit the ROM disc just before a disc operation. This little snippet, courtesy of @TomEtJerry, will allow you to do that. Click on "Initialisation du système disque".

I believe this is what I do on Demoniak 7.

I will take a look, thanks. Why putting a TXT file inside a DSK? Interesting approach.

EDIT: after a quick read, there's a lot of black magic in there I didn't know about! :D I had got to something similar, but in no way as elaborate (and different address depending of the model? of course not).

Thanks again, very useful!
Released The Return of Traxtor, Golden Tail, Magica, The Dawn of Kernel, Kitsune`s Curse, Brick Rick and Hyperdrive for the CPC.

If you like my games and want to show some appreciation, you can always buy me a coffee.

reidrac

#5
This works perfectly!

As suggested by the doc, I have a table with calls to different addresses depending on 464, 664 and 6128. I have tried it with emulation for now and works fine (but I guess "the test" is my 464 with the M4!).

I'm using double buffer by hw, and setting up the firmware corrupts memory from 0x8000 to 0xbfff. This is expected because it has to set variables, jump table, etc in there; so it is matter of ensuring 0xc000 is the active video memory and restore 0x8000 when the disc operation is completed. I'm not completely sure I *need* double buffer via hw, but for now I'll continue using it.

I'll keep testing (+ the real CPC test), but this looks like is what I was looking for.

Thanks a lot to @Targhan for the pointer and @TomEtJerry for sharing the code!

EDIT: also I've been reading the firmware disassm in @arnoldemu's website. Very useful!
Released The Return of Traxtor, Golden Tail, Magica, The Dawn of Kernel, Kitsune`s Curse, Brick Rick and Hyperdrive for the CPC.

If you like my games and want to show some appreciation, you can always buy me a coffee.

Arnaud

Really interesting, i could have use of it !

According to this snipet, is only memory from &B900 to &BFFF will be restored with firmware (not all system from &A67B a &BFFF) ?
In this case we have just to keep an area of &6FF Bytes with only tempory or movable data ?

reidrac

#7
Quote from: Arnaud on 08:13, 15 August 21
Really interesting, i could have use of it !

According to this snipet, is only memory from &B900 to &BFFF will be restored with firmware (not all system from &A67B a &BFFF) ?
In this case we have just to keep an area of &6FF Bytes with only tempory or movable data ?

I'm not completely sure. I suggest you look at this: https://cpctech.cpcwiki.de/docs/os.asm ; it is for the 6128 only, but it may help you to understand better what is happening "Setup HIGH KERNEL jumpblock".

This hack is great, but it makes sense only now that we are not going to get more new CPC models; back in the day this would have make the games potentially forward incompatible because changes in the ROM could break the game.
Released The Return of Traxtor, Golden Tail, Magica, The Dawn of Kernel, Kitsune`s Curse, Brick Rick and Hyperdrive for the CPC.

If you like my games and want to show some appreciation, you can always buy me a coffee.

Powered by SMFPacks Menu Editor Mod