Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #746 > unrolled thread

Announce: Aztec C Shell Utilities including No Slot Clock Examples

Started by"Bill Buckels" <bbuckels@mts.net>
First post2013-07-15 16:26 -0500
Last post2013-07-26 05:12 -0500
Articles 8 — 2 participants

Back to article view | Back to comp.sys.apple2.programmer


Contents

  Announce: Aztec C Shell Utilities including No Slot Clock Examples "Bill Buckels" <bbuckels@mts.net> - 2013-07-15 16:26 -0500
    Re: Announce: Aztec C Shell Utilities including No Slot Clock Examples mverpelli@libero.it - 2013-07-24 04:35 -0700
      Re: Announce: Aztec C Shell Utilities including No Slot Clock Examples "Bill Buckels" <bbuckels@mts.net> - 2013-07-24 10:19 -0500
      Re: Announce: Aztec C Shell Utilities including No Slot Clock Examples "Bill Buckels" <bbuckels@mts.net> - 2013-07-24 10:32 -0500
        Re: Announce: Aztec C Shell Utilities including No Slot Clock Examples mverpelli@libero.it - 2013-07-24 09:01 -0700
      Re: Announce: Aztec C Shell Utilities including No Slot Clock Examples "Bill Buckels" <bbuckels@mts.net> - 2013-07-25 20:05 -0500
        Re: Announce: Aztec C Shell Utilities including No Slot Clock Examples mverpelli@libero.it - 2013-07-26 01:43 -0700
          Re: Announce: Aztec C Shell Utilities including No Slot Clock Examples "Bill Buckels" <bbuckels@mts.net> - 2013-07-26 05:12 -0500

#746 — Announce: Aztec C Shell Utilities including No Slot Clock Examples

From"Bill Buckels" <bbuckels@mts.net>
Date2013-07-15 16:26 -0500
SubjectAnnounce: Aztec C Shell Utilities including No Slot Clock Examples
Message-ID<ks1pdv$pji$1@speranza.aioe.org>
Available for Download at the Aztec C Website at the following link:

http://www.aztecmuseum.ca/UTL.zip

This zip file contains a number of Apple IIe Utilities written in Aztec C 
that run under the ProDOS Aztec C Shell.

Some of these utilites make use of the Apple IIe's No Slot Clock.

Within this folder are subfolders that contain the source code and compile 
environmnet for these and working disk images that group these in a topical 
nature. Hopefully they will prove both useful and informative.

The following is a brief synopsis of these utilities as they are grouped on 
disk. The Source Code comments should prove quite informative, and some 
documentation is also provided.

CHANGE.DSK

CHMOD - change file permissions
CHTYPE - change file types
TOUCH - change file dates

CLOCK.DSK (Aztec C Shell)

D8 - Gets and Sets ProDOS date and/or time.
TD - Display Date and Time - Y2K Fixup Revision

CLOCKPRO.DSK ("raw" ProDOS)

TD.SYSTEM - Same as above but for "raw" ProDOS

SHELLUTL.DSK (previously released)

CLS - clear text screen
LCASE - lower case filter
MORE - text file pager filter
SORT - sort filter
UCASE - upper case filter

LIST.DSK

FI - List ProDOS 8 file info (try it)
LM - List Multiple Files (try it)

All of these are part of a larger collection that will include DOS 3.3 Shell 
Utilities as well as ProDOS Shell Utilities, but since that work has been 
coming slowly, I am releasing what you see here in advance of the larger 
collection.

The Aztec C Shell offers wildcards and other Unix-like features which are 
supported by some of these utilities.

I hope that you will find what I have here so far useful and informative. 
Especially read the source code and try these for more details.

Regards,

Bill Buckels
bbuckels@mts.net
July 2013

[toc] | [next] | [standalone]


#763

Frommverpelli@libero.it
Date2013-07-24 04:35 -0700
Message-ID<962b3d52-d74d-428f-8d46-888e2945aac7@googlegroups.com>
In reply to#746
On Monday, July 15, 2013 11:26:29 PM UTC+2, Bill Buckels wrote:
> Available for Download at the Aztec C Website at the following link:
> 
> 
> 
> http://www.aztecmuseum.ca/UTL.zip
> 
> 
> 
> This zip file contains a number of Apple IIe Utilities written in Aztec C 
> 
> that run under the ProDOS Aztec C Shell.
> 
> 
> 
> Some of these utilites make use of the Apple IIe's No Slot Clock.
> 
> 
> 
> Within this folder are subfolders that contain the source code and compile 
> 
> environmnet for these and working disk images that group these in a topical 
> 
> nature. Hopefully they will prove both useful and informative.
> 
> 
> 
> The following is a brief synopsis of these utilities as they are grouped on 
> 
> disk. The Source Code comments should prove quite informative, and some 
> 
> documentation is also provided.
> 
> 
> 
> CHANGE.DSK
> 
> 
> 
> CHMOD - change file permissions
> 
> CHTYPE - change file types
> 
> TOUCH - change file dates
> 
> 
> 
> CLOCK.DSK (Aztec C Shell)
> 
> 
> 
> D8 - Gets and Sets ProDOS date and/or time.
> 
> TD - Display Date and Time - Y2K Fixup Revision
> 
> 
> 
> CLOCKPRO.DSK ("raw" ProDOS)
> 
> 
> 
> TD.SYSTEM - Same as above but for "raw" ProDOS
> 
> 
> 
> SHELLUTL.DSK (previously released)
> 
> 
> 
> CLS - clear text screen
> 
> LCASE - lower case filter
> 
> MORE - text file pager filter
> 
> SORT - sort filter
> 
> UCASE - upper case filter
> 
> 
> 
> LIST.DSK
> 
> 
> 
> FI - List ProDOS 8 file info (try it)
> 
> LM - List Multiple Files (try it)
> 
> 
> 
> All of these are part of a larger collection that will include DOS 3.3 Shell 
> 
> Utilities as well as ProDOS Shell Utilities, but since that work has been 
> 
> coming slowly, I am releasing what you see here in advance of the larger 
> 
> collection.
> 
> 
> 
> The Aztec C Shell offers wildcards and other Unix-like features which are 
> 
> supported by some of these utilities.
> 
> 
> 
> I hope that you will find what I have here so far useful and informative. 
> 
> Especially read the source code and try these for more details.
> 
> 
> 
> Regards,
> 
> 
> 
> Bill Buckels
> 
> bbuckels@mts.net
> 
> July 2013

