Jump to content
Sign in to follow this  
tschak909

SpartaDOS X system calls via CC65?

Recommended Posts

Hello everybody, am trying to figure out the best way to do SDX system calls from C via cc65?

 

For example, there is a routine that can be called to get the current date and time:

 

 

void timedate(TimeDate* td)
{
  struct regs r;
  assert(td!=NULL);
  r.pc = 0x703; // KERNEL
  r.y = 100;    // GETTD
 
  *(byte*) 0x0761 = 0x10; // DEVICE
 
  _sys(&r);     // Do Kernel Call.
 
  td->day     = *(byte*) 0x77B;
  td->month   = *(byte*) 0x77C;
  td->year    = *(byte*) 0x77D;
  td->hours   = *(byte*) 0x77E;
  td->minutes = *(byte*) 0x77F;
  td->seconds = *(byte*) 0x780;
 
  return;
}

 

Is it possible to use a similar mechanism to get access to the other SpartaDOS X functions? For example, I need to be able to set errno, when one module of my program goes byebye, so that I can call the next program module to load (and to cut down on footprint. I do not want to write a whole overlay system when I can use the OS to do it reliably).

 

What I _want_ to do is have an overreaching TSR program (which I'd LIKE to be able to write in C), which will provide serial routines that I can call (open, close, read, write) from the other system modules (LOGIN.COM, BULLETIN, MSGBOARD, FILBOARD, BYE, etc.) and thus not only keep the memory footprint down, but to maximize modularity/flexibility.

 

-Thom

Share this post


Link to post
Share on other sites

You could use JFSYMBOL function accessible at $7eb. Look at http://sdx.atari8.info/sdx_files/4.48/SDX448_Programming_Guide_EN.pdfchapter 16.1 "Looking up the symbols (S_LOOKUP)".

A number of information is accessible by COMTAB structure addressed by DOSVEC vector.

 

Edit: Main trouble is CC65 is not supporting relocatable SDX format, so making TSRs will be hard.

Edited by mono

Share this post


Link to post
Share on other sites

No, but you don't have to use MADS' idiosyncratic features (just the directives pertaining to symbols and fixups, which would need to be catered for regardless of the language being used).

Edited by flashjazzcat

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...