Google
 

Trailing-Edge - PDP-10 Archives - integ_tools_tops20_v7_30-apr-86_dumper - tools/10backup/bur.mar
There are 8 other files named bur.mar in the archive. Click here to see a list.
	.title	BUR	10BACKUP Utility Routines
	.ident	'BUR v1.0'
;
; This module is part of 10BACKUP - a program to read DECsystem-10
; BACKUP tapes in INTERCHANGE mode on a VAX.
;
; The source modules that make up the 10BACKUP program are:-
;
;	10BACKUP.BAS	the main line program.
;	BIO.BAS		contains tape and file IO routines.
;	BUR.MAR		is a set of macro utility routines.
;	C36.MAR		contains 36 bit conversion routines.
;	BMS.MSG		contains the error message definitions.
;	10BACKUP.RNH	Runoff input to build the help library.
;
;
;
;
;
;
; BUR_GET_HELP is a function to call LBR$OUTPUT_HELP to provide
; help information.
;
; Called via:  STATUS = BUR_GET_HELP( HELP_KEYS, HELP_LIBRARY, HELP_FLAGS )
;
	.psect	$code,pic,shr,nowrt,long
;
	.entry	bur_get_help,^M<>

	pushab	G^LIB$GET_INPUT			;Name of input routine.
	pushl	12(AP)				;Flags for help.
	pushl	8(AP)				;Name of help library.
	pushl	4(AP)				;What to give help on.
	clrl	-(SP)				;No particular line length.
	pushab	G^LIB$PUT_OUTPUT		;Name of output routine.
	calls	#6,G^LBR$OUTPUT_HELP		;Go get help.
;
	ret					;Return to caller.
;
;
;
; BUR_FLAG_SET is a function to test whether a bit is set in an
; unpacked DEC-10 word.
;
; Called via:  RESULT = BUR_FLAG_SET( WORD, DEC10-BIT BY VALUE )
;
	.psect	$code,pic,shr,nowrt,long
;
	.entry	bur_flag_set,^M<>

	clrl	R0				;Assume bit is not set.
	subl3	8(AP),#35,R1			;Generate VAX bit number.
	bbc	R1,@4(AP),10$			;Is bit clear?
	cvtbl	#-1,R0				;Indicate bit was set
;
10$:	ret					;Return to caller.
;
;
;
; BUR_GET_DATE is a routine to convert a Universal Date/Time
; in an unpacked DEC-10 word into a string.
;
; Called via:  CALL BUR_GET_DATE( DATE_STRING, WORD )
;
	.psect	$code,pic,shr,nowrt,long
;
	.entry	bur_get_date,^M<R2,R3,R4>

	movl	8(AP),R4			;Get date quadword address.
	movl	#52734375,R3			;Conversion factor.
	bicl3	#^XFFFFFFF0,4(R4),R0		;Get date hi half - no sign extension.
	emul	(R4),R3,#0,R1			;Multiply low half.
	mull	R3,R0				;Multiply hi half.
	tstl	(R4)				;Was low half signed?
	bgeq	10$				;No, skip compensation.
	addl	R3,R0				;Compensate for sign.
10$:	addl	R0,R2				;Add in high half.
	ashq	#-4,R1,-(SP)			;Shift bits to complete conversion
;
	clrl	-(SP)				;Conversion flag argument.
	pushaq	4(SP)				;Date quadword argument.
	pushl	4(AP)				;Output string argument.
	clrl	-(SP)				;Output length argument.
	calls	#4,G^LIB$SYS_ASCTIM		;Get ascii time.
;
	ret					;Return to caller.
;
;
;
;
; BUR_GET_SIXBIT is a routine for extracting a SIXBIT string from
; a group of unpacked DEC-10 words.
;
; Called via:  CALL BUR_GET_SIXBIT( SIXBIT_STRING, WORD_COUNT, WORDS() )
;
	.psect	$code,pic,shr,nowrt,long
;
	.entry	bur_get_sixbit,^M<R2,R3,R4,R5,R6>

	mull3	#6,@8(AP),R5			;Get maximum number of chars.
	subl	R5,SP				;Make space on stack.
	movl	SP,R4				;Remember work area location.
;
	pushl	R4				;Destination argument.
	pushl	12(AP)				;Source argument.
	pushl	@8(AP)				;Number of words argument.
	calls	#3,G^C36_SIXBIT			;Convert Sixbit data.
;
	bsbb	bur_make_string			;Make result without nulls.
;
	ret					;Return to caller
