![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

Ceballos Cabrillo, Federico de wrote:
> Richard Owlett wrote:
>
>
>>Is there anyway in SwiftForth to do reads of specific sectors?
>
>
> I wrote:
>
>
>>YES, it is possible to read specific sectors in SwiftForth.
>>=20
>>1440 1024 * CONSTANT SIZE
>>SIZE BUFFER: DATA
>>S" \\.\A:" R/O OPEN-FILE THROW
>>( fid ) DATA SIZE THIRD READ-FILE THROW SIZE <> THROW
>>( fid ) CLOSE-FILE THROW
>
>
> Richard Owlett wrote:
>
>
>>I'm looking for a scheme to read explicitly specified physical
>>sector(s).
>
>
> Richard (et al.),
>
> I was trying to show that you can open a disk (or floppy) in
> Windows as if it were a file. If you want to do normal file
> operations, use normal file words.
>
> The following example is given without comments:
>
> 0 VALUE F-ID
>
> : OPEN-DISK S" \\.\A:" R/O OPEN-FILE THROW TO F-ID ;
> : CLOSE-DISK F-ID CLOSE-FILE THROW 0 TO F-ID ;
>
> : READ-SECTOR ( addr n )
> S>D F-ID REPOSITION-FILE THROW ( addr )
> 512 F-ID READ-FILE THROW 512 <> THROW ;
>
> Regards,
> Federico de Ceballos
>
My confusion came from looking up definition of OPEN-FILE
: OPEN-FILE ( c-addr u fam -- fileid ior )
R-BUF -ROT R@ ZPLACE
R> SWAP FILE_SHARE_READ 0 OPEN_EXISTING
FILE_ATTRIBUTE_NORMAL FILE_FLAG_SEQUENTIAL_SCAN OR
0 CreateFile DUP 1+ 0= -199 AND ;
I got worried when I saw the "CreateFile".
I was having trouble following the code ( I'm a beginner ). BUT, I
positively knew I wanted no chance whatsoever of performing any disk
write -- Essentially how i partially trashed the disk.
It's 720k and I may have written to it with a 1.44M drive. That can
result in "not nice". My experience of innocently messing up computers
goes back to days of 026's and 12AX7's and even a KIM ;}
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Tue Feb 15 2005 - 12:21:24 PST
This archive was generated by hypermail 2.2.0 : Thu Dec 04 2008 - 03:04:19 PST