Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-04 - 43,50354/fold.mac
There are no other files named fold.mac in the archive.
	TITLE	FOLD	BY ROBERT WILSON
	SUBTTL	SYOSSET HIGH SCHOOL  --  1974-75
	PRINTX	FOLD

AC=1
C=3
CHAR=5
P=7
PNT=11

	LOC	124
	EXP	ENDERR
	LOC	137
	700106,,0
	RELOC
	PRINTX	GET FILE
FOLD:	CALLI
	MOVE	P,[IOWD 50,PDL]
	TTCALL	3,[ASCIZ!
TYPE /H FOR HELP
!]
INNAME:	TTCALL	3,[ASCIZ/SOURCE:/]
	PUSHJ	P,SIXIN
	CAMN	AC,MEM1
	JRST	HELP
	CAIE	CHAR,":"
	JRST	.+3
	MOVEM	AC,INRIB+1
	JRST	.+2
	MOVEM	AC,RIB
	PUSHJ	P,SIXIN
	CAIN	CHAR,"["
	JRST	PPNIN
	CAIE	CHAR,12
	JRST	.+3
	MOVEM	AC,RIB+1
	JRST	GOTIT
	CAIN	CHAR,33
	JRST	.-3
	MOVEM	AC,RIB
	PUSHJ	P,SIXIN
	CAIE	CHAR,12
	JRST	.+3
	MOVEM	AC,RIB+1
	JRST	GOTIT
	CAIN	CHAR,33
	JRST	.-3
PPNIN:	MOVEM	AC,RIB+1
	PUSHJ	P,OCTIN
	CAIN	CHAR,","
	JRST	.+3
	HRRM	AC,RIB+3
	JRST	GOTIT
	HRLZM	AC,RIB+3
	JRST	PPNIN+1
	PRINTX	OUTPUT THE INFO
GOTIT:	TTCALL	3,[BYTE(7) 15,12]
	MOVE	AC,RIB+3
	MOVEM	AC,FILPPN
	MOVE	AC,RIB+1
	MOVEM	AC,FILEXT
	OPEN	1,INRIB
	JRST	NOOPEN
	LOOKUP	1,RIB
	JRST	NOFILE
	SETZ	AC,
REPEAT	10,<TTCALL	15,AC>
	TTCALL	3,CREASE
REPEAT	71,<TTCALL	15,AC>
	JSR	FOLDIT
GETCHR:	JSR	LOAD
	TTCALL	15,CHAR
	SOJG	C,GETCHR
	JSR	FOLD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	POPJ	P,
	CAIN	CHAR,"["
	POPJ	P,
	CAIN	CHAR,15
	JRST	SIXIN+2
	CAIE	CHAR,12
	CAIN	CHAR,33
	POPJ	P,
	SUBI	CHAR,40
	IDPB	CHAR,PNT
	JRST	SIXIN+2

OCTIN:	SETZ	AC,
	TTCALL	4,CHAR
	CAIL	CHAR,60
	CAIL	CHAR,72
	JRST	ILLCHR
	SUBI	CHAR,60
	IMULI	AC,10
	ADD	AC,CHAR
	JRST	OCTIN+1
ILLCHR:	CAIN	CHAR,15
	TTCALL	2,CHAR
	JFCL
	CAIE	CHAR,12
	CAIN	CHAR,33
	POPJ	P,
	CAIN	CHAR,","
	POPJ	P,
	CAIE	CHAR,"]"
	JRST	.+3
	TTCALL	4,CHAR
	JRST	ILLCHR
	TTCALL	3,[ASCIZ/%
% ILLEGAL CHARACTER /]
	TTCALL	1,CHAR
	TTCALL	3,[ASCIZ/ IN PPN
/]
	JRST	ENDERR
	PRINTX	OUTPUT ROUTINES
SIXOUT:	MOVE	PNT,[POINT 6,AC]
	ILDB	CHAR,PNT
	JUMPE	CHAR,.+3
	ADDI	CHAR,40
	TTCALL	1,CHAR
	TLNN	PNT,770000
	POPJ	P,
	JRST	SIXOUT+1

OCTOUT:	IDIVI	AC,10
	PUSH	P,AC+1
	SKIPE	AC
	PUSHJ	P,OCTOUT
	POP	P,CHAR
	ADDI	CHAR,60
	TTCALL	1,CHAR
	POPJ	P,
	PRINTX	HOW IT WORKS
HELP:	TTCALL	3,HLPTXT
	JRST	INNAME


HLPTXT:	ASCIZ/


	'FOLD' IS USED TO MAKE PAPER TAPES WITH PLACES TO FOLD THE
TAPE AT REGULAR INTERVALS. IN RESPONSE TO 'SOURCE:' TYPE:

DEVICE:FILENAME.EXTENSION[PROJECT,PROGRAMER NUMBER]

DEFAULTS:
	FOR DEVICE  --  DSK
	FOR [PPN]   --  YOUR OWN



/
	PRINTX	MEMORY LOCATIONS
INRIB:	0
	SIXBIT/DSK/
	IBUF
RIB:	BLOCK	4
IBUF:	BLOCK	3
CREASE:	BYTE (7) 40,177
PDL:	BLOCK	50
MEM1:	SIXBIT!/H!
MEM2:	SIXBIT/DSK/
FILPPN:	0
FILEXT:	0
	END	FOLD