CPCWiki forum

General Category => Programming => Topic started by: arnoldemu on 22:21, 27 October 09

Title: firmware + direct to disc - working together
Post by: arnoldemu on 22:21, 27 October 09
Is there a nice way to:
1. turn on or off disc motor using firmware/amsdos
2. stop/delay the disc motor ticker in amsdos
3. tell amsdos the drive motor state?

it seems the only way may be to poke some data in RAM and to call directly into ROM :(
But is there some nice way that I don't know about?

thinking about it, I may be able to call the bios function to modify the drive on/off timings in my favour... hmmm... any other ideas?

Maybe I should clairfy this a bit: I have a tool which uses both AMSDOS and direct disc access. AMSDOS to load files, and direct disc access to write them into another special format. Now the problem is that AMSDOS uses a timer to turn off the disc motor. So if interrupts are enabled it will happily turn off the motor even if we wanted it to stay on. Interrupts are often enabled when calling other firmware functions. So say you had a special disc formatter but you wanted to use AMSDOS to print text, and also you loaded some files, the possibility here is that AMSDOS *may* turn off the disc motor for you, potentially at the wrong time. So I am after a way to be friendly to amsdos (and also other DOSes which are derived from it e.g. Parados, and also to make it work with CPC+ DOS). So if I worked in cooperation with AMSDOS I could save having to keep turning the motor on and off unnecessarily and we can both work together ;)

In the end I will probably have to look into the dissassembly of AMSDOS more to work out the best thing to do.
Title: Re: firmware + direct to disc - working together
Post by: Targhan on 22:35, 19 November 09
Hi,

I didn't exactly understand what you needed, but I think the following code could help you. It kills the Tick of the amsdos (that manages the timer to stop the drive) :

   ld hl,#be67   ;Kill Ticker
   call #bcec
   ld bc,#fa7e   ;Stop drive
   xor a
   out (c),a
   ld (#Be5f),a   ;Lecteur=off flag for the system (#ff = on)
   ld l,a
   ld h,a
   ld (#be69),hl   ;Timer off=0.

So by POKing the right bytes at the right addresses, you should make the Amsdos think the drive is on/off. Hope it helps !

Targhan/Arkos.
Powered by SMFPacks Menu Editor Mod