English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 01 September 2018, 12:28   #1
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,234
System takeover and multi floppy mess

Take this situation:
- bare metal game with multiple floppy but hdd installable
- system take over but reanimated when needed
- files loading through standard Open(diskname:dir/filename)/Seek()/Read() DOS functions
- task->pr_WindowPtr=-1 so all the requesters are suppressed
- if Open() fail then a request (in my private non-system screen) to insert proper disk is displayed

All work as it should and compatibility for an hdd usage is guaranteed.
But there is a big contraindication.

If you swap floppys during system takeover Open() call never return to the caller and you are stuck with no possibilities to regain program control!
This sure is due to system that is not aware of the disk change and use now invalid structures.

Ok, a low level file loader can be used but for various reason (also 'academic') I want to avoid this.
Or a message for the user to not change the discs unless requested.. also no.

So after thinking about it I thought about simulating a disk change using an ACTION_INHIBIT packet to the file system before the takeover
and then, after the reanimation, uninhibit.

Before trying I have some questions:
- has anyone already tried this way and it works?
[EDIT] it works
- The ACTION packet to the file system need to be sent for each device separately? (DF0, DF1, DF2, DF3)
[EDIT] yes, to each device
- there are better/faster way, maybe sending a command directly to trackdisk.device?

Thanks.

[EDIT] forgot to mention that I need to support also <KS2.0

Last edited by ross; 01 September 2018 at 13:27.
ross is offline  
Old 01 September 2018, 13:51   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 22,017
Do you modify CIA registers or floppy state when you restore system?

Floppy removal is remembered until drive is stepped at least once. System should still detect the change immediately when system is restored.

btw, packets are send to filesystem process, not to device.
Toni Wilen is offline  
Old 01 September 2018, 14:18   #3
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,234
Quote:
Originally Posted by Toni Wilen View Post
Do you modify CIA registers or floppy state when you restore system?
CIA registers untouched.

Quote:
Floppy removal is remembered until drive is stepped at least once. System should still detect the change immediately when system is restored.
True for >KS2.0, but on KS12/KS13 is totally unreliable.
Most of the time disk inserted during takeover is not recognized at all (or sometime partially, like wrong icon on WB and bad access).
Tried not only inside game, but also from a standard hdd KS/Workbench 1.3 install.
Anyway Open() get stuck.

Quote:
btw, packets are send to filesystem process, not to device.
Yes, I get filesystem process handler with DeviceProc(DF0).
I'm forced to call it for every device.

There is a better way?
ross is offline  
Old 01 September 2018, 14:52   #4
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,234
More info.

As simple as:
Code:
start:
move #$4000,$dff09a
.. a dummy waiting loop ..
- meantime disk change -
move #$c000,$dff09a
rts
On Workbench, so with unmodified pr_WindowPtr, the requester on disk access say:
"Disk corrupt - task held
Finish ALL bla bla"


On cancel a beautiful guru :#8700000B
ross is offline  
Old 01 September 2018, 17:49   #5
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 45
Posts: 3,237
Quote:
Originally Posted by ross View Post
There is a better way?
Leave the OS running in the background ?
meynaf is offline  
Old 01 September 2018, 18:31   #6
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,234
Quote:
Originally Posted by meynaf View Post
Leave the OS running in the background ?
I've tried but frame rate drop

I'll use the ACTION_INHIBIT method until proven otherwise.
There is some unwanted delay if you don't change the disks but better than hung.

Also found another interesting thing.
If you write an input handler to grab all event you need to not raise the task priority over 20 to not stall input.device (better at 19 'cause there is no latency on event).
And this is well know.
But I did not know that the events IECLASS_DISKINSERTED and IECLASS_DISKREMOVED are not reported if the priority is >1!
To tell the truth I've never been interested in being too much system-compliant, bashing the metal is much more interesting
At first I also tried this method but failed..
ross is offline  
Old 01 September 2018, 20:28   #7
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 22,017
This is just a guess..

Perhaps 1.x trackdisk.device has accidental bug and seek to zero and handling of actual removal/insertion are separate parts of code and both check DSKCHANGE CIA bit instead of setting some internal "disk changed" bit. IMHO this kind of bug would be really easy to do.

So try seeking to track zero (using trackdisk.device, using hardware would leave trackdisk.device internal current track counter unchanged) before taking over the system.
Toni Wilen is offline  
Old 01 September 2018, 22:03   #8
ross
Omnia fert aetas

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,234
Quote:
Originally Posted by Toni Wilen View Post
This is just a guess..

Perhaps 1.x trackdisk.device has accidental bug and seek to zero and handling of actual removal/insertion are separate parts of code and both check DSKCHANGE CIA bit instead of setting some internal "disk changed" bit. IMHO this kind of bug would be really easy to do.

So try seeking to track zero (using trackdisk.device, using hardware would leave trackdisk.device internal current track counter unchanged) before taking over the system.
It works!
I've to check if it's faster than the other method (maybe yes, anyway the various seek in both cases slow down the access) but no more disk error.

Thanks like usual Toni.
ross is offline  
Old 15 September 2018, 21:01   #9
Photon
Moderator
Photon's Avatar
 
Join Date: Nov 2004
Location: Hult / Sweden
Posts: 4,589
Hehe. Yes, this is asking for trouble and there is an issue on 1.3. I think you should go by the game's requirements: if you need to load more than 2 disks of resources and if so go harddisk only.
Photon is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a "system-takeover" game to OS friendly alpine9000 Coders. General 13 01 January 2018 02:06
System takeover/shutdown alpine9000 Coders. Asm / Hardware 5 07 June 2016 10:03
trackdisk.device after system takeover alpine9000 Coders. Asm / Hardware 20 21 March 2016 10:17
startup/system takeover sidewinder Coders. General 15 28 February 2016 17:33
Multi-System DATs killergorilla Retrogaming General Discussion 18 07 July 2013 03:04

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:37.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.09240 seconds with 15 queries