Fine job as usual.
May I ask for the source code of findopen, findnext and findclose used in lm.c ?

Regards.

Marco

[toc] | [prev] | [next] | [standalone]


#764

From"Bill Buckels" <bbuckels@mts.net>
Date2013-07-24 10:19 -0500
Message-ID<ksor9f$j1$1@speranza.aioe.org>
In reply to#763
Marco <mverpelli@libero.it> wrote:
> Fine job as usual. May I ask for the source code of findopen, findnext and 
> findclose used in lm.c ?

Hi Marco,

All the source code for my routines for this compiler is in the AppleX 
distribution from the Aztec C website. I updated this a little earlier this 
year, except some of the stuff that I am currently working on. Download the 
latest compiler distribution:

http://www.aztecmuseum.ca/AppleX.zip

I would love to post all my source code right here:)

Here's ff.c - I hope it doesn't get truncated, but this is complicated 
somewhat. The reference material is all in AppleX as well as many comments 
and other demos that make all things clear. In particular look at the code 
in AppleX/PROGRAMS/LISTDIR and also in some of the slideshows... the volume 
directory in ProDOS 8 is the key here... My parody of the file find routines 
from the Microsoft C and Turbo C environments is just to wrap this stuff...

x--- snip --x

#include <stdio.h>
#include <prodir.h>

/* internal - for information call 411 */
int findcount(cnt)
int cnt;
{
 static int fcount = 0;

 if (cnt != 411) fcount = cnt;

 return fcount;
}

/* internal - for information call 411 */
int findhandle(fh)
int fh;
{
 static int fhandle = -1;

 if (fh != 411) fhandle = fh;

 return fhandle;
}


/* closes a ProDOS directory after calling findnext */
int findclose()
{
 int fh = findhandle(411);
 if (fh != -1) {
  close(fh);
  findhandle(-1);
 }
 findcount(0);
}


/* opens a ProDOS directory prior to calling findnext

   arg - path - if null uses current directory

   closes prior open directory if any.

   if successful

   - sets findhandle for findfirst
   - sets findcount for findfirst
   - returns a valid file handle

   otherwise closes directory if open and returns error

 */

int findopen(path)
char *path;
{
 char pathname[64], buf[43];
    struct fileinfo pathinfo;
    int fh = -1;

    findclose();

    if (NULL == path) {
  if (getprefix (pathname) == -1)return -1;
 }
 else strcpy(pathname,path);

 if (getfinfo (pathname, &pathinfo) == -1) return -2;
 if (pathinfo.file_type != 15) return -3;

    if ((fh = open (pathname, 0, 0)) < 0)return -4;

 if (read (fh, buf, 43) < 43) {
  close (fh);
  return -5;
 }

    findhandle(fh);
 findcount(1);

return fh;

}


/* args - input - filetype - a valid ProDOS filetype - if 0 any filetype 
will be returned.
          input - ext - extension without the dot - if null any extension 
will be returned.

          input, output - filename - char[16] - must not be null
                        - filefind structure - must not be null

          returns 0 if successful
          returns -1 if done (directory is closed when done)
          returns -2 if directory has not been opened prior to calling
*/

int findnext(filetype, ext, filename, ff)
int filetype;
char *ext, *filename;
struct filefind *ff;
{


 char buf[16];
 int fh, count, i, j, filelength;

    fh = findhandle(411);
    if (fh < 0) return -2;

    count = findcount(411);
    filename[0] = 0;

    if (NULL != ext) {
    for (i = 0; ext[i] != 0; i++) ext[i] = toupper(ext[i]);
 }


    for (;;) {

        if (read (fh,ff,39) < 39) break;
        if (ff->type == 0) break;

        count++;
        findcount(count);

        if (count == 13)
        {
         read (fh,buf,5);
            count = 0;
            findcount(count);;
        }


        filelength = (ff->length & 0xf);

        if (filelength != 0)
        {

            if (filetype == 0 || (filetype == (int)ff->type)) {

    if (NULL == ext) {
                 strncpy(filename, ff->name, filelength);
                 filename[filelength] = 0;
     return 0;
    }
    j = -1;
    for (i = 0; i < filelength; i++) {
       if (j > -1) {
        buf[j] = toupper(ff->name[i]);
        j++;
        buf[j] = 0;
       }
       if (ff->name[i] == '.') j = 0;
    }
    if (j != -1) {
        for (i = 0; ext[i] != 0; i++) {
      if (ext[i] == '?') continue;
      if (ext[i] != buf[i]) {
       j = -1;
       break;
      };
     }

    }
    if (j!= -1) {
                 strncpy(filename, ff->name, filelength);
                 filename[filelength] = 0;
     return 0;

    }
    }
        }
 }

    close (fh);
    findhandle(-1);
    findcount(0);
    ff->name[0] = 0;
    ff->length = 0;
    ff->type = 0;


 return -1;
}

[toc] | [prev] | [next] | [standalone]


#765

From"Bill Buckels" <bbuckels@mts.net>
Date2013-07-24 10:32 -0500
Message-ID<ksos2b$53e$1@speranza.aioe.org>
In reply to#763
Marco <mverpelli@libero.it> wrote:

> May I ask for the source code of findopen, findnext and findclose used in 
> lm.c ?

See my previous post for that source code. My header file, prodir.h, is 
included in my G2 library routine ff.c which is in that previous post...

