.PRINT  ; $MACRO type string to lun 3
.PRINT  ; ?? 3,4,5
.PRINT  ;         br #@5
.PRINT  ; #@4=.
.PRINT  ; 	.ascii ~#@1~
.PRINT  ; #@3=.
.PRINT  ; 	.even
.PRINT  ; #@5=.
.PRINT  ; I%NB <#@2> <pu.sh <#@2>>
.PRINT  ; I%B  <#@2> <pu.sh <40>>
.PRINT  ; ?+ 2
.PRINT  ;         qiow$s #io.wvb,#3,#15. ,, ,, <#<#@4>,#<#@3-#@4>,#<#@2>>
.PRINT  ; $ENDM
.PRINT  ; ;
.PRINT  ; $MACRO pu.sh
.PRINT  ; ?- <#@1>
.PRINT  ; $ENDM
.PRINT  ; $MACRO moveb from to nbytes
.PRINT  ; ?? 4
.PRINT  ;         mov #@1,r0
.PRINT  ;         mov #@2,r1
.PRINT  ;         mov #@3,r2
.PRINT  ; #@4=.
.PRINT  ;         movb (r0)+,(r1)+
.PRINT  ;         sob r2,#@4
.PRINT  ; $ENDM
.PRINT  ; /
.PRINT  ;         PROGRAM SD
.ENABL LC
 ; library-created 3/5/80 - for WHT-SM c runtime
.PRINT  ;         .title SD
        .title SD
.PRINT  ;         .enabl lc
        .enabl lc
.PRINT  ;         .psect send
        .psect send
.PRINT  ;         .enabl ama
        .enabl ama
.PRINT  ; 	.nlist sym
	.nlist sym
.PRINT  ; 
.PRINT  ;         space=40
        space=40
.PRINT  ;         cr=15
        cr=15
.PRINT  ;         esc=33
        esc=33
.PRINT  ;         bad=4
        bad=4
.PRINT  ;         good=1
        good=1
.PRINT  ; 
.PRINT  ;         .mcall sdat$,exit$s,dir$,STOP$S,gtsk$s,gmcr$
        .mcall sdat$,exit$s,dir$,STOP$S,gtsk$s,gmcr$
.PRINT  ;         .mcall exst$s,qiow$s
        .mcall exst$s,qiow$s
.PRINT  ; 
.PRINT  ; sdat:  sdat$ trnsfr,uic
sdat:  sdat$ trnsfr,uic
.PRINT  ; gmcr:   gmcr$
gmcr:   gmcr$
.PRINT  ;  
 
.PRINT  ; uic:    .byte 1,1
uic:    .byte 1,1
.PRINT  ; puic:   .byte 1,1
puic:   .byte 1,1
.PRINT  ; text:  .ASCII /                                                /
text:  .ASCII /                                                /
.PRINT  ;         .EVEN
        .EVEN
.PRINT  ; 
.PRINT  ; task:   .blkw   16.
task:   .blkw   16.
.PRINT  ; 
.PRINT  ; eof:    .word 0
eof:    .word 0
.PRINT  ; p:      .word 0
p:      .word 0
.PRINT  ; 
.PRINT  ; start:
start:
.PRINT  ; 
.PRINT  ;         gtsk$s #task                    ;get task parms
        gtsk$s #task                    ;get task parms
.PRINT  ;         mov task+g.tspc,uic             ;default uic
        mov task+g.tspc,uic             ;default uic
.PRINT  ;         mov task+g.tsdu,puic            ;protection uic (why is it tsDU???)
        mov task+g.tsdu,puic            ;protection uic (why is it tsDU???)
.PRINT  ; 
.PRINT  ;         dir$ #gmcr                      ;get command line
        dir$ #gmcr                      ;get command line
.PRINT  ;         IF $dsw LE #4                   ;check it
	CMP $dsw,#4		;IS $dsw LE #4
	BGT SD1	;Not if GT
.PRINT  ; usage:
usage:
.PRINT  ;            type <Send Usage: Send filename1 filename2 ...>
        br SD6
SD5=.
	.ascii ~Send Usage: Send filename1 filename2 ...~
SD4=.
	.even
