Aw: Re: [cc65] Common macros for dirent.d_type

From: A. Fachat <fachat1web.de>
Date: 2012-07-06 18:50:26
Hi there,

I'm trying this one without quoting, hopefully this goes through to the list 
now. (sorry if it's a bit late, some versions got rejected...)

First of all - Commodore BASIC does not know about the file type at all. The 
drive decides which file type to use.

It does this based on 1) secondary IEC/IEEE488 address and 2) file name 
extension.

1) on secondary address 0 and 1 - for LOAD and SAVE respectively - the drive 
selects PRG files. Those are supposed to be used for executables. On any other 
secondary address (i.e. >= 2) the drive by default uses SEQ.
Just try an OPEN 1,8,2,"NAME,W" - it will create a SEQ file, the ",W" is for 
write mode. But, you can even load a SEQ file with LOAD"NAME,S",8

2) However, when creating a file with an open like shown above, you can 
optionally add a file type to the name to determine what type of file to create. 
For example an OPEN 1,8,2,"NAME,U,W" will create a USR file.

Opening a file for reading can be done with the file type as well
OPEN1,8,2,"NAME,S,R" - it will only find those files that have the correct type, 
anything else gives a FILE TYPE MISMATCH.
Opening the file without file type like "OPEN1,8,2,"NAME,R" will open the file 
with that name without regard to the file type
(file names are unique across types)

Note: you can also create PRG files using the open method with file type: 
OPEN1,8,2,"FILE,P,W"

So I am wondering why a C program actually needs a default file type at all. 
Just use IEC secondary addresses 2 or greater, then the drive will create SEQ 
files.
Or let the user add a ",P" or ",U" to the file name to get specific file types.

Of course someone has mentioned existing programs using PRG files. I am 
wondering what they are. I know assemblers and compilers create
PRG files of course, but any program that does data processing should (IMHO) 
stay away from SEQ files, to avoid accidential loading.

André

P.S.: tested with VICE xpet and a 2031 true drive emulation.
P.P.S.: If VICE does behave differently on the virtual drives, it should 
probably be fixed.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Jul 6 18:51:35 2012

This archive was generated by hypermail 2.1.8 : 2012-07-06 18:51:38 CEST