ff.c is not commented much because I have documented all this stuff to death 
already in my demos and so forth and I am expecting anyone who reads it to 
have an in-depth knowledge of the language and the environment. If anyone 
reads through my stuff in AppleX they will know what I know at the end of 
their learning curve...

My prodir.h header has some of the technical bits in it. Here's the code 
from the header file:

Apologies if the text diagrams do not align. Tabstops as always are 4... but 
hey... that's implicit for hardcore C guys right?

x--- snip ---x

/* the Aztec C runtime library function getfinfo() fetches information from 
ProDOS
about a file, including volume directories and subdirectories, by issuing 
the
GET_FILE_INFO ProDOS MLI call, and returns the information about the file
in the following structure... */

struct fileinfo {
 unsigned char access;
 unsigned char file_type;
 unsigned aux_type;
 unsigned char storage_type;
 unsigned blocks_used;
 unsigned mod_date;
 unsigned mod_time;
 unsigned create_date;
 unsigned create_time;
 };


/* based on volume directory header */
struct keyblockheader{
    unsigned char length;   /* low nibble = file name length */
    char name[15];
    unsigned char  reserved[8];
    unsigned create_date;
    unsigned create_time;
    unsigned char  version;
    unsigned char  minversion;
    unsigned char  access;
    unsigned char  entrylength;
    unsigned char  entries;
    unsigned count;
    unsigned pointer;
    unsigned blocks;
    };

/* based on directory file entries */
struct filefind{
    unsigned char length;   /* low nibble = file name length */
    char name[15];
    unsigned char  type;
    unsigned key;
    unsigned blocks;
    unsigned size;
    unsigned char  size3;       /* highest byte of 3 byte filesize integer 
*/
    unsigned create_date;
    unsigned create_time;
    unsigned char  version;
    unsigned char  minversion;
    unsigned char  access;
    unsigned address;   /* load adress (subtype) low-byte */
    unsigned mod_date;
    unsigned mod_time;
    unsigned hdr;
    };

/*
Figure B-3. The Volume Directory Header

    Field                                Byte of
   Length                                Block
          +----------------------------+
  1 byte  | storage_type | name_length | $04
          |----------------------------|
          |                            | $05
          /                            /
 15 bytes /        file_name           /
          |                            | $13
          |----------------------------|
          |                            | $14
          /                            /
  8 bytes /          reserved          /
          |                            | $1B
          |----------------------------|
          |                            | $1C
          |          creation          | $1D
  4 bytes |        date & time         | $1D
          |                            | $1F
          |----------------------------|
  1 byte  |          version           | $20
          |----------------------------|
  1 byte  |        min_version         | $21
          |----------------------------|
  1 byte  |           access           | $22
          |----------------------------|
  1 byte  |        entry_length        | $23
          |----------------------------|
  1 byte  |     entries_per_block      | $24
          |----------------------------|
          |                            | $25
  2 bytes |         file_count         | $26
          |----------------------------|
          |                            | $27
  2 bytes |      bit_map_pointer       | $28
          |----------------------------|
          |                            | $29
  2 bytes |        total_blocks        | $2A
          +----------------------------+

Figure B-4. The Subdirectory Header

    Field                                Byte of
   Length                                Block
          +----------------------------+
  1 byte  | storage_type | name_length | $04
          |----------------------------|
          |                            | $05
          /                            /
 15 bytes /         file_name          /
          |                            | $13
          |----------------------------|
          |                            | $14
          /                            /
  8 bytes /          reserved          /
          |                            | $1B
          |----------------------------|
          |                            | $1C
          |          creation          | $1D
  4 bytes |        date & time         | $1D
          |                            | $1F
          |----------------------------|
  1 byte  |          version           | $20
          |----------------------------|
  1 byte  |        min_version         | $21
          |----------------------------|
  1 byte  |           access           | $22
          |----------------------------|
  1 byte  |        entry_length        | $23
          |----------------------------|
  1 byte  |     entries_per_block      | $24
          |----------------------------|
          |                            | $25
  2 bytes |         file_count         | $26
          |----------------------------|
          |                            | $27
  2 bytes |       parent_pointer       | $28
          |----------------------------|
  1 byte  |    parent_entry_number     | $29
          |----------------------------|
  1 byte  |    parent_entry_length     | $2A
          +----------------------------+

*/

/*  ProDOS 8 Technical Reference Manual
    http://www.easy68k.com/paulrsm/6502/PDOS8TRM.HTM

Figure B-5. The File Entry

  Field                                Entry
 Length                                Offset
          +----------------------------+
  1 byte  | storage_type | name_length | $00
          |----------------------------|
          |                            | $01
          /                            /
 15 bytes /         file_name          /
          |                            | $0F
          |----------------------------|
  1 byte  |         file_type          | $10
          |----------------------------|
          |                            | $11
  2 bytes |        key_pointer         | $12
          |----------------------------|
          |                            | $13
  2 bytes |        blocks_used         | $14
          |----------------------------|
          |                            | $15
  3 bytes |            EOF             |
          |                            | $17
          |----------------------------|
          |                            | $18
          |          creation          |
  4 bytes |        date & time         |
          |                            | $1B
          |----------------------------|
  1 byte  |          version           | $1C
          |----------------------------|
  1 byte  |        min_version         | $1D
          |----------------------------|
  1 byte  |           access           | $1E
          |----------------------------|
          |                            | $1F
  2 bytes |          aux_type          | $20
          |----------------------------|
          |                            | $21
          |                            |
  4 bytes |          last mod          |
          |                            | $24
          |----------------------------|
          |                            | $25
  2 bytes |       header_pointer       | $26
          +----------------------------+

*/


[toc] | [prev] | [next] | [standalone]


#768