;
;
;
;
; BUR_GET_ASCII is a routine for extracting an ASCII string from
; a group of unpacked DEC-10 words.
;
; Called via:  CALL BUR_GET_ASCII( ASCII_STRING, WORD_COUNT, WORDS() )
;
	.psect	$code,pic,shr,nowrt,long
;
	.entry	bur_get_ascii,^M<R2,R3,R4,R5,R6>

	mull3	#5,@8(AP),R5			;Get maximum number of chars.
	subl	R5,SP				;Make space on stack.
	movl	SP,R4				;Remember work area location.
;
	pushl	R4				;Destination argument.
	pushl	12(AP)				;Source argument.
	pushl	@8(AP)				;Number of words argument.
	calls	#3,G^C36_ASCII			;Convert data to ascii.
;
	bsbb	bur_make_string			;Make result without nulls.
;
	ret					;Return to caller
;
;
;
bur_make_string::				;Local routine to make a string.
	locc	#0,R5,(R4)			;Look for null character.
	beql	30$				;None found.
	movl	R1,R2				;Get address of byte.
10$:	movb	(R2)+,(R1)			;Move character.
	beql	20$				;If null it doesn't count.
	incl	R1				;Count the character.
20$:	sobgtr	R0,10$				;Do for all characters.
;
30$:	subl3	R4,R1,R0			;Source string length argument.
	movl	R4,R1				;Source string address argument.
	movl	4(AP),R2			;Destination descriptor address.
	jsb	G^LIB$SCOPY_R_DX6		;Move string to users area.
;
	rsb					;Return to main routine.
;
;
;
;
;
	.psect	data_ro,pic,shr,nowrt,noexe,long
;
wrttab::.byte   0,  1,  2,  3,  4,  5,  6,  7,  8,  9
	.byte   0, 11, 12, 13, 14, 15, 16, 17, 18, 19
	.byte  20, 21, 22, 23, 24, 25, 26, 27, 28, 29
	.byte  30, 31, 32, 33, 34, 35, 36, 37, 38, 39
	.byte  40, 41, 42, 43, 44, 45, 46, 47, 48, 49
	.byte  50, 51, 52, 53, 54, 55, 56, 57, 58, 59
	.byte  60, 61, 62, 63, 64, 65, 66, 67, 68, 69
	.byte  70, 71, 72, 73, 74, 75, 76, 77, 78, 79
	.byte  80, 81, 82, 83, 84, 85, 86, 87, 88, 89
	.byte  90, 91, 92, 93, 94, 95, 96, 97, 98, 99
	.byte 100,101,102,103,104,105,106,107,108,109
	.byte 110,111,112,113,114,115,116,117,118,119
	.byte 120,121,122,123,124,125,126,127
	.byte   0,  1,  2,  3,  4,  5,  6,  7,  8,  9
	.byte   0, 11, 12, 13, 14, 15, 16, 17, 18, 19
	.byte  20, 21, 22, 23, 24, 25, 26, 27, 28, 29
	.byte  30, 31, 32, 33, 34, 35, 36, 37, 38, 39
	.byte  40, 41, 42, 43, 44, 45, 46, 47, 48, 49
	.byte  50, 51, 52, 53, 54, 55, 56, 57, 58, 59
	.byte  60, 61, 62, 63, 64, 65, 66, 67, 68, 69
	.byte  70, 71, 72, 73, 74, 75, 76, 77, 78, 79
	.byte  80, 81, 82, 83, 84, 85, 86, 87, 88, 89
	.byte  90, 91, 92, 93, 94, 95, 96, 97, 98, 99
	.byte 100,101,102,103,104,105,106,107,108,109
	.byte 110,111,112,113,114,115,116,117,118,119
	.byte 120,121,122,123,124,125,126,127
;
;
; BUR_WRITE_ASCII is called to convert a group of unpacked DEC-10
; words to ascii and write them to an output file.
;
; Called via: CALL BUR_WRITE_ASCII( WORD_COUNT, WORDS(), CHAR_COUNT, CHAR_STRING )
;
	.psect	$code,pic,shr,nowrt,long
;
	.entry	bur_write_ascii,^M<R2,R3,R4,R5,R6,R7>

	mull3	#5,@4(AP),R2			;Get maximum number of chars.
	subl	R2,SP				;Make space on stack.
	movl	SP,R3				;Remember where.
;
	pushl	R3				;Destination argument.
	pushl	8(AP)				;Source argument.
	pushl	@4(AP)				;Number of words argument.
	calls	#3,G^C36_ASCII			;Convert ascii data.
