home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / test / pdp11 / krtini.mac < prev    next >
Text File  |  1996-10-17  |  32KB  |  911 lines

  1.     .title    KRTINI    Initialization and rarely used routines
  2.     .ident    "V04.64"
  3.  
  4. ; /E64/    14-Apr-96  John Santos
  5. ;
  6. ;    On RSTS/E, look for initialization file in SY:, LB:[1,2],
  7. ;    SY:[1,2], KRT: in that order.
  8. ;    Init RSTS/E-specific data.  Use RSTS/E clock for STATS info.
  9. ;    note: ctrl/a display doesn't display high word of file size
  10.  
  11. ; /63/    10-Feb-96  Billy Youdelman
  12.  
  13. ; /62/    27-Jul-93  Billy Youdelman  V03.62
  14. ;
  15. ;    dump FILLOG, as PRINTM now does this
  16. ;    provide for logfile errors
  17. ;    add current_block_pointer/size_of file to ^A stats display
  18. ;
  19. ;    check packet length in dskdmp, don't trap to 4 writing past end
  20. ;    of buffer due to line noise and/or modems retraining
  21. ;
  22. ;    major cleanup and maintenance update
  23.  
  24. ; /BBS/     1-Dec-91  Billy Youdelman  V03.61
  25. ;
  26. ;    prompt set to KRT
  27. ;
  28. ;    call to an .INI file now tries INI, KRT then DK and finally
  29. ;    SY.  take file echo is disabled if krt.ini is found, then
  30. ;    enabled when the init file is closed (in readcmd, in krtcmd)
  31. ;    name of init file (if found) is displayed while reading same..
  32. ;
  33. ;    recdsp table fixed to call recvt1 (instead of senvt1 .. ) for
  34. ;    terminals >VT100
  35. ;
  36. ;    added warning message when 8-bit quoting is first forced on and
  37. ;    init stuff in fixchk so the need for 8-bit quoting is tested on
  38. ;    each xfr, thus one need not exit/restart Kermit to turn it off
  39. ;
  40. ;    packet length display in log files now accommodates four digit
  41. ;    numbers, as the max. packet is now 1024. bytes
  42. ;
  43. ;    kill normal packet stats display when logging to TT
  44. ;    reset parity found while set NONE warning before each transaction
  45. ;    fixed warning messages for unsupported/disabled long packets
  46. ;    dkname used to home, here it's init'd to physical DK at start-up
  47.  
  48. ;    03-Jul-84  09:34:32  Brian Nelson
  49. ;
  50. ;    Copyright 1984 Change Software, Inc.
  51. ;
  52. ;    Remove Kermit init code and routines like SPAR and RPAR that
  53. ;    are only called once per file transfer.  Placed into overlay
  54. ;    with KRTATR.  This was done to reduce the task size a bit.
  55.  
  56.  
  57.     .include "IN:KRTMAC.MAC"
  58.     .iif ndf  KRTINC  .error    <; .include for IN:KRTMAC.MAC failed>
  59.  
  60. .if df    RT11                ; /E64/
  61.     .mcall    .GTIM            ; /62/
  62. .endc    ;RT11                ; /E64/
  63.  
  64.  
  65.     .macro    $chkb    val ,reg ,?a    ; used to check received parameters
  66.     tstb    @reg            ; to be sure something is there
  67.     bne    a            ; if no default supplied
  68.     movb    val    ,@reg        ; stuff one in
  69. a:    inc    reg            ; next time, do next one
  70.     .endm    $chkb
  71.  
  72.  
  73.     .sbttl    Misc defaults        ; /63/ moved these here from KRTPAK
  74.  
  75.     DEFDLY    =      6.        ; secs delay before SENDing a file
  76.     IN$TRY    =      5.        ; /BBS/ number of times to retry init
  77.     MX$TRY    =     16.        ; number of times to retry packet
  78.     MYCHKT    =     '1        ; normal checksumming
  79.     MYEOL    =     cr        ; end-of-line
  80.     MYQUOTE    =     '#        ; control char quoting prefix char
  81.     MYPAD    =      0        ; no padding
  82.     MYPCHAR    =      0        ; thus no pad character
  83.     MYQBIN    =     '&        ; 8-bit quoting prefix char
  84.     MYREPT    =     tilde        ; tilde for repeat quoting
  85.     MYRTMO    =     10.        ; /62/ RECEIVE default time-out
  86.     MYSTMO    =     13.        ; /62/ SEND default time-out
  87.  
  88.  
  89.     .sbttl    Local data        ; /63/ consolidated here..
  90.  
  91.     .psect    $pdata
  92. ini.00:    .word    ini.01    ,ini.02    ,ini.03    ,ini.04    ,0 ; /63/ init file name list
  93. .if df    RT11                ; /E64/
  94. ini.01:    .asciz    "INI:KRT.INI"        ; /BBS/ try this logical first
  95. ini.02:    .asciz    "KRT:KRT.INI"        ; /BBS/ then this one, etc..
  96. ini.03:    .asciz    "DK:KRT.INI"
  97. ini.04:    .asciz    "SY:KRT.INI"
  98. .endc    ;RT11                ; /E64/
  99. .if df    RSTS                ; /E64/
  100. ini.01:    .asciz    "SY:KRT.INI"
  101. ini.02:    .asciz    "LB:[1,2]KRT.INI"
  102. ini.03:    .asciz    "SY:[1,2]KRT.INI"
  103. ini.04:    .asciz    "KRT:KRT.INI"
  104. .endc    ;RSTS                ; /E64/
  105. ini.05:    .asciz    "Paknum"        ; /BBS/ PAK and LEN flipped
  106. ini.06:    .asciz    "Type"
  107. ini.07:    .asciz    "Length"
  108. ini.08:    .asciz    "    "            ; /62/ four blanks to indent
  109. ini.09:    .asciz    " Bytes "
  110. ini.10:    .asciz    ", open file: "        ; /62/
  111. ini.11:    .asciz    "sent"            ; /62/
  112. ini.12:    .asciz    "rec'd"            ; /62/
  113. ini.13:    .asciz    ", cur/max blk: "    ; /62/
  114. ini.14:    .asciz    "Reading "        ; /BBS/ display this while waiting..
  115. ini.15:    .asciz    " .."            ; /BBS/ ..for the file to load
  116. prefix:    .asciz    "The other Kermit "
  117. cando:    .asciz    "supports long packets, which are disabled locally"
  118. lmsg:    .asciz    "doesn't support or has disabled long packets"
  119. warn8m:    .asciz    "Eight-bit quoting forced on"
  120.  
  121. $delim:    .asciz    "/"            ; /63/ display format stuff
  122. $sendh:    .ascii    <cr><esc>"[2K"
  123.     .asciz    "Packets sent:            Naks:            Time-outs: "
  124. $rech:    .ascii    <cr><esc>"[2K"
  125.     .asciz    "Packets received:            Naks:            Time-outs: "
  126. $pos0:    .asciz    <cr><esc>"[15C"        ; /BBS/ cursor to column 15.
  127. $pos1:    .asciz    <cr><esc>"[19C"        ; /BBS/ col 19.
  128. npos:    .asciz    <cr><esc>"[36C"        ; /BBS/ col 36.
  129. npox:    .asciz    <cr><esc>"[32C"        ; /BBS/ col 32.
  130. dpos:    .asciz    <cr><esc>"[58C"        ; /BBS/ col 58.
  131. dpox:    .asciz    <cr><esc>"[54C"        ; /BBS/ col 54.
  132.     .even
  133.  
  134.  
  135.     .psect    $code
  136.     .sbttl    Initialize ourselves    ; /62/ rearranged for clarity..
  137.  
  138. kerini::mov    #rwdata    ,r0        ; first of all, clear all read/write
  139.     mov    #rwsize/2,r1        ; data out please
  140. 10$:    clr    (r0)+            ; for i := 1 to rwdata_size
  141.     sob    r1    ,10$        ;  do data[i] := 0
  142.  
  143.     mov    sp    ,doauto        ; default to checking file attributes
  144.     mov    #<at.all!at.on>    ,doattr    ; /63/ and doing all file attributes
  145.     mov    sp    ,setrpt        ; assume we will do repeat counts
  146.     mov    sp    ,dolong        ; /62/ we want long packets if doable
  147.     mov    #myrtmo    ,rectim        ; /62/ default receive time-out
  148.     mov    #mystmo    ,sentim        ; /62/ default send time-out
  149.     call    rparini            ; other Kermit's default sinit params
  150.     call    sparini            ; initialize my sinit parameters
  151.  
  152.     mov    #1    ,blip        ; assume logging all packets to TT
  153. .if df    RSTS                ; /E64/
  154.     clrb    defdir            ; /51/ Moved it
  155. .endc    ;RSTS                ; /E64/
  156.     call    xinit            ; /42/ moved call forward, init memory
  157. .if df    RSTS                ; /E64/
  158.     mov    #15    ,recdlm        ; /56/ Assume CR
  159. .endc    ;RSTS                ; /E64/
  160.  
  161.     mov    #soh    ,recsop        ; assume ^A please, for receive SOH
  162.     mov    #soh    ,sensop        ; ditto for sending..
  163.     mov    #defchk    ,chktyp        ; set the default checksum type
  164.     mov    #1    ,chksiz        ; and its size (length in bytes)
  165.     mov    #defchk    ,setchkt    ; /62/ init the SET BLO type too..
  166.     mov    #in$try    ,initry        ; /BBS/ init packet retry limit
  167.     mov    #mx$try    ,maxtry        ; all other packets retry limit
  168.     mov    sp    ,dowild        ; /63/ default to implicit wildcards
  169.     mov    sp    ,incfile    ; /BBS/ discard incomplete files
  170.     mov    #60.    ,serwait    ; /41/ SET SERVER [NO]WAIT default
  171.     mov    #defdly    ,sendly        ; init the delay for send command
  172.  
  173.     mov    #ctlflgs,r0        ; /63/ ctrl char processing list top
  174.     mov    #<1.+32.+1.+32.>,r1    ; /63/ list is this many bytes long
  175. 20$:    incb    (r0)+            ; /63/ init each one as must quote
  176.     sob    r1    ,20$        ; /63/
  177.  
  178.     mov    sp    ,infomsg    ; /BBS/ default to verbosity
  179.     mov    sp    ,qu.ini        ; /BBS/ save copy of infomsg for reset
  180.     mov    sp    ,rtvol        ; /BBS/ assume volume header checks
  181.     mov    #con$esc,conesc        ; /62/ default CONNECT escape char
  182.  
  183.     clrb    ininam            ; /62/ no init file found yet
  184.     mov    #ini.00    ,r3        ; try to open an init file somewhere
  185. 30$:    tst    @r3            ; any more to try?
  186.     beq    40$            ; no
  187.     calls    open    ,<(r3)+,#lun.ta,#text> ; ya, see if it's there
  188.     tst    r0            ; did the open work?
  189.     bne    30$            ; no, just ignore it
  190.     mov    #lun.ta    ,cmdlun        ; yes, setup for reading from init
  191.     mov    sp    ,sy.ini        ; flag an init file is now open
  192.     clr    infomsg            ; /BBS/ don't echo init file
  193.     strcpy    #indnam    ,-(r3)        ; /62/ stash a copy of file name
  194.     strcpy    #ininam    ,(r3)        ; /62/ and another for show file
  195.     wrtall    #ini.14            ; /63/ "Reading "
  196.     wrtall    (r3)            ; /BBS/ name of init file
  197.     wrtall    #ini.15            ; /63/ tag with " .."
  198.     call    l$nolf            ; /BBS/ just a CR unless TT is NOSCOPE
  199. 40$:    return
  200.  
  201.  
  202.     .sbttl    Setup defaults for our SINIT parameters
  203.  
  204. ; NOTE:    the SENPAR and CONPAR buffers are zeroed at the top of KERINI thus
  205. ;    unused bytes here and for RPARINI are assumed to be already cleared
  206.  
  207. sparini:mov    #senpar    ,r1        ; where to put them
  208.     movb    #maxpak    ,(r1)+        ; maximum packet size
  209.     mov    #maxpak    ,senlen        ; /62/ init SET SEND PAC limit
  210.     movb    #mystmo    ,(r1)+        ; /62/ send time-out default
  211.     movb    #mypad    ,(r1)+        ; how much padding
  212.     movb    #mypchar,(r1)+        ; whatever I use for padding
  213.     movb    #myeol    ,(r1)+        ; EOL char (not used by this program)
  214.     movb    #myquote,(r1)+        ; ctrl (<40) char quoting prefix char
  215.     movb    #'Y&137    ,(r1)+        ; do 8-bit quoting if need be..
  216.     movb    #mychkt    ,(r1)+        ; /BBS/ checksum type
  217.  
  218.     movb    #space    ,(r1)        ; assume no repeat processing
  219.     tst    setrpt            ; really do repeat encoding?
  220.     beq    10$            ; no
  221.     movb    #myrept    ,(r1)        ; ya, use this char to prefix it
  222.  
  223. 10$:    mov    #11    ,sparsz        ; /62/ spar packet size up to now..
  224.     mov    doattr    ,r0        ; /62/ if both attributes and
  225.     bis    dolong    ,r0        ; /62/ long-packets are not enabled
  226.     beq    30$            ; /62/ then this is all that's needed
  227.     add    #4    ,sparsz        ; /62/ more to come, make room for it
  228.  
  229.     inc    r1            ; /62/ bump pointer to capas byte
  230.     tst    doattr            ; /42/ are attributes enabled?
  231.     beq    20$            ; /62/ no
  232.     bisb    #capa.a    ,(r1)        ; /62/ ya, let the other Kermit know
  233.  
  234. 20$:    tst    dolong            ; /42/ long packets enabled?
  235.     beq    30$            ; /62/ no, done
  236.     bisb    #capa.l    ,(r1)+        ; /62/ set long packets support bit
  237.     inc    r1            ; /62/ no window size to send over
  238.     mov    #maxlng    ,r3        ; /62/ use long-packet max length
  239.     clr    r2            ; /42/ break the size
  240.     div    #95.    ,r2        ; /42/ into two bytes
  241.     movb    r2    ,(r1)+        ; /42/ p.mxl1 = buffer_size / 95.
  242.     movb    r3    ,(r1)        ; /62/ p.mxl2 = buffer_size mod 95.
  243.     mov    #maxlng    ,senlen        ; /62/ make SET SEND PAC the max too..
  244. 30$:    return
  245.  
  246.  
  247.     .sbttl    Setup defaults for other Kermit's SINIT parameters
  248.  
  249. rparini:mov    #conpar    ,r1        ; where to put them
  250.     movb    #maxpak    ,(r1)+        ;  0 maximum packet size
  251.     movb    #myrtmo    ,(r1)+        ;  1 /62/ default to receive time-out
  252.     movb    #mypad    ,(r1)+        ;  2 how much padding
  253.     movb    #mypchar,(r1)+        ;  3 pad char
  254.     movb    #myeol    ,(r1)+        ;  4 EOL char (not used by this pgm)
  255.     movb    #myquote,(r1)+        ;  5 control (<40) char quoting char
  256.     movb    #'Y&137    ,(r1)+        ;  6 do 8-bit quoting if asked
  257.     movb    #mychkt    ,(r1)+        ;  7 checksum type
  258.     movb    #space    ,(r1)        ; 10 assume no repeat count processing
  259.     return
  260.  
  261.  
  262.     .sbttl    Read other Kermit's SINIT parameters
  263.  
  264. ;    input:     (r5)    = address of packet
  265. ;        2(r5)    = packet length
  266. ;    output:    CONPAR[0..20] list of parameters
  267.  
  268. rpar::    save    <r0,r1,r2,r3,r4>
  269.     mov    #conpar    ,r2        ; /62/ pointer to conpar buffer
  270.     mov    #20    ,r0        ; /62/ its length
  271. 10$:    clrb    (r2)+            ; /62/ clear out any old data
  272.     sob    r0    ,10$        ; /62/ next please
  273.     mov    @r5    ,r1        ; incoming packet address
  274.     mov    2(r5)    ,r0        ; and its length
  275.     mov    #conpar    ,r2        ; save other Kermit's params here
  276.     clr    r3            ; /42/ init long-packet length reg
  277.     movb    #'N&137    ,p.qbin(r2)    ; /58/ assume worst for 8-bit quoting
  278.  
  279.     unchar    (r1)+    ,(r2)+        ; conpar.spsiz
  280.     dec    r0            ; if no more data
  281.     beq    20$            ; exit
  282.     unchar    (r1)+    ,(r2)+        ; conpar.time
  283.     dec    r0
  284.     beq    20$
  285.     unchar    (r1)+    ,(r2)+        ; conpar.npad
  286.     dec    r0
  287.     beq    20$
  288.     ctl    (r1)+    ,(r2)+        ; conpar.padc
  289.     dec    r0
  290.     beq    20$
  291.     unchar    (r1)+    ,(r2)+        ; conpar.eol
  292.     dec    r0
  293.     beq    20$
  294.     movb    (r1)+    ,(r2)+        ; conpar.qctl
  295.     dec    r0
  296.     beq    20$
  297.     movb    (r1)+    ,(r2)+        ; conpar.qbin
  298.     dec    r0
  299.     beq    20$
  300.     movb    (r1)+    ,(r2)+        ; conpar.chkt
  301.     dec    r0
  302.     beq    20$
  303.     movb    (r1)+    ,(r2)+        ; conpar.rept
  304.     dec    r0
  305.     beq    20$
  306.     unchar    (r1)+    ,(r2)+        ; /62/ conpar.capas
  307.     dec    r0
  308.     beq    20$
  309.     unchar    (r1)+    ,(r2)        ; /62/ conpar.winds
  310.     movb    (r2)+    ,senwin        ; /62/ save a copy here
  311.     dec    r0
  312.     beq    20$
  313.     unchar    (r1)+    ,r3        ; /42/ conpar.mxl1 (hi word)
  314.     bicb    #200    ,r3        ; /42/ ensure high bit off
  315.     movb    r3    ,(r2)+        ; /62/ copy to the conpar vector
  316.     mul    #95.    ,r3        ; /42/ and save it
  317.     dec    r0            ; /42/ get the next part please
  318.     beq    20$            ; /42/ nothing is left
  319.     unchar    (r1)+    ,r4        ; /42/ conpar.mxl2 (lo word)
  320.     bicb    #200    ,r4        ; /42/ ensure high bit off
  321.     movb    r4    ,(r2)+        ; /62/ copy to the conpar vector
  322.     add    r4    ,r3        ; /42/ add into long-packet length
  323. 20$:    clrb    (r2)            ; /62/ null terminate the conpar data
  324.  
  325.     mov    #conpar    ,r2        ; now clear parity please
  326.     mov    #15    ,r0        ; 13. of 'em to do
  327. 30$:    bicb    #200    ,(r2)+        ; simple
  328.     sob    r0    ,30$        ; next one
  329.  
  330.     mov    #conpar    ,r0        ; /37/ be defensive about the other
  331.     $chkb    #maxpak    ,r0        ; /37/ guy's parameters please..
  332.     inc    r0            ; /62/ allow time-out of zero value
  333.     $chkb    #mypad    ,r0
  334.     $chkb    #mypchar,r0
  335.     $chkb    #myeol    ,r0
  336.     $chkb    #myquote,r0
  337.     $chkb    #'Y    ,r0
  338.     $chkb    #defchk    ,r0        ; /62/ always default to type 1
  339.     $chkb    #space    ,r0
  340.  
  341.     mov    #senpar    ,r0        ; /43/ check to see if we need to
  342.     mov    #conpar    ,r1        ; override any of the sinit stuff
  343.  
  344.     movb    p.npad(r0),r2        ; /57/ check for SET SEND PADDING
  345.     beq    40$            ; /62/ not set, use rec'd values
  346.     movb    r2    ,p.npad(r1)    ; /57/ set, use that value along
  347.     movb    p.padc(r0),p.padc(r1)    ; /62/ with the local pad char
  348.  
  349. 40$:    movb    p.chkt(r1),senpar+p.chkt ; setup for type of checksum used
  350.  
  351.     mov    snd8bit    ,do8bit        ; in case spar decided WE need 8-bit
  352.     clr    snd8bit            ; prefixing to send a file over, but
  353.     cmpb    p.qbin(r1),#'Y&137    ; can the other end handle it?
  354.     bne    50$            ; maybe.. go find out
  355.     movb    #myqbin    ,ebquot        ; yes, use the default "&" prefix and
  356.     br    70$            ; do8bit as possibly set per the above
  357. 50$:    cmpb    p.qbin(r1),#'N&137    ; other end require 8-bit quoting?
  358.     bne    60$            ; yes, using its own prefix char
  359.     clr    do8bit            ; no, it doesn't want it
  360.     br    70$
  361. 60$:    mov    sp    ,do8bit        ; set flag for doing 8-bit prefixing
  362.     movb    p.qbin(r1),ebquot    ; set the quote character please
  363.     call    warn8            ; /BBS/ warn 8-bit prefixing forced on
  364.  
  365. 70$:    clr    senlng            ; /42/ clear write long buffer size
  366.     tst    dolong            ; /42/ really want long-packets today?
  367.     bne    80$            ; /42/ yes
  368.     bitb    #capa.l    ,p.capas(r1)    ; /BBS/ no, but can other end do them?
  369.     beq    120$            ; /BBS/ no
  370.     tst    msgtim            ; /BBS/ ya, is this a new transaction?
  371.     bne    120$            ; /62/ no, continue..
  372.     calls    printm    ,<#2,#prefix,#cando> ; /BBS/ ya, say it is possible..
  373.     br    110$            ; /62/ go set msg given flag, continue
  374.  
  375. 80$:    bitb    #capa.l    ,p.capas(r1)    ; /42/ can other end do long packets?
  376.     beq    100$            ; /42/ no
  377.     mov    r3    ,senlng        ; /42/ yes, load its passed pak length
  378.     bne    90$            ; /42/ something was there
  379.     mov    #maxpak    ,senlng        ; /BBS/ not there, use normal packets
  380. 90$:    cmp    senlng    ,#maxlng    ; /42/ is this bigger than our buffer?
  381.     ble    120$            ; /42/ no
  382.     mov    #maxlng    ,senlng        ; /42/ yes, please fix it then
  383.     br    120$            ; /43/ and continue
  384.  
  385. 100$:    cmp    reclng    ,#maxpak    ; /BBS/ is SET REC PAC > 94. here?
  386.     ble    120$            ; /BBS/ no
  387.     tst    msgtim            ; /43/ ya, say long-packets possible
  388.     bne    120$            ; /43/ but please, NOT for every file
  389.     calls    printm    ,<#2,#prefix,#lmsg> ; /BBS/ print a warning message
  390. 110$:    mov    sp    ,msgtim        ; /43/ flag we printed a warning
  391. 120$:    unsave    <r4,r3,r2,r1,r0>
  392.     return
  393.  
  394. warn8:    tst    warn8done        ; /BBS/ done this yet?
  395.     bne    10$            ; /BBS/ ya
  396.     calls    printm    ,<#1,#warn8msg>    ; /BBS/ warn 8-bit prefixing forced
  397.     mov    sp    ,warn8done    ; /BBS/ flag warning has been given
  398. 10$:    return
  399.  
  400.  
  401.     .sbttl    Fill a buffer with my initialization parameters
  402.  
  403. ;    input:    (r5)    = address of buffer to fill
  404.  
  405. spar::    save    <r0,r1,r2>
  406.     mov    @r5    ,r2        ; point to the destination
  407.     mov    #senpar    ,r1        ; and our local parameters
  408.  
  409.     tochar    (r1)+    ,(r2)+        ; senpar.spsiz
  410.     tochar    (r1)+    ,(r2)+        ; senpar.time
  411.     tochar    (r1)+    ,(r2)+        ; senpar.npad
  412.     ctl    (r1)+    ,(r2)+        ; senpar.padc
  413.     movb    (r1)    ,conpar+p.eol    ; /62/ in case SET and SENDing first..
  414.     tochar    (r1)+    ,(r2)+        ; senpar.eol
  415.     movb    (r1)+    ,(r2)+        ; senpar.qctl
  416.  
  417.     clr    snd8bit            ; assume we don't need 8-bit quoting
  418.     movb    #'Y&137    ,(r1)        ; /62/ but "if we must, ok"
  419.     movb    conpar+p.qbin,r0    ; get other Kermit's quote character
  420.     cmpb    r0    ,#'N&137    ; can it do 8-bit quoting?
  421.     bne    10$            ; possibly..
  422.     clr    do8bit            ; no, don't ever try to do it, but
  423.     br    30$            ; stuff the "Y" in our params anyway
  424. 10$:    cmpb    r0    ,#'Y&137    ; does the other end require quoting?
  425.     bne    20$            ; yes, set the mode up then
  426.     tst    parity            ; /BBS/ no, but do we need to do it?
  427.     beq    30$            ; no, don't waste the overhead
  428.     movb    #myqbin    ,r0        ; yes, force this to the other side
  429. 20$:    mov    sp    ,snd8bit    ; flag so rpar knows what's up here
  430.     mov    sp    ,do8bit        ; force 8-bit prefixing then
  431.     movb    r0    ,ebquot        ; and set ours to the same please
  432.     movb    r0    ,(r1)        ; /62/ update senpar data
  433.     call    warn8            ; /BBS/ warn 8-bit prefixing forced
  434.  
  435. 30$:    movb    (r1)+    ,(r2)+        ; senpar.qbin
  436.     movb    (r1)+    ,(r2)+        ; senpar.chkt
  437.     movb    (r1)+    ,(r2)+        ; senpar.rept
  438.  
  439.     mov    #11    ,sparsz        ; /62/ spar packet size up to now..
  440.     mov    doattr    ,r0        ; /62/ if both attributes and
  441.     bis    dolong    ,r0        ; /62/ long-packets are not enabled
  442.     beq    60$            ; /62/ then this is all that's needed
  443.     add    #4    ,sparsz        ; /62/ more to come, make room for it
  444.  
  445.     clrb    (r1)            ; /62/ init capas byte
  446.     tst    dolong            ; /42/ do long packets?
  447.     beq    40$            ; /42/ no
  448.     bisb    #capa.l    ,@r1        ; /42/ ya
  449. 40$:    tst    doattr            ; /42/ do attributes?
  450.     beq    50$            ; /62/ no
  451.     bisb    #capa.a    ,@r1        ; /62/ ya
  452.  
  453. 50$:    tochar    (r1)+    ,(r2)+        ; senpar.capas
  454.     tochar    (r1)+    ,(r2)+        ; /42/ senpar.capas+1 (window_size)
  455.     tochar    (r1)+    ,(r2)+        ; /42/ senpar.capas+2 (maxlen1)
  456.     tochar    (r1)+    ,(r2)+        ; /42/ senpar.capas+3 (maxlen2)
  457.  
  458. 60$:    clrb    (r2)            ; /62/ end, null terminate
  459.     unsave    <r2,r1,r0>
  460.     return
  461.  
  462.  
  463.     .sbttl    Restore set checksum type and init a few things
  464.  
  465. fixchk::movb    setchkt    ,senpar+p.chkt    ; /62/ put SET BLO value back
  466.     clr    do8bit            ; /BBS/ reset the 8-bit quoting flag
  467.     clr    warn8done        ; /BBS/ allow warn message again
  468.     clr    msgtim            ; /BBS/ and long packet messages
  469.     movb    #'Y&137    ,conpar+p.qbin    ; /BBS/ preset normal 8-bit quote bit
  470.     clr    incpar            ; /BBS/ reset parity warning counter
  471.     return
  472.  
  473.  
  474.     .sbttl    Dump a debug packet to disk
  475.  
  476. ;    D S K D M P
  477. ;
  478. ;    input:      (r5)    = function name (RPACK or SPACK)
  479. ;         2(r5)    = packet number    ; /BBS/ number and length flipped
  480. ;         4(r5)    = packet type
  481. ;         6(r5)    = packet length
  482. ;        10(r5)    = packet buffer address
  483.  
  484. dskdmp::save                ; /42/ save r0-r5
  485.     sub    #64    ,sp        ; /BBS/ allocate a formatting buffer
  486.     mov    sp    ,r1        ; point to it
  487.     mov    #64    ,r0        ; number of bytes in the buffer
  488. 10$:    movb    #space    ,(r1)+        ; /BBS/ fill it with blanks
  489.     sob    r0    ,10$        ; one byte at a time
  490.     mov    sp    ,r1        ; point back to the buffer
  491.     mov    (r5)+    ,r0        ; point to the routine name
  492.     call    160$            ; and copy it
  493.     dec    r1            ; /BBS/ format display
  494.     mov    #ini.05    ,r0        ; /BBS/ and a label, "PAK"
  495.     call    160$            ; copy it
  496.     inc    r1            ; /BBS/ a space
  497.     mov    (r5)+    ,r0        ; /BBS/ deccvt uses r5, so use r0 here
  498.     deccvt    r0    ,r1    ,#2    ; /BBS/ convert to decimal
  499.     add    #6    ,r1        ; /BBS/ and skip to next position
  500.     mov    #ini.06    ,r0        ; another label, "TYP"
  501.     call    160$            ; simple
  502.     inc    r1            ; /BBS/ a space
  503.     movb    (r5)+    ,(r1)        ; get the packet type
  504.     inc    r5            ; /62/ finish bumping r5 to next arg..
  505.     cmpb    (r1)    ,#badchk    ; /62/ checksum error?
  506.     bne    20$            ; /62/ no
  507.     movb    #'*    ,(r1)        ; /62/ yes, flag it please
  508.     br    40$            ; /62/ and continue
  509. 20$:    cmpb    (r1)    ,#'A&137    ; /62/ smaller than an "A" ?
  510.     blt    30$            ; /62/ ya..
  511.     cmpb    (r1)    ,#'Z&137    ; /62/ bigger than a "Z" ?
  512.     ble    40$            ; /62/ nope
  513. 30$:    movb    #'?    ,(r1)        ; /62/ indicate type is in la-la land
  514. 40$:    add    #5    ,r1        ; /62/ skip to next entry in line
  515.     mov    #ini.07    ,r0        ; and a label, "LEN"
  516.     call    160$            ; copy it
  517.     inc    r1            ; /BBS/ a space
  518.     mov    (r5)+    ,r2        ; /BBS/ save a copy of packet length
  519.     deccvt    r2    ,r1    ,#4    ; /BBS/ and convert to decimal
  520.     add    #4    ,r1        ; now point to the end
  521.     clrb    @r1            ; make it .asciz
  522.     mov    sp    ,r1        ; point back to the start
  523.     bit    #log$pa    ,trace        ; /BBS/ maybe only doing TT now?
  524.     beq    100$            ; /BBS/ ya..
  525.     strlen    r1            ; /BBS/ don't write extra blanks!
  526.     calls    putrec    ,<r1,r0,#lun.lo> ; and put out to disk now
  527.     tst    r0            ; /62/ did it work?
  528.     beq    50$            ; /62/ ya
  529.     call    logerr            ; /62/ no, handle the error
  530.     br    100$            ; /62/ that's it for this part..
  531. 50$:    mov    @r5    ,r3        ; /BBS/ get address of packet buffer
  532.     cmp    r2    ,#$allsiz-2    ; /62/ is this length for real?
  533.     ble    60$            ; /62/ should be..  else truncate to
  534.     mov    #$allsiz-2,r2        ; /62/ avoid trap to 4 past buff end!!
  535. 60$:    mov    r2    ,r4        ; /42/ save the length please
  536. 70$:    mov    r4    ,r0        ; /42/ assume a reasonable size
  537.     ble    100$            ; /BBS/ don't write null lines..
  538.     cmp    r0    ,#72.        ; /42/ will the leftovers fit?
  539.     ble    80$            ; /42/ yes
  540.     mov    #72.    ,r0        ; /42/ no
  541. 80$:    call    170$            ; /62/ indent 4 columns
  542.     calls    putrec    ,<r3,r0,#lun.lo> ; /42/ dump a (partial) bufferful
  543.     tst    r0            ; /62/ did it work?
  544.     beq    90$            ; /62/ ya
  545.     call    logerr            ; /62/ no, handle the error
  546.     br    100$            ; /62/ that's it for this part..
  547. 90$:    add    #72.    ,r3        ; /42/ move up to next partial
  548.     sub    #72.    ,r4        ; /42/ and try again
  549.     br    70$            ; /42/ next please
  550.  
  551. 100$:    bit    #log$de    ,trace        ; /62/ should we also dump to TT?
  552.     beq    150$            ; no
  553.     wrtall    r1            ; yes, dump the length and type
  554.     .newline            ; and a CR/LF
  555.     tst    r2            ; anything in the packet?
  556.     beq    150$            ; no
  557.     clr    r1            ; /BBS/ init a counter for newlines
  558.     mov    @r5    ,r3        ; /BBS/ get address of packet buffer
  559. 110$:
  560. .if df    RT11                ; /E64/
  561.     tst    tsxsav            ; /BBS/ running under TSX?
  562.     beq    120$            ; /BBS/ nope
  563.     cmpb    @r3    ,m.tsxr        ; /62/ ya, is this TSLICH?
  564.     beq    140$            ; /BBS/ ya, don't type it to TT
  565. .endc    ;RT11                ; /E64/
  566. 120$:    tst    r1            ; /62/ at the top of a line (col.1)?
  567.     bne    130$            ; /62/ nope
  568.     wrtall    #ini.08            ; /62/ ya, indent 4 columns..
  569. 130$:    movb    (r3)+    ,r0        ; /BBS/ get a byte
  570.     call    writ1char        ; /BBS/ send it to TT
  571.     inc    r1            ; /BBS/ increment the byte counter
  572.     cmp    r1    ,#72.        ; /BBS/ done 72. chars yet?
  573.     ble    140$            ; /BBS/ nope
  574.     .newline            ; /BBS/ ya, do a <cr><lf>
  575.     clr    r1            ; /BBS/ and reset the byte counter
  576. 140$:    sob    r2    ,110$        ; /BBS/ continue
  577.     tst    r1            ; /BBS/ need a newline?
  578.     beq    150$            ; /BBS/ nope
  579.     .newline            ; /BBS/ ya
  580. 150$:    add    #64    ,sp        ; /BBS/ pop the local buffer
  581.     unsave                ; /42/ unsave r5-r0
  582.     return
  583.  
  584. 160$:    movb    (r0)+    ,(r1)+        ; copy .asciz string to buffer
  585.     bne    160$            ; done yet?
  586.     dec    r1            ; /BBS/ back up to null
  587.     movb    #space    ,(r1)+        ; /BBS/ stuff a space where null was
  588.     return
  589.  
  590. 170$:    save    <r2,r1,r0>        ; /62/ added, dump 4 blanks to logfile
  591.     mov    #4    ,r2        ; loop 4 times
  592.     mov    #lun.lo    ,r1        ; write to this channel
  593. 180$:    mov    #space    ,r0        ; space is the char to write
  594.     call    putcr0            ; do it
  595.     sob    r2    ,180$        ; until done
  596.     unsave    <r0,r1,r2>
  597.     return
  598.  
  599.  
  600.     .sbttl    Init stats registers    ; /62/ now includes clrsta
  601.  
  602. inista::call    dcdtst            ; /63/ check DCD, report any change
  603.     mov    #pcnt.r    ,r1        ; packets received
  604.     mov    totp.r    ,r2        ; running count so far
  605.     mov    #34    ,r0        ; number of words to add/clear
  606. 10$:    add    2(r1)    ,2(r2)        ; /43/ add in the totals
  607.     adc    (r2)            ; /43/ the carryover also
  608.     add    (r1)    ,(r2)+        ; /43/ the high order of it
  609.     tst    (r2)+            ; /43/ get to the next one
  610.     clr    (r1)+            ; /43/ clear old stuff out
  611.     clr    (r1)+            ; /43/
  612.     sob    r0    ,10$        ; /43/ next please
  613.     mov    #pcnt.s    ,r1        ; now for the packets sent
  614.     mov    totp.s    ,r2        ; where to add them in
  615.     mov    #34    ,r0        ; number of words to do
  616. 20$:    add    2(r1)    ,2(r2)        ; /43/ add in the totals
  617.     adc    (r2)            ; /43/ the carryover also
  618.     add    (r1)    ,(r2)+        ; /43/ the high order of it
  619.     tst    (r2)+            ; /43/ get to the next one
  620.     clr    (r1)+            ; /43/ clear old stuff out
  621.     clr    (r1)+            ; /43/
  622.     sob    r0    ,20$        ; /43/ next please
  623.     clr    pcnt.n            ; NAKs count
  624.     clr    pcnt.n+2        ; /43/ rest of it
  625.     clr    pcnt.t            ; /44/ time-outs
  626.     clr    pcnt.t+2        ; /44/
  627.     clr    filein+0        ; /43/ file data stats
  628.     clr    filein+2        ; /43/
  629.     clr    fileout+0        ; /43/
  630.     clr    fileout+2        ; /43/
  631.     clr    charin+0        ; /43/ physical link stats
  632.     clr    charin+2        ; /43/
  633.     clr    charout+0        ; /43/
  634.     clr    charout+2        ; /43/
  635.     clr    rdrate+0        ; /BBS/ read rate, # chars hi word
  636.     clr    rdrate+2        ; /BBS/ # chars lo word
  637.     clr    rdrate+4        ; /BBS/ # of reads
  638.     clr    nakrec            ; /BBS/ anti-resonating NAK register
  639. .if df    RT11                ; /E64/
  640.     .gtim    #rtwork    ,#pkrate    ; /62/ start of init packet xmission
  641.     mov    #-1    ,pkrate+4    ; /62/ flag this is first time through
  642. .endc    ;RT11                ; /E64/
  643.     mov    #-1    ,pcnt.n+2    ; init so next bump makes it zero
  644.     clr    pcnt.n+0        ; /43/ clear high order bits
  645.     mov    #-1    ,pcnt.t+2    ; /44/ init time-out counter
  646.     clr    pcnt.t+0        ; /44/ 32. bits here too
  647.     .br    incsta            ; /63/
  648.  
  649.  
  650.     .sbttl    Increment stats
  651.  
  652. incsta::
  653. .if df    RT11                ; /E64/
  654.     cmp    -(sp)    ,-(sp)        ; allocate two word buffer
  655.     mov    sp    ,r3        ; and point to the small buffer
  656.     .gtim    #rtwork    ,r3        ; get ticks past midnite
  657.     mov    (r3)+    ,r0        ; load time hi word and
  658.     mov    (r3)    ,r1        ; low word for double precision divide
  659.     cmp    (sp)+    ,(sp)+        ; pop the tiny buffer
  660.     mov    #40    ,r3        ; set iteration count in r3 (32. bits)
  661.     mov    clkflg    ,-(sp)        ; put divisor on the stack
  662.     clr    r2            ; set the remainder to zero
  663. 10$:    asl    r1            ; shift the entire dividend
  664.     rol    r0            ; ...
  665.     rol    r2            ; ... to left and into remainder
  666.     cmp    r2    ,(sp)        ; is remainder greater than divisor
  667.     blo    20$            ; no, skip to iteration control
  668.     sub    (sp)    ,r2        ; yes, subtract divisor out please
  669.     inc    r1            ; increment the quotient
  670. 20$:    dec    r3            ; repeat please
  671.     bgt    10$            ; not done    r0=hiword secs>midnite
  672.     tst    (sp)+            ; pop divisor    r1=loword secs>midnite
  673. .endc    ;RT11                ; /E64/
  674. .if df    RSTS                ; /E64/
  675.     call    seconds            ; /43/ get current seconds since
  676. .endc    ;RSTS                ; /E64/
  677.     mov    #times+4,r2        ; /43/ midnight, moving old times
  678.     mov    r0    ,(r2)+        ; /43/ insert new times first
  679.     mov    r1    ,(r2)        ; /43/ then subtract off the old
  680.     sub    times+2    ,(r2)        ; /43/ times from it
  681.     sbc    -(r2)            ; /43/ ditto for the carry
  682.     sub    times+0    ,(r2)        ; /43/ incremental is in times+4..>>
  683.     bge    30$            ; /BBS/ didn't cross midnight
  684.     mov    #times+6,r2        ; /BBS/ did cross, add 24 hours to fix
  685.     add    #20864.    ,(r2)        ; /BBS/ low word of # secs in 24 hours
  686.     adc    -(r2)            ; /BBS/ add carry to 32-bit hi word
  687.     add    #1.    ,(r2)        ; /BBS/ hi word of # secs in 24 hours
  688. 30$:    mov    r1    ,times+2    ; /43/ <<..and times+6, new time is in
  689.     mov    r0    ,times+0    ; /43/ times+0 and times+2
  690.     return                ; /43/
  691.  
  692.  
  693.     .sbttl    Initialize repeat count for sending packets
  694.  
  695. inirep::save    <r0>
  696.     clr    dorpt            ; assume not doing repeat things
  697.     tst    setrpt            ; repeat count processing disabled?
  698.     beq    10$            ; yes
  699.     cmpb    #myrept    ,#space        ; am I doing it?
  700.     beq    10$            ; no, just exit then
  701.     clr    rptcount        ; size of repeat if zero
  702.     clr    rptlast            ; no last character please (a null)
  703.     mov    #-1    ,rptinit    ; need to prime the pump please
  704.     movb    conpar+p.rept,r0    ; check for doing so
  705.     beq    10$            ; no
  706.     cmpb    r0    ,#space        ; a space also?
  707.     beq    10$            ; yes
  708.     cmpb    r0    ,senpar+p.rept    ; same?
  709.     bne    10$            ; no
  710.     movb    r0    ,rptquo        ; yes, save it and
  711.     mov    sp    ,dorpt        ; /62/ we are indeed doing this
  712. 10$:    unsave    <r0>
  713.     return
  714.  
  715.  
  716.     .sbttl    Decide what to do about displaying packet counts
  717.  
  718. dolog:    call    dcdtst            ; /62/ check DCD, report any change
  719.     tst    blip            ; display at every "blip" # of counts
  720.     beq    10$            ; do not do this at all
  721.     tst    infomsg            ; /51/ if SET TT QUIET
  722.     beq    10$            ; /51/ don't do this
  723.     tst    remote            ; a server?
  724.     bne    10$            ; could be
  725.     tst    xmode            ; extended reply?  also clears carry..
  726.     bne    10$            ; yes
  727.     bit    #log$de    ,trace        ; /62/ debugging to TT?
  728.     bne    10$            ; /BBS/ ya, stop headers + etc..
  729.     bit    #log$rp    ,trace        ; /BBS/ this also writes to TT
  730.     beq    20$            ; /BBS/ except when equal to zero
  731. 10$:    sec                ; flag to skip stats display
  732. 20$:    return                ; /63/ or carry cleared by above tests
  733.  
  734.  
  735.     .sbttl    Display received packets stats
  736.  
  737. reclog::save    <r1>
  738.     call    dolog            ; decide what to do
  739.     bcs    10$            ; do nothing
  740.     mov    pcnt.r+2,r1        ; check for modulo on screen updates
  741.     clr    r0            ; setup for the divide
  742.     div    blip    ,r0        ; do it
  743.     tst    r1            ; any remainder left over?
  744.     bne    10$            ; yes, simply exit
  745.     mov    vttype    ,r0        ; no, dispatch to the correct routine
  746.     asl    r0            ; it's word indexing
  747.     jsr    pc    ,@recdsp(r0)    ; dispatch
  748. 10$:    unsave    <r1>
  749.     return
  750.  
  751.     .save
  752.     .psect    $pdata
  753. recdsp:    .word    rectty    ,rectty    ,recvt1    ,recvt1    ,recvt1
  754.     .restore
  755.  
  756. rectty:    mov    #pcnt.r    ,r1        ; /43/ pass address in r1
  757.     call    numout            ; write the number to the terminal
  758.     wrtall    #$delim            ; a "/" delimiter
  759.     mov    #pcnt.s+<4*<<'N&137>-100>>,r1 ; /43/ 32. bits this time
  760.     cmp    2(r1)    ,pcnt.n+2    ; /43/ unlikely that the NAK
  761.     beq    10$            ; /43/ count would ever be > 65535.
  762.     mov    2(r1)    ,pcnt.n+2    ; /43/ use low order 16 bits
  763. 10$:    call    numout            ; /BBS/ always refresh display
  764.     call    l$nolf            ; just a CR, unless TT is NOSCOPE
  765.     mov    sp    ,logini        ; /BBS/ flag this line has been used
  766.     return
  767.  
  768. recvt1:    tst    logini            ; need the header?
  769.     bne    20$            ; no
  770.     tst    pcnt.r+2        ; /62/ ya, but sent any packets yet?
  771.     bne    10$            ; /62/ ya
  772.     tst    pcnt.r+0        ; /62/ check hi word just in case
  773.     beq    50$            ; /62/ nothing to do yet
  774. 10$:    wrtall    #$rech            ; /62/ initial header please
  775.     mov    #-1    ,pcnt.n+2    ; /62/ force redisplay of NAKs
  776.     mov    #-1    ,pcnt.t+2    ; /62/ and time-outs
  777.     mov    sp    ,logini        ; /62/ flag it has been done
  778. 20$:    wrtall    #$pos1            ; position the cursor
  779.     mov    #pcnt.r    ,r1        ; /43/ received packet count
  780.     call    numout            ; dump it
  781.     mov    #pcnt.s+<4*<<'N&137>-100>>,r1 ; /43/ get the sent NAK count
  782.     cmp    2(r1)    ,pcnt.n+2    ; /43/ really need to update NAKs?
  783.     beq    30$            ; no
  784.     mov    2(r1)    ,pcnt.n+2    ; /43/ stuff low order 16 bits
  785.     wrtall    #npos            ; /62/ put cursor where NAK count goes
  786.     call    numout            ; print the NAK count
  787. 30$:    ; /BBS/ dotmo moved here
  788.     mov    #pcnt.r+<4*<<'T&137>-100>>,r1 ; /44/ get time-out count
  789.     cmp    2(r1)    ,pcnt.t+2    ; /44/ has time-out count changed?
  790.     beq    40$            ; /44/ no, just exit
  791.     mov    2(r1)    ,pcnt.t+2    ; /44/ yes, update counter
  792.     wrtall    #dpos            ; /44/ position cursor
  793.     call    numout            ; /44/ dump the number to TT please
  794. 40$:    call    l$nolf
  795. 50$:    return
  796.  
  797.  
  798.     .sbttl    Display sent packets stats
  799.  
  800. senlog::save    <r1>
  801.     call    dolog            ; decide what to do
  802.     bcs    10$            ; don't do anything
  803.     mov    pcnt.s+2,r1        ; check for modulo on screen updates
  804.     clr    r0            ; setup for the divide
  805.     div    blip    ,r0        ; do it
  806.     tst    r1            ; any remainder left over?
  807.     bne    10$            ; yes, simply exit
  808.     mov    vttype    ,r0        ; recover terminal type
  809.     asl    r0            ; word indexing here
  810.     jsr    pc    ,@sendsp(r0)    ; dispatch based on terminal type
  811. 10$:    unsave    <r1>
  812.     return
  813.  
  814.     .save
  815.     .psect    $pdata
  816. sendsp:    .word    sentty    ,sentty    ,senvt1    ,senvt1    ,senvt1
  817.     .restore
  818.  
  819. sentty:    mov    #pcnt.s    ,r1        ; /43/ 32. bits now
  820.     call    numout            ; write the number to the terminal
  821.     wrtall    #$delim            ; a "/" delimiter
  822.     mov    #pcnt.r+<4*<<'N&137>-100>>,r1 ; get the sent NAK count
  823.     cmp    2(r1)    ,pcnt.n+2    ; any change in count?
  824.     beq    10$            ; no
  825.     mov    2(r1)    ,pcnt.n+2    ; ya, update it
  826. 10$:    call    numout            ; /BBS/ always refresh display
  827.     call    l$nolf            ; just a CR, unless TT is NOSCOPE
  828.     mov    sp    ,logini        ; /BBS/ flag this line has been used
  829.     return
  830.  
  831. senvt1:    tst    logini            ; need the header?
  832.     bne    20$            ; no
  833.     tst    pcnt.r+2        ; /62/ ya, but sent any packets yet?
  834.     bne    10$            ; /62/ ya
  835.     tst    pcnt.r+0        ; /62/ check hi word just in case
  836.     beq    50$            ; /62/ nothing to do yet
  837. 10$:    wrtall    #$sendh            ; /62/ ya, dump it to TT
  838.     mov    #-1    ,pcnt.n+2    ; /62/ force redisplay of NAKs
  839.     mov    #-1    ,pcnt.t+2    ; /62/ and time-outs
  840.     mov    sp    ,logini        ; /62/ flag header now exists
  841. 20$:    wrtall    #$pos0            ; /BBS/ position the cursor
  842.     mov    #pcnt.s    ,r1        ; /43/ 32. bits now
  843.     call    numout            ; write number on terminal
  844.     mov    #pcnt.r+<4*<<'N&137>-100>>,r1 ; get the sent NAK count
  845.     cmp    2(r1)    ,pcnt.n+2    ; any change in count?
  846.     beq    30$            ; no
  847.     mov    2(r1)    ,pcnt.n+2    ; ya, update it
  848.     wrtall    #npox            ; /62/ for shortened send logging
  849.     call    numout            ; write number on terminal
  850. 30$:    ; /BBS/ dotmo moved here
  851.     mov    #pcnt.r+<4*<<'T&137>-100>>,r1 ; /44/ get time-out count
  852.     cmp    2(r1)    ,pcnt.t+2    ; /44/ has time-out count changed?
  853.     beq    40$            ; /44/ no, just exit
  854.     mov    2(r1)    ,pcnt.t+2    ; /44/ yes, update counter
  855.     wrtall    #dpox            ; /BBS/ position cursor for send
  856.     call    numout            ; /44/ dump the number to TT please
  857. 40$:    call    l$nolf            ; just a CR, unless TT is NOSCOPE
  858. 50$:    return
  859.  
  860.  
  861.     .sbttl    Display packet stats via ^A    ; 9-Dec-86 07:46:02
  862.  
  863. ; /56/    This is similar to the VMS Kermit's ^A status line, which is just like
  864. ; that in FTP.  Under KRT as it currently is however, the only time this test
  865. ; can be done is just after receiving a data packet, and there may be some lag
  866. ; until that occurs, especially when using long packets over a slow link.
  867.  
  868. cs$in::    mov    #ini.12    ,r0        ; pass to common code
  869.     mov    #filein    ,r1        ; address of data to print
  870.     mov    #lun.ou    ,-(sp)        ; /62/ save for blocks display
  871.     br    cs.com            ; /63/
  872.  
  873. cs$out::mov    #ini.11    ,r0        ; pass to common code
  874.     mov    #fileout,r1        ; address of data to print
  875.     mov    #lun.in    ,-(sp)        ; /62/ save for blocks display
  876. cs.com:    call    l$nolf            ; /62/ ensure stats are in the clear
  877.     call    numout            ; dump char count @r1
  878.     wrtall    #ini.09            ; /62/ some text
  879.     wrtall    r0            ; send or receive?
  880.     wrtall    #ini.10            ; /62/ some more text
  881.     wrtall    #filnam            ; name of the file
  882.     wrtall    #ini.13            ; /62/ "curblk/maxblk"
  883.     mov    (sp)+    ,r1        ; /62/ recover file's lun
  884.     asl    r1            ; /62/ word indexing here..
  885.     mov    blknum(r1),r0        ; /62/ current block number
  886.     call    L10266            ; /62/ display it
  887.     mov    #'/    ,r0        ; /62/ a slash
  888.     call    writ1char        ; /62/ display it
  889.     mov    sizof(r1),r0        ; /62/ this is how big file is
  890.     call    L10266            ; /62/ display it
  891.     .newline            ; /62/ done
  892.     clr    logini            ; retype the display header
  893.     return
  894.  
  895.  
  896.     .sbttl    Display a 32-bit number    ; /43/
  897.  
  898. numout:    save    <r0,r1,r2>
  899.     sub    #20    ,sp        ; allocate a buffer please
  900.     mov    sp    ,r0        ; point to buffer for $cddmg
  901.     clr    r2            ; kill leading zero and spaces
  902.     call    $cddmg            ; convert to ascii
  903.     clrb    @r0            ; make it .asciz
  904.     mov    sp    ,r0        ; reset pointer
  905.     wrtall    r0            ; dump the string
  906.     add    #20    ,sp
  907.     unsave    <r2,r1,r0>
  908.     return
  909.  
  910.     .end
  911.