Frommverpelli@libero.it
Date2013-07-24 09:01 -0700
Message-ID<a957524e-1c05-469f-b39a-b86ac11a2bd2@googlegroups.com>
In reply to#765
On Wednesday, July 24, 2013 5:32:27 PM UTC+2, Bill Buckels wrote:
> Marco <mverpelli@libero.it> wrote:
> 
> 
> 
> > May I ask for the source code of findopen, findnext and findclose used in 
> 
> > lm.c ?
> 
> 
> 
> See my previous post for that source code. My header file, prodir.h, is 
> 
> included in my G2 library routine ff.c which is in that previous post...
> 
> 
> 
> ff.c is not commented much because I have documented all this stuff to death 
> 
> already in my demos and so forth and I am expecting anyone who reads it to 
> 
> have an in-depth knowledge of the language and the environment. If anyone 
> 
> reads through my stuff in AppleX they will know what I know at the end of 
> 
> their learning curve...
> 
> 
> 
> My prodir.h header has some of the technical bits in it. Here's the code 
> 
> from the header file:
> 
> 
> 
> Apologies if the text diagrams do not align. Tabstops as always are 4... but 
> 
> hey... that's implicit for hardcore C guys right?
> 
> 
> 
> x--- snip ---x
> 
> 
> 
> /* the Aztec C runtime library function getfinfo() fetches information from 
> 
> ProDOS
> 
> about a file, including volume directories and subdirectories, by issuing 
> 
> the
> 
> GET_FILE_INFO ProDOS MLI call, and returns the information about the file
> 
> in the following structure... */
> 
> 
> 
> struct fileinfo {
> 
>  unsigned char access;
> 
>  unsigned char file_type;
> 
>  unsigned aux_type;
> 
>  unsigned char storage_type;
> 
>  unsigned blocks_used;
> 
>  unsigned mod_date;
> 
>  unsigned mod_time;
> 
>  unsigned create_date;
> 
>  unsigned create_time;
> 
>  };
> 
> 
> 
> 
> 
> /* based on volume directory header */
> 
> struct keyblockheader{
> 
>     unsigned char length;   /* low nibble = file name length */
> 
>     char name[15];
> 
>     unsigned char  reserved[8];
> 
>     unsigned create_date;
> 
>     unsigned create_time;
> 
>     unsigned char  version;
> 
>     unsigned char  minversion;
> 
>     unsigned char  access;
> 
>     unsigned char  entrylength;
> 
>     unsigned char  entries;
> 
>     unsigned count;
> 
>     unsigned pointer;
> 
>     unsigned blocks;
> 
>     };
> 
> 
> 
> /* based on directory file entries */
> 
> struct filefind{
> 
>     unsigned char length;   /* low nibble = file name length */
> 
>     char name[15];
> 
>     unsigned char  type;
> 
>     unsigned key;
> 
>     unsigned blocks;
> 
>     unsigned size;
> 
>     unsigned char  size3;       /* highest byte of 3 byte filesize integer 
> 
> */
> 
>     unsigned create_date;
> 
>     unsigned create_time;
> 
>     unsigned char  version;
> 
>     unsigned char  minversion;
> 
>     unsigned char  access;
> 
>     unsigned address;   /* load adress (subtype) low-byte */
> 
>     unsigned mod_date;
> 
>     unsigned mod_time;
> 
>     unsigned hdr;
> 
>     };
> 
> 
> 
> /*
> 
> Figure B-3. The Volume Directory Header
> 
> 
> 
>     Field                                Byte of
> 
>    Length                                Block
> 
>           +----------------------------+
> 
>   1 byte  | storage_type | name_length | $04
> 
>           |----------------------------|
> 
>           |                            | $05
> 
>           /                            /
> 
>  15 bytes /        file_name           /
> 
>           |                            | $13
> 
>           |----------------------------|
> 
>           |                            | $14
> 
>           /                            /
> 
>   8 bytes /          reserved          /
> 
>           |                            | $1B
> 
>           |----------------------------|
> 
>           |                            | $1C
> 
>           |          creation          | $1D
> 
>   4 bytes |        date & time         | $1D
> 
>           |                            | $1F
> 
>           |----------------------------|
> 
>   1 byte  |          version           | $20
> 
>           |----------------------------|
> 
>   1 byte  |        min_version         | $21
> 
>           |----------------------------|
> 
>   1 byte  |           access           | $22
> 
>           |----------------------------|
> 
>   1 byte  |        entry_length        | $23
> 
>           |----------------------------|
> 
>   1 byte  |     entries_per_block      | $24
> 
>           |----------------------------|
> 
>           |                            | $25
> 
>   2 bytes |         file_count         | $26
> 
>           |----------------------------|
> 
>           |                            | $27
> 
>   2 bytes |      bit_map_pointer       | $28
> 
>           |----------------------------|
> 
>           |                            | $29
> 
>   2 bytes |        total_blocks        | $2A
> 
>           +----------------------------+
> 
> 
> 
> Figure B-4. The Subdirectory Header
> 
> 
> 
>     Field                                Byte of
> 
>    Length                                Block
> 
>           +----------------------------+
> 
>   1 byte  | storage_type | name_length | $04
> 
>           |----------------------------|
> 
>           |                            | $05
> 
>           /                            /
> 
>  15 bytes /         file_name          /
> 
>           |                            | $13
> 
>           |----------------------------|
> 
>           |                            | $14
> 
>           /                            /
> 
>   8 bytes /          reserved          /
> 
>           |                            | $1B
> 
>           |----------------------------|
> 
>           |                            | $1C
> 
>           |          creation          | $1D
> 
>   4 bytes |        date & time         | $1D
> 
>           |                            | $1F
> 
>           |----------------------------|
> 
>   1 byte  |          version           | $20
> 
>           |----------------------------|
> 
>   1 byte  |        min_version         | $21
> 
>           |----------------------------|
> 
>   1 byte  |           access           | $22
> 
>           |----------------------------|
> 
>   1 byte  |        entry_length        | $23
> 
>           |----------------------------|
> 
>   1 byte  |     entries_per_block      | $24
> 
>           |----------------------------|
> 
>           |                            | $25
> 
>   2 bytes |         file_count         | $26
> 
>           |----------------------------|
> 
>           |                            | $27
> 
>   2 bytes |       parent_pointer       | $28
> 
>           |----------------------------|
> 
>   1 byte  |    parent_entry_number     | $29
> 
>           |----------------------------|
> 
>   1 byte  |    parent_entry_length     | $2A
> 
>           +----------------------------+
> 
> 
> 
> */
> 
> 
> 
> /*  ProDOS 8 Technical Reference Manual
> 
>     http://www.easy68k.com/paulrsm/6502/PDOS8TRM.HTM
> 
> 
> 
> Figure B-5. The File Entry
> 
> 
> 
>   Field                                Entry
> 
>  Length                                Offset
> 
>           +----------------------------+
> 
>   1 byte  | storage_type | name_length | $00
> 
>           |----------------------------|
> 
>           |                            | $01
> 
>           /                            /
> 
>  15 bytes /         file_name          /
> 
>           |                            | $0F
> 
>           |----------------------------|
> 
>   1 byte  |         file_type          | $10
> 
>           |----------------------------|
> 
>           |                            | $11
> 
>   2 bytes |        key_pointer         | $12
> 
>           |----------------------------|
> 
>           |                            | $13
> 
>   2 bytes |        blocks_used         | $14
> 
>           |----------------------------|
> 
>           |                            | $15
> 
>   3 bytes |            EOF             |
> 
>           |                            | $17
> 
>           |----------------------------|
> 
>           |                            | $18
> 
>           |          creation          |
> 
>   4 bytes |        date & time         |
> 
>           |                            | $1B
> 
>           |----------------------------|
> 
>   1 byte  |          version           | $1C
> 
>           |----------------------------|
> 
>   1 byte  |        min_version         | $1D
> 
>           |----------------------------|
> 
>   1 byte  |           access           | $1E
> 
>           |----------------------------|
> 
>           |                            | $1F
> 
>   2 bytes |          aux_type          | $20
> 
>           |----------------------------|
> 
>           |                            | $21
> 
>           |                            |
> 
>   4 bytes |          last mod          |
> 
>           |                            | $24
> 
>           |----------------------------|
> 
>           |                            | $25
> 
>   2 bytes |       header_pointer       | $26
> 
>           +----------------------------+
> 
> 
> 
> */

