Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-02 - 43,50232/cobwak.mac
There are no other files named cobwak.mac in the archive.
TITLE	*************** ROUTINE TO WAKE UP JOBS ***************
SUBTTL			*** WORDS OF WISDOM ***

















;********************************************************************
;*                                                                  *
;*	...AND THE EARTH WAS WITHOUT FORM, AND VOID; AND            *
;*	DARKNESS WAS UPON THE FACE OF THE DEEP. AND THE SPIRT       *
;*	OF GOD MOVED UPON THE FACE OF THE WATERS. AND GOD SAID,     *
;*	LET THERE BE LIGHT: AND THERE WAS LIGHT.                    *
;*                                                                  *
;********************************************************************














SUBTTL			*** INSTRUCTIONS ***

COMMENT @       "COBWAK" -- ROUTINE TO WAKE UP A JOB
		------------------------------------

	THIS PROGRAM IS DESIGNED TO RUN EITHER AS A SUBROUTINE ENTERED
FROM COBOL OR AS A PROGRAM RUN AT MONITOR LEVEL. THERE IS ONE PARAMETER
THAT MUST BE DEFINED AT ASSEMBLY TIME TO DECIDE IN WHICH MANNER
THE PROGRAM WILL BE ASSEMBLED. THE FOLLOWING SHOWS THE SETTINGS FOR
BOTH ASSEMBLIES:

	EXEC==1			PRODUCES A COBOL SUBROUTINE.
	EXEC==0 (OR NOT DEFINED)PRODUCES A PROGRAM RUN AT MONITOR LEVEL.

	THE COMPILATION PROCEDURE IS AS FOLLOWS TO PRODUCE A COBOL
SUBROUTINE:

	.R PIP
	*FTEXEC.MAC_TTY:
	EXEC==1			
	^Z			
	*^C
	.COMPILE FTEXEC+COBWAK

	THE LOADING IS AS FOLLOWS TO PRODUCE A PROGRAM RUN FROM
MONITOR LEVEL:

	.LOAD COBWAK
	.SAVE WAKE
@
	IFE EXEC,<XLIST>
	COMMENT @

	COBWAK EXPECTS THE FOLLOWING PARAMETER AREA TO BE SET UP
BEFORE IT IS ENTERED FROM COBOL:

	01	WAKE-ARGUMENTS.
		02	WAKE-JOB	PIC	X(6).

	COBWAK IS THEN ENTERED FROM COBOL WITH THE FOLLOWING COBOL
STATEMENT:

	ENTER MACRO COBWAK USING WAKE-ARGUMENTS.

	THE PARAMETER WAKE-JOB HOLDS THE NUMBER OF THE JOB TO BE
AWAKEN IN SIXBIT LEFT JUSTIFIED. ON RETURN FROM THE SUBROUTINE
WAKE-JOB WILL HOLD ONE OF THE FOLLOWING TWO MESSAGES:

	DONE		JOB WOKE UP.
	ERROR		JOB DID NOT WAKE UP. THIS OCCURS IF THE
			JOB WAS PROTECTED AGAINST BEING
			AWAKENED.

	COBWAK IS LOADED ALONG WITH THE COBOL PROGRAM THAT IS TO
EXECUTE IT. THE FOLLOWING "CCL" COMMAND CAN BE USED TO LOAD COBWAK
PROVIDED COBWAK.REL IS IN THE SYSTEM LIBRARY [1,4].

	.LOAD "COBOL PROGRAM NAME",SYS:COBWAK

	THE JOB CAN THEN BE SAVED WITH THE MONITOR COMMAND
"SSAVE JOBNAME" OR "SAVE JOBNAME".
@
	IFN EXEC,<XLIST>
	IFE EXEC,<LIST>
	COMMENT @

	WAKE [ASSEMBLED WITH EXEC==0 -- DEFAULT] RUNS FROM MONITOR
LEVEL. WAKE WILL ASK FOR THE NUMBER OF THE JOB TO BE AWAKEN AND
THEN WILL REPLY WITH A SHORT MESSAGE TELLING IF THE WAKE
WAS DONE.

EXAMPLE:
	.R WAKE

	JOB NUMBER--"USER SUPPLIES JOB NUMBER HERE"
	<MESSAGE>
	.

	THERE ARE SEVERAL MESSAGES THAT WAKE WILL TYPE THESE ARE
AS FOLLOWS:

	JOB HAS LIFE!		JOB WOKE UP. WAKE RETURNS TO MONITOR
				LEVEL.

	? JOB DIDN'T WAKE UP.	JOB IS STILL IN A SLEEP
				STATE OR AN ERROR OCCURED. WAKE ALLOWS
				THE USER ANOTHER CHANCE.

	? BAD JOB NUMBER.	THE USER HAS GIVEN WAKE A BAD JOB
				NUMBER TO WAKE UP. WAKE ALLOWS THE
				USER ANOTHER CHANCE.
@

	LIST
SUBTTL			*** DEFINITIONS ***

;	ACCUMULATOR DEFINITIONS.

T1=1				;TEMPORARY STORAGE.
T2=2
T3=3
WP=10				;USED TO HOLD POINTER TO COBOL'S ARGS.
PDP=17				;PUSH-DOWN POINTER.

;	OPCODE DEFINITIONS.

OPDEF	MME	[XWD 047000,0]	;MASTER MODE ENTRY.
OPDEF	NOP	[JFCL]		;NO OPERATION.

;	MASTER MODE ENTRY SYMBOLS.

