[comp.sys.amiga.tech] A little help please...

ddave@pnet02.cts.com (David Donley) (02/24/89)

OK, I am having several small problems.  First of all, I have two programs.  A
program A and a program B.  It appears that if program A has the serial.device
allocated in an exclusive manner, and program B tries to open it once,
everything is fine, and program B is locked out and errored.  If program B
tries to open it twice, it opens!  I can't figure this out, and for all I
know, it may just be something stupid I'm doing.

I want an interrupt to render graphics into a RastPort inside a window.  I
need to know when the layer is locked, so I won't draw into it and cause a
lockup/crash/guru whatever.

I want to know how to allocate my own stack for a C program.  I am writing a
BBS, and in the manual, it says "Stack 10000 at least!!!" over and over, but
people still complain of it crashing who haven't set the stack right.  I have
trie many things, but none of them seem to work right from C.  (Manx that is) 
I once had it working great, but it crashed when it exited.  If I can't
allocate it, I would like to at least be able to check it's size and abort
with an error.  (I've tried looking at the bottom of the stack, which is
supposed to have this, but I can't seem to get it to work right either.)

Thanks!

PS:  Call my BBS:  Bug Eyes BBS at (213) 372-4494

UUCP: {ames!elroy, <backbone>}!gryphon!pnet02!ddave
INET: ddave@pnet02.cts.com

peter@sugar.uu.net (Peter da Silva) (02/25/89)

This is the code I use to find the stack size for launch...

---------[from launch.shar]---------
Xstruct Process *FindTask();
...
X	struct Process *me;
X	struct CommandLineInterface *cli;
X	long stack;
...
X	if(stack == 0) {
X		me = FindTask(0);
X		if(me->pr_CLI) {
X			cli = (struct CommandLineInterface *)(me->pr_CLI<<2);
X			stack = cli->cli_DefaultStack<<2; /* DefaultStack is in Longwords */
X		} else
X			stack = me->pr_StackSize;
X	}
-- 
Peter "Have you hugged your wolf today" da Silva  `-_-'  Hackercorp.
...texbell!sugar!peter, or peter@sugar.uu.net      'U`

cmcmanis%pepper@Sun.COM (Chuck McManis) (02/28/89)

In article <12492@gryphon.COM> ddave@pnet02.cts.com (David Donley) writes:
->OK, I am having several small problems.  First of all, I have two programs.  A
->program A and a program B.  It appears that if program A has the serial.device
->allocated in an exclusive manner, and program B tries to open it once,
->everything is fine, and program B is locked out and errored.  If program B
->tries to open it twice, it opens!  I can't figure this out, and for all I
->know, it may just be something stupid I'm doing.

When you fail do you go ahead and close it? If so you may be closing the
serial.device out from under your other program.

->I want an interrupt to render graphics into a RastPort inside a window.  I
->need to know when the layer is locked, so I won't draw into it and cause a
->lockup/crash/guru whatever.

Have your interrupt routine signal a "drawing" task and then return. You
should never draw from within the interrupt routine. 

->I want to know how to allocate my own stack for a C program.  

Excellent article by Bryce Nesbitt in the various Amiga mails and in 
various archives. 


--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.

acct015@carroll1.UUCP (Bevan Wang) (03/01/89)

	This might be a stupid question... but I just purchased an Amiga and
	I am wondering how I can access the graphics mode through BASIC with
	more than four colors.  Can someone help me?

	Also I was wondering what are the 'in' languages the people on the Net
	use.  I am looking for something just a bit faster than BASIC... I am
	flexible in learning almost any language(except Assembly).

	Also(this is the final question) does anyone know how to access the
	parallel port for just on/off signals?(access meaning which pins to
	use and what code to use)  The reason why is because I need some thing
	to count a the revolutions of a high speed drive cam.  Any suggestions?

	Thanks in advance.
	Bevan Wang
	acct015@carroll1.UUCP

ddave@pnet02.cts.com (David Donley) (03/01/89)

When my task fails, I definatly do not close the serial port... Also, I have
noticed this with other programs...  Try running you favorite term three
times.

I was wanting to draw from an interrupt because my main task will probably be
doing gobs of hard disk access and heavy calculation, and I do not want the
thing to jiggle... Oh well...

        Thanks!
    _______________________________________________
    >                                             <\
    > David Donley- another P-Net C-Nut           <<
    > Do you support ANSI?  [7mGuess not[m        <<
    > Discalimer: If it doesn't work, tough.      <<
    > PS: Call the Bug Eyes BBS/\/\/\/\/\/\Bug Eyes BBS at (213) 273-4494 <<
    >_____________________________________________<<
    \_____________________| |\____________________\<
                          | ||
                          | ||
                          | ||
                          | ||
                         \|||//

cmcmanis%pepper@Sun.COM (Chuck McManis) (03/02/89)

In article <12718@gryphon.COM> ddave@pnet02.cts.com (David Donley) writes:
>I was wanting to draw from an interrupt because my main task will probably be
>doing gobs of hard disk access and heavy calculation, and I do not want the
>thing to jiggle... Oh well...

Who said anything about your "main" task? Let me rephrase, when you get the
interrupt signal your high priority drawing task to do the drawing, as soon
as you get out of the interrupt it will draw, guarunteed. Think of the 
flow like this :

	main
		Main initialization ...

		set up high priority drawing task
			LoadSeg();
			AddTask();
			FindPort("DrawingPort"); /* Wait for it to init */

		set up interrupt handler
			AddIntHandler();

		Finish main initialization start heavy calculations
		and gobs of hard disk access ...
		
		remove interrupt handler
			RemIntHandler();

		Kill off your Drawing Task
			PutMsg(DrawingPort, KILL_YOURSELF);
			WaitPort(ReplyPort); /* Wait for the reply */
			RemTask();
	
		free up whatever was allocated.
	end


--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.

ddave@pnet02.cts.com (David Donley) (03/03/89)

Thanks, I was just hoping I wouldn't need so much overhead...
---------------------------------------------------------
Disclaimer: If it doesn't work, you did something wrong.
This signature ought to be short enough for you guys.
If it isn't, go ahead, frown.  I'll sue you if you bite.
---------------------------------------------------------