I'd want to check when the disk activity ended. Cannot find anything for that, BIOS or DiskROM.
Aangemeld of registreer om reacties te plaatsen
I'd want to check when the disk activity ended. Cannot find anything for that, BIOS or DiskROM.
I don't know how MSX handles the disk internally, but typically programs will perform multiple disk accesses fairly close to each other, so to prevent the disk motor from having to spin up between each access the driver will keep the drive spinning after each access and stop it on a timeout if no access has happened for a while.
So "disk activity" have probably already ended the moment your code is allowed to run again, but the timeout for stopping the disk motor has not happened.
There is a 401FH (DSKSTP)
that might force this early if you don't want to wait.
Otherwise it's probably fairly safe to count the time since last disk access and assume that the disk have stopped after a certain time.
Those are the only ways I can find:
- Checking if 401FH (DSKSTP) of slot MASTER (F348H) <> 00H for it to be valid and call it. Or
- Set a 8-bit variable at 0 then inc at vblank and when Carry (overflow) we could assume it already stopped.
I'd prefer to use a system check for disk activity, but looks like BIOS ISFLIO does nothing, and cannot find any other thing.
Can you explain the use case, i.e. why you want to check for disk activity?
Can you explain the use case, i.e. why you want to check for disk activity?
I want to disable the Inter-slot call to the DiskROM once it has finished loading content.
Made some tests and it takes too much CPU.
So the idea is: load, disable DiskROM, on new load enable again.
If we disable it just after loading finished there is no spin-down.
But isn't your own code actually using the diskdrive? So you know when loading is finished?
Yes but the drive spin takes some time to stop. If we disable just after loading some drives could not spin-down.
TBH I think your best bet is to just wait a fixed time, like 150 frames or something.
Maybe use the time to unpack the data.
If you show some loader graphics you can take the time to do a pretty transition.
Wouldn't it make more sense just to call into the Disk ROM to turn off the drive motor after your data is loaded but before you disable the inter-slot call to the Disk ROM? My guess is that the Disk ROM hooks the timer while the motor is on so that, after it's seen enough time elapse after the last access, it can turn off the drive motor, but disabling the Disk ROM inter-slot call while the motor is on is breaking this mechanism.
Yes, but Not all diskinterfaces support this entry. Only valid when 401FH <> 00H, so you still need to handle the case where you can't.
Well, implemented but seems to do nothing:
public _disk_stop _disk_stop: ; read DSKSTP ld a, (MASTER) ld hl, DSKSTP call RDSLT ; if 0 then not supported, return or 0 ret z ; else call it ld ix, DSKSTP ld iy, (MASTER - 1) jp CALSLT
The RDSLT result is != 0, so it should be supported. Calling it just before disabling the DiskROM and the drive doesn't spin-down.
But, the main is the IDE one, and reading from FDD, so probably MASTER is not what I want, but the current used drive. Don't know how can get that.
Looking at the machine XML, the FDD controller is at slot 3-3, and then calling with:
ld ix, DSKSTP ld iy, 0x8f00 jp CALSLT
It stops the drive.
But reading about MTOFF:
Some HDD interfaces have wrongly implemented this as a HDD powerdown (HSH/MAK)
Seems better to wait a time. As probably the multiple controllers implementation is made by chaining them.
Don't you have an account yet? Become an MSX-friend and register an account!