English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 13 December 2023, 13:38   #1
Brick Nash
Prototron
 
Brick Nash's Avatar
 
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.
Brick Nash is offline  
Old 13 December 2023, 14:07   #2
Toni Wilen
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.
Toni Wilen is offline  
Old 13 December 2023, 16:55   #3
hooverphonique
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).
hooverphonique is offline  
Old 13 December 2023, 18:40   #4
Brick Nash
Prototron
 
Brick Nash's Avatar
 
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
Thanks for the replies!

Quote:
Originally Posted by hooverphonique View Post
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).
I'm confused? I thought you had to specify exactly which disk drive you were reading from in the file name string. Like...

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?
Brick Nash is offline  
Old 13 December 2023, 19:51   #5
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,099
Quote:
Originally Posted by Brick Nash View Post
Thanks for the replies!
I'm confused? I thought you had to specify exactly which disk drive you were reading from in the file name string. Like...

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?

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
paraj is offline  
Old 14 December 2023, 08:04   #6
Brick Nash
Prototron
 
Brick Nash's Avatar
 
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.
Brick Nash is offline  
Old 14 December 2023, 10:48   #7
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by Brick Nash View Post
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.
Yes, or attempt making a dos Lock on the volume name before reading a file, and if that fails, ask the user to insert the volume.. this way you don't need to know about how many drives there is, or if the user assigned your disk names to a harddrive directory for instance.
hooverphonique is offline  
Old 14 December 2023, 11:31   #8
Olaf Barthel
Registered User
 
Join Date: Aug 2010
Location: Germany
Posts: 532
Quote:
Originally Posted by Brick Nash View Post
The things you learn.
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:
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.
Sounds like the standard assembly language introduction for the Amiga to me, as it was in the 1980'ies. Which book did you consult? There has to be something more satisfying which puts the use of the operating system into context. You do not need to start at the lowest rung of the ladder to get things done, and you do not need to write everything all by yourself.
Olaf Barthel 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
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

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 14:50.

Top

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