Thanks a lot.
I missed the source because I was using an Apple //c and not the cross compiler.

[toc] | [prev] | [next] | [standalone]


#777

From"Bill Buckels" <bbuckels@mts.net>
Date2013-07-25 20:05 -0500
Message-ID<kssi0l$57s$1@speranza.aioe.org>
In reply to#763
Marco <mverpelli@libero.it> wrote:
> May I ask for the source code of findopen, findnext and findclose used in 
> lm.c ?

Hi Marco,

Changing the topic a little, I will be releasing a cross-compiler for the 
Aztec C DOS 3.3 Shell fairly soon.

One of the Aztec C DOS 3.3 shell program "demos" bundled with the compiler, 
DLIST, modifies the CATALOG command to list without pausing in a continuous 
block, then calls CATALOG and then scrapes the screen and prepares a list of 
the files on a DOS 3.3 disk. The DLIST program accepts command line 
arguments for filematching of extensions and for creating text file lists of 
the files on the DOS 3.3 disk, which is its primary function.

You'll probably want to look at the source for that one too. DOS 3.3's 
built-in catalog customization is limited. No setting exists to display the 
filename field only, nor to modify the length of the other fields.

The DOS 3.3 shell is not quite as robust as the Aztec C ProDOS Shell, just 
as DOS 3.3 is not as robust as ProDOS but it is older so that can be 
expected. However, the programs are tiny.

Here's a little of the code:)

x---snip---x

    /* catalog the disk */
    precat();
    catalog(6,1,254);
    postcat();
    /* scrape the screen */
    cnt = dlines();

    scr_clear();
 scr_curs(0,0);

    /* list the files */
    if (cnt > 0) {
  cnt = dlist();
  printf("%d file(s).\n",cnt);
 }
 else {
  printf("dlines returned %d.\n",cnt);
 }

x--- snip---x

And here's a little more:)

x---snip---x

/* buffer to save and restore catalog settings */
char savecat[6];

/* function precat() is called for two main purposes:

   1. To save default catalog settings.
   2. To set-up the custom catalog settings required by this program prior
   to making the catalog call

   Note: precat() must be called to save catalog listing settings before
   calling postcat()  */
precat()
{

  /* cancels carriage returns after catalog file names */
  char *crcat = (char*)0xAE22;
  /* cancels catalog pause */
  char *cancat = (char*)0xAE34;
  /* number of characters in catalog file name */
  char *lencat = (char *)0xAE17;

  char c = (char)234;
  int len;

  /* initialize screen-scraper buffer to 0's (NULL)
     and initialize extension field position to 127
     before calling the catalog function
  */
  clear(&dline[0],BUFLEN,(char)0);
  clear(&dext[0],CATMAX,(char)127);

  /* save previous settings for catalog function */
  savecat[0] = crcat[0];
  savecat[1] = crcat[1];
  savecat[2] = crcat[2];

  savecat[3] = cancat[0];
  savecat[4] = cancat[1];
  savecat[5] = cancat[2];

  /* cancel carriage returns for catalog */
  crcat[0] = c;
  crcat[1] = c;
  crcat[2] = c;

  /* cancel catalog pause */
  cancat[0] = c;
  cancat[1] = c;
  cancat[2] = c;

  lencat[0] = (char)16;

  /* clear screen and write "header tag" */
  len = strlen("\n");
  write(1,"\n",len);

  scr_clear();
  scr_curs(0,0);

  write(1,"****",4);


}

/*  function postcat() is called after making the catalog call to restore
 the default catalog settings saved by function precat().

    Note: precat() must be called to save catalog listing settings before
 calling postcat(). */
