programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: Low level diskette I/O in Swiftforth

From: Ceballos Cabrillo, Federico de <federico.ceballos_at_unican.es>
Date: Tue, 15 Feb 2005 10:59:38 +0100

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

----------------------------------------------------------------------
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 - 02:01:22 PST

This archive was generated by hypermail 2.2.0 : Thu Dec 04 2008 - 03:04:19 PST