Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50513/dopen.mac
There are no other files named dopen.mac in the archive.
TITLE DOPEN
SEARCH UUOSYM,ALGSYS,ALGPRM
EXTERN %ALGDR
.EXIT==1
.RH==3
.LLI==4
J==12
ENTRY DOPEN
DOPEN::JSP AX,PARAM
EXP:PMB
6
XWD $PRO!$N!$SIM,3
XWD $VAR!$I!$FOV,.RH
XWD $VAR!$S!$FON,.LLI
MOVE J,.RH(DL)
XCT .LLI(DL)
	MOVEI	A2,@A2		; STATICISE IT
	LDB	A0,[
	POINT	24,STR2(A2),35]	; GET ITS LENGTH
	MOVE	A4,STR1(A2)	; AND SAVE BYTE POINTER
	SETZB	A5,A6		; CLEAR FILE AND EXTENSION
	JUMPE	A0,OPF5		; NULL STRING?
	MOVE	A7,[
	POINT	6,A5,]		; BYTE POINTER FOR FILE NAME
	MOVEI	A10,1		; BYTE INDEX
OPF1:	PUSHJ	SP,OPF6		; GET NEXT BYTE
	CAIN	A2,'.'		; POINT?
	AOJA	A10,OPF3	; YES
	IDPB	A2,A7		; PLANT BYTE IN NAME
	CAIGE	A10,6		; NAME FULL?
	AOJA	A10,OPF1	; NO - KEEP GOING

	AOJ	A10,		;[210] COUNT THE SIXTH CHARACTER
OPF2:	PUSHJ	SP,OPF6		; SCAN FOR POINT
	CAIE	A2,'.'
	AOJA	A10,OPF2
	ADDI	A10,1

OPF3:	MOVE	A7,[
	POINT	6,A6,]		; BYTE POINTER FOR FILE EXTENSION
	MOVEI	A11,3		; BYTE COUNT

OPF4:	PUSHJ	SP,OPF6		; GET NEXT BYTE
	IDPB	A2,A7		; AND PLANT IT IN EXTENSION
 	SOJE A11,OPF5
	AOJA A10,OPF4
OPF5A:POP SP,(SP)
	OPF5:
MOVEM A5,PWLL+2
MOVEM A6,PWLL+3
JUMPL J,DROS
CAIG J,17
JUMPA NESAF
DROS:
OUTSTR[ASCIZ/INCORRECT CHANNEL NUMBER/]
HALT
NESAF:
ROT J,-15
ADDM J,AG
ADDM J,ED
ADDM J,MYNED
XCT AG
OUTSTR [ASCIZ/FILE NOT OPENED/]
XCT ED
OUTSTR [ASCIZ//]
XCT MYNED
OUTSTR [ASCIZ/WRITING NOT ALLOWED/]
SETZM PWLL+2
SETZM PWLL+3
MOVNS 
ADDM J,AG
ADDM J,ED
ADDM J,MYNED
DIWEDD:
JRST .EXIT(DL)
OPF6: CAMLE A10,A0
JRST OPF5A
ILDB A2,A4
SUBI A2,40
JUMPL A2,OPF7
CAILE A2,132
JRST OPF7
CAIL A2,100
SUBI A2,40
POPJ SP,0
OPF7:MOVEI A2,0
POPJ SP,0
AG:OPEN 0,[EXP .IODPR
SIXBIT /DSK/
0]
ED:LOOKUP 0,PWLL
MYNED:ENTER 0,PWLL
PWLL:3
0
0
0
PMB: 0
1,,5
SIXBIT/DOPEN/
; Part of Algol Random Access package,
;which also includes  DCLOSE.MAC, DWRITE.MAC, DREAD.MAC,
;DRFIND.MAC, DWFIND.MAC, DNEW.ALG, DFEOF.ALG.
END