;
	movq	R2,R0				;Set up length & address.
	movl	16(AP),R4			;Address of buffer descriptor.
	movzwl	(R4),R6				;Maximum buffer length.
	movl	4(R4),R7			;Buffer address.
	subl3	@12(AP),R6,R4			;Remaining buffer length.
	addl3	@12(AP),R7,R5			;Current load address.
;
10$:	movtuc	R0,(R1),#0,wrttab,R4,(R5)	;Move characters to buffer.
	bvs	20$				;Escape char? - go see what.
	tstl	R0				;Any characters left?
	bgtr	40$				;Yes, go write full buffer.
	brb	70$				;Out of data - exit.
;
20$:	cmpb	(R1)+,#10			;Line feed caused escape?
	bneq	50$				;No, ignore the character then.
	cmpl	R5,R7				;Characters in the buffer?
	blequ	40$				;No - don't look in it.
	cmpb	-(R5),#13			;Second last char a Return?
	beql	40$				;Yes, go write record.
	incl	R5				;Put back character.
;
40$:	subl3	R7,R5,@12(AP)			;Get current buffer length.
	movq	R0,R2				;Save R0 & R1.
	pushl	12(AP)				;Buffer length argument.
	calls	#1,G^FILE_WRITE			;Write out the record.
	movq	R2,R0				;Recover R0 & R1
	movl	R6,R4				;Reset remaining buffer length.
	movl	R7,R5				;Reset current buffer address.
;
50$:	sobgtr	R0,10$				;Keep going if more characters.
;
70$:	subl3	R7,R5,@12(AP)			;Pass back current buffer length.
	ret					;Return to caller.
;
;
;
;
;
; BUR_WRITE_SIXBIT is called to convert a group of unpacked DEC-10
; words to sixbit and write them to an output file.
;
; Called via: CALL BUR_WRITE_SIXBIT( WORD_COUNT, WORDS(), CHAR_COUNT, 
;		CHAR_STRING, RECORD_SIZE )
;
	.psect	$code,pic,shr,nowrt,long
;
	.entry	bur_write_sixbit,^M<R2,R3,R4,R5,R6,R7>

	mull3	#6,@4(AP),R2			;Get maximum number of chars.
	subl	R2,SP				;Make space on stack.
	movl	SP,R3				;Remember where.
;
	pushl	R3				;Destination argument.
	pushl	8(AP)				;Source argument.
	pushl	@4(AP)				;Number of words argument.
	calls	#3,G^C36_SIXBIT			;Convert sixbit data.
;
	movq	R2,R0				;Set up length & address.
	movl	16(AP),R4			;Address of buffer descriptor.
	movzwl	(R4),R6				;Maximum buffer length.
	movl	4(R4),R7			;Buffer address.
	cmpl	@20(AP),R6			;Requested length shorter than buffer.
	bgtru	10$				;No, stick with maximum length.
	movl	@20(AP),R6			;Use the requested length.
10$:	subl3	@12(AP),R6,R2			;Remaining buffer length.
	addl3	@12(AP),R7,R3			;Current load address.
;
20$:	cmpl	R2,R0				;Extra characters in output?
	bleq	30$				;No, proceed with move.
	movl	R0,R2				;Adjust output size (for no fill)
30$:	movc5	R0,(R1),#0,R2,(R3)		;Move characters to buffer.
	blss	50$				;Didn't fill buffer.. can exit.
	subl3	R7,R3,@12(AP)			;Get current buffer length.
	movq	R0,R2				;Save R0 & R1.
	pushl	12(AP)				;Buffer length argument.
	calls	#1,G^FILE_WRITE			;Write out the record.
	movq	R2,R0				;Recover R0 & R1.
	movl	R6,R2				;Reset remaining buffer length.
	movl	R7,R3				;Reset current buffer address.
	tstl	R0				;Any characters remaining?
	bgtr	20$				;Yup, go do em.
;
50$:	subl3	R7,R3,@12(AP)			;Pass back current buffer length.
	ret					;Return to caller.
;
;
;
; BUR_SIGNAL is a routine to call LIB$SIGNAL. The reason for doing this
; is to attempt to speed up image activation by having only one call to
; LIB$SIGNAL in the program.
;
; Called via:  CALL BUR_SIGNAL( STATUS_CODE by value )
;
	.psect	$code,pic,shr,nowrt,long
;
	.entry	bur_signal,^M<>

	pushl	4(AP)				;Push status code.
	calls	#1,G^LIB$SIGNAL			;Call LIB$SIGNAL routine.
;
	ret					;Return to caller.
;
;
;
	.end