Hi!
I want to ask how to check that diskette is not in drive in assembler.
Thanks for every help.
Miro
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
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
You have to try to access the disk first before you'll get the error.
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.
Initializing is the most foolproof way to determine if a readable disk is present.