.RESET==0			;RESET THE WORLD.
.WAKE==73			;PUT LIFE IN A JOB.
.TERM==12			;TERMINATE THE JOB.

;	CONSTANTS.

ZERO==0				;USED FOR INDEXING.
ONE==1				;DITTO.

;	SWITCHES.

IFNDEF EXEC, <EXEC==0>		;ZERO IF ASSEMBLED TO RUN AS PROGRAM.

;	THINGS THAT HAVE NO OTHER PLACE TO LIVE.

IFN EXEC, <ENTRY	COBWAK>		;ENTRY POINT.
SUBTTL			*** THE PROGRAM ***

IFE EXEC, <XLIST>
;HERE TO WAKE UP A JOB. COBWAK ASSUMES THAT IT
;WAS CALLED FROM COBOL WITH FOLLOWING TYPE OF
;PARAMETER AREA SET UP:
;
;	01	WAKE-ARGUMENTS.
;		02	WAKE-JOB	PIC	X(6).
;
;COBWAK IS THEN ENTERED WITH THE FOLLOWING COBOL
;STATEMENT:
;
;ENTER MACRO COBWAK USING WAKE-ARGUMENTS.

	IFN EXEC, <
COBWAK:	MOVE	WP,ZERO(PDP)		;PICK UP POINTER TO POINTER.
	MOVE	WP,@ZERO(WP)		;GET WHAT WE WANT.
	MOVE	T2,ZERO(WP)		;PICK UP JOB NUMBER IN SIXBIT.
	SETZM	T3			;ZERO OUT REGISTER TO GET NUMBER.
NXTDIG:	SETZM	T1			;CLEAR A REGISTER.
	LSHC	T1,6			;GET A CHARACTER.
	SKIPN	T1			;NO SKIP IF THAT'S ALL.
	JRST	LIFE			;GO SUPPLY LIFE.
	IMULI	T3,^D10			;SHIFT...
	ADDI	T3,-20(T1)		;CONVERT...AND ADD...
	JRST	NXTDIG			;GET NEXT DIGIT.

LIFE:	MME	T3,.WAKE		;WAKE HIM UP.
	SKIPA	T1,[SIXBIT "ERROR"]	;COULDN'T DO IT.
	MOVE	T1,[SIXBIT "DONE"]	;HE IS ALIVE.
	MOVEM	T1,ZERO(WP)		;SAVE RESULT SO GOOD PEOPLE CAN LOOK AT IT.
	AOS	(PDP)			;BUMP POINTER OVER ARGUMENT.
	POPJ	PDP,COBWAK		;BACK TO COBOL.

	END>
IFE EXEC, <LIST>
;PROGRAM TO WAKE UP A JOB. WAKE WILL ASK FOR
;THE JOB NUMBER OF THE JOB THAT IT IS TO AWAKENED.
;WAKE WILL THEN TYPE A SHORT MESSAGE
;TELLING IF THE WAKE WAS DONE.
;EXAMPLE:
;
;	.R WAKE
;
;	JOB NUMBER--"SUPPLY JOB NUMBER HERE"
;	JOB HAS LIFE!
;
;WAKE MUST BE RESTARTED FOR EACH JOB THAT IS
;TO BE AWAKEN.

	IFE EXEC, <
WAKE:	MME	.RESET			;RESET THE WORLD.
	TTCALL	3,[ASCIZ "JOB NUMBER--"];ASK FOR A JOB TO WAKE.
	SETZM	T3			;CLEAR REGISTER TO GET RESULT.
NXTDIG:	TTCALL	4,T1			;GET A CHARACTER.
	CAIE	T1,15			;IGNORE RETURNS.
	CAIN	T1,40			;IGNORE SPACES.
	JRST	NXTDIG			;GET NEXT CHARACTER.
	CAIN	T1,12			;LINE-FEED IS END OF LINE.
	JRST	LIFE			;GIVE JOB LIFE.
	CAIL	T1,"0"			;MAKE SURE WE HAVE A NUMBER.
	CAILE	T1,"9"			;TEST BOTH LIMITS.
	JRST	BADNUM			;BAD NUMBER IN INPUT STRING.
	IMULI	T3,^D10			;SHIFT LEFT.
	ADDI	T3,-60(T1)		;ADD IN NEW DIGIT.
	JRST	NXTDIG			;AGAIN PLEASE.

LIFE:	MME	T3,.WAKE		;GIVE THAT GUY SOME LIFE.
	JRST	FAIL			;WHAT HAPPENED.
	TTCALL	3,[ASCIZ "JOB HAS LIFE!"];DONE.
	TTCALL	3,[BYTE (7),15,12,0]	;SUPPLY A CRLF.
	MME	1,.TERM			;TERMINATE.
	JRST	.-1			;INCASE OF CONTINUE.

FAIL:	TTCALL	3,[ASCIZ "? JOB DIDN'T WAKE UP."]
	TTCALL	3,[BYTE (7)15,12,12,0]	;SUPPLY A RETURN.
	JRST	WAKE			;TRY AGAIN...

BADNUM:	TTCALL	4,T1			;WAIT FOR LINE-FEED.
	CAIE	T1,12			;TEST THE CHARACTER.
	JRST	BADNUM			;WAIT FOR IT.
	TTCALL	3,[ASCIZ "? BAD JOB NUMBER."]
	JRST	FAIL+1			;TRY AGAIN.

	END	WAKE>			;STARTING ADDRESS FOR WAKE.
	END