postcat()
{

  /* cancels carriage returns after catalog file names */
  char *crcat = (char*)0xAE22;
  /* cancels catalog pause */
  char *cancat = (char*)0xAE34;
  /* number of characters in catalog file name */
  char *lencat = (char *)0xAE17;

  int len;

  /* restore saved default catalog settings */
  crcat[0] = savecat[0];
  crcat[1] = savecat[1];
  crcat[2] = savecat[2];

  cancat[0] = savecat[3];
  cancat[1] = savecat[4];
  cancat[2] = savecat[5];

  lencat[0] = (char)29;

  /* write "footer tag" */
  len = strlen("\n");
  write(1,"**\n****",(len+6));

}

/* 80 column screen-scraper helper function for dlines

   scrapes a line of the catalog listing from screen memory into a buffer
   line. converts text from apple II high-ascii screen memory format to the
   normal ascii that we all know and love...

*/
drow(x,cnt)
{
  char *pgptr = (char *)0xC054;
  unsigned int crt;
  int i,j,k;

     j = (cnt * 80);
     k = j+1;

     crt = textbase[x];
     pgptr[1] = 0x00; /* aux mem */

     for (i = crt + 40;crt<i;crt++,j+=2)
   dline[j] = (char)(poke[crt] - 128);


     crt = textbase[x];
     pgptr[0] = 0x00; /* main mem */

     for (i = crt + 40;crt<i;crt++,k+=2)
   dline[k] = (char)(poke[crt] - 128);
}


dlines()
{
 int i, cnt = 0;
    char *ptr = (char *)0x400;
    unsigned int crt;

    /* if our "header tag" (double asterisks)
       at cursor position 0,0 has "scrolled-up" just fail ! */
    if (ptr[0] != (char)170 || ptr[1] != (char)170) return -1;

    /* otherwise file listings start at the 5th row of the screen */
 for (i = 4; i < 23; i++) {
  drow(i,cnt);
  cnt++;
  crt = textbase[i];
  ptr = (char *)&poke[crt];
  /* if our "footer tag" (double asterisks)
           has been reached, return the line count */
        if (ptr[0] == (char)170 && ptr[1] == (char)170) break;
 }

 return cnt;
}

dlist()
{
 int i, j=1, k, cnt = 0, len, n, epos, elen, f=0;
 char *name, *ext, ch;


    /* step 1 - walk through the catalog listings until we reach the end...

    the filetype field in the blank entry at the end of the listing will
    either begin with a whitespace or an asterisk... in either case we
    relace the first byte in the blank entry following the listing with
    an ascii 0 */

    for (i = 0; i < BUFLEN; i+= CATLEN,j+=CATLEN) {
  if (dline[j] == (char)32) dline[i] = (char)0;
  if (dline[j] == (char)42) dline[i] = (char)0;
  if (dline[i] == (char)0)break;
 }

    /* step 2 - command line options */

    /* open the output file if any */
    if (wild[0] != 0) {
  f = -1;
  fp = fopen(wild, "w");
        if (NULL != fp) f=1;
 }

    /* get extension length if any */
    elen = strlen(srch);

    /* step 3 - check for matching files. if file matches, increment counter
    and write formatted output to screen and if optional output
    file name was specified write file list to output file */

 len = strlen("\n");

 for (j = 0,i=0; j < CATMAX; j++,i+= CATLEN) {
  /* if the first character of the catalog structure entry is ascii 0
     we have reached the end of the listing */
  if (dline[i] == (char)0) break;

  /* offset to the name field in the catalog data structure */
  n = i + ONAME;
  name = (char *)&dline[n];
  /* truncate name field */
  name[16] = (char *)0;

        /* if the extension length is 0 then filematch is
           turned-off so list all files */
        if (elen == 0) {
   /* default - list all files to screen */
   write(1,name,16);
   if ((cnt % 4) == 3) write(1,"\n",len);
   else write(1," ",len);
   cnt++;
   /* if no output file then loop to next */
            if (f != 1) continue;
     }

        for (k = 0; k < 16; k++) {
     ch = name[k];
     if (ch == '.') dext[j] = (char)k;
     if (ch == 32) name[k] = (char)0;
  }

  if (elen == 0) {
   continue;
     }

  /* extension match from here, so...
     if filename has no extension
     then skip-it */
  k = (int)dext[j];
  if (k == 127) continue;
  ext = (char *)&name[k];

  for (k = 0; k < elen; k++) {
     if (ext[k] == srch[k]) continue;
     k = 127;
     break;
  }
        /* if extension does not match
           skip it */
  if (k == 127) continue;

  /* option - list matching files to screen */
  printf("%-16s",name);
  if ((cnt % 4) == 3) write(1,"\n",len);
  else write(1," ",len);
        cnt++;

     /* option - list match to file */
  if (f == 1) fprintf(fp,"%s\n",name);
 }

 write(1,"\n",len);
 if (f==1) {
  fclose(fp);
  if (cnt != 0) printf("%s created!\n",wild);
  else unlink(wild);
 }
 if (f == -1) printf("could not create %s!\n",wild);

 return cnt;
}


[toc] | [prev] | [next] | [standalone]


#778

