From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 21-NOV-1989 19:39
To:	MRGATE::"ARISIA::EVERHART"
Subj:	xbin 3 of 4

Message-Id:  <8911212005.AA08708@crdgw1.ge.com>
Received: From NWC.NAVY.MIL by CRVAX.SRI.COM with TCP; Tue, 21 NOV 89 07:58:21 PDT
Date: 21 Nov 89 07:24:00 PDT
From: "LEVINE PETER J" <levine%y.mil:amiga-relay-request@louie.udel.edu>
Subject: xbin 3 of 4
To: "info-vax" <info-vax@crvax.sri.com>

-+-+-+-+-+-+-+-+ START OF PART 3 -+-+-+-+-+-+-+-+
X`009cmpw`009r0, #9
X`009blss`00910$
X`009cmpb`009(r1)+, #c_dollar
X`009bneq`00910$
X`009subl2`009#9, r0
X`009bsbw`009read_hex_number
X`009movw`009r2, fileflags
X10$:`009rsb
X
X;************************************************************************
X;**************************  read_hex_number  ***************************
X;************************************************************************
X
X; Registers & parameters:
X;    r0 = line length
X;    r1 = pointer to line
X;    r2 = hex value (returned)
X;    r3 = (clobbered)
X
Xread_hex_number:
X`009clrl`009r2
X`009movw`009r0, r3
X
X10$:`009sobgeq`009r3, 30$
X20$:`009rsb
X30$:`009bsbw`009read_hex_digit
X`009tstb`009r0
X`009blss`00920$
X`009ashl`009#4, r2, r2
X`009addl2`009r0, r2
X`009brb`00910$
X
X;************************************************************************
X;***************************  read_hex_digit  ***************************
X;************************************************************************
X
X; Registers & parameters:
X;    r0 = hex value (returned)
X;    r1 = pointer to character (incremented)
X
Xread_hex_digit:
X`009movb`009(r1)+, r0
X`009cmpb`009r0, #c_zero
X`009blss`00940$
X`009cmpb`009r0, #c_nine
X`009bgtr`00940$
X`009subb2`009#c_zero, r0
X`009rsb
X40$:`009cmpb`009r0, #c_a
X`009blss`00950$
X`009cmpb`009r0, #<c_a+5>
X`009bgtr`00950$
X`009subb2`009#<c_a-10>, r0
X`009rsb
X50$:`009cmpb`009r0, #c_big_a
X`009blss`00980$
X`009cmpb`009r0, #<c_big_a+5>
X`009bgtr`00980$
X`009subb2`009#<c_big_a-10>, r0
X`009rsb
X80$:`009movl`009#-1, r0
X90$:`009rsb
X
X;************************************************************************
X;***************************  create_output  ****************************
X;************************************************************************
X
X; Registers & parameters:
X;    r0-r5 = (clobbered)
X
Xcreate_output:
X`009tstw`009<outfab+fab$b_fns>
X`009beql`0095$
X`009brw`00920$
X5$:`009tstw`009macnlen
X`009beql`0097$
X`009brw`00910$
X
X7$:`009movl`009#buflen, descr
X`009movab`009string, <descr+4>
X`009pushl`009data_len
X`009pushl`009rsrc_len
X`009pushab`009filecreator
X`009pushl`009#4
X`009pushab`009filetype
X`009pushl`009#4
X`009pushaq`009descr
X`009pushaw`009len
X`009pushaq`009msg_no_name
X`009calls`009#5, g`094sys$fao
X`009$iferr
X`009movzwl`009len, descr
X`009movl`009#macflen, descr2
X`009movab`009macname, <descr2+4>
X`009pushaw`009macnlen
X`009pushaq`009descr
X`009pushaq`009descr2
X`009calls`009#1, g`094lib$get_input
X`009$iferr
X
X10$:`009movzwl`009macnlen, descr
X`009movab`009macname, <descr+4>
X`009movl`009#buflen, descr2
X`009movab`009outfile, <descr2+4>
X`009pushaw`009-(sp)
X`009pushaq`009descr2
X`009pushaq`009descr
X`009calls`009#3, cvt_name_uv
X`009cvtwb`009(sp)+, <outfab+fab$b_fns>
X
X20$:`009$create`009fab=outfab
X`009$iferr
X`009$connect`009rab=outrab
X`009$iferr
X
X`009movab`009outbuff, r3
X`009clrb`009(r3)+
X`009cvtwb`009macnlen, (r3)+
X`009movc3`009#macflen, macname, (r3)
X`009movl`009filetype, (r3)+
X`009movl`009filecreator, (r3)+
X`009movb`009<fileflags+1>, (r3)+
X`009clrb`009(r3)+
X`009clrq`009(r3)+
X`009movb`009<data_len+3>, (r3)+
X`009movb`009<data_len+2>, (r3)+
X`009movb`009<data_len+1>, (r3)+
X`009movb`009data_len, (r3)+
X`009movb`009<rsrc_len+3>, (r3)+
X`009movb`009<rsrc_len+2>, (r3)+
X`009movb`009<rsrc_len+1>, (r3)+
X`009movb`009rsrc_len, (r3)+
X`009movl`009file_cre_date, (r3)+
X`009movl`009file_mod_date, (r3)+
X`009movc5`009#0, (sp), #0, #29, (r3)
X`009$put`009rab=outrab
X`009$iferr
X`009rsb
X
X;************************************************************************
X;***************************  copy_hex_fork  ****************************
X;************************************************************************
X
X; Registers & parameters:
X;    r0 = temporary
X;    r1 = pointer to next char in input line
X;    r2 = number of (encoded) bytes remaining in input line
X;    r4 = temp
X;    r6 = number of bytes in output line
X;    r7 = pointer into output line
X;    r9 = addr of fork length counter
X;    r10 = addr of input file rab
X;    r11 = addr of output file rab
X
Xcopy_hex_fork:
X`009clrl`009r6
X`009clrl`009(r9)
X`009movab`009@rab$l_rbf(r11), r7
X
X10$:`009$get`009rab=(r10)
X`009$iferr
X`009movaq`009s_end_of_data, r0
X`009bsbw`009case_blind_prefix
X`009tstl`009r0
X`009beql`00940$
X`009ashl`009#-1, rab$w_rsz(r10), r2
X`009bicl2`009#`094xFFFF0000, r2
X`009addl2`009r2, r6
X`009addl2`009r2, (r9)
X`009movab`009@rab$l_rbf(r10), r1
X
X30$:`009bsbw`009read_hex_digit
X`009movb`009r0, r4
X`009bsbw`009read_hex_digit
X`009insv`009r4, #4, #4, r0
X`009addb2`009r0, crc
X`009movb`009r0, (r7)+
X`009sobgtr`009r2, 30$
X
X`009cmpl`009r6, #reclen
X`009blss`00910$
X`009$put`009rab=(r11)
X`009$iferr
X`009subl2`009#reclen, r6
X`009movab`009@rab$l_rbf(r11), r3
X`009movc3`009r6, reclen(r3), (r3)
X`009movab`009(r3), r7
X`009brb`00910$
X
X40$:`009subl3`009r6, #reclen, r6
X`009beql`00950$
X`009movc5`009#0, (sp), #0, r6, (r7)
X`009$put`009rab=(r11)
X`009$iferr
X50$:`009rsb
X
X;************************************************************************
X;************************  copy_compressed_fork  ************************
X;************************************************************************
X
X; Registers & parameters:
X;    r0 = temporary
X;    r1 = temp
X;    r2 = number of (decoded) bytes remaining in input line
X;    r4 = pointer to next char in input line
X;    r6 = number of bytes in output line
X;    r7 = pointer into output line
X;    r8 = tmp
X;    r9 = addr of fork length counter
X;    r10 = addr of input file rab
X;    r11 = addr of output file rab
X
Xcopy_compressed_fork:
X`009clrl`009r6
X`009clrl`009(r9)
X`009movab`009@rab$l_rbf(r11), r7
X
X10$:`009$get`009rab=(r10)
X`009$iferr
X`009movaq`009s_end_of_data, r0
X`009bsbw`009case_blind_prefix
X`009tstl`009r0
X`009bneq`00911$
X`009brw`00940$
X11$:`009movzwl`009rab$w_rsz(r10), r2
X`009movab`009@rab$l_rbf(r10)`091r2`093, r3`009`009; r3 = byte beyond input r
Vecord
X`009movl`009#l_spaces, (r3)
X`009movl`009@rab$l_rbf(r10), r0
X`009xorl2`009#l_spaces, r0
X`009bsbw`009read_4x6_3x8
X`009movl`009r1, r8
X`009movzbl`009r1, r1
X`009addl2`009r1, r6
X`009addl2`009r1, (r9)
X`009ashl`009#1, r1, r1
X`009movc5`009#0, (sp), #c_space, r1, (r3)
X`009movzbl`009r8, r2
X`009subl2`009#2, r2
X`009ashl`009#-8, r8, r0
X`009movw`009r0, (r7)+
X`009movab`009@rab$l_rbf(r10), r4
X`009addl2`009#4, r4
X
X20$:`009tstl`009r2
X`009bleq`00930$
X`009movl`009(r4)+, r0
X`009xorl2`009#l_spaces, r0
X`009bsbw`009read_4x6_3x8
X`009movl`009r1, (r7)+
X`009decl`009r7
X`009subl2`009#3, r2
X`009brb`00920$
X
X30$:`009addl2`009r2, r7
X`009cmpl`009r6, #reclen
X`009bgeq`00931$
X`009brw`00910$
X31$:`009movl`009#reclen, r0
X`009movab`009@rab$l_rbf(r11), r1
X`009bsbw`009incremental_c_crc
X`009$put`009rab=(r11)
X`009$iferr
X`009subl2`009#reclen, r6
X`009movab`009@rab$l_rbf(r11), r3
X`009movc3`009r6, reclen(r3), (r3)
X`009movab`009(r3), r7
X`009brw`00910$
X
X40$:`009tstl`009r6
X`009beql`00950$
X`009movc5`009#0, (sp), #0, #reclen, (r7)
X`009movl`009r6, r0
X`009movab`009@rab$l_rbf(r11), r1
X`009bsbw`009incremental_c_crc
X`009$put`009rab=(r11)
X`009$iferr
X50$:`009rsb
X
X;************************************************************************
X;****************************  read_4x6_3x8  ****************************
X;************************************************************************
X
X; Registers & parameters:
X;    r0 = 4 input bytes
X;    r1 = 3 output bytes
X
Xread_4x6_3x8:
X`009insv`009r0, #2, #6, r1
X`009ashl`009#-8, r0, r0
X`009insv`009r0, #12, #4, r1
X`009ashl`009#-4, r0, r0
X`009insv`009r0, #0, #2, r1
X`009ashl`009#-4, r0, r0
X`009insv`009r0, #22, #2, r1
X`009ashl`009#-2, r0, r0
X`009insv`009r0, #8, #4, r1
X`009ashl`009#-6, r0, r0
X`009insv`009r0, #16, #6, r1
X`009rsb
X
X;eeeeeeee...
X;33333333 222222 22 1111 1111 00000000
X;76543210 765432 10 7654 3210 76543210
X;  222222   1111 22   00 1111   000000
X;  543210   3210 76   10 7654   765432
X
X;************************************************************************
X;*************************  incremental_c_crc  **************************
X;************************************************************************
X
X; Registers & parameters:
X;    r0 = number of bytes to do crc on
X;    r1 = address of string to do crc on
X;    r2-r3 = (clobbered)
X
Xincremental_c_crc:
X`009movzwl`009crc, r3
X10$:`009movzbw`009(r1)+, r2
X`009addw`009r2, r3
X`009ashl`009#3, r3, r2
X`009ashl`009#-13, r3, r3
X`009bisw`009r2, r3
X`009sobgtr`009r0, 10$
X`009movw`009r3, crc
X`009rsb
X
X;************************************************************************
X;***************************  read_q_header  ****************************
X;************************************************************************
X
X; Registers & parameters:
X;    r0-r8 = (clobbered)
X;    r10 = addr of input file rab
X
Xread_q_header:
X`009clrw`009crc
X`009bsbw`009get_q_byte
X`009movzbw`009r0, r6
X`009movw`009r6, macnlen
X`009movab`009macname, r7
X`009bsbw`009get_q_string
X`009bsbw`009get_q_byte
X`009tstb`009r0
X`009beql`00910$
X`009pushaq`009msg_not_null
X`009calls`009#1, g`094lib$put_output
X`009$iferr
X10$:`009movw`009#4, r6
X`009movab`009filetype, r7
X`009bsbw`009get_q_string
X`009movw`009#4, r6
X`009movab`009filecreator, r7
X`009bsbw`009get_q_string
X`009bsbw`009get_q_word
X`009movw`009r0, fileflags
X`009bsbw`009get_q_long
X`009movl`009r0, data_len
X`009bsbw`009get_q_long
X`009movl`009r0, rsrc_len
X`009movaq`009msg_header, r8
X`009brw`009do_q_end
X
X;************************************************************************
X;****************************  copy_q_fork  *****************************
X;************************************************************************
X
X; Registers & parameters:
X;    r0-r7 = (clobbered)
X;    r8 = pointer to string descriptor for fork type
X;    r9 = length of fork
X;    r10 = addr of input file rab
X;    r11 = addr of output file rab
X
Xcopy_q_fork:
X`009clrw`009crc
X10$:`009movab`009@rab$l_rbf(r11), r7
X`009subl2`009#reclen, r9
X`009blss`00930$
X`009movw`009#reclen, r6
X`009bsbw`009get_q_string
X`009bbc`009#flag_eof, status_flags, 20$
X`009movl`009#rms$_eof, r0
X`009ret
X20$:`009$put`009rab=(r11)
X`009$iferr
X`009brb`00910$
X
X30$:`009addl3`009#reclen, r9, r6
X`009bleq`00940$
X`009bsbw`009get_q_string
X`009$put`009rab=(r11)
X`009$iferr
X40$:`009brw`009do_q_end
X
X;************************************************************************
X;*************************  Q-format routines  **************************
X;************************************************************************
X
X;    r10 = addr of input file rab
Xinit_q:
X`009addl3`009#1, rab$l_rbf(r10), r1
X`009movl`009r1, r5
X`009movl`009r1, inptr
X`009subw3`009#1, rab$w_rsz(r10), r0
X`009bsbw`009translate_q_line
X`009clrb`009q_len
X`009clrb`009rept
X`009clrb`009lastch
X`009rsb
X
X;    r0-r1,r7 = (clobbered)
X;    r8 = pounter to string descriptor for area name
X;    r10 = addr of input file rab
Xdo_q_end:
X`009bbc`009#flag_eof, status_flags, 20$
X10$:`009movl`009#rms$_eof, r0
X`009ret
X
X20$:`009movw`009crc, r7
X
X`009movl`009#16, r0
X30$:`009ashl`009#1, r7, r7
X`009bbc`009#16, r7, 40$
X`009xorw2`009#q_crc_mask, r7
X40$:`009sobgtr`009r0, 30$
X
X`009bsbw`009get_q_word
X`009cmpw`009r0, r7
X`009beql`00950$
X
X`009movl`009#buflen, descr
X`009movab`009string, <descr+4>
X`009movzwl`009r0, -(sp)
X`009movzwl`009r7, -(sp)
X`009pushaq`009(r8)
X`009pushaq`009descr
X`009pushaw`009len
X`009pushaq`009msg_bad_crc_in
X`009calls`009#6, g`094sys$fao
X`009$iferr
X`009movzwl`009len, descr
X`009pushaq`009descr
X`009calls`009#1, g`094lib$put_output
X`009$iferr
X
X50$:`009bbc`009#flag_eof, status_flags, 60$
X`009brw`00910$
X60$:`009rsb
X
X;    r0-r5 = (clobbered)
X;    r6 = length of string to get
X;    r7 = place to put string
X;    r10 = input rab
Xget_q_string:
X`009movzwl`009r6, r6
X`009bgtr`00910$
X`009rsb
X10$:`009bsbw`009get_q_byte
X`009movb`009r0, (r7)+
X`009sobgtr`009r6, 10$
X`009rsb
X
X;    r0 = gotten longword
X;    r1-r6 = (clobbered)
X;    r10 = input rab
Xget_q_long:
X`009bsbw`009get_q_byte
X`009insv`009r0, #16, #8, r6
X`009bsbw`009get_q_byte
X`009insv`009r0, #8, #8, r6
X`009bsbw`009get_q_byte
X`009movb`009r0, r6
X`009bsbw`009get_q_byte
X`009insv`009r6, #8, #24, r0
X`009rsb
X
X;    r0 = gotten word
X;    r1-r6 = (clobbered)
X;    r10 = input rab
Xget_q_word:
X`009bsbw`009get_q_byte
X`009movb`009r0, r6
X`009bsbw`009get_q_byte
X`009insv`009r6, #8, #8, r0
X`009rsb
X
X;    r0 = gotten byte
X;    r1-r5 = (clobbered)
X;    r10 = input rab
Xget_q_byte:
X`009tstb`009rept
X`009beql`00910$
X`009decb`009rept
X`009movb`009lastch, r0
X`009brb`00950$
X10$:`009bsbw`009get_q_raw
X`009cmpb`009r0, #q_rept_flag
X`009bneq`00950$
X`009bsbw`009get_q_raw
X`009tstb`009r0
X`009beql`00920$
X`009subb3`009#1, r0, rept
X`009brb`009get_q_byte
X20$:`009movb`009#q_rept_flag, r0
X
X50$:`009movb`009r0, lastch
X
X`009movw`009crc, r1
X`009movl`009#8, r3
X60$:`009movzbl`009r0, r0
X`009ashl`009#1, r0, r0
X`009ashl`009#1, r1, r1
X`009bbc`009#16, r1, 70$
X`009xorw2`009#q_crc_mask, r1
X70$:`009ashl`009#-8, r0, r2
X`009xorw2`009r2, r1
X`009sobgtr`009r3, 60$
X
X`009movw`009r1, crc
X`009movb`009lastch, r0
X`009rsb
X
Xget_q_raw:
X`009decb`009q_len
X`009blss`009get_q_3
X`009movb`009q_buff, r0
X`009ashl`009#-8, q_buff, q_buff
X`009rsb
X
Xget_q_3:
X`009bbc`009#flag_eof, status_flags, 10$
X`009clrl`009q_buff
X`009movb`009#50, q_len
X`009brb`009get_q_raw
X10$:`009cmpw`009inlen, #4
X`009blss`009get_q_line
X`009movl`009@inptr, r0
X`009tstb`009r0
X`009bgeq`00920$
X`009bisw2`009#1@flag_eof, status_flags
X`009brb`009get_q_3
X20$:`009addl2`009#4, inptr
X`009subw2`009#4, inlen
X`009bsbw`009read_4x6_3x8
X`009movl`009r1, q_buff
X`009movb`009#3, q_len
X`009brb`009get_q_raw
X
Xget_q_line:
X`009movc3`009inlen, @inptr, @rab$l_ubf(r10)
X`009movab`009(r3), rab$l_ubf(r10)
X`009subw2`009inlen, rab$w_usz(r10)
X`009$get`009rab=(r10)
X`009cmpl`009r0, #rms$_eof
X`009bneq`00910$
X`009movb`009#c_colon, @rab$l_ubf(r10)
X`009movl`009rab$l_ubf(r10), rab$l_rbf(r10)
X`009movw`009#1, rab$w_rsz(r10)
X`009brb`00920$
X10$:`009$iferr
+-+-+-+-+-+-+-+-  END  OF PART 3 +-+-+-+-+-+-+-+-