SD6=.
        qiow$s #io.wvb,#3,#15. ,, ,, <#<SD5>,#<SD4-SD5>,#<40>>
.PRINT  ;            exst$s #bad
           exst$s #bad
.PRINT  ;         ELSE
	JMP SD7
SD1=.			; 
.PRINT  ;            mov #gmcr+g.mcrb+4,p            ;set pointer to start of input
           mov #gmcr+g.mcrb+4,p            ;set pointer to start of input
.PRINT  ;            DO FOREVER
SD8=.
.PRINT  ;                call clear                  ;clear send to blanks
               call clear                  ;clear send to blanks
.PRINT  ;                call getf                   ;get next file on line
               call getf                   ;get next file on line
.PRINT  ;                IF CC                       ;cc if something there
	BCS SD10	;Not if CS
.PRINT  ;                   dir$ #sdat               ;send
                  dir$ #sdat               ;send
.PRINT  ;                   stop$s                   ;stop until done
                  stop$s                   ;stop until done
.PRINT  ;                ELSE
	JMP SD13
SD10=.			; 
.PRINT  ;                   exit$s                   ;cs means no more
                  exit$s                   ;cs means no more
.PRINT  ;                FI
SD13=.			; 
SD12=.
.PRINT  ;            OD
	JMP SD8		;Repeat loop
SD9=.
.PRINT  ;         FI
SD7=.			; 
SD3=.
.PRINT  ; 
.PRINT  ; clear:
clear:
.PRINT  ;         movb #space,text                   ;put space in 1st position
        movb #space,text                   ;put space in 1st position
.PRINT  ;         moveb #text  #text+1   #30.        ;propgate spaces to right
        mov #text,r0
        mov #text+1,r1
        mov #30.,r2
SD14=.
        movb (r0)+,(r1)+
        sob r2,SD14
.PRINT  ;         rts pc
        rts pc
.PRINT  ; 
.PRINT  ; 
.PRINT  ; getf:
getf:
.PRINT  ;         IF eof NE #0                       ;did we set eof last time
	TST eof		;IS eof NE #0
	BEQ SD15	;Not if EQ
.PRINT  ;            sec                             ;yes, done
           sec                             ;yes, done
.PRINT  ;            rts pc
           rts pc
.PRINT  ;         ELSE
	JMP SD18
SD15=.			; 
.PRINT  ; 
.PRINT  ;            mov #text,r1                    ;output location
           mov #text,r1                    ;output location
.PRINT  ;            DO FOREVER
SD19=.
.PRINT  ;                movb @p,r0                  ;next input char
               movb @p,r0                  ;next input char
.PRINT  ;                IFB r0 = #esc OR r0 = #cr   ;terminator of buffer
	CMPB r0,#cr		;IS r0 = #cr
	BNE SD24	;Not if NE
	BR SD22		;condition met
SD24=.
	CMPB r0,#esc		;IS r0 = #esc
	BNE SD21	;Not if NE
SD22=.
.PRINT  ;                   inc eof                  ;yes, also eof next time
                  inc eof                  ;yes, also eof next time
.PRINT  ;                   clc                      ;not eof this time
                  clc                      ;not eof this time
.PRINT  ;                   rts pc
                  rts pc
.PRINT  ;                ELSEIFB r0 = #space
	JMP SD23
SD21=.
	CMPB r0,#space		;IS r0 = #space
	BNE SD27	;Not if NE
.PRINT  ;                   inc p                    ;end of this filename
                  inc p                    ;end of this filename
.PRINT  ;                   clc                      ;not eof
                  clc                      ;not eof
.PRINT  ;                   rts pc
                  rts pc
.PRINT  ;                ELSE
	JMP SD30
SD27=.			; 
.PRINT  ;                   movb r0,(r1)+            ;move char to output
                  movb r0,(r1)+            ;move char to output
.PRINT  ;                   inc p                    ;next output position
                  inc p                    ;next output position
.PRINT  ;                FI
SD30=.			; 
SD23=.
.PRINT  ;            OD
	JMP SD19		;Repeat loop
SD20=.
.PRINT  ;         FI
SD18=.			; 
SD17=.
.PRINT  ; 
.PRINT  ;         .end start
        .end start
