[Coco] How can you make permanent directory changes in OS-9 ml programs?

Robert Gault robert.gault at att.net
Sun Sep 4 15:32:18 EDT 2011


Boisy G. Pitre wrote:
 ><snip>
 > Such an extraordinary measure would be to (a) change the directory in the 
process using I$ChgDir, (b) find the process descriptor of that process in 
system RAM, (c) copy the P$DIO bytes in the process descriptor, (c) locate the 
parent's process descriptor, then (d) write the P$DIO bytes copied earlier into 
the parent's process descriptor at its P$DIO location.

Best Regards,
Boisy G. Pitre

Right, Boisy or anyone else, I think I've implemented the above but keep getting 
errors. Will the following work and if not why?

Code snippets

DskName	rmb	40
Myproc	rmb	512
Prproc	rmb	512
	rmb	255
size	equ	.

...				directories changed here

	OS9	F$ID		get my ID
	leax	Myproc,u	get copy of my process descriptor
	OS9	F$GPrDsc
	lda	Myproc+P$PID,u	get my parent's ID
	leax	Prproc,u	get copy of parent's proc descriptor
	OS9	F$GPrDsc
	lda	Prproc+P$ID,u	get pointer to parent's proc desc in
	OS9	F$GProcP	system task space
	pshs	y		save pointer
	lda	Myproc+P$Task,u	get my task number
	ldb	Prproc+P$Task,u	get parent's task number
	leax	Myproc+P$DIO,u	point to my P$DIO
	ldy	#16		bytes to move
	puls	u		recover pointer to parent
	OS9	F$Move		move my P$DIO to parent's P$DIO

The main error seems to be the OS9 F$GProcP system call. If I insert an error 
trap of
lp	bcs	lp
immediately after the F$GProcP call, the program stalls out. Here is the 
description of this system call from NitrOS-9.

**************************************************
* System Call: F$GProcP
*
* Function: Get process pointer
*
* Input:  A = Process ID
*
* Output: Y = Pointer to process descriptor
*
* Error:  CC = C bit set; B = error code
*

Any ideas on the above and how to correct it? Assuming I got the pointer without 
an error, would F$Move send the data correctly?



More information about the Coco mailing list