Path: utzoo!attcan!uunet!jarthur!uci-ics!orion.oac.uci.edu!usc!zaphod.mps.ohio-state.edu!uwm.edu!bionet!agate!pasteur!ucbvax!pro-generic.cts.com!ericmcg From: ericmcg@pro-generic.cts.com (Eric Mcgillicuddy) Newsgroups: comp.sys.apple Subject: hyperC Message-ID: <214.infoapple.net@pro-generic> Date: 28 Feb 90 05:22:25 GMT Sender: usenet@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 62 Rajeev Dayal has asked how to get the current working directory. In the Shell, 'pwd' displays the current prefix. This hints at the presense of a library function that handles the details. The documentation does not list one, however some poking around reveals a routine that can be called from within a program. LOCAL VOID getPrefix(buf) CHAR buf[64] handles the situation. Prodos recommends 64 characters for prefixes so make sure that amount of memory is reserved. This brings up another point. On my searches, I found that most MLI calls were handled directly by HyperC functions. In fact you could probably write FST's in HyperC (not really, but I wanted to turn some of Matt's hair gray). Three different methods are used to pass parameter though. One uses the address of the destination buffer, usually on 1 parameter calls. The second passes the address of a structure, for 6 or greater parameter calls. The ones in between, mercifully few, use global variables such as NewPath[], oldPath[], and a few others. Returned values will likely occupy one or more of the parameters passed (or structures thereof). I would suggest re-writting the lowest level MLI calls in an assembly module that you personally can use. for example here is the _getPrefix call using the HyperC asm6502 assembler: .entry _getPrefix _getPrefix: ldy #0 lda [sp],y sta pfixparms+1 iny lda [sp],y sta pfixparms+2 jsr 0xbf00 ;prodos jmp vector .byte 0xc7 .word pfixparms sta _ioresult ;global variable return right? rts pfixparms: .byte 1 .word 0 Mr. Dayal's other question dealt with the floating point functions. Results are returned in the first parameter passed. e.g. fmultd(f1,f2) returns the result in f1. To get around this he suggested writing separate functions that create a temp variable and then call the desired function. for instance: DOUBLE multd (f1,f2) DOUBLE f1,f2; { DOUBLE temp; temp=f1; return(fmuld(temp,f2)); } This will work, however I believe temp still takes real memory although how long before it is re-used is unknown, I'd expect some of the zero page memory locations are used for temporary storage and there is no telling how soon they will become non-current. I would suggest allocating the 4-10 bytes up front just to be sure. i.e. DOUBLE f1,f2,f3; f3=f1; fmuld(f3,f2);