Re: FD2000 media detection

From: Steve Judd (sjudd_at_ffd2.com)
Date: 2000-12-28 16:28:43

Hi Nathan,

On Thu, 28 Dec 2000, Nathan Smith wrote:

> Anyone know a reliable way of detecting, using drive code, how to
detect media currently inserted. Is the best way write some rubbish to
$0500-$05ff, raw read track 80, sector 1. if a read error then assume
1581. if $0500-$05ff isn't touched then 800K else it is 1600K? Any better
methods?
> 

(Time to turn on 80-column mode in your email editor!)

Here is how FD-tools does it (g-p is the "get partition" command):

1000 open15,dv,15:print#15,"i:":get#15,e:close15
1011 dt$="  unknown"
1012 open15,dv,15:print#15,"g-p";chr$(255):get#15,pt$,d$:close15:dt=asc(d$+chr$(0))
1020 if(dt and 128)thengoto1030:rem check for disk inserted
1021 dt$="  no disk"
1025 return
1029 :
1030 if(dt and 64)thengoto1040:rem check if disk is formatted
1035 return
1039 :
1040 if(dt and 32)thengoto1050:rem check for valid cbm/cmd format
1041 dt=(dt and 15)
1042 ifdt=5thendt$="ibm  720k"
1043 ifdt=6thendt$="ibm 1.44m"
1044 ifdt=7thendt$="ibm 2.88m"
1045 return
1049 :
1050 if(dt and 16)thendt$="1581 800k":return:rem cbm or cmd format
1051 dt=(dt and 15)
1052 ifdt=1thendt$="cmd  800k"
1053 ifdt=2thendt$="cmd 1.60m"
1054 ifdt=4thendt$="cmd 3.20m"
1055 return

-Steve

-
This message was sent through the cbm-hackers mailing list.
To unsubscribe: echo unsubscribe | mail cbm-hackers-request@dot.tml.hut.fi.

Archive generated by hypermail 2.1.1.