Re: [cc65] Latest Snapshot - Apple II

From: Bill Buckels <bbuckels1mymts.net>
Date: 2014-05-16 16:13:40
Oliver Schmidt wrote:
>This isn't new so there's no need to post some obect file list to prove 
>whatever:

The need to post this is hardly your decision Oliver. The reason for posting 
this was to confirm that indeed I had taken a look and also to verify that 
this functionality was indeed missing. The reader has the option of not 
reading the post.

>The reason for me not implementing it so far is that there's no reasonable 
>way to implement lseek() on CBM which means that cross target programs 
>can't make use of it anyway.

So what. Aztec C65 provided this on platforms that supported it, and 
doucmented that it did not work rather than penlizing systems where it does 
work. You already have this in place in callmli which does not as far as I 
know allow itself to be directly accessed from C except selectively.

Since I am not a big fan of information hiding in a small-code application 
environment the first thing I am doing as you may have guessed is 
duplicating callmli with a _callcmli with exported structure which I find 
will be more useful.

>cc65 is an open source community project so you might consider contributing 
>a nice lseek() implementation for the A2.

That's not my most direct path to port Aztec C's additional functionality to 
this compiler. In fact goin the community route seems to be a complete waste 
of time. I really don't know how you have the patience.

You already have this half-written. Here's the Aztec C code to complete the 
other half if some else wants to try. I will be writing my own implemenation 
in C and not assembler as a replacement in my replacement runtime library 
for my development fork for my Aztec C65 por which will at least get the 
first part of the job done... lseek of course maps to seek:

struct seek_parms {
 char param_cnt,
   ref_num;
 long pos;    /* only lower three bytes are significant */
} ;
#define seek  ((struct seek_parms *)_sys_parm)

long
lseek (fd, pos, how)
long pos;
{
 register int err;

 if (fd < 0 || fd > MAXFILES || (seek->ref_num=_fil_tab[fd].unit) == 0) {
  err = EBADF;
xerr:
  errno = err;
  return(-1);
 }
 seek->param_cnt = 2;
 switch (how)  {
 case 0:
  seek->pos = pos;
  break;
 case 1:
  if (err = _system(SYS_GTMRK))
   goto xerr;
  seek->pos += pos;
  break;
 case 2:
  if (err=_system(SYS_GTEOF))
   goto xerr;
  seek->pos += pos;
  break;
 }

 if (err=_system(SYS_STMRK))
  goto xerr;
 _sys_parm[5] = 0;
 return(seek->pos);
}

As I say, you already have this half done. If nobody misses it then why do 
any more. Someone wanting to rewind a file can always close it and re-open 
it. Someone wanting to seek throught a file can just do the same and throw 
away bytes until they reach the required position. There are work-arounds 
that can be used to mask this deficiency and others without you or I 
becoming involved at this point.

The creation of a C interface for MLI calls in cc65 works for me in the 
short-term. After I get it done in a fork we can look at whether some of it 
might fit without creating a library that is too big for the commodore 64 
community to accept, but that works better for the Apple II community.

The commodore 64 and apple II community both will benefit from the Math 
library that I intend to provide as well. But since not everyone will need 
that, it probably shouldn't be in the mainline either.

I can't really see that much besides what's there is needed to write "Hello 
World!" which is a good start. Additional devlopment needs to be in place 
and working before being submitted, but until then I already have a 
framework that I can work with so I don't need to post here if these posts 
are going to be effectively censored or moderated with guidelines that don't 
help my port of Aztec C65 for the Apple II.

The compiler works great. Good job! Thanks. I'll roll with that.

Check-out my websites and my posts on usenet and on FaceBook for futher 
progress. Window's installations and my own documentation will appear as I 
make progress.

Bill 

----------------------------------------------------------------------
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 May 16 16:13:59 2014

This archive was generated by hypermail 2.1.8 : 2014-05-16 16:14:01 CEST