How to detect that diskette is not in drive?

Started by MIRKOSOFT, February 22, 2010, 12:04 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

MIRKOSOFT

Hi!

I want to ask how to check that diskette is not in drive in assembler.

Thanks for every help.

Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster and more!!!

http://www.mirkosoft.sk

Hydrophilic

#1
The easiest way, I think, is to issue disk command "I0:" (initialize drive 0).  If no disk is present, or if disk is not CBM format (maybe Apple or foreign CP/M format), you will usually get error: 21, READ ERROR, 18, 00.

Error 21 means no sync mark was detected.  Because Apple and foreign CP/M disks (Kaypro, Osborne, etc.) do not write GCR sync marks, you will likely get this error if such a disk is inserted.  Another error you sometimes get is 74, DRIVE NOT READY.

I don't know why sometimes you get one error or the other.  Best to check for both error 21 and error 74.  I hope this helps!

Edit
If disk is Commodore CP/M format, then you will get no error.  Be careful!
/Edit
I'm kupo for kupo nuts!

MIRKOSOFT

Hi!
Yes, I tried this.
But don't understand why error channel reading returns OK also when is disk not in drive...
Can you explain me this?
Thanks
Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster and more!!!

http://www.mirkosoft.sk

airship

You have to try to access the disk first before you'll get the error.
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

cbmguy

Is this what you're looking for?:

print#15,"m-r";chr$(0)chr$(28)chr$(1):get#15,a$:a = asc(a$)and16

if a = 16 there is a disk in the drive.  if a is clear, then there is no disk in the drive

I did this years ago with a 1541.   I used to check for a disk in the drive and then wait until one was present.  One thing about this is that you cannot tell if the drive door is shut or not...  still not 100% fool proof.

BigDumbDinosaur

Initializing is the most foolproof way to determine if a readable disk is present.
x86?  We ain't got no x86.  We don't need no stinking x86!