From nvcc!fozztexx@calvin.sfasu.EDU Mon Oct 12 14:10:59 1992 Received: from calvin.sfasu.edu by umaxc.weeg.uiowa.edu (5.61.jnf/920629) on Mon, 12 Oct 92 14:10:56 -0500 id AA02052 with SMTP Received: from mvax.Sonoma.EDU by calvin.sfasu.EDU with SMTP (5.59/25-eef) id AA07781; Mon, 12 Oct 92 14:05:16 CDT Return-Path: Received: by mvax.Sonoma.EDU (5.57/Ultrix2.4-C) id AA03351; Mon, 12 Oct 92 12:03:14 -0700 Received: by groucho.sonoma.edu (NeXT-1.0 (From Sendmail 5.52)/NeXT-2.0) id AA00526; Mon, 12 Oct 92 12:02:00 PDT Received: by nvcc (NeXT-1.0 (From Sendmail 5.52)/NeXT-2.0) id AA06277; Mon, 12 Oct 92 12:01:22 PDT Date: Mon, 12 Oct 92 12:01:22 PDT From: nvcc!fozztexx@calvin.sfasu.EDU (Chris Osborn) Message-Id: <9210121901.AA06277@ nvcc > Received: by NeXT Mailer (1.63) To: hyperc-l@calvin.sfasu.edu Subject: Easy way to call ProDOS Status: R Here is an easy way to call ProDOS from your C program. This is much easier because you can continue to use the cc shell script and you don't have to bother with linking several files together. Just pop this into your C source code. Excerpt from csh.c: #ifndef _STRING_H void strncpy(dest, from, len) char *dest, *from; int len; { int i; for (i = 0; i < len; i++) dest[i] = from[i]; return; } #endif #ifndef unix static char parms[32]; /* External so I don't have to put it in every function */ static char pathbuf[66]; int call_pdos(cmd, parms) unsigned int cmd; unsigned int parms; { int (*f)(); static unsigned char p[] = {0x20, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x85, 0xee, 0xa9, 0x00, 0x85, 0xef, 0x60}; p[3] = cmd; p[4] = parms & 0xff; p[5] = (parms >> 8) & 0xff; f = p; return (*f)(); } int chdir(path) char *path; { int i; strncpy(&pathbuf[1], path, 64); pathbuf[66] = 0; pathbuf[0] = strlen(&pathbuf[1]); i = (int) &pathbuf[0]; parms[0] = 0x01; parms[1] = i & 0xff; parms[2] = (i >> 8) & 0xff; return call_pdos(0xc6, parms); } #endif /* unix */ And here's a little main function to test it out: int main(argc, argv) int argc; char *argv[]; { int err; if (argc > 2) { printf("%s: Too many arguments\n", argv[0]); return 1; } if (argc < 2) { printf("%s: Chdir to what?\n", argv[0]); return 1; } err = chdir(argv[1]); switch (err) { case 0: return 0; case 0x44: printf("%s: No such file or directory\n", argv[1]); return 1; default: printf("I/O error\n"); return err; } } Also, I'm about 90% complete with my reformatting of the Ascii version of the Hyper C manuals into FrameMaker. Mostly need to convert all the Ascii pics into real graphics. Then I can begin with the rewrite/reorganization. Would be nice to have a printed copy of the original manual to refer to, or at least a copy of the graphs that went with the manual. Oh, has anyone gotten a nice unix like make working? My csh takes too long to compile, so I'd like to break it up into several modules. Without make though, it's too much work to compile and link, so I'm just putting everything into one big file. --- Chris Osborn Napa Valley College groucho.sonoma.edu!nvcc!fozztexx <- Preferred fozztexx@groucho.sonoma.edu NeXTMail ok at both