#: 4031 S10/Tandy CoCo
31-May-90 19:13:19
Sb: #4030-#Syscall
Fm: James Jones 76257,562
To: PHIL SCHERER 71211,2545 (X)
My mistake on the name; I'm sure ss.siz is what you want. OK--here's the poop
on syscall:
syscall is a direct hook to OS-9 system calls. If you take a gander at the
Technical Manual, you'll see that the interface to the system calls is defined
in terms of what the registers of the 6809 contain when you make the call and
what they contain when the kernel gets back to you, right? OK--the interface
for the BASIC09 procedure syscall (and, for that matter, the C routine _os9())
is defined the same way--there's a TYPE statement that you should use that has
fields defined that correspond precisely to the registers of the 6809, and you
assign to the appropriate fields what you want to hand to the system call in
accordance with the input parameters specified in the manual page for that
system call. After the procedure is run, the variable you passed as a
parameter has its fields modified to reflect exactly what comes back from the
system call. The fields that correspond to the registers contain just what the
registers had in them coming back from the system call.
In this particular case, you have to do something perhaps a little
counterintuitive, because the length of a file can be up to 2**32 bytes, which
is too big to fit in a BASIC09 INTEGER variable. The length comes back from
the system call with the least-significant 16 bits in one register, and the
mostsignificant 16 bits in another. To get the right length, you need to do
something like "65536.0*regs.x+regs.y" to force the calculation to be done in
floating-point arithmetic. So you'd say "SEEK #path,65536.0*regs.x+regs.y" to
get to the end of the file open on path.
There should be a tutorial that gives all the gory details of syscall, probably
better than I've done here, and probably with examples, which I'd say would be
very appropriate at this point. Wander over to the DL areas and browse--or
maybe someone here will pipe up with the proper file name and area (eh eh,
nudge nudge! :-).
There is 1 Reply.
|