13 December 2023, 13:38 | #1 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Check if DF1 is present/attatched
At the moment my code just assumes that there are two disk drives (DF0 and DF1) and that there is a disk in each of them. Files are opened and read using the OS.
Works fine, but I need a way to check if DF1 is actually attached in the first place and then check if there's a disk in it. If not, it should go to a "Swap Disk" routine. According to one of the books I have, bit 2 of $BFE001 is 0 when there is no disk in a drive, but I'm having trouble finding a way to specify which drive to actually check, and if it's even there in the first place. The OS book doesn't seem to describe any way to check drives' availability before starting DOS/ attempting to open a file, and it hangs if I try to Open/Read from DF1 if it isn't there. Is there some simple check(s) that can be made? I tried scouring Google, but it came up with no hits whatsoever (or I'm just not recognising what to look for). Basically, I need these three checks satisfied: - Is there a disk in DF0? - Is DF1 attached? - If so, is there a disk in DF1? Thanks in advance. Any info would be great as this issue has been holding me up for two days now. |
13 December 2023, 14:07 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
disk.resource/GetUnitID() can be used to query if drive exists.
|
13 December 2023, 16:55 | #3 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
If you're using dos, don't mess with bfe001 which requires selecting the drive in question and stepping to update diskchange (dos does all this for you already).
If you are using dos, why care about in which drive the volume is anyway? Just use the volume name when reading files, and people can put in the disks whereever they want (or even make an assign to a harddisk volume). If your concern is a requester popping up when requesting a volume name not present, you can set your pr_WindowPtr to -1 which will block dos requests (remember to restore it to the original value before exiting your process). |
13 December 2023, 18:40 | #4 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Thanks for the replies!
Quote:
SPRITE_SHEET1: "DF0:SS1.RNC" That's what I've been doing, and been poking the string with a "1" when I want to check DF1. So if I just put the disk's name itself in the string then DOS will search all available drives automatically? |
|
13 December 2023, 19:51 | #5 | |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,099
|
Quote:
If you have two disks with volume labels "GAMEDISK1" and "GAMEDISK2" you can just open e.g. "GAMEDISK1:fileA" and you'll be prompted to "Insert volume GAMEDISK1 in any drive". After inserting the disk the file will open (unless do the pr_WindowPtr thing already mentioned, or the user presses cancel). Similarly for GAMEDISK2. If you have both disks inserted in DF0/DF1 there will be no prompt. If you open DF0:fileA it will (try to) open "fileA" on whatever disk is inserted in drive 0. You have probably observed the above in action many times without realizing This way you can also easily run from HD, by just doing Code:
ASSIGN GAMEDISK1: "" ASSIGN GAMEDISK2: "" YOUJUSTLOSTTHEGAME |
|
14 December 2023, 08:04 | #6 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
The things you learn.
I had no idea that could be done. The book I have has barely a paragraph for each function, and doesn't go into any detail or context about what can be used. Thanks so much for the clarification. I'll go and experiment with those. I wrote my own little routine for disk prompts using bitmaps if the user only has one drive, so that's why I wanted to know how to check if there was an external drive there. I could just make them select how many drive they have at the start of the game. That might be easier actually. |
14 December 2023, 10:48 | #7 | |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
Quote:
|
|
14 December 2023, 11:31 | #8 | |
Registered User
Join Date: Aug 2010
Location: Germany
Posts: 532
|
This used to be common knowledge on how the user interface of the Amiga works, which extends to the Workbench and how disks as well as CD-ROMs and hard disks are accessed by the user and the software alike.
I am starting to worry that if this is no longer to be taken for granted, how can developing software for the Amiga remain possible, rather than becoming a source of frustration instead. Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Let me present the A3660 | Chucky | Hardware mods | 51 | 13 July 2018 09:08 |
My 17th birthday present | Retroplay | Nostalgia & memories | 36 | 06 June 2012 07:54 |
My xmas present to myself! | DoogUK | Hardware pics | 27 | 09 January 2009 22:37 |
Colgate... game not present... | Shoonay | HOL suggestions and feedback | 2 | 20 August 2004 18:16 |
A little present | Uukrul | Amiga websites reviews | 2 | 26 September 2001 00:38 |
|
|