Google
 

Trailing-Edge - PDP-10 Archives - tops10_tools_bb-fp64a-sb - 10,7/sed/sedonl.mac
There are 13 other files named sedonl.mac in the archive. Click here to see a list.
TITLE	SEDONL - TRANSLATED BY MACRO


;ACS

T0=0
T1=1
T2=2
T3=3
T4=4
F=5
FB=12
DO=13
CR=14
CT=15
PP=16
P=17

START:	MOVE	P,[IOWD 4,STACK]
GOTFIL:	OPEN	T1,INBLK	;FIND SEDONL.TXT
          HALT
	LOOKUP	T1,INNAM
	  JRST	LUKERR
	OPEN	T2,OUTBLK	;OPEN UP A NEW SEDONL.HLP
	  HALT
	ENTER	T2,OUTFIL
	  JRST	ENTERR
	SETO	FB,		;THE FIRST BLOCK WILL TAKE UP 4 BLOCKS

;LOOP THROUGHT THE TEXT OF THE COMMAND

LOOP0:	SETZ	CT,		;CLEAR COUNT OF CHARACTERS FOR THIS COMMAND
LOOP:	PUSHJ	P,GETWD		;GET A CHARACTER
	MOVE	T4,T1
	CAIN	T4,14		;LINEFEED (END OF COMMAND)?
	JRST	LOOP2		;YES - SKIP TO THE NEXT BLOCK
	PUSHJ	P,PUTCHR	;NO - SAVE THE CHARACTER
	AOJA	CT,LOOP		;AND GET ANOTHER ONE

;HERE AT THE END OF A COMMAND. NULL SEDONL.HLP OUT TO THE END OF THE
;DISK BLOCK. IF ALREADY PAST THE END OF THE BLOCK, GIVE A WARNING MESSAGE
;AND TRUNCATE THE TEXT.

LOOP2:	PUSHJ	P,GETWD		;END OF COMMAND - SKIP THE CRLF
	PUSHJ	P,GETWD
	AOJE	FB,LOOPF	;HANDLE THE FIRST BLOCK SPECIALLY
	CAIL	CT,1200		;DID THE TEXT FIT IN A BLOCK?
	JRST	LOOPS		;NO - INFORM THE USER
	SETZ	T4,		;YES - NULL OUT TO THE END OF THE BLOCK
LOOP1:	PUSHJ	P,PUTCHR
	CAIGE	CT,1176
	AOJA	CT,LOOP1
	MOVEI	T4,14		;PUT A LINEFEED IN THE LAST CHARACTER
	PUSHJ	P,PUTCHR
	JRST	LOOP0		;AND DO ANOTHER COMMAND

;HERE FOR THE FIRST "COMMAND" IN THE FILE (A KEYBOARD LAYOUT GIVEN
;ON HELP HELP). IT OCCUPIES THE FIRST FOUR BLOCKS.

LOOPF:	CAIL	CT,5000		;DID THE TEXT FIT IN 4 BLOCKS?
	JRST	LOOPS		;NO - INFORM THE USER
	SETZ	T4,		;YES - NULL OUT TO THE END OF THE BLOCK
LOOPF1:	PUSHJ	P,PUTCHR
	CAIGE	CT,4776
	AOJA	CT,LOOPF1
	MOVEI	T4,14		;PUT A LINEFEED IN THE LAST CHARACTER
	PUSHJ	P,PUTCHR
	JRST	LOOP0		;AND DO ANOTHER COMMAND

;HERE IF THE COMMAND DIDN'T FIT IN ONE DISK BLOCK (200 WORDS)

LOOPS:	OUTSTR	BLKERR		;SAY THE TEXT DIDN'T FIT
LOOPS1:	PUSHJ	P,GETWD		;SKIP UNTIL THE END OF THIS COMMAND'S TEXT
	CAIE	T1,14
	JRST	LOOPS1
	JRST	LOOP0		;AND GO DO THE NEXT COMMAND

;SUBROUTINE TO READ A CHARACTER FROM SEDONL.TXT

GETWD:	SOSGE	INBUF1+2
	JRST	GETIT1
	ILDB	T1,INBUF1+1
	POPJ	P,
GETIT1:	IN	T1,
	JRST	GETWD
	CLOSE	T2,
	EXIT

;SUBROUTINE TO WRITE A CHARACTER INTO SEDONL.HLP

PUTCHR:	SOSG	OUTBF1+2
	OUTPUT	T2,
	IDPB	T4,OUTBF1+1
	POPJ	P,

LUKERR:	OUTSTR	[ASCIZ /SEDONL.TXT IS NOT IN YOUR AREA
/]
	EXIT
ENTERR:	OUTSTR	[ASCIZ /CAN'T WRITE SEDONL.HLP
/]
	EXIT

;DATA

INBLK:	0
	EQVM	7,(DO)
	INBUF1
INBUF1:	BLOCK	3
INNAM:
INFIL:	SIXBIT	/SEDONL/
INEXT:	SIXBIT	/TXT/
	0
INPPN:	0
OUTBLK:	0
	EQVM	7,(DO)
	XWD	OUTBF1,0
OUTBF1:	BLOCK	3
OUTFIL:
OUTNAM:	SIXBIT	/SEDONL/
OUTEXT:	SIXBIT	/HLP/
	0
OUTPPN:	0
STACK:	BLOCK	4

BLKERR:	ASCIZ	/%BLOCK TOO LARGE
/
	END	START