Frommverpelli@libero.it
Date2013-07-26 01:43 -0700
Message-ID<ca07e47c-b131-40e3-9ef6-da28c8634317@googlegroups.com>
In reply to#777
On Friday, July 26, 2013 3:05:26 AM UTC+2, Bill Buckels wrote:
> Marco <mverpelli@libero.it> wrote:
> 
> > May I ask for the source code of findopen, findnext and findclose used in 
> 
> > lm.c ?
> 
> 
> 
> Hi Marco,
> 
> 
> 
> Changing the topic a little, I will be releasing a cross-compiler for the 
> 
> Aztec C DOS 3.3 Shell fairly soon.
> 
> 
> 
> One of the Aztec C DOS 3.3 shell program "demos" bundled with the compiler, 
> 
> DLIST, modifies the CATALOG command to list without pausing in a continuous 
> 
> block, then calls CATALOG and then scrapes the screen and prepares a list of 
> 
> the files on a DOS 3.3 disk. The DLIST program accepts command line 
> 
> arguments for filematching of extensions and for creating text file lists of 
> 
> the files on the DOS 3.3 disk, which is its primary function.
> 
> 
> 
> You'll probably want to look at the source for that one too. DOS 3.3's 
> 
> built-in catalog customization is limited. No setting exists to display the 
> 
> filename field only, nor to modify the length of the other fields.
> 
> 
> 
> The DOS 3.3 shell is not quite as robust as the Aztec C ProDOS Shell, just 
> 
> as DOS 3.3 is not as robust as ProDOS but it is older so that can be 
> 
> expected. However, the programs are tiny.
> 
> 
> 
> Here's a little of the code:)
> 
> 
> 
> x---snip---x
> 
> 
> 
>     /* catalog the disk */
> 
>     precat();
> 
>     catalog(6,1,254);
> 
>     postcat();
> 
>     /* scrape the screen */
> 
>     cnt = dlines();
> 
> 
> 
>     scr_clear();
> 
>  scr_curs(0,0);
> 
> 
> 
>     /* list the files */
> 
>     if (cnt > 0) {
> 
>   cnt = dlist();
> 
>   printf("%d file(s).\n",cnt);
> 
>  }
> 
>  else {
> 
>   printf("dlines returned %d.\n",cnt);
> 
>  }
> 
> 
> 
> x--- snip---x
> 
> 
> 
> And here's a little more:)
> 
> 
> 
> x---snip---x
> 
> 
> 
> /* buffer to save and restore catalog settings */
> 
> char savecat[6];
> 
> 
> 
> /* function precat() is called for two main purposes:
> 
> 
> 
>    1. To save default catalog settings.
> 
>    2. To set-up the custom catalog settings required by this program prior
> 
>    to making the catalog call
> 
> 
> 
>    Note: precat() must be called to save catalog listing settings before
> 
>    calling postcat()  */
> 
> precat()
> 
> {
> 
> 
> 
>   /* cancels carriage returns after catalog file names */
> 
>   char *crcat = (char*)0xAE22;
> 
>   /* cancels catalog pause */
> 
>   char *cancat = (char*)0xAE34;
> 
>   /* number of characters in catalog file name */
> 
>   char *lencat = (char *)0xAE17;
> 
> 
> 
>   char c = (char)234;
> 
>   int len;
> 
> 
> 
>   /* initialize screen-scraper buffer to 0's (NULL)
> 
>      and initialize extension field position to 127
> 
>      before calling the catalog function
> 
>   */
> 
>   clear(&dline[0],BUFLEN,(char)0);
> 
>   clear(&dext[0],CATMAX,(char)127);
> 
> 
> 
>   /* save previous settings for catalog function */
> 
>   savecat[0] = crcat[0];
> 
>   savecat[1] = crcat[1];
> 
>   savecat[2] = crcat[2];
> 
> 
> 
>   savecat[3] = cancat[0];
> 
>   savecat[4] = cancat[1];
> 
>   savecat[5] = cancat[2];
> 
> 
> 
>   /* cancel carriage returns for catalog */
> 
>   crcat[0] = c;
> 
>   crcat[1] = c;
> 
>   crcat[2] = c;
> 
> 
> 
>   /* cancel catalog pause */
> 
>   cancat[0] = c;
> 
>   cancat[1] = c;
> 
>   cancat[2] = c;
> 
> 
> 
>   lencat[0] = (char)16;
> 
> 
> 
>   /* clear screen and write "header tag" */
> 
>   len = strlen("\n");
> 
>   write(1,"\n",len);
> 
> 
> 
>   scr_clear();
> 
>   scr_curs(0,0);
> 
> 
> 
>   write(1,"****",4);
> 
> 
> 
> 
> 
> }
> 
> 
> 
> /*  function postcat() is called after making the catalog call to restore
> 
>  the default catalog settings saved by function precat().
> 
> 
> 
>     Note: precat() must be called to save catalog listing settings before
> 
>  calling postcat(). */
> 
> postcat()
> 
> {
> 
> 
> 
>   /* cancels carriage returns after catalog file names */
> 
>   char *crcat = (char*)0xAE22;
> 
>   /* cancels catalog pause */
> 
>   char *cancat = (char*)0xAE34;
> 
>   /* number of characters in catalog file name */
> 
>   char *lencat = (char *)0xAE17;
> 
> 
> 
>   int len;
> 
> 
> 
>   /* restore saved default catalog settings */
> 
>   crcat[0] = savecat[0];
> 
>   crcat[1] = savecat[1];
> 
>   crcat[2] = savecat[2];
> 
> 
> 
>   cancat[0] = savecat[3];
> 
>   cancat[1] = savecat[4];
> 
>   cancat[2] = savecat[5];
> 
> 
> 
>   lencat[0] = (char)29;
> 
> 
> 
>   /* write "footer tag" */
> 
>   len = strlen("\n");
> 
>   write(1,"**\n****",(len+6));
> 
> 
> 
> }
> 
> 
> 
> /* 80 column screen-scraper helper function for dlines
> 
> 
> 
>    scrapes a line of the catalog listing from screen memory into a buffer
> 
>    line. converts text from apple II high-ascii screen memory format to the
> 
>    normal ascii that we all know and love...
> 
> 
> 
> */
> 
> drow(x,cnt)
> 
> {
> 
>   char *pgptr = (char *)0xC054;
> 
>   unsigned int crt;
> 
>   int i,j,k;
> 
> 
> 
>      j = (cnt * 80);
> 
>      k = j+1;
> 
> 
> 
>      crt = textbase[x];
> 
>      pgptr[1] = 0x00; /* aux mem */
> 
> 
> 
>      for (i = crt + 40;crt<i;crt++,j+=2)
> 
>    dline[j] = (char)(poke[crt] - 128);
> 
> 
> 
> 
> 
>      crt = textbase[x];
> 
>      pgptr[0] = 0x00; /* main mem */
> 
> 
> 
>      for (i = crt + 40;crt<i;crt++,k+=2)
> 
>    dline[k] = (char)(poke[crt] - 128);
> 
> }
> 
> 
> 
> 
> 
> dlines()
> 
> {
> 
>  int i, cnt = 0;
> 
>     char *ptr = (char *)0x400;
> 
>     unsigned int crt;
> 
> 
> 
>     /* if our "header tag" (double asterisks)
> 
>        at cursor position 0,0 has "scrolled-up" just fail ! */
> 
>     if (ptr[0] != (char)170 || ptr[1] != (char)170) return -1;
> 
> 
> 
>     /* otherwise file listings start at the 5th row of the screen */
> 
>  for (i = 4; i < 23; i++) {
> 
>   drow(i,cnt);
> 
>   cnt++;
> 
>   crt = textbase[i];
> 
>   ptr = (char *)&poke[crt];
> 
>   /* if our "footer tag" (double asterisks)
> 
>            has been reached, return the line count */
> 
>         if (ptr[0] == (char)170 && ptr[1] == (char)170) break;
> 
>  }
> 
> 
> 
>  return cnt;
> 
> }
> 
> 
> 
> dlist()
> 
> {
> 
>  int i, j=1, k, cnt = 0, len, n, epos, elen, f=0;
> 
>  char *name, *ext, ch;
> 
> 
> 
> 
> 
>     /* step 1 - walk through the catalog listings until we reach the end...
> 
> 
> 
>     the filetype field in the blank entry at the end of the listing will
> 
>     either begin with a whitespace or an asterisk... in either case we
> 
>     relace the first byte in the blank entry following the listing with
> 
>     an ascii 0 */
> 
> 
> 
>     for (i = 0; i < BUFLEN; i+= CATLEN,j+=CATLEN) {
> 
>   if (dline[j] == (char)32) dline[i] = (char)0;
> 
>   if (dline[j] == (char)42) dline[i] = (char)0;
> 
>   if (dline[i] == (char)0)break;
> 
>  }
> 
> 
> 
>     /* step 2 - command line options */
> 
> 
> 
>     /* open the output file if any */
> 
>     if (wild[0] != 0) {
> 
>   f = -1;
> 
>   fp = fopen(wild, "w");
> 
>         if (NULL != fp) f=1;
> 
>  }
> 
> 
> 
>     /* get extension length if any */
> 
>     elen = strlen(srch);
> 
> 
> 
>     /* step 3 - check for matching files. if file matches, increment counter
> 
>     and write formatted output to screen and if optional output
> 
>     file name was specified write file list to output file */
> 
> 
> 
>  len = strlen("\n");
> 
> 
> 
>  for (j = 0,i=0; j < CATMAX; j++,i+= CATLEN) {
> 
>   /* if the first character of the catalog structure entry is ascii 0
> 
>      we have reached the end of the listing */
> 
>   if (dline[i] == (char)0) break;
> 
> 
> 
>   /* offset to the name field in the catalog data structure */
> 
>   n = i + ONAME;
> 
>   name = (char *)&dline[n];
> 
>   /* truncate name field */
> 
>   name[16] = (char *)0;
> 
> 
> 
>         /* if the extension length is 0 then filematch is
> 
>            turned-off so list all files */
> 
>         if (elen == 0) {
> 
>    /* default - list all files to screen */
> 
>    write(1,name,16);
> 
>    if ((cnt % 4) == 3) write(1,"\n",len);
> 
>    else write(1," ",len);
> 
>    cnt++;
> 
>    /* if no output file then loop to next */
> 
>             if (f != 1) continue;
> 
>      }
> 
> 
> 
>         for (k = 0; k < 16; k++) {
> 
>      ch = name[k];
> 
>      if (ch == '.') dext[j] = (char)k;
> 
>      if (ch == 32) name[k] = (char)0;
> 
>   }
> 
> 
> 
>   if (elen == 0) {
> 
>    continue;
> 
>      }
> 
> 
> 
>   /* extension match from here, so...
> 
>      if filename has no extension
> 
>      then skip-it */
> 
>   k = (int)dext[j];
> 
>   if (k == 127) continue;
> 
>   ext = (char *)&name[k];
> 
> 
> 
>   for (k = 0; k < elen; k++) {
> 
>      if (ext[k] == srch[k]) continue;
> 
>      k = 127;
> 
>      break;
> 
>   }
> 
>         /* if extension does not match
> 
>            skip it */
> 
>   if (k == 127) continue;
> 
> 
> 
>   /* option - list matching files to screen */
> 
>   printf("%-16s",name);
> 
>   if ((cnt % 4) == 3) write(1,"\n",len);
> 
>   else write(1," ",len);
> 
>         cnt++;
> 
> 
> 
>      /* option - list match to file */
> 
>   if (f == 1) fprintf(fp,"%s\n",name);
> 
>  }
> 
> 
> 
>  write(1,"\n",len);
> 
>  if (f==1) {
> 
>   fclose(fp);
> 
>   if (cnt != 0) printf("%s created!\n",wild);
> 
>   else unlink(wild);
> 
>  }
> 
>  if (f == -1) printf("could not create %s!\n",wild);
> 
> 
> 
>  return cnt;
> 
> }

I always look at your source code!
I was interested in the no-slot utilities because I had it installed in my //c.

[toc] | [prev] | [next] | [standalone]


#779

From"Bill Buckels" <bbuckels@mts.net>
Date2013-07-26 05:12 -0500
Message-ID<ksti33$g15$1@speranza.aioe.org>
In reply to#778
Marco <mverpelli@libero.it> wrote:

> I always look at your source code! I was interested in the no-slot 
> utilities because I had it installed in my //c.

I've been reaqding source code instead of fiction since the '80's so I 
understand:) 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.apple2.programmer


csiph-web