Hi,

About stopping the diskdrive after disk actions:
This particular address mentioned earlier contains a drive-off 
counter. It is set to, I think, 254, after every disk action, and 
decreased 1 on every call to the diskROM's interrupt handler (so 
every timing-interrupt). If it reaches zero (so after some 5 
seconds), the drive motor is stopped. If THIS drive is accessed again 
in the meanwhile, the interval starts again. The value 255 has a 
special meaning: 'keep running'. If you do something with the drive, 
and POKE 255 in this memory location quickly (before the counter 
reaches zero), this diskdrive motor simply keeps running.

The address is simply the same on many MSX machines, because they use 
similar working diskROM(s), but it is NOT a fixed address in any way, 
not documented, not guaranteed or such, in one word: don't rely on 
something like this, if you do, someone will have troubles because of 
it, some other time.


I figured out this approach to stopping disk drive motor(s, note 
there might still be another drive running, if you start this game 
quickly enough from a different one):

   LD IX,#4029
   LD IY,(#F347)
   CALL #001C

This is a call to a diskROM entry, which (should) contain a routine 
that 'scans' all diskROMs, and calls another entry in each, which 
should be present in each diskROM, to stop the drive. The address 
F348h contains the slot-address of the 'main' diskROM (the first one, 
that handles the initialising stuff and so on), the address 4029h is 
one of a small number of entries present in any diskROM, and are 
described in the MSX Technical Databook (I'm not sure if they're also 
in the MSX2 Tech Handbook). You can call the method above pretty 
solid, and it should work whenever there IS a diskdrive (contents of 
FFA7h<>C9h).

But: on using this myself, I found these drawbacks:
-It stops DRIVE-motors, doesn't do anything with other 
interrupt-related processes that might be running.
-On my Novaxis SCSI, it stopped the HDD motor as well (great, mine 
made a lot of noise). But those stupids from Gouda did implement this 
diskROM-entry, but forgot to turn on the drive again when accessed, 
in case it was shut down this way (! stupid, stupid...)
So, shutdown the drives this way, and you'd have to reset the machine 
again, just to get the HDD spinning again (I switched it on and off 
instead).
-This diskROM-entry might not be (properly, or not at all) 
implemented with a particular disk system


I would say calling the hook at FD9Fh 256 times (do yourself a favor, 
no less than 256..), is by far the best, AND most 
compatible/problem-free way of shutting down disk-drives and such.


I'd say this IM2 approach is not a bad idea (and yes, there need to 
be 257 of the same values on the address I*256), it prevents you from 
HAVING to switch RAM in page 0, and you can select a different 
starting address for your interrupt routine, which is called 
immediately on each interrupt, rather than having to wait for a few 
instructions at #0038 to get executed first, before a hook-address is 
called.

If you'd switch RAM in page 0, you'd also have to setup at least the 
slotswitching-routines, which are the same under DOS, BASIC, and even 
present in MSX-2 subROM. I'd say, a lot of work.
Best way would be to use this IM2-approach during run-time, using 
all 'common' hardware (VDP, keyboard etc.) by direct I/O (remember 
any BIOS call might re-enable interrupts, and mess up things when 
you'd expect these to be off at that time), and temporarily switching 
back to IM1, and restoring memory settings etc. when making any BIOS 
or disk CALLs.
Your program might have a setup like this:

On startup:
-Store any memory settings, in case you need to change, and restore 
these later

(other initialisation)

-Set up your interrupt handler
-Set up this 257 byte table (interrupt handler at address 
257*fillbyte), starting at a 256-byte boundary (low byte 0)
-Set Z80 I-register to the high byte of the address of this table
-switch to IM 2
-enter a main loop of your program


On a disk-access/BIOS-call:
-restore memory settings, if needed, possibly update some system 
memory locations containing VDP-register contents and so forth
-switch back to IM 1
-make your BIOS/disk CALL
-(.. make some more disk CALLs)
-call FD9Fh 256 times
-switch to IM 2 again

On exit:
-Do the same restoring as before
-Switch back to IM 1


If that still doesn't do it:
-Use a faster METHOD of obtaining your goal
-Write even faster code
-make a turbo-circuit (6/7 MHz. or my own) a system requirement
-or make it a TurboR program


Greetings,

Alwin Henseler    ([EMAIL PROTECTED])

http://huizen.dds.nl/~alwinh/msx    (MSX Tech Doc page)
http://www.twente.nl/~cce/index.htm    (Computerclub Enschede)


****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****

Reply via email to