
*3400

/BCD SUBTRACT, 6-DIGITS (DOUBLE)
/
/CALLING SEQUENCE:
/JMS SUBBCD
/X     /ADDRESS OF LEAST SIGNIFICANT OF X
/Y     /ADDRESS OF LEAST SIGNIFICANT OF Y
/EXIT IF X<Y     /+ RESULT
/EXIT IF X=Y     /0
/EXIT IF X>Y     /-
/
/(MOST SIGNIFICANT)=(LEAST)+1
/
/
SUBBCD,	ENTRY
	TAD I SUBBCD 	/GET ARGS.
	ISZ SUBBCD
	DCA XX
	TAD I SUBBCD
	ISZ SUBBCD
	DCA YY
	JMS MOVEIT 	/SAVE X
XX,	0
	ZZZ
	TAD .-1
	JMS COMPL 	/ASSUME Y>X
	JMS I BSADD
	ZZZ
YY,	0
	SNL CLA 		/DID FOR ADD OVERFLOW.
	JMP SUBNEG 	/TEST Y<X
	TAD I YY 		/CHECK FOR 000,000
	ISZ YY 		/DON'T MISTAKE FOR
	TAD I YY 		/800,800
	SNA SZL CLA 	/(7670
	ISZ SUBBCD
	JMP I SUBBCD
//////
SUBNEG,	TAD YY 		/RECOMPLEMENT
	JMS COMPL
	JMP I SUBBCD
ZZZ,	0;0
BSADD,	ADDBCD

/BCDSH VIA BCDSHI
/ "BCDSH"
/ A SUBROUTINE TO SHIFT A BCD DIGIT GIVEN
/IN THE ACC. , INTO THE LEAST SIGNIFICANT END OF
/A DOUBLE LENGTH (6DIGIT) BCD NUMBER, WHOSE LEAST
/SIGNIFICANT WORD IS AT "OLD" SAY.
/AND MOST SIG. AT "OLD+1".
/IF THE OLD NUMBER IS ALREADY MORE THAN 5 DIGITS
/THE TOP DIGIT WILL DISSAPPEAR. IF THE NEW
/NUMBER IS MORE THAN 4BITS , IE. 1 BCD DIGIT
/THEN THE RESULT WILL BE NONSENSE
/OCCUPIES 32 MEMORY LOCATIONS (DECIMAL).
/RUNNING TIME = 52 CORE CYCLES = 78 MICROSEC.
/CALLING SEQUENCE :  TAD "NEW" ; JMS BCDSH ; "OLD"
/   THEN EXIT WITH ZERO ACC.
/
BCDSH,	0
	AND P17P 		/CLEANUP IN CASE!
	DCA LONG1 	/HOLD NEW BCD DIGIT
	TAD I BCDSH
	DCA LONG3 	/GET ADDRESS OF OLD NUMBER
	TAD I LONG3
	RTL
	RTL
	DCA LONG2 	/MOVE AROUND
	TAD LONG2
	AND LMSKK 	/MAKE SPACE FOR NEW DIGIT
	TAD LONG1 	/SHOVE IN NEW
	DCA I LONG3 	/STORE LS RESULT
	ISZ LONG3 	/MOVE POINTER TO MS END
	TAD LONG2
	RAL
	AND P17P
	DCA LONG1 	/DIGIT FOR MS WORD
	TAD I LONG3
	RTL
	RTL
	AND LMSKK 	/MAKE SPACE FOR ABOVE DIGIT
	TAD LONG1 	/PUSH IT IN
	DCA I LONG3 	/STOREMS END OF RESULT
	ISZ BCDSH
	JMP I BCDSH 	/EXIT
LONG1,	0
LONG2,	0
LONG3,	0 		/TEMPORARIES
LMSKK,	7760
P17P,	17
//////////

/COMPLEMENT SUBROUTINE FOR USE IN SUBTRACT ROUTINE
/10'S COMPLIMENT OF 6 DIGIT BCD NUMBER
/CALLING SEQUENCE :-
/AC: (POINTER TO LOWER HALF); AC+1=UPPER.
/ JMS COMPL
/EXIT WITH ZERO ACC AND X COMPLIMENTED
/NOTE THE LS DIGIT COULD EQUAL 10 ;THIS IS OK FOR THE BCD ADD ROUTINE.
COMPL,	0
	DCA AA 		/STORE POINTS
	TAD I AA 		/GET LS END
	TAD BB 		/ADD 6'S
	CMA IAC 		/10'S COMPLIMENT
	DCA I AA 		/STORE LS END
	ISZ AA 		/INDEX POINTS
	TAD I AA 		/GET MS END
	TAD BB 		/ADD 6'S
	CMA 		/9'S COMPLIMENT
	DCA I AA 		/STORE HS END
	JMP I COMPL 	/EXIT
AA,	0 		/ POINTER STORE
BB,	3146 		/(0110 0110 0110)
/////2 WORD MOVE ROUTINE,  X TO Y    X+1 TO Y+1
/CALLING SEQUENCE:-
/          JMS I MOVE
/        XXX
/        YYY
/
MOVEIT,	ENTRY
	TAD I MOVEIT 	/GET ADDRESSES
	DCA X11
	ISZ MOVEIT
	TAD I MOVEIT
	DCA Y11
	ISZ MOVEIT
	TAD I X11 	/MOVE LOWER
	DCA I Y11
	ISZ X11 		/MOVE POINTERS.
	ISZ Y11
	TAD I X11 	/MOVE UPPER
	DCA I Y11
	JMP I MOVEIT
X11,	0
Y11,	0

/TOTAL VIA TOTLIT

/ZEROIT VIA ZEROIN
/SUB. TO ZERO 2 WORDS , AT XXX & XXX+1
/CALLING SEQUENCE :-
/   JMS I ZEROIN
/   XXXXXX
ZEROIT,	0
	DCA .+5 		/DEPOSIT POINTER
	DCA I .+4 	/ZERO FIRST
	ISZ .+3
	DCA I .+2 	/ZERO SECOND
	JMP I ZEROIT
	0 		/TEMPORARY

/SORT AND REPLACE.
/

/CHARACTER SORTING OR GENERAL DISPATCH
/SUBROUTINE. GIVEN AN ARGUEMENT (POSITIVE)
/IN THE AC. , IT SEARCHES A TABLE FOR
/THAT ARGUEMENT. WHEN IT IS FOUND, DELTA
/IS ADDED TO THE CURRENT VALUE OF THE
/POINTER (WHICH WAS POINTING AT THE
/ARGUEMENT IN THE TABLE),TO POINT IT AT
/THE ENTRY CORRESPONDING TO THAT 
/ARGUEMENT.THAT ENTRY IS THEN PLACED IN
/THE ACC. AND THE SECOND SUBROUTINE
/EXIT IS TAKEN.
/IF THE ARGUEMENT IS NOT IN THE TABLE
/THE FIRST EXIT OF THE SUBROUTINE IS
/TAKEN.THE END OF THE TABLE OF ARGUEMENTS
/IS ALWAYS INDICATED BY A DUMMY ENTRY
/WHICH MUST BE NEGATIVE.
/CALLING SEQUENCE:-
/          TAD "ARGUEMENT"
/          JMS SORTCH
/          TABLE ADDRESS  /1ST. ENTRY 
/          DELTA
/     EXIT IF SEARCH FAILS (AC=END DUMMY)
/     EXIT WITH CORRESPONDENCE IN ACC.
/
SORTCH,	ENTRY 		/DISPATCH TABLE ROUTINE
	DCA CHARR 	/SAVE THE INPUT
	TAD I SORTCH
	DCA POINT 	/SAVE TABLE POINTER.
	ISZ SORTCH
	TAD I POINT 	/GET ARG. FROM TABLE
	SPA 		/IS THIS THE LAST ENTRY ?
	JMP EXIT1 	/YES, ARG. NOT TABLED
	CIA 		/NEGATE TABLED ENTRY
	TAD CHARR
	SNA CLA 		/ARE THEY EQUAL?
	JMP .+3 		/YES
	ISZ POINT 	/NO....
	JMP SORTCH+5 	/...GO BACK FOR NEXT
	TAD I SORTCH 	/...ADD TO POINTER...
	TAD POINT 	/...TO FIND ADDRESS...
	DCA POINT 	/...OF CORRESPONDING ENTRY
	TAD I POINT 	/ GET CORRESPONDING ENTRY
	ISZ SORTCH 	/GO TO SECOND EXIT
EXIT1,	ISZ SORTCH
	JMP I SORTCH
CHARR,	0
POINT,	0
/NOTE THAT THE CORRESPONDING ENTRY COULD
/BE A TRANSFORMATION OF THE ARGUEMENT,
/OR AN ADDRESS TO WHICH THE PROGRAM SHOULD
/GO FOR THAT KIND OF ARGUEMENT. IT ALL
/DEPENDS HOW THE RESULT OF THE SUBROUTINE
/IS USED.

*3600

/BCD ADD SUBROUTINE, X + Y => Y
/CALLING SEQUENCE:-
/     JMS ADDBCD  ; XXXXXX ; YYYYYY
/WORKS WITH 6 DIGIT BCD NUMBERS, POINTERS POINT AT LS ENDS
/USES THE SINGLE LENGTH BCD ADD ROUTINE "BCDADD"
ADDBCD,	ENTRY
	CLA
	TAD I ADDBCD
	DCA T1 		/STORE X POINTER
	ISZ ADDBCD
	TAD I ADDBCD
	DCA T2 		/STORE Y POINTER
	TAD T2
	IAC
	DCA T3 		/(Y+1) = TOP END POINTER
	TAD I T1
	JMS BCDADD 	/GO TO SINGLE LENGTH ADD
T2,	0 		/ADDEND ADDRESS
	DCA I T2 		/LS RESULT
	ISZ T1 		/MOVE POINTER TO (X+1)
	RAL 		/GET CARRY
	TAD I T1 		/ADD TO MS END
	JMS BCDADD 	/SINGLE ADD AGAIN
T3,	0
	DCA I T3 		/STORE MS END
	ISZ ADDBCD 	/MOVE POINTER TO EXIT
	JMP I ADDBCD
T1,	0
////////

/BCD ADDITION SUBROUTINE
/CALLING SEQUENCE:-
/      TAD ONE NUMBER
/      JMS BCDADD
/      OTHER NUMBER'S ADDRESS
/      EXIT WITH SUM (BCD) IN ACC. WITH CARRY IN LINK.
/NOTE.   THE TWO NUMBERS NEED NOT BE RATIONALISED, PROVIDED
/THE RAW SUM OF ANY CORRESPONDING DIGITS DOES NOT EXCEED 19.
/IN OTHER WORDS, A BCD NUMBER COULD BE INDEXED AS A BINARY
/NUMBER AND SUBSEQUENTLY RATIONALISED BY THIS ROUTINE.
/
/
BCDADD,	ENTRY
	DCA ALPHA
	TAD I BCDADD 	/GET OTHER OPERAND
	DCA TEMP2
	TAD I TEMP2
	DCA BETA
	ISZ BCDADD 	/MOVE POINTER DOWN
	JMS BBCCDD
	0017 		/ (0000 0000 1111)
	7766 		/ (1111 1111 0110)
	0012 		/ (0000 0000 1010)
	SZL 		/SKIP IF NO CARRY FROM UNITS
	TAD EIGHT 	/ (0000 0001 0000)
	JMS BBCCDD
	0360 		/ (0000 1111 0000)
	7540 		/ (1111 0110 0000)
	0240 		/ (0000 1010 0000)
	SZL 		/SKIP IF NO CARRY FROM 8'S
	TAD SIXTY4 	/( 0001 0000 0000)
	JMS BBCCDD
MSK74,	7400 		/ (1111 0000 0000)
	3000 		/ (0110 0000 0000)
	5000 		/ (1010 0000 0000)
	JMP I BCDADD 	/EXIT WITH RESULT IN ACC. & LINK.

/NOW THE COMMON SUBROUTINE WHICH MASKS AND ADDS THE DIGITS.
BBCCDD,	ENTRY
	DCA TEMP2 	/STORE RESULT SO FAR
	CLL
	TAD I BBCCDD 	/GET CURRENT MASK BITS
	AND ALPHA
	DCA TEMP1
	TAD I BBCCDD 	/GET MASK AGAIN
	AND BETA
	TAD TEMP1 	/SUM THESE TWO DIGITS
	TAD TEMP2 	/ADD PREVIOUS RESULT SO FAR
	ISZ BBCCDD 	/MOVE POINTER DOWN
	TAD I BBCCDD 	/TEST FOR SPILL FROM TOP DIGIT SO FAR
	ISZ BBCCDD 	/MOVE POINTER DOWN AGAIN
	SZL 		/SKIP IF NO SPILL OCCURED
	JMP .+3 		/SPILL OCCURED, END SUBROUTINE.
	TAD I BBCCDD 	/CORRECT FOR UNWANTED ADDITION OF 6
	CLL 		/CORRECT FOR LINK TOO
	ISZ BBCCDD 	/MOVE POINTER DOWN YET AGAIN
	JMP I BBCCDD 	/EXIT TO PUT BACK SPILL BIT IF NECESS.
TEMP1,	0
TEMP2,	0
ALPHA,	0
BETA,	0
EIGHT,	0020
SIXTY4,	0400 		/THESE TWO ARE IN BCD


///////////BCD MULTIPLY SUBROUTINE.
/CALLING SEQUENCE:-
/        TAD XXX             /GET MULTIPLIER
/          JMS MPYBCD
/           YYYYYY  /ADDRESS OF MULTIPLICAND
/           ZZZZZZ  /ADDRESS WHERE RESULT IS PUT
/Y & Z POINT TO THE LS END OF 6 DIGIT NUMBERS
/USES ZEROIT, MOVEIT, ADDBCD, BCDSH
MPYBCD,	ENTRY
	DCA MULT 		/PLANT MULTIPLIER
	TAD I MPYBCD
	DCA MCAND 	/POINTER TO MULTIPLICAND
	ISZ MPYBCD
	TAD I MPYBCD
	DCA PROD 		/POINTER TO PRODUCT
	TAD PROD
	JMS I ZERO1
	ISZ MPYBCD
	JMS I MOVE 	/MOVE MULTIPLICAND TO WORKING AREA
MCAND,	0
	WORK
SWIZ,	TAD MULT 		/GET MPYER
	SNA 		/IS IT ZERO?
	JMP I MPYBCD 	/YES, EXIT NOW
	CLL RTR
	RTR
	DCA WORK2 	/SHIFT NEXT DIGIT INTO POSITION
	TAD MSK377 	/GET NEXT 3 DIGITS
	AND WORK2 	/CLEAR THE CURRENT DIGIT AWAY
	DCA MULT 		/STORE IT FOR THE NEXT ROUND
	TAD WORK2
	RAR
	CLL 		/GET CURRENT DIGIT INTO POSITION
SWIZIL,	TAD MSK74 	/SUBTRACT 100
	DCA WORK2 	/HOLD COUNTED DOWN DIGIT
	SZL 		/THIS DIGIT DONE?
	JMP .+4 		/NO, ADD AGAIN
	JMS I BCDSH6 	/YES, MPY BY 10
	WORK 		/POINTER TO WORKING AREA
	JMP SWIZ 		/TO DO NEXT DIGIT
	JMS ADDBCD 	/DOUBLE LENGTH ADD
	WORK 		/POINTER TO WORKING AREA
PROD,	0 		/POINTER TO PRODUCT AREA
	TAD WORK2 	/GET COUNTED DOWN DIGIT AGAIN
	JMP SWIZIL 	/BACK TO CONTINUE THIS DIGIT
WORK,	0
	0 		/MULTIPLIER WORKING AREA
MULT,	0
WORK2,	0
ZERO1,	ZEROIT
BCDSH6,	BCDSH
MOVE,	MOVEIT
MSK377,	377
	PAUSE


*4000

/DOLLAR OUTUT

/CALLING SEQUENCE:
/JMS DOLOUT
/    LOW ORDER ADDRESS 
/(RETURNS HERE)
/
/THIS ROUTINE PRINTS "$XXXX.YY " ; THE "X'S" WILL
/BE OR HAVE LEADING BLANKS.
/ 
DOLOUT,	ENTRY
	TAD I .-1
	ISZ .-2
	JMS GETARG 	/PICK UP DATA.
	TAD DOLLAR 	/PRINT DOLLAR.
	JMS I OUTCX
	JMS SPACES 	/PRINT LEADING BLANKS.
	TAD FIRST
	ISZ ADR
	SNA CLA 		/STILL NEED BLANKS.
	JMS SPACEQ
	JMP BCD3 		/NO
	TAD SPACE
	JMS ROT 		/YES
BCD4,	TAD POIT
	JMS I OUTCX 	/PRINT POINT AND
	JMS OUT 		/DECIMAL DIGITS.
	JMS OUT
	TAD SPACE
	JMS I OUTCX 	/FORMAT BY A SPACE.
	JMP I DOLOUT
///////
BCD3,	JMS OUT 		/PRINT ZEROS OR NUMBERS
	JMP BCD4
///////

/JMS SPACEQ
/  EXIT IF NON-SPACE
/  EXIT IF A SPACE(240)
SPACEQ,	ENTRY 		/SPACE QUERY.?
	TAD I ADR
	AND P7400D
	SNA CLA
	ISZ SPACEQ
	JMP I SPACEQ
///////
/PRINTS LEFTMOST BCD DIGIT AND ROTATES THE WORD.

OUT,	ENTRY
	TAD I ADR
	RTL;RTL;RAL
	AND P17D
	TAD P260D 	/SETUP ASCII
	JMS ROT 		/OUTPUT
	JMP I OUT
////////
// OUTPUT THE AC AND ROTATE I ADR.
ROT,	ENTRY
	JMS I OUTCX 	/PRINT A DIGIT
	TAD I ADR
	RTL;RTL 		/POSITION NEXT DIGIT
	DCA I ADR
	JMP I ROT
///////
POIT,	256 		/.
DOLLAR,	244 		/$
SPACE,	240 		/
ADR,	0;0 		/POINTER;HIGH;LOW.
CNTR,	0
FIRST,	0 		/SAVE HIGH ORDER TO CHECK FOR 0'S.
P17D,	17
P260D,	260
P7400D,	7400
M3,	-3


/PRINT SIX BCD CHARACTERS.


/THE POINTER FOLLOWS THE CALL.
/THE ROUTINE PRINTS LEADING BLANKS,
/6 BCD DIGITS, AND ONE EXTRA SPACE.
/ (HIGH ORDER) = (LOW) + 1 . 

P6BCD,	ENTRY
	TAD I .-1
	JMS GETARGS
	ISZ P6BCD
	JMS SPACES 	/PRINT FIRST THREE DIGITS
	TAD FIRST
	SZA CLA 		/ARE THERE ANY NON-ZEROS?
	JMP P6BCD2 	/YES
	JMS P3BCD 	/NO
	ADR+2
	JMP I P6BCD
///
P6BCD2,	ISZ ADR 		/SETUP LOW ORDER WORD.
	JMS OUT 		/ PRINT LAST THREE DIRECTLY
	JMS OUT 		/ SINCE THE FIRST THREE CONTAINED
	JMS OUT 		/ AT LEAST ONE NON-ZERO NUMBER.
	TAD SPACE
	JMS I OUTCX 	/FORMAT SPACE.
	JMP I P6BCD
///////

/ OUT3S VIA PUNCH3

/ROUTINE PUNCHES THREE BCD NUMBERS FROM ONE REGISTER
/WHOSE POINTER FOLLOWS THE CALL.
/ THE METHOD IS TO ADD
/ 17 TO THE FOUR BITS.

OUT3S,	ENTRY
	TAD I .-1 	/GET ADDRESS OF ARGUMENTS.
	JMS GETARGS
	ISZ ADR 		/USE ONLY LOW ORDER PART.
	TAD M3
	DCA CNTR 		/ SETUP THE COUNT./
	ISZ OUT3S
	TAD I ADR 	/ MAKE A NO-PRINT FROM BCD.
	AND P17D
	TAD P17D
	JMS ROT 		/OUTPUT.
	ISZ CNTR 		/DONE YET?
	JMP .-5 		/NO
	JMP I OUT3S 	/YES
////////////

SPACES,	ENTRY 		/PRINTS 3BCD WITH
	TAD M3 		/LEADING BLANKS.
	DCA CNTR
	JMS SPACEQ 	/ IS THE NEXT DIGIT ZERO? 
	JMP NUMBRS 	/  NO.
	TAD SPACE 	/   YES.
	JMS ROT 		/    OUTPUT AND GET NEXT.
	ISZ CNTR
	JMP .-5
	JMP I SPACES
/////
NUMBRS,	JMS OUT 		/ PRINT THE NEXT DIGIT.
	ISZ CNTR
	JMP .-2 		/PRINT THREE.
	JMP I SPACES
/////////
/ROUTINE GETS THE INPUT DATA AND SAVES IT.
GETARG,	ENTRY 		/PICK UP ARGS FOR PRINT SUBROUTINES.
	DCA ADR 		/SAVE ADDRESS.
	TAD I ADR 	/GET LOW ORDER.
	DCA ADR+2 	/REVERSE PLACES.
	ISZ ADR
	TAD I ADR
	DCA ADR+1
	TAD ADR+1 	/SAVE HIGH ORDER PART.
	DCA FIRST
	TAD .+3 		/SET POINTER.
	DCA ADR
	JMP I GETARG
	ADR+1 		/POINTS TO HIGH ORDER PART.
///////


/ P3BCD VIA PRINT3

P3BCD,	ENTRY 		/3+ SPACE.
	TAD I .-1
	ISZ .-2 
	JMS GETARGS
	ISZ ADR 		/USE ONLY LOW ORDER PART.
	JMS SPACES
	TAD SPACE
	JMS I OUTCX 	/ PRINT TRAILING SPACE./
	JMP I P3BCD


*4200
/SORT AND BRANCH
/"TABLE SIZE" MAY ALSO BE INTERPRETED
/AS THE INCREMENT BETWEEN THE IN-TABLE 
/AND THE OUT-TABLE.  IT MAY THEREFORE
/BE NEGATIVE.


/SIMILAR TO THE ABOVE PROGRAM EXCEPT THAT THE
/SECOND EXIT IS NOT USED; INSTEAD THE
/CORRESPONDENCE IS USED AS THE BRANCH ADDRESS.

SORTCB,	ENTRY
	DCA CHARR 	/SAVE THE INPUT
	TAD I .-2
	DCA POINT 	/SAVE THE POINTER
	ISZ SORTCB
	TAD I POINT
	SPA
	JMP EXIT2 	/END OF TABLE
	CIA
	TAD CHARR
	SNA CLA
	JMP .+3 		/MATCH FOUND
	ISZ POINT
	JMP SORTCB+5
	TAD I SORTCB 	/GET DELTA.
	TAD POINT
	DCA POINT 	/COMPUTE ADDRESS
	JMP I POINT 	/TRANSFER CONTROL
/////
EXIT2,	ISZ SORTCB 	/CHARACTER NOT IN TABLE
	JMP I SORTCB 	/RETURN CONTROL

/ GET A NUMBER
/ SUBROUTINE GETNUM READS IN A SERIES OF N ASCII DIGITS
/TERMINATED BY A ";" .  IF MORE THAN N DIGITS AFTER OR IF
/ASCII CHARACTERS OTHER THAN 0-9 AND ; ARE RECEIVED, THE
/ROUTINE JMP OUTS  THROUGH TERROR
/ IF N>6 AND >6 DIGITS GIVEN,THE LAST 6 ONLY ARE KEPT AND NO
/        ERROR INDICATED.
/CALLING SEQUENCE:
/         TAD (N)
/        JMS GETNUM
/        NUMBER              /POINTER TO LS END OF NUMBER
/USES GETCX, BCDSH, SORTCH, ZEROIT
GETNUM,	ENTRY
	CMA 		/ -(N+1)
	DCA DIGCNT
	TAD I GETNUM
	DCA GETNP 	/POINTER TO NUMBER
	TAD GETNP
	JMS I ZERO2 	/ZERO NUMBER, NUMBER +1
	ISZ GETNUM
GETN1,	JMS I GETCX 	/GET NEXT CHARACTER (ASCII)
	JMS SORTCH 	/SORT IT OUT
	ADDLST 		/ADDING KEYBOARD LIST
	ADDLST-KEYINT
	JMS I TERROR 	/CHARACTER INVALID ERROR CONDITION
	SPA
	JMP GETN2 	/TO EXIT WITH NUMBER ";" FOUND
	JMS I BCD6SH 	/SHIFT NEW DIGIT INTO RH END OF NUMBER
GETNP,	0 		/HOLDS POINTER TO NUMBER (LS END)
	ISZ DIGCNT 	/>N TO DIGITS FOUND?
	JMP GETN1
	JMS I TERROR 	/YES ERROR CONDITION
GETN2,	CLA 
	JMP I GETNUM 	/EXIT
DIGCNT,	0
BCD6SH,	BCDSH

////////KEYBOARD CHARACTER TABLE
ADDLST,	240;316;315;254;310
	312;313;331;325;311
	272;-11
////////KEYBOARD INTERPRETATION TABLE
KEYINT,	260;261;262;263;264;265
	266;267;270;271;-257
//////
ZERO2,	ZEROIT

/SUBROUTINE TO PRINT A CHARACTER STRING ON EITHER DEVICE.
/JMS OUTLT/OR OUTLP
/STARTING ADDRESS
/LENGTH

	JMS I OUTCT0
OUTLT,	ENTRY
	TAD .-2
	DCA OUTLXB
	TAD I OUTLT 	/GET STARTING ADDRESS - 1.
	DCA POINT
	ISZ OUTLT
	TAD I OUTLT 	/GET TOTAL NUMBER OF CHARACTERS.
	ISZ OUTLT
	CIA
	DCA CHARR
	TAD I POINT
	ISZ POINT

OUTLXB,	JMS I OUTCT0 	/(CALL I OUTCP0)-FOR OUTLP.
	ISZ CHARR
	JMP .-4
	JMP I OUTLT
/////
	JMS I OUTCP0
OUTLP,	ENTRY
	TAD .-1 		/SWITCH THE RETURN POINT.
	DCA OUTLT
	TAD OUTLP-1
	JMP OUTLT+2 	/SWITCH THE OUTPUT.
/////
*75
/MUST BE FILLED IN BY THE USER OR BY MULTIPROC.
OUTCP0=.                    /PRINTER OUTPUT
OUTCT0=.+1                    /TTY OUTPUT
GETCX=.+2                    /GENERAL INPUT
OUTCX=.+3                    /GENERAL INPUT
TERROR=.+4                    /ERROR CATCHER VIA JMS I TERROR

	$
*U*;8	x