home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / FMAILSRC.ZIP / FMS.ASM < prev    next >
Assembly Source File  |  1991-05-23  |  223KB  |  7,561 lines

  1.  
  2. ;Sat  Sat  04-06-1991
  3.  
  4. ;                               FMAIL ver 1.00
  5.  
  6.  
  7.  
  8. ;********************************************************************************
  9. ;
  10. ;This code is only slightly commented, but most of the subroutines are well
  11. ;headed with entry and exit characteristics.  The code is written in a
  12. ;"self commenting" manner so there should be little difficulty in following
  13. ;it.
  14. ;
  15. ;I'll not claim that this is "great" code, It's not! It is very loose and
  16. ;wasteful in both size and speed. It is easy to work with though and easy to
  17. ;modify. (easier to write too).
  18. ;
  19. ;The entire first section (up to the start of the data segment) is a set of
  20. ;macros and structures to ease the calling conventions of the API and reduce
  21. ;errors. I'm still adding to this regularly and it could easily be put in an
  22. ;include file.
  23. ;
  24. ;As a general rule (that is often broken) the subroutines follow the parent.
  25. ;
  26. ;You will often find non attached pieces of code in this file. These will
  27. ;usually be parts of features in progress of debugging aids.
  28. ;
  29. ;The entire program is my exclusive work with the exception on the crc
  30. ;computation routine which was found in public domain file and entirely
  31. ;rewritten with the exception of the table of values. My thanks to the unknown
  32. ;author.
  33. ;
  34. ;This work is copyrite 1991 by Patrick O'Riva, all rights reserved.
  35. ;
  36. ;You may use, modify, distribute, or whatever else you wish to do with it as
  37. ;long as no money is asked for it. As long as pieces of it are recognizable
  38. ;you must include my copyrite and this notice.
  39. ;
  40. ;If you are adding features to FMAIL as a whole (rather than writing a new
  41. ;mailer using parts of this) send the changes to me for inclusion in an
  42. ;"official" release.
  43. ;
  44. ;**********************************************************************************
  45.  
  46.  
  47.  
  48. .286
  49.  
  50. false   equ     0
  51. true    equ     1
  52.  
  53. tight   equ     false
  54. debug   equ     false
  55. drived  equ     false
  56. no_tosslog      equ false
  57.  
  58.  
  59. lodad   macro
  60.                 lodsw
  61.                 mov dx,ax
  62.                 lodsw
  63.                 xchg dx,ax
  64. endm
  65.  
  66.  
  67. ddata   macro
  68.                 push    _data
  69.                 pop     ds
  70. endm
  71.  
  72. edata   macro
  73.                 push    _data
  74.                 pop     es
  75. endm
  76.  
  77. xdses   macro
  78.                 push    ds
  79.                 push    es
  80.                 pop     ds
  81.                 pop     es
  82. endm
  83.  
  84. prt             macro   message
  85.                 mov     di,offset message
  86.                 call    print_asciiz
  87. endm
  88.  
  89. add_m32_rax     macro   m32
  90.                 push    dx
  91.                 xor     dx,dx
  92.                 add     word ptr m32,ax
  93.                 adc     word ptr m32+2,dx
  94.                 pop     dx
  95. endm
  96.  
  97.  
  98.  
  99. error_check     macro
  100.                 local mend
  101.                 and     ax,ax
  102.                 jz      mend
  103.                 stc
  104. mend:
  105. endm
  106.  
  107. openerror       macro path,jump
  108.                 local   endoe
  109.                 jnc     endoe
  110.                 mov     si,offset path
  111.                 jmp     jump
  112. endoe:
  113. endm
  114.  
  115.  
  116. mdosallocseg    macro   selname,sharing_mode
  117.                 push    ax
  118.                 mov     ax,offset selname
  119.                 push    ds
  120.                 push    ax
  121.                 push    sharing_mode
  122.                 call    dosallocseg
  123.                 error_check
  124. endm
  125.  
  126. ;doschdir....ds:si -> at a path (may contain drive(1 based))
  127.  
  128. mdoschdir       macro
  129.                 push    ds
  130.                 push    si
  131.                 xor     ax,ax
  132.                 push    ax
  133.                 push    ax
  134.                 call    doschdir
  135.                 error_check
  136. endm
  137.  
  138.  
  139. ;doschgfileptr
  140. ;changes the dos file pointer. Receives the handle in ax, delta in dx:bx
  141. ;                               rets the new file pointer in cur_file_ptr
  142. ;cur_file_ptr   dd      0
  143.  
  144. rel_end equ     2
  145. rel_beg equ     0
  146. rel_cur equ     1
  147.  
  148.  
  149. mdoschgfileptr  macro relative
  150.                 push    ax
  151.                 push    dx
  152.                 push    bx
  153.                 push    relative
  154.                 mov     ax,offset cur_file_ptr
  155.                 push    ds
  156.                 push    ax
  157.                 call    doschgfileptr
  158.                 error_check
  159. endm
  160.  
  161.  
  162.  
  163.  
  164. mdosclose       macro
  165.                 local mnoopen
  166.                 and     ax,ax
  167.                 jz      mnoopen
  168.                 push    ax
  169.                 call    dosclose
  170.                 error_check
  171. mnoopen:
  172.  
  173. endm
  174.  
  175.  
  176.  
  177. ;mdosdelete     si -> at the pathname to delete
  178. mdosdelete      macro
  179.                 push    ds
  180.                 push    si
  181.                 xor     ax,ax
  182.                 push    ax
  183.                 push    ax
  184.                 call    dosdelete
  185.                 error_check
  186. endm
  187.  
  188.  
  189.  
  190.  
  191. ;for DosExecPgm the following should be defined before the macro call
  192. ;objname         db      20 dup(0) ;this recs failing .dll
  193. ;arg_strings     label   byte
  194. ;  simple program name asciiz
  195. ;    string, followed by one or
  196. ;    more asciiz args. 2null
  197. ;    terminated
  198. ;
  199. ;env_strings     label   byte
  200. ;  0 or more asciiz env strings
  201. ;    2null terminated
  202. ;child_pathname  asciiz
  203. ;
  204. ;on entry si is offset of pathname, bx is offset of arg strings, cx offset
  205. ;  of envstrings, ax = 0 for synchronous mode
  206. ;
  207. ;on exit result is child termination type and result2 is termination code
  208.  
  209. mdosexecpgm     macro
  210.                 push    ds
  211.                 push    offset objname
  212.                 push    20
  213.                 push    ax
  214.                 push    ds
  215.                 push    bx
  216.                 push    ds
  217.                 push    cx
  218.                 push    ds
  219.                 push    offset results
  220.                 push    ds
  221.                 push    si
  222.                 call    dosexecpgm
  223.                 error_check
  224. endm
  225.  
  226.  
  227.  
  228.  
  229.  
  230. mdosfindfirst   macro
  231.                 push cx
  232.                 push ax
  233.                 push ds
  234.                 push offset search_handle
  235.                 push dx
  236.                 push word ptr doscall_inseg
  237.                 push si
  238.                 push di
  239.                 push ds
  240.                 push offset max_find
  241.                 xor ax,ax
  242.                 push ax
  243.                 push ax
  244.                 call dosfindfirst
  245.                 and ax,ax
  246.                 error_check
  247. endm
  248.  
  249. ;mdosmove       si points at old pathname, di points at new pathname
  250. ;used for renaming or moving file within a drive, and renaming directories
  251. ;directories must exist.
  252.  
  253. extrn dosmove:far
  254. mdosmove        macro
  255.                 push    ds
  256.                 push    si
  257.                 push    ds
  258.                 push    di
  259.                 xor     ax,ax
  260.                 push    ax
  261.                 push    ax
  262.                 call    dosmove
  263.                 error_check
  264. endm
  265.  
  266.  
  267. mmdosopen       macro
  268.                 push    ds
  269.                 push    si
  270.                 push    ds
  271.                 push    offset handle
  272.                 push    ds
  273.                 push    offset result
  274.                 push    bx
  275.                 push    cx
  276.                 mov     si,ax
  277.                 mov     al,ah
  278.                 xor     ah,ah
  279.                 push    ax
  280.                 mov     ax,si
  281.                 xor     ah,ah
  282.                 push    ax
  283.                 push    dx
  284.                 xor     ax,ax
  285.                 push    ax
  286.                 push    ax
  287.                 call    dosopen
  288. endm
  289.  
  290.  
  291. mdosopen        macro   l_o_pathname,if_exist,if_n_exist
  292.                 local m1
  293.                 push    bx
  294.                 push    cx
  295.                 push    dx
  296.                 push    si
  297.                 mov     dl,sharing
  298.                 add     dl,access
  299.                 mov     dh,other_open_flags
  300.                 mov     al,if_exist+if_n_exist
  301.                 mov     ah,attrib_create
  302.                 mov     si,offset filesize
  303.                 mov     cx,[si]
  304.                 mov     bx,[si+2]
  305.                 mov     si,offset l_o_pathname
  306.                 mmdosopen
  307.                 and     ax,ax
  308.                 jz      m1
  309.                 stc
  310. m1:
  311.                 pop     si
  312.                 pop     dx
  313.                 pop     cx
  314.                 pop     bx
  315. endm
  316.  
  317.  
  318. ;mdosqcurdir     parameter receives the directory pathname. cx hold the
  319. ;                length of the buffer, ax has the drive number (1 based)
  320.  
  321. mdosqcurdir     macro   dirpath
  322.                 mov     result,cx
  323.                 push    ax
  324.                 push    ds
  325.                 push    offset dirpath
  326.                 push    ds
  327.                 push    offset result
  328.                 call    dosqcurdir
  329.                 error_check
  330. endm
  331.  
  332.  
  333. ;mdosqcurdisk    first parameter receives a word giving the drive number
  334. ;                (1 based). The second parameter receives a dword drive bitmap
  335. ;                (bits 0-25 indicate logical drives)
  336.  
  337. mdosqcurdisk    macro   drive_code,bitmap
  338.                 push    ds
  339.                 push    offset drive_code
  340.                 push    ds
  341.                 push    offset bitmap
  342.                 call    dosqcurdisk
  343.                 error_check
  344. endm
  345.  
  346.  
  347.  
  348.  
  349. mdosqfileinfo   macro   struc_file_info
  350.                 push    handle
  351.                 push    1
  352.                 push    ds
  353.                 push    offset struc_file_info
  354.                 push    type file_info
  355.                 call    dosqfileinfo
  356.                 error_check
  357. endm
  358.  
  359.  
  360.  
  361.  
  362. mdosread        macro
  363.                 mov     ax,handle
  364.                 push    ax
  365.                 push    doscall_inseg
  366.                 push    si
  367.                 push    cx
  368.                 push    ds
  369.                 push    offset results
  370.                 call    dosread
  371.                 error_check
  372. endm
  373.  
  374. ;mdosscanenv    searches the current environment for string pointed to by si
  375. ;               returns the offset in result if found.
  376. mdosscanenv     macro
  377.                 push    ds
  378.                 push    si
  379.                 push    ds
  380.                 push    offset result
  381.                 call    dosscanenv
  382.                 error_check
  383. endm
  384.  
  385.  
  386. ;mdossearchpath searches an explicit list of directories (seperated by semicolons)
  387. ; or as contained in an environment variable(bare name only) pointed to by si
  388. ; for the filename pointed to by di (wildcards ok). bx points to the buffer to
  389. ; receive the fully qualified pathname (wildcards NOT expanded) cx is the length
  390. ; of the buffer pointed to by bx. Ax is search control. 0 = search current only
  391. ; if explicitly listed. 1 = always search current first.
  392.  
  393. mdossearchpath  macro
  394.                 push    ax
  395.                 push    ds
  396.                 push    si
  397.                 push    ds
  398.                 push    di
  399.                 push    ds
  400.                 push    bx
  401.                 push    cx
  402.                 call    dossearchpath
  403.                 error_check
  404. endm
  405.  
  406.  
  407.  
  408.  
  409.  
  410. ;mdosselectdisk  requires drive number (1 based) in ax
  411.  
  412. mdosselectdisk  macro
  413.                 push    ax
  414.                 call    dosselectdisk
  415.                 error_check
  416. endm
  417.  
  418. ;mdoswrite - receives the handle in ax,the count in cx, offset of buffer in si
  419.  
  420.  
  421. mdoswrite       macro l_o_buffseg,l_o_bytes_written
  422.                 push    ax
  423.                 mov     ax,l_o_buffseg
  424.                 push    ax
  425.                 push    si
  426.                 push    cx
  427.                 push    ds
  428.                 push    offset l_o_bytes_written
  429.                 call    doswrite
  430.                 error_check
  431. endm
  432.  
  433.  
  434. ;uses viocall and sends a crlf to the console
  435.  
  436. pcrlf           macro
  437.                 mov di,offset CRLF
  438.                 call print_asciiz
  439. endm
  440.  
  441.  
  442.  
  443. nodediz         macro
  444.                 mov     ax,[di+1]
  445. ;                or      al,[di]
  446.                 or      ax,[di+3]
  447. endm
  448.  
  449.  
  450. nodesiz         macro
  451.                 mov     ax,[si+1]
  452. ;                or      al,[si]
  453.                 or      ax,[si+3]
  454. endm
  455.  
  456.  
  457. wstring         macro   azstring
  458.                 mov     si,offset azstring
  459.                 call    write_asciiz
  460. endm
  461.  
  462.  
  463. logaz           macro   azstring
  464.                 mov     si,offset azstring
  465.                 call    eozs
  466.                 mov     ax,log_handle
  467.                 push    ds
  468.                 pop     doscall_inseg
  469.                 mdoswrite doscall_inseg,results
  470. endm
  471.  
  472.  
  473.  
  474. extrn   dosallocseg:far
  475. extrn   doschdir:far
  476. extrn   doschgfileptr:far
  477. extrn   dosclose:far
  478. extrn   dosdelete:far
  479. extrn   dosdelete:far
  480. extrn   dosexecpgm:far
  481. extrn   dosexit:far
  482. extrn   dosfindfirst:far
  483. extrn   dosfreeseg:far
  484. extrn   dosgetdatetime:far
  485. extrn   dosopen:far
  486. extrn   dosqcurdisk:far
  487. extrn   dosqcurdir:far
  488. extrn   dosqfileinfo:far
  489. extrn   dosread:far
  490. extrn   dosscanenv:far
  491. extrn   dossearchpath:far
  492. extrn   dosselectdisk:far
  493. extrn   dossetmaxfh:far
  494. extrn   doswrite:far
  495. extrn   viowrttty:far
  496.  
  497. dupes_no        equ     2000
  498.  
  499. route_area      struc
  500. rt_crash                db      200 dup (5 dup (0))
  501. rt_hold                 db      200 dup (5 dup (0))
  502. rt_send                 db      200 dup (5 dup (0))
  503. rt_leave                db      200 dup (5 dup (0))
  504. rt_this_one             db      100 dup (5 dup (0))
  505. rt_through              db      100 dup (5 dup (0))
  506. route_area ends
  507.  
  508.  
  509.  
  510. read_only_attrib        equ     1
  511. hidden                  equ     2
  512. ssystem                  equ     4
  513. archive                 equ     32
  514. open                    equ     1
  515. fail                    equ     0
  516. replace                 equ     2
  517. create                  equ     010h
  518. read_only_access        equ     0
  519. write_only              equ     1
  520. read_write              equ     2
  521. deny_all                equ     16
  522. deny_write              equ     32
  523. deny_read               equ     48
  524. deny_none               equ     64
  525. no_share                equ     0
  526. ;standard data used in file manipulation
  527.  
  528.  
  529. file_info       struc
  530. ffile_date_create        dw     0
  531. ffile_time_create        dw     0
  532. ffile_date_access        dw     0
  533. ffile_time_access        dw     0
  534. ffile_date_write         dw     0
  535. ffile_time_write         dw     0
  536. ffile_size               dw     0
  537. ffile_size_hi            dw     0
  538. ffile_alloc              dd     0
  539. ffile_attrib             dw     0
  540. flen_filename            db     0
  541. ffilename                db      20 dup (0)
  542. file_info ends
  543.  
  544. config_info     struc                        ;[bx]
  545. sys_default             db      40 dup (0)
  546. config_akas             dw      5 dup (0)
  547. toss_log                db      40 dup (0)
  548. net_file                db      40 dup (0)
  549. net_mail                db      40 dup (0)
  550. config_info ends
  551.  
  552.  
  553. smessage_header struc
  554. msg_from_net            dw 0
  555. msg_from_node           dw 0
  556. smessage_header ends
  557.  
  558. line_infos       struc
  559. li_path                 db      61 dup (0)
  560. li_highest              dw      0       ;hex of highest message number. 0 if not yet determined
  561. li_flag                 db      0
  562. li_area                 db      20 dup (0)
  563. li_nodes                dw      40 dup (0)
  564. line_infos ends
  565.  
  566.  
  567. message_format  struc
  568. mFromUser       db      36 dup (0)
  569. mToUser         db      36 dup (0)
  570. mSubject        db      72 dup (0)
  571. mDateTime       db      20 dup (0)
  572. mtimes_read     dw      0
  573. mdest_node      dw      0
  574. morigin_node      dw      0
  575. mcost           dw      0
  576. morigin_net     dw      0
  577. mdest_net       dw      0
  578. mdest_Zone      dw      0
  579. morigin_Zone    dw      0
  580. mdest_point     dw      0
  581. morigin_point   dw      0
  582. mreply_to       dw      0
  583. mattribute      dw      0
  584. mnext_reply     dw      0
  585. mtext           db      0
  586. message_format ends
  587.  
  588. pmsg_format     struc                ; [si]
  589. ;pmcode          dw      0002h       ;This structure is used in get_msg
  590. pmorigin_node   dw      0
  591. pmdest_node     dw      0
  592. pmorigin_net    dw      0
  593. pmdest_net      dw      0
  594. pmattribute     dw      0
  595. pmcost          dw      0
  596. pmDateTime      dw      0
  597. pmsg_format ends
  598.  
  599.  
  600. spmsg_format     struc                  ; [si]
  601. spmcode          dw      0002h          ;This structure is used in scanning
  602. spmorigin_node   dw      0              ;by send_to_node
  603. spmdest_node     dw      0
  604. spmorigin_net    dw      0
  605. spmdest_net      dw      0
  606. spmattribute     dw      0
  607. spmcost          dw      0
  608. spmDateTime      dw      0
  609. spmsg_format ends
  610.  
  611.  
  612.  
  613. bad_flag        equ     1
  614. netmail_flag    equ     2
  615. split_flag      equ     4
  616. no_more_flag    equ     8
  617.  
  618.  
  619. ;toss equ's
  620. no_area         equ     1
  621. end_log         equ     2
  622.  
  623.  
  624. assume cs:_code
  625. assume ds:_data
  626. DGROUP  group   _DATA
  627.  
  628. _DATA   SEGMENT para PUBLIC 'DATA'
  629.  
  630. ;
  631. ;filesize        dd      0       ;??
  632. ;sharing         db      0       ;deny_all | deny_none | deny_read | deny_write
  633. ;Attrib_creat    db      0       ;sum of read_only_attrib + hidden + system + archive
  634. ;access          db      0       ;read_only_access | write_only | read_write
  635. ;other_open_flags db     0       ;(nominal 0) ;high 8bits of mode word
  636.  
  637. config_index    label   word
  638.                 dw      offset config$1
  639.                 dw      offset config$2
  640.                 dw      offset config$3
  641.                 dw      offset config$4
  642.                 dw      offset config$5
  643.                 dw      offset config$6
  644.                 dw      offset config$7
  645.                 dw      offset config$8
  646.                 dw      offset config$9
  647.                 dw      offset config$10
  648.                 dw      offset config$11
  649.                 dw      offset config$12
  650.                 dw      offset config$13
  651.                 dw      offset config$14
  652.                 dw      offset config$15
  653.                 dw      offset config$16
  654.                 dw      offset config$17
  655.                 dw      offset config$18
  656.                 dw      offset config$19
  657.                 dw      offset config$20
  658.                 dw      offset config$21
  659.                 dw      offset config$22
  660.                 dw      offset config_sr_ind
  661. end_index       label   byte
  662.  
  663. config_strings  label byte
  664.  
  665. config$1        db      'Primary_Zone',0
  666. config$2        db      'Address',0
  667. config$3        db      'aka',0
  668. config$4        db      'Add_To_Seen',0
  669. config$5        db      'NetMail',0
  670. config$6        db      'NetFile',0
  671. config$7        db      'Outbound',0
  672. config$8        db      'Status_Log',0
  673. config$9        db      'Sysop',0
  674. config$10       db      'Bad_Msgs',0
  675. config$11       db      'Dupes',0
  676. config$12       db      'No_Net_Dupes',0
  677. config$13       db      'No_Content',0
  678. config$14       db      'Echo_Toss_Log',0
  679. config$15       db      'Net_Sent',0
  680. config$16       db      'No_Private_EchoMail',0
  681. config$17       db      'Max_Msgs',0
  682. config$18       db      'Routing_Config_File',0
  683. config$19       db      'No_Forward',0
  684. config$20       db      'Kill_Forwarded_Files',0
  685. config$21       db      'Packet_Path',0
  686. config$22       db      'OMMM_CMD_file',0
  687.  
  688.  
  689.  
  690. config_sr_ind   label word
  691.                 dw      offset config_sr_1
  692.                 dw      offset config_sr_2
  693.                 dw      offset config_sr_3
  694.                 dw      offset config_sr_4
  695.                 dw      offset config_sr_5
  696.                 dw      offset config_sr_6
  697.                 dw      offset config_sr_7
  698.                 dw      offset config_sr_8
  699.                 dw      offset config_sr_9
  700.                 dw      offset config_sr_10
  701.                 dw      offset config_sr_11
  702.                 dw      offset config_sr_12
  703.                 dw      offset config_sr_13
  704.                 dw      offset config_sr_14
  705.                 dw      offset config_sr_15
  706.                 dw      offset config_sr_16
  707.                 dw      offset config_sr_17
  708.                 dw      offset config_sr_18
  709.                 dw      offset config_sr_19
  710.                 dw      offset config_sr_20
  711.                 dw      offset config_sr_21
  712.                 dw      offset config_sr_22
  713.  
  714.  
  715. route_index     label   word
  716.                 dw      offset route$1
  717. route_strings   label   byte
  718. route$1         db      'CRASH',0
  719. route$2         db      'HOLD',0
  720. route_sr_ind    label   word
  721.                 dw      offset route_sr_1
  722.  
  723.  
  724. pri_zone        dw      0
  725. this_add        db      5 dup (0)
  726. akas            db      10 dup (5 dup (0))
  727. seens           db      10 dup (5 dup (0))
  728. netmail_path    db      64 dup (0)
  729. netfile_path    db      64 dup (0)
  730. outbound        db      64 dup (0)
  731. log_file        db      64 dup (0)
  732. bad_msgs        db      64 dup (0)
  733. echo_toss       db      64 dup (0)
  734. routing         db      64 dup (0)
  735. cmd_file_head   db      20 dup (0)
  736. pack_path       db      80 dup (0)
  737. sysop           db      20 dup (0)
  738. objname         db      20 dup (0)
  739. dupes           dw      1000
  740. max_msgs        dw      0ffffh
  741.  
  742. this_seg        dw      0
  743. cmd_offset      dw      0
  744. size_of_dgroup  dw      0
  745. size_of_stack   dw      0
  746. crlf            db      0dh,0ah,0
  747. cr_only         db      0dh,0
  748. space3          db      20h
  749. space2          db      20h
  750. space1          db      20h,0
  751. toss_cmd        db      'toss',0
  752. scan_cmd        db      'scan',0
  753. test_cmd        db      'test',0
  754. tosslog_cmd     db      'tlog',0
  755. delete_cmd      db      'delete',0
  756. stack_start     dw      0
  757. handle          dw      0
  758. results         label   dword
  759. result          dw      0
  760. result2         dw      0
  761. doscall_inseg   dw      0
  762. doscall_outseg  dw      0
  763. search_path_ptr dd      0
  764. search_pattern_offset   dw      0
  765. search_handle   dw      0
  766. search_attrib   dw      0
  767. max_find        dw      0
  768. find_ptr        dw      0
  769. total_finds     dw      0
  770. cur_file_ptr    dd      0
  771. comspec_srch    db      'COMSPEC',0
  772. cmd_path        db      80 dup (0)
  773. cmd_simple      db      80 dup (0)
  774. filesize        dd      0
  775. sharing         db      deny_all
  776. Attrib_create   db      0
  777. access          db      read_write
  778. other_open_flags db      0
  779. device_name     db      "COM2:",0
  780. Null_target     dw      0
  781.                 dw      0
  782. lzh_string      db      '-lh',0
  783. zip_string      db      'PK',0
  784. home_drive      dw      4
  785. home_dr_ascii   db      3 dup(0)
  786. home_directory  db      64 dup(0)
  787. Dev_cont_blk    dw      0
  788.                 dw      0
  789. dflagsb1        db      0
  790. dflagsb2        db      0
  791. dflagsb3        db      0
  792.                 db      0
  793.                 db      0
  794.                 db      0
  795.                 db      0
  796. end_dev_cont_blk  db      0
  797. zero            db      0
  798. rail            db      0
  799. msg_cntr        dw      0
  800. scan_count      dw      0
  801. first_digit     db      0
  802. temp_def_net    dw      0
  803. temp_def_zone   db      0
  804. error_code      dw      0
  805. system          db      180 dup (0)
  806. sel_environ     dw      0
  807. sel_areas       dw      0
  808. sel_ar_bbs      dw      0
  809. sel_config_file dw      0
  810. sel_config      dw      0
  811. sel_pkt_buf     dw      0
  812. sel_msg_buf     dw      0
  813. sel_pmsg_buf    dw      0
  814. sel_names       dw      0
  815. sel_tosslog     dw      0
  816. sel_route       dw      0
  817.  
  818. if debug
  819. ife drived
  820. areas_name      db      'h:\work\areas.bbs',0
  821. limit_areas     dw      0
  822. area_changed    db      0
  823. config_name     db      'h:\work\FMAIL.CFG',0
  824.  
  825. else
  826.  
  827. areas_name      db      'd:\binkp\areas.bbs',0
  828. limit_areas     dw      0
  829. area_changed    db      0
  830. config_name     db      'd:\binkp\FMAIL.CFG',0
  831. endif
  832.  
  833. else
  834.  
  835. areas_name      db      '.\areas.bbs',0
  836. limit_areas     dw      0
  837. area_changed    db      0
  838. config_name     db      '.\FMAIL.CFG',0
  839.  
  840. endif
  841.  
  842.  
  843. no_more_bndls   db      0
  844. packet_path     db      60 dup (0)        ;place where the pkt path is assembled
  845. pkt_handle      dw      0
  846. pkt_path_end    dw      0
  847. pkt_size        dd      0
  848. cur_pkt_file_ptr dd     0
  849. large_packet    db      0                      ;flag for .pkt >64k
  850. packet_search   db      '*.pkt',0
  851. bundmo          db      '*.mo?',0
  852. bundtu          db      '*.tu?',0
  853. bundwe          db      '*.we?',0
  854. bundth          db      '*.th?',0
  855. bundfr          db      '*.fr?',0
  856. bundsa          db      '*.sa?',0
  857. bundsu          db      '*.su?',0
  858.  
  859. all_file_info   db      type file_info dup (0)
  860. end_file_info   equ     $
  861. configuration   db      type config_info dup (0) ;obsolete
  862. packet_hdr      label   byte
  863.         phorigin_node   dw      0
  864.         phdest_node     dw      0
  865.         phyear          dw      0
  866.         phmonth         dw      0
  867.         phday           dw      0
  868.         phhour          dw      0
  869.         phminute        dw      0
  870.         phsecond        dw      0
  871.         phbaud          dw      0
  872.         phcode          dw      0       ;0002h
  873.         phorigin_net    dw      0
  874.         phdest_net      dw      0
  875.         phproduct       db      089h
  876.         phserial        db      1
  877. ;                        db      0
  878.         phpassword      db      8 dup (0)
  879.         phorigin_Zone   db      0
  880.         phdest_Zone     db      0
  881. ;                        db      0
  882.         phfill          db      22 dup (0)
  883. packet_hdr_end  label  byte
  884. current_read    dw      0
  885. bad_packet      db      0
  886. empty_pkt       db      0
  887. mail_flags      db      0
  888. message_is_split db     0
  889. no_more_msgs    db      0
  890. no_more_pkts    db      0
  891. current_area_info       label dword              ;no, do NOT put value here
  892. areas_segment   dw      0
  893. current_path    dw      0               ;pointer to the path part of the parsed areas file.
  894.  
  895. path_line       db      1,'PATH:',0     ;search prototype
  896. origin_line     db      ' * Origin:',0   ;search prototype
  897. area_line       db      'AREA:',0
  898. tear_line       db      '---',0
  899. seen_by_line    db      'SEEN-BY:',0
  900. find_buffer     db      type file_info dup (0)
  901. msg_start       dw      0
  902. pathline_start  dw      0               ;generally refers to the current version
  903.                                         ;of the message (packed or unpacked)
  904. msg_length      dw      0
  905. upmsg_length    dw      0
  906. end_of_msg      dw      0
  907. prev_end        dw      0
  908. text_start      dw      0
  909. EVEN
  910. current_area    db      20 dup (0)        ;as extracted from the areas buffer
  911. route_work_area label   byte
  912. seen_by_list    db      4096 dup (0)       ;expanded hex format
  913. path_list       db      4096 dup (0)        ;expanded hex format
  914. message_pathname label  byte              ;that's right no value
  915. cur_path_line   db      80 dup (0)
  916. first_seen_by   dw      0
  917. first_path      dw      0
  918. target_end      dw      0
  919. null_node       dd      0
  920. highest_msg     dw      0
  921. lowest_msg      dw      0
  922. column_ctr      db      0
  923. path_end        dw      0
  924. cur_ar_path_end dw      0
  925. msg_counter     dw      0
  926. msg_search      db      '*.msg',(0)
  927. out_search      db      '*.out',(0)
  928. EVEN
  929. scratch_path    db      64 dup (0)
  930. scratch_path_end dw     0
  931. vmsg_dot        db      '.',0
  932. vmsg_delete     db      0dh,0ah,'Deleting msgs in area - ',0
  933. vmsg_get        db      'Getting msg  ',0
  934. vmsg_to_area    db      ' to area ',0
  935. vmsg_scan       db      'Scanning directory ',0
  936. vmsg_scanned    db      'Scan Complete',0
  937. vmsg_toss_num   db      'Tossing message ',0
  938. vmsg_pconfig    db      'Parsing Configuration File',0
  939. vmsg_pareas     db      'Parsing Areas.bbs',0
  940. vmsg_allpkts    db      'All packets tossed',0
  941. vmsg_done       db      'Done',0
  942. vmsg_error      db      'ERROR **** number ',0
  943. vmsg_nocmd      db      'No commands given',0
  944. vmsg_pspawn     db      'Spawning to Packer',0
  945. logmsg_begin    db      'BEGIN ',0
  946. logmsg_end      db      'END ',0
  947. logmsg_pkt1     db      '  @ ',0
  948. logmsg_pkt2     db      '  O=',0
  949. logmsg_pkt3     db      '  D=',0
  950. logmsg_pkt4     db      '  ID=',0
  951. logmsg_pkt5     db      '  S=',0
  952. logmsg_echo1    db      '   + ECHO: ',0
  953. logmsg_echo2    db      '  (Sent=',0
  954. logmsg_stossed  db      'Tossed ',0
  955. logmsg_sscan    db      'Scanned out ',0
  956. logmsg_smsg     db      ' messages in ',0
  957. logmsg_smins    db      ' minutes ',0
  958. logmsg_ssecs    db      ' seconds.',0
  959. logmsg_bndl     db      '& Unpacking ',0
  960. ermsg_no_log    db      'Unable to open Log File',0dh,0ah,0
  961. ermsg_no_area   db      0dh,0ah,'No such area as ',0
  962. ermsg_bad_msg   db      'Bad message or ???',0
  963. ermsg_bad_open  db      'Open/Create failed by explicit command',0
  964. title_msg_l1    db      'FMAIL - Echomail utility ver 1.00',0
  965. title_msg_l2    db      'The FAST Mail processor for OS/2',0
  966. title_msg_l3    db      'Copyright 1991 by Patrick O',027h,'Riva 1:143/37',0
  967.  
  968.  
  969. msg1            label   byte       ;in format: message_format
  970. fr_fmail        db      'Fmail version 1.00    '
  971.                 db      13 dup (20h),0
  972. to_whom         db      'Whom it may concern'
  973.                 db      16 dup (20h),0
  974. sub_why         db      'Storage of "High water" mark'
  975.                 db      43 dup (20h),0
  976. dat_un          db      '21 Mar 91 16:54:32 ',0
  977. hw_misc         db      20 dup (0)
  978. hw_reply        dw      2
  979. hw_attrib       dw      0108h
  980.                 dw      0
  981. hw_text         db      'High water mark at offset 0B8h',0dh,0ah
  982. hw_tear         db      '---',0dh,0ah
  983. hw_origin       db      100 dup (20h)
  984. msg1_end        equ     $
  985. hex_buff        db      6 dup (0)
  986. toss_ptr        dw      0
  987. EVEN
  988. toss_list       label  byte
  989.                 db      8000 dup (0)
  990. dupes_list      label   byte
  991.                 dd      dupes_no dup (0)
  992. scratch_ascii   db      80 dup (0)
  993. scratch_node    db      5 dup (0)
  994. dupes_file      db      'fdups.dat',(0)
  995. dupes_num       dw      dupes_no
  996. dupes_ptr       dw      offset dupes_list
  997. dupes_handle    dw      0
  998. first_time      db      0
  999. fm_debug        db      'h:\work\debug.log',0
  1000. debug_handle    dw      0
  1001. log_handle      dw      0
  1002. si_length       dw      0
  1003. di_length       dw      0
  1004. shortest        dw      0
  1005. longest         dw      0
  1006. arc_pathname    db      'arc2.exe',0
  1007. arc_args        db      'arc2',0
  1008.                 db      'x'
  1009.                 db      'o '
  1010. arc_file        db      'filename.ext',0
  1011. arc_other       db      20 dup(0)
  1012.                 db      0
  1013. zip_pathname    db      'pkunzip2.exe',0
  1014. zip_args        db      'pkunzip2 ',0
  1015.                 db      '-o '
  1016. zip_file        db      'filename.ext '
  1017. zip_other       db      20 dup(0)
  1018.                 db      0
  1019. lh_pathname     db      'lh.exe',0
  1020. lh_args         db      'lh ',0
  1021.                 db      'X '
  1022.                 db      '/o '
  1023. lh_file         db      'filename.ext ',0
  1024. lh_other        db      20 dup(0)
  1025. bad_arc_string  db      'BAD_ARC.*',0
  1026. start_in_secs   dw      0
  1027. end_in_secs     dw      0
  1028.  
  1029. toss_flag       db      0
  1030. tosslog_length  dw      0
  1031. toss_add        dw      0
  1032. err_index       label   word
  1033.  
  1034.                 dw      offset os_err000
  1035.                 dw      offset os_err001
  1036.                 dw      offset os_err002
  1037.                 dw      offset os_err003
  1038.                 dw      offset os_err004
  1039.                 dw      offset os_err005
  1040.                 dw      offset os_err006
  1041.                 dw      offset os_errx
  1042.                 dw      offset os_err008
  1043.                 dw      offset os_errx
  1044.                 dw      offset os_err00a
  1045.                 dw      offset os_err00b
  1046.                 dw      offset os_err00c
  1047.                 dw      offset os_err00d
  1048.                 dw      offset os_err00e
  1049.                 dw      offset os_err00f
  1050.                 dw      offset os_err010
  1051.                 dw      offset os_err011
  1052.                 dw      offset os_err012
  1053.                 dw      offset os_err013
  1054.                 dw      offset os_errx
  1055.                 dw      offset os_err015
  1056.                 dw      offset os_err016
  1057.                 dw      offset os_err017
  1058.                 dw      offset os_err018
  1059.                 dw      offset os_err019
  1060.                 dw      offset os_errx
  1061.                 dw      offset os_errx
  1062.                 dw      offset os_errx
  1063.                 dw      offset os_errx
  1064.                 dw      offset os_errx
  1065.                 dw      offset os_err01f
  1066.                 dw      offset os_err020
  1067.                 dw      offset os_err021
  1068.                 dw      offset os_errx
  1069.                 dw      offset os_errx
  1070.                 dw      offset os_errx
  1071.                 dw      offset os_errx
  1072.                 dw      offset os_errx
  1073.                 dw      offset os_errx
  1074.                 dw      offset os_errx
  1075.                 dw      offset os_errx
  1076.                 dw      offset os_errx
  1077.                 dw      offset os_errx
  1078.                 dw      offset os_errx
  1079.                 dw      offset os_errx
  1080.                 dw      offset os_errx
  1081.                 dw      offset os_errx
  1082.                 dw      offset os_errx
  1083.                 dw      offset os_errx
  1084.                 dw      offset os_errx
  1085.                 dw      offset os_errx
  1086.                 dw      offset os_errx
  1087.                 dw      offset os_errx
  1088.                 dw      offset os_errx
  1089.                 dw      offset os_errx
  1090.                 dw      offset os_errx
  1091.                 dw      offset os_errx
  1092.                 dw      offset os_errx
  1093.                 dw      offset os_errx
  1094.                 dw      offset os_errx
  1095.                 dw      offset os_errx
  1096.                 dw      offset os_errx
  1097.                 dw      offset os_errx
  1098.                 dw      offset os_errx
  1099.                 dw      offset os_errx
  1100.                 dw      offset os_errx
  1101.                 dw      offset os_errx
  1102.                 dw      offset os_errx
  1103.                 dw      offset os_errx
  1104.                 dw      offset os_errx
  1105.                 dw      offset os_errx
  1106.                 dw      offset os_errx
  1107.                 dw      offset os_errx
  1108.                 dw      offset os_errx
  1109.                 dw      offset os_errx
  1110.                 dw      offset os_errx
  1111.                 dw      offset os_errx
  1112.                 dw      offset os_errx
  1113.                 dw      offset os_errx
  1114.                 dw      offset os_err050
  1115.                 dw      offset os_errx
  1116.                 dw      offset os_err052
  1117.                 dw      offset os_errx
  1118.                 dw      offset os_errx
  1119.                 dw      offset os_errx
  1120.                 dw      offset os_errx
  1121.                 dw      offset os_errx
  1122.                 dw      offset os_errx
  1123.                 dw      offset os_errx
  1124.                 dw      offset os_errx
  1125.                 dw      offset os_err05b
  1126.                 dw      offset os_errx
  1127.                 dw      offset os_errx
  1128.                 dw      offset os_errx
  1129.                 dw      offset os_errx
  1130.                 dw      offset os_errx
  1131.                 dw      offset os_errx
  1132.                 dw      offset os_errx
  1133.                 dw      offset os_errx
  1134.                 dw      offset os_errx
  1135.                 dw      offset os_errx
  1136.                 dw      offset os_errx
  1137.                 dw      offset os_errx
  1138.                 dw      offset os_errx
  1139.                 dw      offset os_errx
  1140.                 dw      offset os_errx
  1141.                 dw      offset os_errx
  1142.                 dw      offset os_errx
  1143.                 dw      offset os_errx
  1144.                 dw      offset os_err06e
  1145.                 dw      offset os_err06f
  1146.                 dw      offset os_err070
  1147.                 dw      offset os_err071
  1148.                 dw      offset os_errx
  1149.                 dw      offset os_errx
  1150.                 dw      offset os_err074
  1151.                 dw      offset os_err075
  1152.                 dw      offset os_errx
  1153.                 dw      offset os_errx
  1154.                 dw      offset os_err078
  1155.                 dw      offset os_errx
  1156.                 dw      offset os_errx
  1157.                 dw      offset os_err07b
  1158.                 dw      offset os_errx
  1159.                 dw      offset os_err07d
  1160.                 dw      offset os_errx
  1161.                 dw      offset os_errx
  1162.                 dw      offset os_errx
  1163.                 dw      offset os_errx
  1164.                 dw      offset os_errx
  1165.                 dw      offset os_errx
  1166.                 dw      offset os_errx
  1167.                 dw      offset os_errx
  1168.                 dw      offset os_errx
  1169.                 dw      offset os_errx
  1170.                 dw      offset os_errx
  1171.                 dw      offset os_errx
  1172.                 dw      offset os_errx
  1173.                 dw      offset os_errx
  1174.                 dw      offset os_errx
  1175.                 dw      offset os_errx
  1176.                 dw      offset os_errx
  1177.                 dw      offset os_errx
  1178.                 dw      offset os_errx
  1179.                 dw      offset os_errx
  1180.                 dw      offset os_errx
  1181.                 dw      offset os_errx
  1182.                 dw      offset os_errx
  1183.                 dw      offset os_errx
  1184.                 dw      offset os_errx
  1185.                 dw      offset os_errx
  1186.                 dw      offset os_errx
  1187.                 dw      offset os_err099
  1188.                 dw      offset os_errx
  1189.                 dw      offset os_errx
  1190.                 dw      offset os_errx
  1191.                 dw      offset os_errx
  1192.                 dw      offset os_errx
  1193.                 dw      offset os_errx
  1194.                 dw      offset os_err0a0
  1195.                 dw      offset os_err0a1
  1196.                 dw      offset os_errx
  1197.                 dw      offset os_errx
  1198.                 dw      offset os_errx
  1199.                 dw      offset os_errx
  1200.                 dw      offset os_errx
  1201.                 dw      offset os_errx
  1202.                 dw      offset os_errx
  1203.                 dw      offset os_errx
  1204.                 dw      offset os_errx
  1205.                 dw      offset os_errx
  1206.                 dw      offset os_errx
  1207.                 dw      offset os_errx
  1208.                 dw      offset os_errx
  1209.                 dw      offset os_errx
  1210.                 dw      offset os_errx
  1211.                 dw      offset os_errx
  1212.                 dw      offset os_errx
  1213.                 dw      offset os_errx
  1214.                 dw      offset os_errx
  1215.                 dw      offset os_errx
  1216.                 dw      offset os_errx
  1217.                 dw      offset os_errx
  1218.                 dw      offset os_errx
  1219.                 dw      offset os_errx
  1220.                 dw      offset os_errx
  1221.                 dw      offset os_errx
  1222.                 dw      offset os_err0bc
  1223.                 dw      offset os_err0bd
  1224.                 dw      offset os_err0be
  1225.                 dw      offset os_err0bf
  1226.                 dw      offset os_err0c0
  1227.                 dw      offset os_err0c1
  1228.                 dw      offset os_err0c2
  1229.                 dw      offset os_err0c3
  1230.                 dw      offset os_err0c4
  1231.                 dw      offset os_err0c5
  1232.                 dw      offset os_errx
  1233.                 dw      offset os_err0c7
  1234.                 dw      offset os_errx
  1235.                 dw      offset os_errx
  1236.                 dw      offset os_errx
  1237.                 dw      offset os_err0cb
  1238.                 dw      offset os_errx
  1239.                 dw      offset os_errx
  1240.                 dw      offset os_err0ce
  1241.                 dw      offset os_errx
  1242.                 dw      offset os_errx
  1243.                 dw      offset os_errx
  1244.                 dw      offset os_errx
  1245.                 dw      offset os_err0d3
  1246.                 dw      offset os_errx
  1247.                 dw      offset os_errx
  1248.                 dw      offset os_errx
  1249.                 dw      offset os_errx
  1250.                 dw      offset os_errx
  1251.                 dw      offset os_errx
  1252.                 dw      offset os_errx
  1253.                 dw      offset os_errx
  1254.                 dw      offset os_errx
  1255.                 dw      offset os_errx
  1256.                 dw      offset os_errx
  1257.                 dw      offset os_errx
  1258.  
  1259.  
  1260.  
  1261. os_err000       db      'No Error',0
  1262. os_err001       db      'Invalid Function Number',0
  1263. os_err002       db      'File not found',0
  1264. os_err003       db      'Path not found',0
  1265. os_err004       db      'Out of handles',0
  1266. os_err005       db      'Access denied',0
  1267. os_err006       db      'Invalid handle',0
  1268. os_err008       db      'Insufficient memory',0
  1269. os_err00a       db      'invalid environment',0
  1270. os_err00b       db      'invalid format',0
  1271. os_err00c       db      'invalid access code',0
  1272. os_err00d       db      'invalid data',0
  1273. os_err00e       db      'unknown unit',0
  1274. os_err00f       db      'invalid disk drive',0
  1275. os_err010       db      'cannot remove current directory',0
  1276. os_err011       db      'Not same device',0
  1277. os_err012       db      'No more files',0
  1278. os_err013       db      'Disk write protected',0
  1279. os_err015       db      'Drive not ready',0
  1280. os_err016       db      'Unknown unit',0
  1281. os_err017       db      'Unknown command',0
  1282. os_err018       db      'Data error',0
  1283. os_err019       db      'Bad request structure length',0
  1284. os_err01f       db      'General failure',0
  1285. os_err020       db      'Sharing violation',0
  1286. os_err021       db      'Lock violation',0
  1287. os_err050       db      'File already exists',0
  1288. os_err052       db      'Cannot make directory',0
  1289. os_err05b       db      'System Error',0
  1290. os_err06e       db      'Open/create failed due to explicit fail command',0
  1291. os_err06f       db      'Buffer too small',0
  1292. os_err070       db      'Disk is full',0
  1293. os_err071       db      'No more search handles',0
  1294. os_err074       db      'Error on display write or keyboard read',0
  1295. os_err075       db      'Invalid DosDevIOCTL catagory',0
  1296. os_err078       db      'Invalid function called',0
  1297. os_err07b       db      'Invalid character or bad filename',0
  1298. os_err07d       db      'No volume label found',0
  1299. os_err099       db      'Invalid list format',0
  1300. os_err0a0       db      'Bad environment pointer',0
  1301. os_err0a1       db      'Bad pathname for DosExecPgm',0
  1302. os_err0bc       db      'Invalid starting code segment',0
  1303. os_err0bd       db      'invalid stack segment',0
  1304. os_err0be       db      'Invalid module type',0
  1305. os_err0bf       db      'Wrong EXE file header',0
  1306. os_err0c0       db      'Invalid EXE file,link errors',0
  1307. os_err0c1       db      'Invalid EXE format',0
  1308. os_err0c2       db      'Iterated data exceeds 64KB',0
  1309. os_err0c3       db      'Invalid minium allocation size',0
  1310. os_err0c4       db      'Invalid Dynamic link fron ring 2 segment',0
  1311. os_err0c5       db      'IOPL not enabled in Config.sys',0
  1312. os_err0c7       db      'Automatic data segment exceeds 64KB',0
  1313. os_err0cb       db      'Environment variable not found',0
  1314. os_err0ce       db      'Filename or extension too long',0
  1315. os_err0d3       db      'File system information not available',0
  1316. os_errx         db      'Undefined error',0
  1317.  
  1318.  
  1319.  
  1320. _DATA   ENDS
  1321.  
  1322. _data   segment
  1323.  
  1324. ;------------------------------------------------------------------------------
  1325. ; data for crc-32 routine
  1326. ;------------------------------------------------------------------------------
  1327.  
  1328. crc_32_table    label   dword
  1329. .radix 010h
  1330.  
  1331. dw 00000h, 00000h, 07707h, 03096h, 0ee0eh, 0612ch, 09909h, 051bah, 0076dh, 0c419h, 0706ah, 0f48fh, 0e963h, 0a535h, 09e64h, 095a3h
  1332. dw 00edbh, 08832h, 079dch, 0b8a4h, 0e0d5h, 0e91eh, 097d2h, 0d988h, 009b6h, 04c2bh, 07eb1h, 07cbdh, 0e7b8h, 02d07h, 090bfh, 01d91h
  1333. dw 01db7h, 01064h, 06ab0h, 020f2h, 0f3b9h, 07148h, 084beh, 041deh, 01adah, 0d47dh, 06dddh, 0e4ebh, 0f4d4h, 0b551h, 083d3h, 085c7h
  1334. dw 0136ch, 09856h, 0646bh, 0a8c0h, 0fd62h, 0f97ah, 08a65h, 0c9ech, 01401h, 05c4fh, 06306h, 06cd9h, 0fa0fh, 03d63h, 08d08h, 00df5h
  1335. dw 03b6eh, 020c8h, 04c69h, 0105eh, 0d560h, 041e4h, 0a267h, 07172h, 03c03h, 0e4d1h, 04b04h, 0d447h, 0d20dh, 085fdh, 0a50ah, 0b56bh
  1336. dw 035b5h, 0a8fah, 042b2h, 0986ch, 0dbbbh, 0c9d6h, 0acbch, 0f940h, 032d8h, 06ce3h, 045dfh, 05c75h, 0dcd6h, 00dcfh, 0abd1h, 03d59h
  1337. dw 026d9h, 030ach, 051deh, 0003ah, 0c8d7h, 05180h, 0bfd0h, 06116h, 021b4h, 0f4b5h, 056b3h, 0c423h, 0cfbah, 09599h, 0b8bdh, 0a50fh
  1338. dw 02802h, 0b89eh, 05f05h, 08808h, 0c60ch, 0d9b2h, 0b10bh, 0e924h, 02f6fh, 07c87h, 05868h, 04c11h, 0c161h, 01dabh, 0b666h, 02d3dh
  1339. dw 076dch, 04190h, 001dbh, 07106h, 098d2h, 020bch, 0efd5h, 0102ah, 071b1h, 08589h, 006b6h, 0b51fh, 09fbfh, 0e4a5h, 0e8b8h, 0d433h
  1340. dw 07807h, 0c9a2h, 00f00h, 0f934h, 09609h, 0a88eh, 0e10eh, 09818h, 07f6ah, 00dbbh, 0086dh, 03d2dh, 09164h, 06c97h, 0e663h, 05c01h
  1341. dw 06b6bh, 051f4h, 01c6ch, 06162h, 08565h, 030d8h, 0f262h, 0004eh, 06c06h, 095edh, 01b01h, 0a57bh, 08208h, 0f4c1h, 0f50fh, 0c457h
  1342. dw 065b0h, 0d9c6h, 012b7h, 0e950h, 08bbeh, 0b8eah, 0fcb9h, 0887ch, 062ddh, 01ddfh, 015dah, 02d49h, 08cd3h, 07cf3h, 0fbd4h, 04c65h
  1343. dw 04db2h, 06158h, 03ab5h, 051ceh, 0a3bch, 00074h, 0d4bbh, 030e2h, 04adfh, 0a541h, 03dd8h, 095d7h, 0a4d1h, 0c46dh, 0d3d6h, 0f4fbh
  1344. dw 04369h, 0e96ah, 0346eh, 0d9fch, 0ad67h, 08846h, 0da60h, 0b8d0h, 04404h, 02d73h, 03303h, 01de5h, 0aa0ah, 04c5fh, 0dd0dh, 07cc9h
  1345. dw 05005h, 0713ch, 02702h, 041aah, 0be0bh, 01010h, 0c90ch, 02086h, 05768h, 0b525h, 0206fh, 085b3h, 0b966h, 0d409h, 0ce61h, 0e49fh
  1346. dw 05edeh, 0f90eh, 029d9h, 0c998h, 0b0d0h, 09822h, 0c7d7h, 0a8b4h, 059b3h, 03d17h, 02eb4h, 00d81h, 0b7bdh, 05c3bh, 0c0bah, 06cadh
  1347. dw 0edb8h, 08320h, 09abfh, 0b3b6h, 003b6h, 0e20ch, 074b1h, 0d29ah, 0ead5h, 04739h, 09dd2h, 077afh, 004dbh, 02615h, 073dch, 01683h
  1348. dw 0e363h, 00b12h, 09464h, 03b84h, 00d6dh, 06a3eh, 07a6ah, 05aa8h, 0e40eh, 0cf0bh, 09309h, 0ff9dh, 00a00h, 0ae27h, 07d07h, 09eb1h
  1349. dw 0f00fh, 09344h, 08708h, 0a3d2h, 01e01h, 0f268h, 06906h, 0c2feh, 0f762h, 0575dh, 08065h, 067cbh, 0196ch, 03671h, 06e6bh, 006e7h
  1350. dw 0fed4h, 01b76h, 089d3h, 02be0h, 010dah, 07a5ah, 067ddh, 04acch, 0f9b9h, 0df6fh, 08ebeh, 0eff9h, 017b7h, 0be43h, 060b0h, 08ed5h
  1351. dw 0d6d6h, 0a3e8h, 0a1d1h, 0937eh, 038d8h, 0c2c4h, 04fdfh, 0f252h, 0d1bbh, 067f1h, 0a6bch, 05767h, 03fb5h, 006ddh, 048b2h, 0364bh
  1352. dw 0d80dh, 02bdah, 0af0ah, 01b4ch, 03603h, 04af6h, 04104h, 07a60h, 0df60h, 0efc3h, 0a867h, 0df55h, 0316eh, 08eefh, 04669h, 0be79h
  1353. dw 0cb61h, 0b38ch, 0bc66h, 0831ah, 0256fh, 0d2a0h, 05268h, 0e236h, 0cc0ch, 07795h, 0bb0bh, 04703h, 02202h, 016b9h, 05505h, 0262fh
  1354. dw 0c5bah, 03bbeh, 0b2bdh, 00b28h, 02bb4h, 05a92h, 05cb3h, 06a04h, 0c2d7h, 0ffa7h, 0b5d0h, 0cf31h, 02cd9h, 09e8bh, 05bdeh, 0ae1dh
  1355. dw 09b64h, 0c2b0h, 0ec63h, 0f226h, 0756ah, 0a39ch, 0026dh, 0930ah, 09c09h, 006a9h, 0eb0eh, 0363fh, 07207h, 06785h, 00500h, 05713h
  1356. dw 095bfh, 04a82h, 0e2b8h, 07a14h, 07bb1h, 02baeh, 00cb6h, 01b38h, 092d2h, 08e9bh, 0e5d5h, 0be0dh, 07cdch, 0efb7h, 00bdbh, 0df21h
  1357. dw 086d3h, 0d2d4h, 0f1d4h, 0e242h, 068ddh, 0b3f8h, 01fdah, 0836eh, 081beh, 016cdh, 0f6b9h, 0265bh, 06fb0h, 077e1h, 018b7h, 04777h
  1358. dw 08808h, 05ae6h, 0ff0fh, 06a70h, 06606h, 03bcah, 01101h, 00b5ch, 08f65h, 09effh, 0f862h, 0ae69h, 0616bh, 0ffd3h, 0166ch, 0cf45h
  1359. dw 0a00ah, 0e278h, 0d70dh, 0d2eeh, 04e04h, 08354h, 03903h, 0b3c2h, 0a767h, 02661h, 0d060h, 016f7h, 04969h, 0474dh, 03e6eh, 077dbh
  1360. dw 0aed1h, 06a4ah, 0d9d6h, 05adch, 040dfh, 00b66h, 037d8h, 03bf0h, 0a9bch, 0ae53h, 0debbh, 09ec5h, 047b2h, 0cf7fh, 030b5h, 0ffe9h
  1361. dw 0bdbdh, 0f21ch, 0cabah, 0c28ah, 053b3h, 09330h, 024b4h, 0a3a6h, 0bad0h, 03605h, 0cdd7h, 00693h, 054deh, 05729h, 023d9h, 067bfh
  1362. dw 0b366h, 07a2eh, 0c461h, 04ab8h, 05d68h, 01b02h, 02a6fh, 02b94h, 0b40bh, 0be37h, 0c30ch, 08ea1h, 05a05h, 0df1bh, 02d02h, 0ef8dh
  1363. _data ends
  1364. .radix 00ah
  1365. assume cs:_code
  1366. assume ds:_data
  1367.  
  1368. public make_msg_pathname
  1369. public terminate
  1370. public main_tonextpkt
  1371. public main_nxtmsg
  1372. public main_nxtpkt
  1373.  
  1374. _code   segment public 'code'
  1375. .286
  1376.  
  1377. ;******************************************************************************
  1378. ; do_crc32 -
  1379. ;
  1380. ;
  1381. ;     ENTRY:    es:di -> buffer to crc
  1382. ;               cx = # of bytes to crc
  1383. ;               dx:ax = current crc (use FFFFFFFF if new check)
  1384. ;               ds -> segment with the crc table
  1385. ;
  1386. ;      EXIT:    dx:ax = new crc of buffer
  1387. ;               this should be xor'd with FFFFFFFF if it is the final CRC
  1388. ;
  1389. ; DESTROYED:
  1390. ;
  1391. ;------------------------------------------------------------------------------
  1392. do_crc32:
  1393. public  do_crc32
  1394.                 push    bx
  1395.                 push    cx
  1396.                 push    di
  1397.  
  1398. l1:
  1399.                 mov     bl,es:[di]
  1400.                 inc     di
  1401.                 xor     bl,al
  1402.  
  1403.                 mov     al,ah
  1404.                 mov     ah,dl
  1405.                 mov     dl,dh
  1406.                 xor     dh,dh
  1407.  
  1408.                 xor     bh,bh
  1409.                 shl     bx,1
  1410.                 shl     bx,1
  1411.  
  1412.                 xor     ax,word ptr crc_32_table[bx+2]
  1413.                 xor     dx,word ptr crc_32_table[bx]
  1414.  
  1415.                 loop    l1
  1416.  
  1417.                 pop     di
  1418.                 pop     cx
  1419.                 pop     bx
  1420.                 ret
  1421.  
  1422.  
  1423.  
  1424. parse_config:            ;enters with ds = local data
  1425. public parse_config
  1426.                 mov     ax,08000h
  1427. ;                m8dosallocseg   sel_config,no_share
  1428.                 mdosopen       config_name,open,fail
  1429.                 jnc     config1
  1430.                 mov     si,offset config_name
  1431.                 jmp     file_error
  1432. config1:
  1433.                 ;;EXPAND: m8dosQfileinfo  all_file_info
  1434. push handle
  1435. push 1
  1436. push ds
  1437. push offset all_file_info
  1438. push type file_info
  1439. call dosqfileinfo
  1440. ;;EXPAND: error_check
  1441. clc
  1442. and ax,ax
  1443. jz m2
  1444. stc
  1445. m2:
  1446.                 mov     bx,offset all_file_info
  1447.                 add     bx,offset ffile_size
  1448.                 mov     ax,word ptr [bx]
  1449.                 add     ax,0100h
  1450.                 push    ax
  1451.                 ;;EXPAND: m8dosallocseg   sel_config_file,no_share
  1452. push ax
  1453. mov ax,offset sel_config_file
  1454. push ds
  1455. push ax
  1456. push no_share
  1457. call dosallocseg
  1458.                 pop     cx
  1459.                 dec     cx
  1460.                 mov     es,sel_config_file
  1461.                 mov     di,0
  1462.                 call    clean_buffer
  1463.                 mov     cx,word ptr [bx]
  1464.                 mov     si,0
  1465.                 mov     ax,sel_config_file
  1466.                 mov     doscall_inseg,ax
  1467.                 ;;EXPAND: m8dosread
  1468. mov ax,handle
  1469. push ax
  1470. push word ptr doscall_inseg
  1471. push si
  1472. push cx
  1473. push ds
  1474. push offset result
  1475. call dosread
  1476. and ax,ax
  1477. jz m3
  1478. stc
  1479. m3:
  1480.                 push    ds
  1481.                 pop     es
  1482.                 mov     ds,sel_config_file
  1483.                 mov     si,es:all_file_info.ffile_size
  1484.                 mov     al,0dh
  1485.                 mov     cx,4
  1486. ;l5:
  1487. x1:
  1488.                 inc     si
  1489.                 mov     byte ptr[si],al
  1490.                 loop    x1
  1491.                 mov     si,0
  1492.                 mov     di,offset  configuration
  1493.                 push    di
  1494. ;l4:
  1495. x2:
  1496.                 call    find_config_line
  1497.                 cmp     si,es:all_file_info.ffile_size
  1498.                 jae     x6
  1499.                 call    sstart
  1500.                 jc      x2
  1501.                 push    si
  1502.                 mov     bx,0
  1503.  
  1504. ;l3:
  1505. x3:
  1506.                 mov     si,offset config_index
  1507.                 mov     di,es:[si+bx]
  1508.                 mov     cx,es:[si+bx+2]
  1509.                 sub     cx,di
  1510.                 mov     ax,si
  1511.                 add     ax,bx
  1512.                 cmp     ax,offset end_index
  1513.                 jae     x5              ;this line didn't match
  1514.                 pop     si
  1515.                 push    si
  1516.         repz    cmpsb
  1517.                 and     cx,cx
  1518.                 jz      x4              ;it's been found
  1519.                 inc     bx
  1520.                 inc     bx
  1521.                 jmp     short x3
  1522.  
  1523. ;l1:
  1524. x4:
  1525.                 pop     ax              ;throw it away
  1526.                 call    sstart
  1527.                 mov     di,offset config_sr_ind
  1528.                 call    es:[di+bx]
  1529.                 jmp     short x2
  1530.  
  1531. ;l2:
  1532. x5:
  1533.                 pop     si
  1534.                 jmp     short x2
  1535.  
  1536. ;f1:
  1537. x6:
  1538.                 pop     di
  1539.                 ret
  1540.  
  1541. config_sr_1:
  1542.                 push    si
  1543.                 call    find_eol
  1544.                 call    backup_to_eol
  1545.                 mov     cx,si
  1546.                 pop     si
  1547.                 sub     cx,si
  1548.                 cmp     cx,5
  1549.                 jbe     x7
  1550.                 mov     cx,5
  1551. ;l1:
  1552. x7:
  1553.                 call    dechex
  1554.                 mov     es:pri_zone,ax
  1555.                 ret
  1556. config_sr_2:
  1557.                 mov     di,offset this_add
  1558.                 call    net_nodes
  1559.                 ret
  1560. config_sr_3:
  1561.                 mov     di,offset akas
  1562.                 call    net_nodes
  1563.                 ret
  1564. config_sr_4:
  1565.                 mov     di,offset seens
  1566.                 call    net_nodes
  1567.                 ret
  1568. config_sr_5:
  1569.                 mov     bx,offset netmail_path
  1570.                 call    xfer_path
  1571.                 ret
  1572. config_sr_6:
  1573.                 mov     bx,offset netfile_path
  1574.                 call    xfer_path
  1575.                 ret
  1576. config_sr_7:
  1577.                 mov     bx,offset outbound
  1578.                 call    xfer_path
  1579.                 ret
  1580. config_sr_8:
  1581.                 mov     bx,offset log_file
  1582.                 call    xfer_path
  1583.                 ret
  1584. config_sr_9:
  1585.                 push    si
  1586.                 call    find_eol
  1587.                 mov     cx,si
  1588.                 pop     si
  1589.                 sub     cx,si
  1590.                 mov     di,offset sysop
  1591.         rep     movsb
  1592.                 mov     al,0
  1593.                 stosb
  1594.                 ret
  1595. config_sr_10:
  1596.                 mov     bx,offset bad_msgs
  1597.                 call    xfer_path
  1598.                 ret
  1599. config_sr_11:
  1600.                 call    slen
  1601.                 call    dechex
  1602.                 mov     es:dupes,ax
  1603.                 ret
  1604. config_sr_12:
  1605.                 ret
  1606. config_sr_13:
  1607.                 ret
  1608. config_sr_14:
  1609.                 mov     bx,offset echo_toss
  1610.                 call    xfer_path
  1611.                 ret
  1612. config_sr_15:
  1613.                 ret
  1614. config_sr_16:
  1615.                 ret
  1616. config_sr_17:
  1617.                 call    slen
  1618.                 call    dechex
  1619.                 mov     es:max_msgs,ax
  1620.                 ret
  1621. config_sr_18:
  1622.                 mov     bx,offset routing
  1623.                 call    xfer_path
  1624.                 ret
  1625. config_sr_19:
  1626.                 ret
  1627. config_sr_20:
  1628.                 ret
  1629. config_sr_21:
  1630.                 mov     bx,offset wkg_path
  1631.                 call    xfer_path
  1632.                 ret
  1633.  
  1634. config_sr_22:
  1635.                 mov     bx,offset pack_path
  1636.                 call    xfer_path
  1637.                 ret
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644. parse_areas:            ;enters with ds = local data
  1645. public parse_areas
  1646.                 mov     ax,0f000h
  1647.                 push    ax
  1648.                 mdosallocseg   sel_areas,no_share
  1649.                 pop     cx
  1650.                 dec     cx
  1651.                 mov     es,sel_areas
  1652.                 mov     di,0
  1653.                 call    clean_buffer
  1654.  
  1655.  
  1656.                 mdosopen       areas_name,open,fail
  1657.                 jnc     par1
  1658.                 mov     si,offset areas_name
  1659.                 jmp     file_error
  1660. par1:
  1661.                 ;;EXPAND: m8dosQfileinfo  all_file_info
  1662. push handle
  1663. push 1
  1664. push ds
  1665. push offset all_file_info
  1666. push type file_info
  1667. call dosqfileinfo
  1668. ;;EXPAND: error_check
  1669. clc
  1670. and ax,ax
  1671. jz m6
  1672. stc
  1673. m6:
  1674.                 mov     ax,word ptr all_file_info.ffile_size
  1675.                 add     ax,010h
  1676.                 mdosallocseg   sel_ar_bbs,no_share
  1677.                 mov     cx,word ptr all_file_info.ffile_size
  1678.  
  1679.                 mov     si,0
  1680.                 mov     ax,sel_ar_bbs
  1681.                 mov     doscall_inseg,ax
  1682.                 mdosread
  1683.                 mov     ax,handle
  1684.                 mdosclose
  1685.                 push    ds
  1686.                 pop     es
  1687.                 mov     ds,sel_ar_bbs
  1688.  
  1689.  
  1690.  
  1691.                 mov     si,word ptr es:results
  1692.                 mov     al,0dh
  1693.                 mov     cx,4
  1694. ;l2:
  1695. x8:
  1696.                 inc     si
  1697.                 mov     byte ptr[si],al
  1698.                 loop    x8
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.                 mov     si,0
  1706.  
  1707.  
  1708.                 call    sstart
  1709.                 push    si
  1710.                 call    find_eol
  1711.                 call    backup_to_eol
  1712.                 mov     cx,si
  1713.                 pop     si
  1714.                 sub     cx,si
  1715.  
  1716.  
  1717.                 mov     di,offset system
  1718.         rep     movsb
  1719.  
  1720.                 push    es              ;true data is on top of the stack
  1721.                 mov     di,0
  1722. ;l1:
  1723. x9:
  1724.  
  1725.  
  1726.                 call    find_eol
  1727.  
  1728.  
  1729.  
  1730.  
  1731.                 push    di
  1732.                 call    parse_aline
  1733.                 pop     di
  1734.                 mov     dx,es
  1735.                 pop     es
  1736.                 push    es
  1737.                 mov     cx,es:all_file_info.ffile_size
  1738.                 dec     cx
  1739.                 cmp     si,cx
  1740.                 jb      y1
  1741.                 jmp     short x10
  1742. y1:
  1743.                 mov     es,dx
  1744.                 add     di,type line_infos
  1745.                 jmp     short x9
  1746. ;f1:
  1747. x10:
  1748.                 pop     es
  1749.                 mov     es:limit_areas,di
  1750.                 push    ds
  1751.                 call    DosFreeSeg
  1752.                 push    es
  1753.                 pop     ds
  1754.  
  1755.                 mov     si,offset origin_line
  1756.                 mov     di,offset hw_origin
  1757.                 call    write_asciiz
  1758.                 mov     si,offset system
  1759.                 call    write_asciiz
  1760.                 mov     al,20h
  1761.                 stosb
  1762.                 mov     al,'('
  1763.                 stosb
  1764.                 mov     si,offset this_add
  1765.                 call    write_node
  1766.                 mov     al,')'
  1767.                 stosb
  1768.                 mov     si,offset crlf
  1769.                 call    write_asciiz
  1770.                 mov     si,offset crlf
  1771.                 call    write_asciiz
  1772.                 mov     al,0
  1773.                 stosb
  1774.  
  1775.                 ret
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781. parse_aline:                    ;ds:si points at start of line, di points at next
  1782.                                 ;available structure in areas segment.
  1783.                                 ;es has true data
  1784.                 push    es
  1785.                 push    di
  1786.                 cmp     byte ptr [si],'0'
  1787.                 jb      x13
  1788.                 cmp     byte ptr [si],'z'
  1789.                 ja      x13
  1790.                 cmp     byte ptr [si],';'
  1791.                 je      x13
  1792.                 cmp     byte ptr [si],'@'
  1793.                 je      x13
  1794.  
  1795.  
  1796. ;l3:
  1797. x11:
  1798.                 call    slen
  1799.                 cld
  1800.                 mov     ax,es:sel_areas
  1801.                 mov     es,ax
  1802.         rep     movsb
  1803.                 call    sstart
  1804.                 jc      x12
  1805.                 pop     di
  1806.                 push    di
  1807.                 add     di,offset li_area
  1808.                 call    slen
  1809.         rep     movsb
  1810.                 pop     di
  1811.                 push    di
  1812.                 add     di,offset li_nodes
  1813.                 call    sstart
  1814.                 call    net_nodes
  1815. ;l2:
  1816. x12:
  1817.                 pop     di
  1818.                 pop es
  1819.                 ret
  1820. ;l1:
  1821. x13:
  1822.                 mov     dx,es
  1823.                 mov     es,es:sel_areas
  1824.                 push    di
  1825.                 add     di,offset li_flag
  1826.                 movsb
  1827.                 mov     es,dx
  1828.                 pop     di
  1829.                 jmp     short x11
  1830. Net_nodes:                              ;converts to expanded hex at es:di a
  1831.                                         ;line of net/nodes at ds:si
  1832.                                         ;format is: byte;zone word;node word;net
  1833.                 call    sstart
  1834.                 jc      x104
  1835.                 call    slash_to_word
  1836.                 push    ax
  1837.                 push    ds
  1838.                 ddata
  1839.                 mov     al,temp_def_zone
  1840.                 stosb
  1841.                 pop     ds
  1842.                 mov     ax,dx
  1843.                 and     ax,07fffh
  1844.                 stosw
  1845.                 pop     ax
  1846.                 and     ax,07fffh
  1847.                 stosw
  1848.                 jmp     short net_nodes
  1849. ;l1:
  1850. x104:
  1851.                 ret
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857. main:
  1858. public main
  1859.                 mov     sel_environ,ax
  1860.                 mov     cmd_offset,bx
  1861.                 mov     size_of_dgroup,cx
  1862.                 mov     size_of_stack,dx
  1863.                 mov     this_seg,ds
  1864. ;if debug
  1865. ;
  1866. ;                mov     ax,home_drive
  1867. ;                mdosselectdisk
  1868. ;                mov     si,offset home_dr_ascii
  1869. ;                mdoschdir
  1870. ;endif
  1871.  
  1872.                 push    50
  1873.                 call    dossetmaxfh
  1874.                 mov     sharing,deny_all
  1875.                 mov     byte ptr other_open_flags,020h
  1876.                 mov     word ptr toss_ptr,offset toss_list
  1877.                 pcrlf
  1878.                 prt     title_msg_l1
  1879.                 pcrlf
  1880.                 prt     title_msg_l2
  1881.                 pcrlf
  1882.                 prt     title_msg_l3
  1883.                 pcrlf
  1884.                 pcrlf
  1885.                 pcrlf
  1886.                 push    ds
  1887.                 mov     stack_start,sp
  1888.                 prt     vmsg_pconfig
  1889.                 pcrlf
  1890.                 call    parse_config
  1891.                 pop     ds
  1892.                 push    ds
  1893.                 prt     vmsg_done
  1894.                 pcrlf
  1895.                 prt     vmsg_pareas
  1896.                 pcrlf
  1897.                 call    parse_areas
  1898.                 prt     vmsg_done
  1899.                 pcrlf
  1900.  
  1901.                 mov     sharing,deny_write
  1902.                 mdosopen log_file,open,create
  1903.                 jnc     main4
  1904.                 prt     ermsg_no_log
  1905.                 jmp     short main5
  1906. main4:
  1907.                 mov     ax,handle
  1908.                 mov     log_handle,ax
  1909.                 call    append
  1910.                 call    get_time
  1911.                 mov     di,offset scratch_ascii
  1912.                 mov     al,0dh
  1913.                 stosb
  1914.                 mov     al,0ah
  1915.                 stosb
  1916.                 mov     si,offset logmsg_begin
  1917.                 call    write_asciiz
  1918.                 call    write_time
  1919.  
  1920.                 mov     al,0dh
  1921.                 stosb
  1922.                 mov     al,0ah
  1923.                 stosb
  1924.                 logaz   scratch_ascii
  1925.                 xor     dx,dx
  1926.                 mov     ah,dh
  1927.                 mov     al,minute
  1928.                 mov     bx,60
  1929.                 mul     bx
  1930.                 add     al,second
  1931.                 adc     ah,0
  1932.                 mov     start_in_secs,ax
  1933.  
  1934.  
  1935. main5:
  1936.  
  1937.                 pop     ds
  1938.                 push    ds
  1939.  
  1940.                 mov     ax,0ffffh
  1941.                         ;allocate message buffer
  1942.                 mdosallocSeg   sel_msg_buf,no_share
  1943.           ;***   clean buffer
  1944.                 pop     ds
  1945.                 push    ds
  1946.                 mov     cx,0fffeh
  1947.                 mov     es,sel_msg_buf
  1948.                 mov     di,0
  1949.                 call    clean_buffer
  1950.  
  1951.                 mov     si,cmd_offset
  1952.                 mov     ax,sel_environ
  1953.                 push    ds
  1954.                 mov     ds,ax
  1955.                 call    find_limit_2null
  1956.                 push    si
  1957.                 push    cx
  1958.                 edata
  1959.                 mov     di,offset toss_cmd
  1960.                 mov     ax,1
  1961.                 call    search_for
  1962.                 jnc     main2
  1963.                 pop     cx
  1964.                 pop     si
  1965.                 push    si
  1966.                 push    cx
  1967.                 mov     di,offset scan_cmd
  1968.                 mov     ax,1
  1969.                 call    search_for
  1970.                 jnc     to_scan
  1971.                 pop     cx
  1972.                 pop     si
  1973.                 push    si
  1974.                 push    cx
  1975.                 mov     di,offset delete_cmd
  1976.                 mov     ax,1
  1977.                 call    search_for
  1978.                 jnc     to_delete
  1979.                 pop     cx
  1980.                 pop     si
  1981.                 mov     di,offset test_cmd
  1982.                 mov     ax,1
  1983.                 call    search_for
  1984.                 jnc     to_test
  1985.                 pop     ds
  1986.                 prt     vmsg_nocmd
  1987.                 pcrlf
  1988.                 jmp     terminate
  1989. to_delete:
  1990.                 pop     cx
  1991.                 pop     si
  1992.                 jmp     delete_rtn
  1993.  
  1994. to_test:
  1995.                 ddata
  1996.                 jmp     up_bundle
  1997.  
  1998. to_scan:
  1999.                 pop     cx
  2000.                 pop     si
  2001.                 jmp     scan
  2002. main2:
  2003.                 pop     cx
  2004.                 pop     si
  2005.                 pop     ds
  2006. main2b:
  2007.                 call    up_bundle
  2008.                 mov     no_more_bndls,0
  2009.                 jnc     main2a
  2010.                 mov     no_more_bndls,1
  2011. main2a:
  2012.                 mov     access,read_write
  2013.                 call    get_packet
  2014. main_test_pkt:
  2015.                 jc      main2c
  2016.                 cmp     empty_pkt,0
  2017.                 jz      main_nxtpkt
  2018. main2c:
  2019.                 jmp     main_tonextpkt
  2020. ;------------------------------------------------------------------------------
  2021. ; each packet
  2022. ;------------------------------------------------------------------------------
  2023. main_nxtpkt:
  2024.                 push    ds
  2025.                 call    get_header      ;this is the Pkt header
  2026.                 call    log_pkt_info
  2027.                 pop     ds
  2028.  
  2029.                 mov     msg_start,36
  2030.                 mov     msg_length,0
  2031.  
  2032. ;------------------------------------------------------------------------------
  2033. ; each message
  2034. ;------------------------------------------------------------------------------
  2035. main_nxtmsg:
  2036. ;                push    ds
  2037.                 mov     si,msg_start
  2038.                 add     si,msg_length
  2039.                 call    get_msg         ;This unpacks the message and puts it
  2040.                                         ;in the message buffer
  2041.  
  2042.                 pop     ds
  2043.                 push    ds              ;ds true data,es msg buffer
  2044.  
  2045.                 test    mail_flags,split_flag
  2046.  ;               cmp     message_is_split,0
  2047.                 jz      x15             ; message split across 64K bound?
  2048. ;p1:
  2049. x14:
  2050.                 call    load_more_packet
  2051.                 mov     msg_start,0
  2052.                 mov     msg_length,0
  2053.                 jnc     y2
  2054.                 jmp     main_tonextpkt
  2055. y2:
  2056.                 jmp     main_nxtmsg
  2057. ;l1:
  2058. x15:
  2059.                 test    mail_flags,no_more_flag
  2060.                 jz      x17
  2061. ;temp patch to exit
  2062. ;                jmp     terminate
  2063.                 jmp     main_tonextpkt
  2064. ;p2:
  2065. x16:
  2066.                 jmp     x14
  2067. ;l1:
  2068. x17:
  2069.                 test    mail_flags,netmail_flag
  2070.                 jz      x250
  2071.                 jmp     it_is_net
  2072. x250:
  2073.                 test    mail_flags,bad_flag
  2074.                 jz      x251
  2075.                 jmp     bad_msg
  2076. x251:
  2077.  
  2078. ;message must be skipped if it's a dupe
  2079.                 call    get_message_area
  2080.                 call    dlen
  2081. if tight
  2082.                 and     cx,cx
  2083.                 jzx     251a
  2084. endif
  2085.                 inc     cx
  2086.                 mov     area_changed,0
  2087.                 mov     si,offset current_area
  2088.                 call    comp_strings
  2089.                 jz      x20
  2090.                 mov     area_changed,1
  2091.                 xchg    di,si
  2092.                 xdses
  2093.  
  2094.  
  2095.                 push    si
  2096.                 push    di
  2097.                 push    cx
  2098.                 mov     cx,20
  2099.                 xor     ax,ax
  2100.         rep     stosb
  2101.                 pop     cx
  2102.                 pop di
  2103.                 pop     si
  2104.  
  2105.                 call    slen
  2106.                 push    cx
  2107.         rep     movsb                   ;bring area string to data seg
  2108.                 xdses                   ;ds: true data es: msg buffer
  2109.                 pop     cx              ;bring back length of tag
  2110.                 mov     si,offset current_area
  2111.                 pop     ds
  2112.                 push    ds
  2113.                 call    locate_area
  2114.                 jnc     x18
  2115. x251a:
  2116.                 jmp     no_such_area
  2117. ;l1:
  2118. x18:
  2119.                 pop     ds
  2120.                 push    ds
  2121.  
  2122.                 mov     current_path,di
  2123.  
  2124.  
  2125.                 call    mov_cur_path_to_data
  2126.                 call    comp_t_area
  2127.                 test    first_time,0ffh
  2128.                 mov     first_time,1
  2129.                 jz      x19
  2130.                 call    write_dupes
  2131. ;p1:
  2132. x19:
  2133.                 call    load_dupes
  2134. ;o1:
  2135. x20:
  2136.  
  2137. public atag_pull
  2138. atag_pull:
  2139.                 push    di
  2140.                 push    cx
  2141.                 call    pull_atag
  2142.                 pop     cx
  2143.                 pop     di
  2144.  
  2145.  
  2146.                 call    crc_main
  2147.                 jnc     y3
  2148.                 jmp     main_nxtmsg
  2149. y3:
  2150.                 pop     ds
  2151.                 push    ds
  2152.                 call    strip_path
  2153.                 pop     ds
  2154.                 push    ds
  2155.                 call    strip_seen_bys
  2156.                 push    ds
  2157.                 pop     es              ;es must -> at true data for next call
  2158.                 mov     si,offset akas
  2159.                 mov     di,offset seen_by_list
  2160.                 call    add_net_nodes
  2161.                 mov     si,offset seens
  2162.                 mov     di,offset seen_by_list
  2163.                 call    add_net_nodes
  2164.  
  2165. ;might also have to ad the nodes from the areas list!
  2166.  
  2167. ;                mov     di,offset path_list
  2168. ;                mov     si,offset null_node
  2169. ;;l2:
  2170. ;x21:
  2171. ;                call    double_comp
  2172. ;                jz      x22
  2173. ;                add     di,4
  2174. ;                jmp     short x21
  2175. ;;l3:
  2176. ;x22:
  2177. ;                mov     si,offset this_add
  2178. ;                movsw
  2179. ;                movsw                   ;the path list is updated!
  2180.                 mov     di,upmsg_length
  2181.                 mov     es,sel_msg_buf
  2182.                 call    write_seen_bys  ;this passes the endofmsg in di to next.
  2183.                 call    write_path_line
  2184.                 test    area_changed,0ffh
  2185.                 jz      x23
  2186. Throw_this_msg:
  2187.                 call    get_msg_high
  2188. ;o2:
  2189. public x23
  2190. x23:
  2191.                                         ;now we can toss it!
  2192.                 call    make_msg_pathname
  2193.                 call    print_tossing
  2194.                 call    log_area_toss
  2195.  
  2196.                 mdosopen scratch_path,replace,create
  2197.                 jnc     main3
  2198.                 mov     si,offset scratch_path
  2199.                 call    dos_error
  2200.                 jmp     bad_msg
  2201. main3:
  2202.                 mov     ax,handle
  2203.                 mov     cx,upmsg_length
  2204.                 mov     si,0
  2205.  
  2206.                 ;;EXPAND: m8doswrite sel_msg_buf,results
  2207. push ax
  2208. push sel_msg_buf
  2209. push si
  2210. push cx
  2211. push ds
  2212. push offset results
  2213. call doswrite
  2214. ;;EXPAND: error_check
  2215. clc
  2216. and ax,ax
  2217. jz m9
  2218. stc
  2219. m9:
  2220.  
  2221.                 mov     ax,handle
  2222.  
  2223.                 mdosclose
  2224.                 inc     msg_cntr
  2225.  
  2226. ;it's time to look for next msg in packet or next packet
  2227.  
  2228.                 jmp     main_nxtmsg
  2229.  
  2230. main_tonextpkt:
  2231.                 call    get_next_packet
  2232.                 cmp     byte ptr no_more_pkts,0
  2233.                 jne     mtep2
  2234.                 jmp     main_test_pkt
  2235.  
  2236. mtep2:
  2237.                 call    up_bundle
  2238.                 jnc     main_tonextpkt
  2239. ;                mov     al,no_more_bndls
  2240. ;                and     al,al
  2241. ;                jnz     terminate
  2242. ;                jmp     main2b
  2243.  
  2244. terminate:
  2245.  
  2246. x24:
  2247. ;l1:
  2248.  
  2249.                 call    write_t_area    ;write out the toss log
  2250.                 mov     ax,msg_cntr
  2251.                 and     ax,ax
  2252.                 jz      x24b
  2253.                 call    write_dupes
  2254. x24b:
  2255.                 call    get_time
  2256.                 mov     di,offset scratch_ascii
  2257.                 mov     si,offset logmsg_end
  2258.                 call    write_asciiz
  2259.                 call    write_time
  2260.  
  2261.                 mov     al,0dh
  2262.                 stosb
  2263.                 mov     al,0ah
  2264.                 stosb
  2265.                 mov     al,0
  2266.                 stosb
  2267.                 logaz   scratch_ascii
  2268.  
  2269.  
  2270.                 mov     al,minute
  2271.                 xor     ah,ah
  2272.                 mov     bx,60
  2273.                 mul     bx
  2274.                 add     al,second
  2275.                 adc     ah,0
  2276.                 mov     end_in_secs,ax
  2277.                 sub     ax,start_in_secs
  2278.                 mov     bx,60
  2279.                 div     bx
  2280.                 push    dx
  2281.                 push    ax
  2282.                 mov     di,offset scratch_ascii
  2283.                 mov     al,0dh
  2284.                 stosb
  2285.                 mov     al,0ah
  2286.                 stosb
  2287.                 mov     si,offset logmsg_stossed
  2288.                 call    write_asciiz
  2289.                 mov     ax,tot_count
  2290.                 call    write_h_ascii
  2291.                 mov     si,offset logmsg_smsg
  2292.                 call    write_asciiz
  2293.                 pop     ax
  2294.                 call    write_h_ascii
  2295.                 mov     si,offset logmsg_smins
  2296.                 call    write_asciiz
  2297.                 pop     ax
  2298.                 call    write_h_ascii
  2299.                 mov     si,offset logmsg_ssecs
  2300.                 call    write_asciiz
  2301.                 mov     al,0
  2302.                 stosb
  2303.                 logaz   scratch_ascii
  2304.                 mov     di,offset scratch_ascii
  2305.                 call    print_asciiz
  2306.  
  2307.  
  2308.                 mov     ax,log_handle
  2309.                 mdosclose
  2310.                 mov     ax,dupes_handle
  2311.                 mdosclose
  2312.  
  2313.                 mov     ax,1
  2314.                 push    ax              ;terminate the process
  2315.                 push    error_code
  2316.                 call    dosExit
  2317.  
  2318. ;END of MAIN for TOSS
  2319.  
  2320. make_msg_pathname:
  2321.                 mov     di,cur_ar_path_end
  2322.                 push    _data
  2323.                 pop     es
  2324.                 mov     ax,highest_msg
  2325.                 inc     ax              ;we'll put the message in the next one
  2326.                 mov     highest_msg,ax  ;update the value
  2327.                 call    write_h_ascii
  2328.                 mov     al,'.'
  2329.                 stosb
  2330.                 mov     al,'m'
  2331.                 stosb
  2332.                 mov     al,'s'
  2333.                 stosb
  2334.                 mov     al,'g'
  2335.                 stosb
  2336.                 xor     ax,ax
  2337.                 stosb
  2338.                 ret
  2339. ;
  2340. ;call update_msg1
  2341.  
  2342. ;lodad           macro
  2343. ;                lodsw
  2344. ;                mov     dx,ax
  2345. ;                lodsw
  2346. ;                xchg    dx,ax
  2347. ;#em
  2348.  
  2349. write_path_line:
  2350. public write_path_line
  2351.  
  2352.                 mov     si,offset path_line
  2353.                 mov     temp_def_net,0
  2354.                 call    write_asciiz
  2355.                 mov     al,020h
  2356.                 stosb
  2357.                 mov     si,offset path_list
  2358. x24a:
  2359. ;l1:
  2360.                 call    write_node
  2361.                 nodesiz
  2362.                 jnz     x24a
  2363.  
  2364.                 push    es
  2365.                 mov     ax,[si-4]
  2366.                 mov     temp_def_net,ax
  2367.                 mov     ax,si
  2368.                 sub     ax,5                    ;ax points at last one written
  2369.                 mov     si,offset this_add
  2370.                 push    di
  2371.                 edata
  2372.                 mov     di,ax
  2373.                 call    triple_comp     ;if we're already listed
  2374.                 pop     di
  2375.                 pop     es
  2376.                 jz      wpl1            ;don't list us again
  2377.                 call    write_node
  2378. wpl1:
  2379.                 mov     si,offset crlf
  2380.                 call    write_asciiz
  2381.                 mov     si,offset crlf
  2382.                 call    write_asciiz
  2383.                 xor     ax,ax
  2384.                 stosb
  2385.                 mov     upmsg_length,di
  2386.                 ret
  2387.  
  2388.  
  2389. write_seen_bys:                         ;writes the seen_by lines to es:di
  2390. public write_seen_bys
  2391.                 mov     temp_def_net,0
  2392.                 mov     si,offset seen_by_list
  2393. x25:
  2394. ;l1:
  2395.                 call    write_sb_line
  2396.                 push    si
  2397.                 mov     si,offset CRLF
  2398.                 pushf
  2399.                 call    write_asciiz
  2400.                 popf
  2401.                 pop     si
  2402.                 jnz     x25
  2403.                 ret
  2404.  
  2405.  
  2406.  
  2407. write_sb_line:                          ;rec pos in the nn_list in si
  2408. public write_sb_line
  2409.                                         ;the position in the msg in es:di
  2410.                                         ;ds as true data. rets with a seen_by
  2411.                                         ;line written to the message.
  2412.                                         ;bx=zero and the z flag set if the end
  2413.                                         ;of the nn_list was reached
  2414.                 push    si
  2415.                 mov     si,offset seen_by_line
  2416.                 call    write_asciiz
  2417.                 mov     al,020h
  2418.                 stosb
  2419.                 mov     column_ctr,10
  2420.                 mov     temp_def_net,0
  2421.                 pop     si
  2422. x26:
  2423. ;l1:
  2424.                 push    di
  2425.                 call    write_node
  2426.                 mov     ax,di
  2427.                 mov     bx,di
  2428.                 pop     di
  2429.                 sub     ax,di
  2430.                 mov     di,bx
  2431.                 add     al,column_ctr
  2432.                 mov     column_ctr,al
  2433.                 cmp     al,60
  2434.                 jb      x27
  2435.                 mov     bx,[si]
  2436.                 or      bx,[si+2]
  2437.                 ret
  2438.  
  2439. x27:
  2440. ;l2:
  2441.                 mov     bx,[si]
  2442.                 or      bx,[si+2]
  2443.                 jnz     x26
  2444.                 ret
  2445. public write_node
  2446. write_node:                             ;rec the pos in the nn_list in si
  2447.                                         ;the position in the msg in es:di
  2448.                                         ;ds as true data. rets with a net/node
  2449.                                         ;or node written to the msg
  2450.                 lodsb
  2451. ;                cmp     al,temp_def_zone
  2452. ;                jz      wn1
  2453. ;                mov     temp_def_zone,al
  2454. ;                xor     ah,ah
  2455. ;                call    write_h_ascii
  2456. ;                mov     al,':'
  2457. ;                stosb
  2458. wn1:
  2459.                 lodad
  2460.                 xchg    ax,dx
  2461.                 cmp     dx,temp_def_net
  2462.                 je      x28
  2463.                 mov     temp_def_net,dx
  2464.                 jmp     short x29
  2465. x28:
  2466. ;l1:
  2467.                 call    write_h_ascii
  2468.                 mov     al,020h
  2469.                 stosb
  2470.                 ret
  2471. x29:
  2472. ;l2:
  2473.                 push    ax
  2474.                 mov     ax,dx
  2475.                 call    write_h_ascii
  2476.                 mov     al,'/'
  2477.                 stosb
  2478.                 pop     ax
  2479.                 jmp     short x28
  2480.  
  2481. public write_asciiz
  2482. write_asciiz:                           ;writes the ASCIIZ string -> ds:si
  2483.                                         ;to es:di. di is updated, si trashed
  2484.                                         ;remainder preserved
  2485.                 push    es
  2486.                 push    ds
  2487.                 pop     es
  2488.                 xchg    si,di
  2489.                 push    di
  2490.                 call    eoz
  2491.                 pop     di
  2492.                 xchg    di,si
  2493.                 pop     es
  2494.                 cld
  2495.         rep     movsb
  2496.                 ret
  2497.  
  2498. public write_h_ascii
  2499. write_h_ascii:                          ;recs 4 digit hex in ax, and writes the
  2500.                                         ;5 digit (leading 0's supressed) ascii
  2501.                                         ;to es:di ax,bx,cx,dx,si may be trashed
  2502.                                         ;di is updated.
  2503.                 call    hexdec
  2504.                 push    ax
  2505.                 mov     al,bh
  2506.                 or      al,al
  2507.                 jz      x30
  2508.                 stosb
  2509. x30:
  2510. ;l1:
  2511.                 mov     al,bl
  2512.                 or      al,al
  2513.                 jz      x31
  2514.                 stosb
  2515. x31:
  2516. ;l2:
  2517.                 mov     al,dh
  2518.                 or      al,al
  2519.                 jz      x32
  2520.                 stosb
  2521. x32:
  2522. ;l3:
  2523.                 mov     al,dl
  2524.                 or      al,al
  2525.                 jz      x33
  2526.                 stosb
  2527. x33:
  2528. ;l4:
  2529.                 pop     ax
  2530.                 stosb
  2531.                 ret
  2532.  
  2533.  
  2534. public write_h_ascii2d
  2535. write_h_ascii2d:                        ;recs 4 digit hex in ax, and writes the
  2536.                                         ;5 digit (leading 0's supressed) ascii
  2537.                                         ;to es:di ax,bx,cx,dx,si may be trashed
  2538.                                         ;di is updated.
  2539.                 call    hexdec
  2540.                 push    ax
  2541.                 mov     al,bh
  2542.                 or      al,al
  2543.                 jz      x30a
  2544.                 stosb
  2545. x30a:
  2546. ;l1:
  2547.                 mov     al,bl
  2548.                 or      al,al
  2549.                 jz      x31a
  2550.                 stosb
  2551. x31a:
  2552. ;l2:
  2553.                 mov     al,dh
  2554.                 or      al,al
  2555.                 jz      x32a
  2556.                 stosb
  2557. x32a:
  2558.                 jmp     short wh4d4
  2559.  
  2560.  
  2561.  
  2562. public write_h_ascii4d
  2563. write_h_ascii4d:                          ;recs 4 digit hex in ax, and writes the
  2564.                                         ;5 digit (leading 0's supressed) ascii
  2565.                                         ;to es:di ax,bx,cx,dx,si may be trashed
  2566.                                         ;di is updated.
  2567.                 call    hexdec
  2568.                 push    ax
  2569.                 mov     al,bh
  2570.                 or      al,al
  2571.                 jz      x30b
  2572.                 stosb
  2573. x30b:
  2574.                 mov     al,bl
  2575.                 or      al,al
  2576.                 jnz     wh4d1
  2577.                 mov     al,30h
  2578. wh4d1:
  2579.                 stosb
  2580.                 mov     al,dh
  2581.                 or      al,al
  2582.                 jnz     wh4d2
  2583.                 mov     al,30h
  2584. wh4d2:
  2585.                 stosb
  2586. wh4d4:
  2587.                 mov     al,dl
  2588.                 or      al,al
  2589.                 jnz     wh4d3
  2590.                 mov     al,30h
  2591. wh4d3:
  2592.                 stosb
  2593.                 pop     ax
  2594.                 stosb
  2595.                 ret
  2596.  
  2597.  
  2598.  
  2599.  
  2600. log_ascii:
  2601.  
  2602.  
  2603. public double_comp
  2604. double_comp:                            ;si->dd w/ di->dd
  2605.                                         ;rets with cl ne 0 if {si} > {di}
  2606.                                         ;rets with ch ne 0 if {si} < {di}
  2607.                                         ;z (equal) flag is valid
  2608.                 mov     ax,es:[di]
  2609.                 mov     dx,es:[di+2]
  2610.                 sub     ax,[si]
  2611.                 sbb     dx,[si+2]
  2612.                 cmp     dx,0
  2613.                 jg      x34 ;si <= di
  2614.                 jl      x35 ;si > di
  2615.                 or      ax,ax
  2616.                 ja      x34
  2617.                 xor     cx,cx
  2618.                 ret
  2619.  
  2620. x34:
  2621. ;l1:
  2622.                 mov     cx,0100h
  2623.                 ret
  2624.  
  2625. x35:
  2626. ;l2:
  2627.                 mov     cx,1
  2628.                 ret
  2629.  
  2630. triple_comp:                    ;a return of carry indicates put it here
  2631.                                 ;zero flag says entries are equal
  2632.                 push    di
  2633.                 push    si
  2634.         inc     si              ;*no zone
  2635.         inc     di              ;*no zone
  2636. ;no zone stuff   cmpsb
  2637. ;                jb      tc1
  2638. ;                ja      next_slot        ;check next slot in list
  2639.                 cmpsw
  2640.                 jb      tc1
  2641.                 ja      next_slot
  2642.                 cmpsw
  2643.                 jb      tc1
  2644. next_slot:
  2645.                 clc
  2646. tc1:
  2647.                 pop     si
  2648.                 pop     di
  2649.                 ret
  2650.  
  2651. public add_net_nodes
  2652. add_net_nodes:                          ;di points at target list, si points at
  2653.                                         ;source list. es and ds -> at true data
  2654.                                         ;Upon return target list
  2655.                                         ;has been updated.
  2656.                 push    es
  2657.                 push    si
  2658.                 push    di
  2659.                 push    si
  2660.                 mov     si,di
  2661.                 call    find_targ_len
  2662.                 mov     es:target_end,si
  2663.                 pop     si
  2664.                 push    ds
  2665.                 pop     es
  2666. x36:
  2667. x37:
  2668.                 mov     ax,[si]
  2669.                 or      ax,[si+2]       ;this checks for a zero source
  2670.                 jz      x42
  2671.  
  2672.                 cmp     es:target_end,0
  2673.                 je      x38
  2674. ann3:
  2675.                 call    triple_comp
  2676.                 jz      x40
  2677.                 jae     x41
  2678. x38:                                    ;put it here
  2679.                 call    stretch_target  ;we'll put it here (es must =true data)
  2680. ann4:
  2681.                 lodsb
  2682.                 mov     byte ptr [di],al
  2683.                 lodsw
  2684.                 mov     word ptr [di+1],ax
  2685.                 lodsw
  2686.                 mov     word ptr [di+3],ax
  2687. x39:
  2688.                 xor     ah,ah
  2689.                 mov     al,[si]
  2690.                 or      ax,[si+1]
  2691.                 or      ax,[si+3]
  2692.                 jz      x42             ;source finished
  2693.                 jmp     short ann3
  2694. x40:                                    ;move to next in source
  2695.                 add     si,5
  2696.                 jmp     short x39
  2697. x41:                                    ;look at next target
  2698.                 add     di,5
  2699.                 cmp     di,es:target_end
  2700.                 jae     ann4
  2701.                 jmp     short x37
  2702. x42:
  2703.                 pop di
  2704.                 pop si
  2705.                 pop es
  2706.                 ret
  2707.  
  2708.  
  2709. public stretch_target
  2710. stretch_target:                         ;di points to place hole is to be made.
  2711.                                         ;es->at true data
  2712.                                         ;target_end is valid. di is preserved
  2713.  
  2714.                 push    si
  2715.                 push    di
  2716.                 push    cx
  2717.                 mov     cx,es:target_end
  2718.                 sub     cx,di
  2719.                 je      st01
  2720.                 mov     di,es:target_end
  2721.                 mov     si,di
  2722.                 add     di,4
  2723.                 sub     si,1
  2724.                 std
  2725.         rep     movsb
  2726. st01:
  2727.                 cld
  2728.                 add     es:target_end,5
  2729.                 pop     cx
  2730.                 pop     di
  2731.                 pop     si
  2732.                 ret
  2733.  
  2734. public find_targ_len
  2735. find_targ_len:                          ;si points at start. rets the number of
  2736.                                         ;of entries in cx, offset of first empty
  2737.                                         ;double in si
  2738.  
  2739.                 xor     cx,cx
  2740. x43:
  2741. ;l1:
  2742.                 nodesiz
  2743.                 jz      x44
  2744.                 add     si,5
  2745.                 inc     cx
  2746.                 jmp     short x43
  2747. x44:
  2748. ;l2:
  2749.                 ret
  2750.  
  2751. ;public get_path_list
  2752. ;get_path_list:                          ;copies the path line to Cur_path_line
  2753. ;                mov     es,sel_msg_buf
  2754. ;
  2755. ;
  2756. ;                mov     di,offset path_line
  2757. ;                mov     cx,upmsg_length
  2758. ;
  2759. ;                xdses
  2760. ;                mov     si,0b8h          ;approx end of header
  2761. ;                mov     ax,1
  2762. ;                call    search_for
  2763. ;                xdses
  2764. ;
  2765. ;                mov     pathline_start,si
  2766. ;                add     si,6
  2767. ;                mov     di,offset Cur_path_line
  2768. ;
  2769. ;                xdses
  2770. ;                call    net_nodes
  2771. ;                xdses                   ;should have true data in ds:
  2772. ;
  2773. ;                mov     ax,pathline_start
  2774. ;                mov     upmsg_length,ax
  2775. ;                ret
  2776.  
  2777. ;get_path_list:                          ;pulls of the path line and puts it
  2778. ;                                        ;into the path_list in expanded hes
  2779. ;                                        ;format. DS must be valid. upmsg_length
  2780. ;                                        ;is updated
  2781. ;                mov     es,sel_msg_buf
  2782. ;                mov     si,pathline_start
  2783. ;                add     si,6
  2784. ;                mov     di,offset path_list
  2785. ;                xdses
  2786. ;                call    net_nodes
  2787. ;                xdses
  2788. ;                mov     ax,pathline_start
  2789. ;                mov     upmsg_length,ax
  2790. ;                ret
  2791. ;
  2792.  
  2793.  
  2794. public Strip_Path
  2795. Strip_Path:                             ;this pulls off the path and puts it
  2796.                                         ;into the path_list in expanded
  2797.                                         ;hex format. DS must be valid, upmsg_length
  2798.                                         ;is updated
  2799.                 edata
  2800.                 mov     di,offset path_list
  2801.                 xor     ax,ax
  2802.                 mov     cx,4096
  2803.         rep     stosb
  2804.                 mov     si,upmsg_length         ;start at end and look
  2805.                 push    si                      ;towards
  2806.                 mov     cx,offset mtext         ;beginning for
  2807.                 mov     di,offset origin_line     ;the origin line
  2808.                 mov     ax,sel_msg_buf
  2809.                 mov     es,ax
  2810.                 mov     ax,-1
  2811.                 xdses
  2812.                 call    search_for
  2813.                 jnc     x200
  2814.                 jmp     bad_msg
  2815. x200:
  2816.                 mov     di,offset path_line
  2817.                 mov     ax,1
  2818.                 pop     cx
  2819.                 call    search_for
  2820.                 xdses
  2821.                 jnc     x201
  2822.                 edata
  2823.                 mov     di,offset path_list
  2824.                 mov     si,offset this_add      ;if no path is
  2825.                 mov     cx,5                    ;found, then one is added
  2826.         rep     movsb
  2827.                 jmp     short x203a             ;upmsg_length should be ok
  2828.  
  2829. x201:
  2830.                 mov     first_path,si           ;now pointing at first path string
  2831.                 mov     di,si
  2832.                 mov     cx,6
  2833.                 mov     dx,upmsg_length
  2834.                 call    delete_cx_chars
  2835.                 mov     upmsg_length,di
  2836. x202:
  2837.                 mov     di,offset path_line
  2838.                 mov     ax,1
  2839.                 mov     cx,upmsg_length
  2840.                 xdses
  2841.                 call    search_for
  2842.                 xdses
  2843.                 jc      x203
  2844.                 mov     di,si
  2845.                 mov     cx,6
  2846.                 mov     dx,upmsg_length
  2847.                 call    delete_cx_chars
  2848.                 mov     upmsg_length,di
  2849.                 jmp     short x202
  2850. x203:
  2851.                 mov     di,first_path
  2852.                 mov     dx,upmsg_length
  2853.                 call    strip_CRs
  2854.                 mov     upmsg_length,dx
  2855.  
  2856.                 mov     dx,temp_def_net
  2857.                 mov     di,offset path_list
  2858.                 mov     si,first_path
  2859.                 xdses
  2860.                 call    net_nodes
  2861.                 xdses
  2862.                 mov     ax,first_path
  2863.                 mov     upmsg_length,ax
  2864. x203a:
  2865.                 ret
  2866.  
  2867.  
  2868.  
  2869. public Strip_seen_bys
  2870. Strip_seen_bys:                         ;this pulls off the seen-bys and puts them
  2871.                                         ;them into the seen_by_list in expanded
  2872.                                         ;hex format. DS must be valid, upmsg_length
  2873.                                         ;is updated
  2874.                 edata
  2875.                 mov     di,offset seen_by_list
  2876.                 xor     ax,ax
  2877.                 mov     cx,4096
  2878.         rep     stosb
  2879.                 mov     si,upmsg_length         ;start at end and look
  2880.                 push    si                      ;towards
  2881.                 mov     cx,offset mtext         ;beginning for
  2882.                 mov     di,offset origin_line     ;the origin line
  2883.                 mov     ax,sel_msg_buf
  2884.                 mov     es,ax
  2885.                 mov     ax,-1
  2886.                 xdses
  2887.                 call    search_for
  2888.                 jnc     y4
  2889.                 jmp     bad_msg
  2890. y4:
  2891.                 mov     di,offset seen_by_line
  2892.                 mov     ax,1
  2893.                 pop     cx
  2894.                 call    search_for
  2895.                 xdses
  2896.                 jnc     y5
  2897.                 edata
  2898.                 mov     di,offset seen_by_list
  2899.                 mov     si,offset this_add
  2900.                 mov     cx,25
  2901.         rep     movsb
  2902.                 mov     ax,upmsg_length
  2903.                 ret
  2904. y5:
  2905.                 mov     first_seen_by,si     ;now pointing at first seen by string
  2906.                 mov     di,si
  2907.                 mov     cx,8
  2908.                 mov     dx,upmsg_length
  2909.                 call    delete_cx_chars
  2910.                 mov     upmsg_length,di
  2911. x45:
  2912. ;l1:
  2913.                 mov     di,offset seen_by_line
  2914.                 mov     ax,1
  2915.                 mov     cx,upmsg_length
  2916.                 xdses
  2917.                 call    search_for
  2918.                 xdses
  2919.                 jc      x46
  2920.                 mov     di,si
  2921.                 mov     cx,8
  2922.                 mov     dx,upmsg_length
  2923.                 call    delete_cx_chars
  2924.                 mov     upmsg_length,di
  2925.                 jmp     short x45
  2926. x46:
  2927. ;l3:
  2928.                 mov     di,first_seen_by
  2929.                 mov     dx,upmsg_length
  2930.                 call    strip_CRs
  2931.                 mov     upmsg_length,dx
  2932.  
  2933.                 mov     dx,temp_def_net
  2934.                 mov     di,offset seen_by_list
  2935.                 mov     si,first_seen_by
  2936.                 xdses
  2937.                 call    net_nodes
  2938.                 xdses
  2939.                 mov     si,first_seen_by
  2940.                 mov     upmsg_length,si
  2941.                 mov     ax,si
  2942.                 ret
  2943.  
  2944.  
  2945. public  locate_area
  2946. locate_area:                    ;enters ds:si->current area, cx = length of tag
  2947.                                 ;rets with es:di ->at path to current area.
  2948.  
  2949.                 mov     ax,sel_areas
  2950.                 mov     es,ax
  2951.                 mov     di,offset li_area
  2952. x47:
  2953. ;l1:
  2954.                 push    si
  2955.                 push    di
  2956.                 push    cx
  2957.         repz    cmpsb
  2958.                 jz      x48
  2959. la1:
  2960.                 pop     cx
  2961.                 pop     di
  2962.                 pop     si
  2963.                 add     di,0a4h
  2964.                 cmp     di,limit_areas
  2965.                 jb      x47
  2966.                 stc
  2967.                 ret
  2968. x48:
  2969. ;l2:
  2970.                 cmp     byte ptr es:[di],0
  2971.                 jnz     la1
  2972.                 pop     cx
  2973.                 pop     di
  2974.                 pop     si
  2975.                 sub     di,offset li_area
  2976.                 mov     current_path,di
  2977.                 clc
  2978.                 ret
  2979.  
  2980.  
  2981.  
  2982.  
  2983. get_message_area:               ;es = message buffer;rets with es:di ->area string
  2984.                 mov     cx,upmsg_length
  2985.                 mov     si,offset mtext
  2986.                 dec     si
  2987.                 dec     si
  2988.                 sub     cx,si
  2989.                 mov     di,offset area_line
  2990.                 xdses
  2991.                 mov     ax,1
  2992.                 call    search_for
  2993.                 jnc     y6
  2994.                 jmp     bad_msg
  2995. y6:
  2996.                 add     si,5
  2997.                 mov     di,si
  2998.                 xdses
  2999.  
  3000. ife tight
  3001.  
  3002. gma2:
  3003.                 cmp     byte ptr es:[di],20h
  3004.                 jnz     gma1
  3005.                 inc     di
  3006.                 jmp     short gma2
  3007.  
  3008. gma1:
  3009.  
  3010. endif
  3011.                 ret
  3012.  
  3013.  
  3014.  
  3015. public get_msg
  3016. get_msg:
  3017.                 mov     mail_flags,0
  3018.                 mov     ax,end_of_msg
  3019.                 mov     prev_end,ax
  3020.                 mov     ax,sel_pkt_buf
  3021.                 mov     es,ax
  3022.                 mov     di,si
  3023.                 xor     dx,dx
  3024.                 mov     cx,current_read
  3025.                 cmp     cx,160
  3026.                 ja      gmsg2
  3027.                 jmp     short x52
  3028. gmsg2:
  3029.                 sub     cx,di
  3030.                 cmp     cx,160
  3031.                 jb      x49
  3032.                 mov     cx,160
  3033. x49:
  3034. ;o1:
  3035.                 mov     ax,0002h
  3036. x50:
  3037. ;l1:
  3038.         repnz   scasb
  3039.                 and     cl,cl
  3040.                 jz      x52
  3041.                 cmp     es:[di],ah
  3042.                 jne     x51
  3043.                 jmp     short x55
  3044. x51:
  3045. ;n1:
  3046.                 and     cx,cx
  3047.                 jnz     x50
  3048.                 cmp     di,current_read
  3049.  
  3050.  
  3051.  
  3052.                 jb      x54
  3053. x52:
  3054. ;o2:
  3055.                 or      mail_flags,no_more_flag
  3056. x53:
  3057. ;o3:
  3058.                 mov     ax,cx
  3059.                 mov     end_of_msg,ax
  3060.                 stc
  3061.                 ret
  3062.  
  3063. x54:
  3064. ;o4:
  3065.                 mov     byte ptr bad_packet,1
  3066.                 jmp     short x52
  3067.  
  3068. x55:
  3069. ;n2:
  3070.                 inc     di
  3071.                 mov     msg_start,di
  3072.  
  3073.  
  3074.  
  3075. ;this is the start of the new checker
  3076.  
  3077.                 mov     cx,current_read
  3078.                 sub     cx,di
  3079.                 cmp     cx,34
  3080.                 jb      to_split
  3081.  
  3082.  
  3083.                 add     di,12
  3084.                 mov     cx,current_read
  3085.                 cmp     cx,0ffffh
  3086.                 jb      x55a
  3087.                 dec     cx
  3088. x55a:
  3089.                 call    next_z_limit
  3090.                 jc      to_split                ;points at to_user
  3091.                 call    next_z_limit
  3092.                 jc      to_split                ;points at from_user
  3093.                 call    next_z_limit
  3094.                 jc      to_split                ;points at subject
  3095.                 call    next_z_limit
  3096.                 jc      to_split                ;points at area tag
  3097.                 mov     text_start,di
  3098.                 call    next_z_limit
  3099.                 jc      to_split                ;points at end of message
  3100.                 mov     end_of_msg,di
  3101.                 sub     di,msg_start
  3102.                 mov     msg_length,di
  3103.  
  3104.         ;now we see it is netmail. i.e. no tagline
  3105.  
  3106.                 mov     si,text_start
  3107.                 mov     cx,si
  3108.                 add     cx,5            ;it must be right here
  3109.                 xdses                   ;xchange ds,es
  3110.                 mov     di,offset area_line
  3111.                 mov     ax,1
  3112.                 call    search_for
  3113.                 jnc     not_netmail
  3114. ;                jmp     is_netmail
  3115.  
  3116.                 xdses
  3117.                 or      mail_flags,netmail_flag
  3118.                 jmp     x57
  3119.  
  3120. to_split:
  3121.                 mov     end_of_msg,0
  3122.                 jmp     no_eom
  3123.  
  3124.  
  3125. not_netmail:
  3126.                 mov     si,es:msg_start
  3127.  
  3128.  
  3129.  
  3130.  
  3131. if tight
  3132.  
  3133.                 mov     di,offset path_line
  3134.                 mov     cx,es:end_of_msg
  3135.                 sub     cx,8                    ;correction for length of path_line
  3136.                 mov     ax,1
  3137.                 call    search_for
  3138.                 jc      x56
  3139.                 xdses
  3140.                 mov     pathline_start,si
  3141.                 jmp     x57
  3142. x56:
  3143. ;o5:
  3144.                 xdses
  3145.                 or      mail_flags,bad_flag
  3146.                 mov     ax,end_of_msg
  3147.                 add_m32_rax cur_pkt_file_ptr
  3148.                 stc
  3149.                 ret
  3150.  
  3151. else
  3152.  
  3153.                 xdses
  3154. endif
  3155.  
  3156. x57:
  3157.                 push    cx
  3158.                 push    es
  3159.                 mov     di,end_of_msg
  3160.                 push    di
  3161.                                 ;this cleans buf where msg will go
  3162.                 mov     es,sel_msg_buf
  3163.                 xor     ax,ax
  3164.                 mov     di,ax
  3165.                 mov     cx,msg_length
  3166.                 add     cx,03bh
  3167.         rep     stosb
  3168.                 pop     di
  3169.                 pop     es
  3170.                 pop     cx
  3171.  
  3172. ;this little snip updates the packet read pointer
  3173.  
  3174.                 push    dx
  3175.                 push si
  3176.  
  3177.                 edata
  3178.                 xor     dx,dx
  3179. ;                mov     ax,word ptr cur_pkt_file_ptr
  3180. ;                or      ax,word ptr cur_pkt_file_ptr+2
  3181. ;                jnz     x58
  3182. ;                mov     ax,msg_start
  3183. ;                sub     ax,3
  3184. ;                mov     word ptr cur_pkt_file_ptr,ax
  3185. ;x58:
  3186. ;;o6:
  3187. ;                mov     ax,msg_length
  3188. ;                add     ax,3
  3189.  
  3190.                 mov     ax,end_of_msg
  3191.                 sub     ax,prev_end
  3192.  
  3193.                 add     word ptr cur_pkt_file_ptr,ax
  3194.                 adc     word ptr cur_pkt_file_ptr+2,dx
  3195. ;                mov     si,offset cur_pkt_file_ptr
  3196.                 pop     si
  3197.                 pop     dx
  3198.  
  3199.                 mov     cx,di
  3200.                 push    ds
  3201.                 mov     ax,sel_pkt_buf
  3202.                 mov     si,msg_start
  3203.                 mov     es,sel_msg_buf
  3204.                 mov     ds,ax
  3205.  
  3206.                 mov     ax,pmorigin_node[si]
  3207.                 mov     es:morigin_node,ax
  3208.                 mov     ax,pmdest_node[si]
  3209.                 mov     es:mdest_node,ax
  3210.                 mov     ax,pmorigin_net[si]
  3211.                 mov     es:morigin_net,ax
  3212.                 mov     ax,pmdest_net[si]
  3213.                 mov     es:mdest_net,ax
  3214.                 mov     ax,pmattribute[si]
  3215.                 mov     es:mattribute,ax
  3216.                 mov     ax,pmcost[si]
  3217.                 mov     es:mcost,ax
  3218.                 add     si,offset pmdatetime
  3219.                 mov     di,offset mdatetime
  3220.  
  3221.                 call    eozs
  3222.  
  3223.         repnz   movsb
  3224.                 mov     di,dx
  3225.                 add     di,offset mtouser
  3226.                 inc     si
  3227.                 call    eozs
  3228.         repnz   movsb
  3229.                 mov     di,dx
  3230.                 add     di,offset mfromuser
  3231.                 inc     si
  3232.                 call    eozs
  3233.         repnz   movsb
  3234.                 mov     di,dx
  3235.                 add     di,offset msubject
  3236.                 inc     si
  3237.                 call    eozs
  3238.         repnz   movsb
  3239.                 mov     di,dx
  3240.                 inc     si
  3241.                 add     di,offset mtext
  3242.                 mov     ax,ds                   ;local data seg saved in ax
  3243.                 pop     ds
  3244.                 push    ds                      ;ds should now have true data
  3245.                 mov     cx,msg_length
  3246.                 sub     cx,si                   ;correct for header already done
  3247.                 add     cx,msg_start
  3248.                 mov     ds,ax
  3249.         rep     movsb
  3250.                 pop     ds
  3251.                 dec     di                      ;normal rep correction
  3252.                 mov     upmsg_length,di
  3253.                 inc     msg_counter
  3254.  
  3255. ;                mov     ax,debug_handle
  3256. ;                mov     handle,ax
  3257. ;                mov     ax,word ptr cur_pkt_file_ptr
  3258. ;                call    write_decf
  3259. ;                mov     ax,word ptr cur_pkt_file_ptr+2
  3260. ;                call    write_decf
  3261. ;                mov     ax,msg_counter
  3262. ;                call    write_decf
  3263.                 clc
  3264.                 ret
  3265.  
  3266. no_eom:
  3267. public no_eom
  3268.                 mov     ax,08001h               ;local error 1 eom not found
  3269.                 or      mail_flags,split_flag
  3270.                 stc
  3271.                 ret
  3272.  
  3273. ;is_netmail:
  3274. ;                push    ds
  3275. ;                pop     es
  3276. ;                ddata
  3277. ;                xor     dx,dx
  3278. ;                mov     ax,word ptr cur_pkt_file_ptr
  3279. ;                or      ax,word ptr cur_pkt_file_ptr+2
  3280. ;                jnz     gmsg1
  3281. ;                mov     ax,msg_start
  3282. ;                sub     ax,3
  3283. ;                mov     word ptr cur_pkt_file_ptr,ax
  3284. ;gmsg1:
  3285. ;                mov     ax,msg_length
  3286. ;                add     ax,2
  3287. ;                add     word ptr cur_pkt_file_ptr,ax
  3288. ;                adc     word ptr cur_pkt_file_ptr+2,dx
  3289. ;
  3290. ;                or      mail_flags,netmail_flag
  3291. ;
  3292. ;                stc
  3293. ;                ret
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300. get_packet:
  3301. public get_packet
  3302.                 mov     empty_pkt,0
  3303.                 mov     ax,sel_pkt_buf
  3304.                 and     ax,ax
  3305.                 jnz     x59
  3306.                 mov     ax,0ffffh
  3307.                 mdosallocseg sel_pkt_buf,no_share
  3308.                 jmp     short x60
  3309. x59:
  3310. ;n1:
  3311.                 mov     ax,pkt_path_end
  3312.                 mov     path_end,ax
  3313.                 mov     di,ax
  3314.                 push    ds
  3315.                 pop     es
  3316.                 jmp     short x61
  3317. x60:
  3318. ;n2:
  3319.                 mov     ax,pkt_path_end
  3320.                 and     ax,ax
  3321.                 jz      gpkt1
  3322.                 mov     di,path_end
  3323.                 jmp     short x61
  3324. gpkt1:
  3325.                 mov     si,offset netfile_path
  3326.                 mov     di,si
  3327.                 mov     ax,ds
  3328.                 mov     es,ax
  3329.                 call    eoz
  3330.                 mov     al,'\'
  3331.                 cmp     al,[di-1]
  3332.                 jz      y7
  3333.                 stosb
  3334. y7:
  3335.                 mov     path_end,di
  3336.                 mov     pkt_path_end,di
  3337. x61:
  3338. ;n3:
  3339.                 mov     si,offset packet_search
  3340.                 mov     cx,6
  3341.         rep     movsb
  3342.                 mov     dx,0                            ;search attribute
  3343.                 mov     search_handle,1
  3344.                  ;generic search handle
  3345.                 mov     di,36                           ;36 bytes/requested found
  3346.                 mov     max_find,1
  3347.                 push    ds
  3348.                 pop     word ptr doscall_inseg
  3349.                 mov     ax,offset netfile_path
  3350.                 mov     cx,ds
  3351.                 mov     si,offset find_buffer
  3352.                 mdosfindfirst
  3353.  
  3354.  
  3355.  
  3356.  
  3357.                 jnc     y11
  3358. ;                jmp     no_toss
  3359.                 ret
  3360. y11:
  3361.                 mov     byte ptr large_packet,0
  3362.                 mov     cx,find_buffer.ffile_size_hi
  3363.                 mov     word ptr pkt_size+2,cx
  3364.                 mov     ax,find_buffer.ffile_size
  3365.                 mov     word ptr pkt_size,ax
  3366.                 and     cx,cx
  3367.                 jnz     gpkt2
  3368.                 cmp     ax,100
  3369.                 jae     gpkt2
  3370.                 mov     empty_pkt,1
  3371. gpkt2:
  3372.                 and     cx,cx
  3373.                 jz      x62
  3374.                 mov     large_packet,1
  3375. x62:
  3376. ;l1:
  3377. ;                xor     cx,cx
  3378. ;                mov     bx,cx
  3379. ;                dec     bx
  3380. ;                sub     word ptr find_buffer.ffile_size,bx
  3381. ;
  3382. ;                sbb     word ptr find_buffer.ffile_size_hi,cx
  3383.                 lea     si,find_buffer.ffilename
  3384.                 mov     cl,find_buffer.flen_filename
  3385.                 xor     ch,ch
  3386.                 mov     di,path_end
  3387.                 push    ds
  3388.                 pop     es
  3389.                 cld
  3390.         rep     movsb
  3391.                 mov     al,0
  3392.                 stosb
  3393.                 mdosopen       netfile_path,open,fail
  3394.                 openerror      netfile_path,file_error
  3395.                 mov     ax,handle
  3396.                 mov     pkt_handle,ax
  3397.                 mov     ax,sel_pkt_buf
  3398.                 mov     doscall_inseg,ax
  3399.                 mov     si,0
  3400.                 test    byte ptr large_packet,0ffh
  3401.                 jz      x66
  3402.                 mov     cx,0ffffh
  3403. x63:
  3404. ;l5:
  3405.                 mov     current_read,cx
  3406. x64:
  3407. ;l3:
  3408.                 mdosRead
  3409.                 jnc     y8
  3410.                 jmp     error
  3411. y8:
  3412.                 add     si,result
  3413.                 cmp     cx,result
  3414.                 jz      short x65
  3415.                 sub     cx,result
  3416.                 jmp     short x64
  3417. x65:
  3418. ;l2:
  3419.                 push    si
  3420.                 mov     si,offset cur_pkt_file_ptr
  3421.                 xor     ax,ax
  3422.                 mov     [si],ax
  3423.                 mov     [si+2],ax
  3424.                 pop     si
  3425.                 clc
  3426.                 ret
  3427. x66:
  3428. ;l4:
  3429.                 mov     cx,find_buffer.ffile_size
  3430.                 jmp     short x63
  3431.  
  3432. ;e1:
  3433. ;                ret
  3434.  
  3435.  
  3436.  
  3437.  
  3438. get_header:
  3439.                 push    ds
  3440.                 mov     di,offset packet_hdr
  3441.                 mov     cx,offset packet_hdr_end
  3442.                 sub     cx,di
  3443.                 push    es
  3444.                 push    ds
  3445.                 pop     es
  3446.                 pop     ds
  3447.                 mov     ds,es:sel_pkt_buf
  3448.                 mov     si,0
  3449.         rep     movsb
  3450.                 pop     ds
  3451.                 ret
  3452.  
  3453.  
  3454. backup_to_eol:                  ;after a find_eol this adjusts si so that
  3455.                                 ;it is pointing at the CR
  3456. x66a:
  3457. ;l1:
  3458.                 dec     si
  3459.                 cmp     byte ptr [si],0dh
  3460.                 jnz     x66a
  3461.                 ret
  3462.  
  3463.  
  3464.  
  3465. xfer_path:
  3466.  
  3467.                 call    slen
  3468.                 mov     di,bx
  3469.         rep     movsb
  3470.                 mov     al,0
  3471.                 stosb
  3472.                 ret
  3473.  
  3474.  
  3475. slash_to_word:                  ;si points at string, temp_def_net has last net #
  3476.                                 ;and is updated if new found.
  3477.                                 ;Same with temp_def_zone.
  3478.                                 ;rets node in AX
  3479.                                 ;si points string+1(;dx carries temp_def_net value)
  3480.  
  3481.                 push    cx
  3482.                 push    si
  3483.                 call    sclength
  3484.                 pop     si
  3485.                 jc      has_zone
  3486. has_net:
  3487.                 test    ch,0ffh
  3488.                 jz      node
  3489.                 xor     ch,ch
  3490.                 call    dechex
  3491.  
  3492. ;***
  3493.                 push    ds
  3494.                 push    ss
  3495.                 pop     ds
  3496.  
  3497.                 mov     temp_def_net,ax
  3498.  
  3499.                 pop     ds
  3500.  
  3501.  
  3502.                 call    sclength
  3503. node:
  3504.                 push    ds
  3505.                 ddata
  3506.                 mov     bx,word ptr temp_def_zone
  3507.                 mov     dx,temp_def_net
  3508.                 pop     ds
  3509.                 push    si
  3510.                 call    sclength
  3511.                 pop     si
  3512.                 push    dx
  3513.                 call    dechex
  3514.                 pop     dx
  3515.                 inc     si
  3516.                 pop     cx
  3517.                 ret
  3518.  
  3519. has_zone:
  3520.                 push    cx
  3521.                 call    dechex
  3522.                 pop     cx
  3523.                 xor     ch,ch
  3524.                 add     si,cx
  3525.                 inc     si
  3526.                 push    ds
  3527.                 ddata
  3528.                 mov     temp_def_zone,al
  3529.                 pop     ds
  3530.                 push    si
  3531.                 call    sclength
  3532.                 pop     si
  3533.                 jmp     short has_net
  3534.  
  3535. public  slen
  3536. slen:                           ;si points at string, rets length of ascii string
  3537.                                 ;in cx. other regs unchanged.
  3538.                 push    si
  3539.                 xor     cx,cx
  3540. x67:
  3541. ;l1:
  3542.                 cmp     byte ptr [si],020h      ;space
  3543.                 jz      x68
  3544.                 cmp     byte ptr [si],9         ;tab
  3545.                 jz      x68
  3546.                 cmp     byte ptr [si],0dh       ;CR
  3547.                 jz      x68
  3548.                 cmp     byte ptr [si],0ah       ;lf
  3549.                 jz      x68
  3550.                 inc     si
  3551.                 inc     cl
  3552.                 jmp     short x67
  3553. x68:
  3554. ;l2:
  3555.                 pop     si
  3556.                 ret
  3557.  
  3558.  
  3559.  
  3560. public  dlen
  3561. dlen:                           ;si points at string, rets length of ascii string
  3562.                                 ;in cx. other regs unchanged.
  3563.                 push    di
  3564.                 xor     cx,cx
  3565. xd67:
  3566.                 cmp     byte ptr es:[di],020h      ;space
  3567.                 jz      xd68
  3568.                 cmp     byte ptr es:[di],9         ;tab
  3569.                 jz      xd68
  3570.                 cmp     byte ptr es:[di],0dh       ;CR
  3571.                 jz      xd68
  3572.                 cmp     byte ptr es:[di],0ah       ;lf
  3573.                 jz      xd68
  3574.                 inc     di
  3575.                 inc     cl
  3576.                 jmp     short xd67
  3577. xd68:
  3578.                 pop     di
  3579.                 ret
  3580.  
  3581.  
  3582.  
  3583.  
  3584. ;public  slength
  3585. ;slength:                        ;si points at string, rets end of string+1 in si
  3586. ;                                ;presence of slash in ch, # of  chars in cl
  3587. ;                                ;if slash present only chars before are counted
  3588. ;
  3589. ;                xor     cx,cx
  3590. ;x69:
  3591. ;;l1:
  3592. ;                cmp     byte ptr [si],020h      ;space
  3593. ;                jz      x70
  3594. ;                cmp     byte ptr [si],9         ;tab
  3595. ;                jz      x70
  3596. ;                cmp     byte ptr [si],0dh       ;CR
  3597. ;                jz      x70
  3598. ;                cmp     byte ptr [si],0ah       ;lf
  3599. ;                jz      x70
  3600. ;                cmp     byte ptr [si],'/'
  3601. ;                jne     y9
  3602. ;                mov     ch,1
  3603. ;y9:
  3604. ;                jz      x70
  3605. ;                inc     si
  3606. ;                inc     cl
  3607. ;                jmp     short x69
  3608. ;x70:
  3609. ;;l2:
  3610. ;                inc     si
  3611. ;                clc
  3612. ;                ret
  3613.  
  3614.  
  3615. sclength:                       ;si points at string, rets end of string+1 in si
  3616.                                 ;presence of slash in ch, # of  chars in cl
  3617.                                 ;if slash present only chars before are counted
  3618.                                 ;presence of colon in carry
  3619.                 xor     cx,cx
  3620. x69:
  3621. ;l1:
  3622.                 cmp     byte ptr [si],020h      ;space
  3623.                 jz      x70
  3624.                 cmp     byte ptr [si],9         ;tab
  3625.                 jz      x70
  3626.                 cmp     byte ptr [si],0dh       ;CR
  3627.                 jz      x70
  3628.                 cmp     byte ptr [si],0ah       ;lf
  3629.                 jz      x70
  3630.                 cmp     byte ptr [si],':'
  3631.                 jz      x260
  3632.                 cmp     byte ptr [si],'/'
  3633.                 jne     y9
  3634.                 mov     ch,1
  3635. y9:
  3636.                 jz      x70
  3637.                 inc     si
  3638.                 inc     cl
  3639.                 jmp     short x69
  3640. x70:
  3641. ;l2:
  3642.                 inc     si
  3643.                 clc
  3644.                 ret
  3645. x260:
  3646.                 stc
  3647.                 ret
  3648.  
  3649.  
  3650.  
  3651. ;
  3652. ;public  dlength
  3653. ;dlength:                        ;es:di points at string, rets end of string+1 in di
  3654. ;                                ;presence of slash in ch, # of  chars in cl
  3655. ;                                ;if slash present only chars before are counted
  3656. ;
  3657. ;                xor     cx,cx
  3658. ;x71:
  3659. ;;l1:
  3660. ;                cmp     byte ptr es:[di],020h      ;space
  3661. ;                jz      x72
  3662. ;                cmp     byte ptr es:[di],9         ;tab
  3663. ;                jz      x72
  3664. ;                cmp     byte ptr es:[di],0dh       ;CR
  3665. ;                jz      x72
  3666. ;                cmp     byte ptr es:[di],0ah       ;lf
  3667. ;                jz      x72
  3668. ;                cmp     byte ptr es:[di],'/'
  3669. ;                jne     y10
  3670. ;                mov     ch,1
  3671. ;y10:
  3672. ;                jz      x72
  3673. ;                inc     di
  3674. ;                inc     cl
  3675. ;                jmp     short x71
  3676. ;x72:
  3677. ;;l2:
  3678. ;                inc     di
  3679. ;                ret
  3680. ;
  3681. sstart:
  3682. public sstart
  3683.                 cmp     byte ptr [si],020h
  3684.                 jz      x73
  3685.                 cmp     byte ptr [si],0h
  3686.                 jz      x73
  3687.                 cmp     byte ptr [si],09h
  3688.                 jz      x73
  3689.                 cmp     byte ptr [si],0dh
  3690.                 jz      x75
  3691.                 cmp     byte ptr [si],'\'
  3692.                 jz      x73a
  3693.  
  3694.                 jmp     short x74
  3695. x73:
  3696. ;l1:
  3697.                 inc     si
  3698.                 jmp     short sstart
  3699. x73a:
  3700.                 add     si,3
  3701.                 jmp     short sstart
  3702.  
  3703.  
  3704. x74:
  3705. ;l2:
  3706.                 clc
  3707.                 ret
  3708. x75:
  3709. ;l3:
  3710.                 stc
  3711.                 ret
  3712. ;dstart:
  3713. ;public dstart
  3714. ;                cmp     byte ptr es:[di],020h
  3715. ;                jz      xd73
  3716. ;                cmp     byte ptr es:[di],0h
  3717. ;                jz      xd73
  3718. ;                cmp     byte ptr es:[di],09h
  3719. ;                jz      xd73
  3720. ;                cmp     byte ptr es:[di],0dh
  3721. ;                jz      xd75
  3722. ;                jmp     short xd74
  3723. ;xd73:
  3724. ;;l1:
  3725. ;                inc     si
  3726. ;                jmp     short dstart
  3727. ;
  3728. ;xd74:
  3729. ;;l2:
  3730. ;                clc
  3731. ;                ret
  3732. ;xd75:
  3733. ;;l3:
  3734. ;                stc
  3735. ;                ret
  3736. ;
  3737. public  find_eol
  3738. find_eol:               ;ds:si in line, rets with si pointing at 1st char of
  3739.                         ;the next line. other regs preserved (lf's ignored)
  3740.                 push    ax
  3741.                 push cx
  3742.                 push di
  3743.                 push es
  3744.                 mov     ax,ds
  3745.                 mov     es,ax
  3746.                 mov     di,si
  3747.                 mov     al,0dh
  3748.                 mov     cx,512
  3749.         repnz   scasb
  3750.                 inc     di
  3751.                 mov     al,0ah
  3752.                 cmp     al,[si]
  3753.                 jnz     x76
  3754.                 inc     di
  3755. x76:
  3756. ;l1:
  3757.                 mov     si,di
  3758.                 pop     es
  3759.                 pop     di
  3760.                 pop     cx
  3761.                 pop     ax
  3762.                 ret
  3763.  
  3764. find_config_line:               ;ds:si in config file segment. Rets sith SI
  3765.                                 ;pointing at start of next valid line
  3766. x77:
  3767. ;l1:
  3768.                 call    find_eol
  3769.                 cmp     byte ptr[si],0
  3770.                 jz      x78
  3771.                 cmp     byte ptr[si],'#'
  3772.                 jz      x77
  3773.                 cmp     byte ptr[si],' '
  3774.                 je      x78
  3775.                 cmp     byte ptr[si],'0'
  3776.                 jb      x77
  3777.                 cmp     byte ptr[si],'z'
  3778.                 ja      x77
  3779. x78:
  3780. ;l2:
  3781.                 ret
  3782.  
  3783. public  search_for
  3784. ;search_forz:                     ;searches ds:si to limit cx for asciiz string
  3785. ;                                ;by es:di. rets carry if not found, or si
  3786. ;                                ;pointing to start of string if found
  3787. ;                                ;search is forward if ax=01h search is from end
  3788. ;                                ;toward the start of ds:si if ax=-1
  3789. ;                push    ax
  3790. ;                push dx
  3791. ;                mov     dx,di
  3792. ;x79:
  3793. ;;l3:
  3794. ;                push    si
  3795. ;
  3796. ;x80:
  3797. ;;l1:
  3798. ;                cmpsb
  3799. ;
  3800. ;                jnz     not_yet
  3801. ;x81:
  3802. ;;l2:
  3803. ;                test    byte ptr es:[di],0ffh
  3804. ;                jz      maybe_found
  3805. ;                cmpsb
  3806. ;
  3807. ;                jz      x81
  3808. ;not_yet:
  3809. ;                pop     si
  3810. ;                mov     di,dx
  3811. ;                add     si,ax
  3812. ;                cmp     si,cx
  3813. ;                je      not_here
  3814. ;                jmp     short x79
  3815. ;found:
  3816. ;                pop     si
  3817. ;                pop     dx
  3818. ;                pop     ax
  3819. ;                clc
  3820. ;                ret
  3821. ;not_here:
  3822. ;                pop     dx
  3823. ;                pop     ax
  3824. ;                stc
  3825. ;                ret
  3826. ;
  3827. ;maybe_found:
  3828. ;                cmp     byte ptr [si],0
  3829. ;                jnz     not_yet
  3830. ;                jmp     found
  3831.  
  3832. search_for:                     ;searches ds:si to limit cx for asciiz string
  3833.                                 ;by es:di. rets carry if not found, or si
  3834.                                 ;pointing to start of string if found
  3835.                                 ;search is forward if ax=01h search is from end
  3836.                                 ;toward the start of ds:si if ax=-1
  3837.                 push    ax
  3838.                 push dx
  3839.                 mov     dx,di
  3840. x79:
  3841. ;l3:
  3842.                 push    si
  3843.  
  3844. x80:
  3845. ;l1:
  3846.                 cmpsb
  3847.  
  3848.                 jnz     not_yet
  3849. x81:
  3850. ;l2:
  3851.                 test    byte ptr es:[di],0ffh
  3852.                 jz      found
  3853.                 cmpsb
  3854.  
  3855.                 jz      x81
  3856. not_yet:
  3857.                 pop     si
  3858.                 mov     di,dx
  3859.                 add     si,ax
  3860.                 cmp     si,cx
  3861.                 je      not_here
  3862.                 jmp     short x79
  3863. found:
  3864.                 pop     si
  3865.                 pop     dx
  3866.                 pop     ax
  3867.                 clc
  3868.                 ret
  3869. not_here:
  3870.                 pop     dx
  3871.                 pop     ax
  3872.                 stc
  3873.                 ret
  3874.  
  3875.  
  3876. public  delete_cx_chars
  3877. delete_cx_chars:                ;es:di -> 1st char to remove, cx is # to remove
  3878.                                 ;dx is the offset of the end of the text.
  3879.                                 ;di rets w/ the new offset of the eot
  3880.                                 ;dx and cx undefined.
  3881.                 push    si
  3882.                 push ds
  3883.                 mov     si,di
  3884.                 push    es
  3885.                 pop     ds
  3886.                 mov     si,di
  3887.                 add     si,cx
  3888.                 sub     dx,di
  3889.                 sub     dx,cx
  3890.                 mov     cx,dx
  3891.  
  3892.         rep     movsb
  3893.                 pop     ds
  3894.                 pop     si
  3895.                 ret
  3896.  
  3897. public  eoz
  3898. eoz:                    ;rec start of asciiz in es:di. on exit di points at
  3899.                         ;the zero. length in cx
  3900.                 push    di
  3901.                 mov     al,0
  3902.                 mov     cx,80h
  3903.                 cld
  3904.         repnz   scasb
  3905.                 dec     di
  3906.                 mov     cx,di
  3907.                 pop     ax
  3908.                 sub     cx,ax
  3909.                 ret
  3910.  
  3911.  
  3912.  
  3913.  
  3914. public  eozs
  3915. eozs:                   ;rec start of asciiz in ds:si.
  3916.                         ;rets length in cx
  3917.                 push    si
  3918.                 xdses
  3919.                 xchg    di,si
  3920.                 call    eoz
  3921.                 xchg    di,si
  3922.                 xdses
  3923.                 pop     si
  3924.                 ret
  3925.  
  3926.  
  3927.  
  3928.  
  3929. mov_cur_path_to_data:           ;takes the pathline from the areas buffer and
  3930.                                 ;moves it to local data
  3931.                                 ; assures ending in '\',
  3932.                                 ;and assures a '0' terminator. places offset of
  3933.                                 ;the 0 in cur_ar_path_end.
  3934.                                 ;entered with ds=true data, cur_path_line valid.
  3935.                                 ;on ret es=sel_areas, ax, dx, si trashed
  3936.                 mov     ax,sel_areas
  3937.                 mov     es,ax
  3938.                 mov     di,current_path
  3939.                 push    di
  3940.                 call    eoz
  3941.                 pop     si
  3942.                 mov     di,offset scratch_path
  3943.                 xdses
  3944.         rep     movsb
  3945.                 mov     al,'\'
  3946.                 cmp     al,[di-1]
  3947.                 jz      x82
  3948.                 stosb
  3949. x82:
  3950. ;l1:
  3951.                 mov     al,0
  3952.                 stosb
  3953.                 dec     di
  3954.                 xdses
  3955.                 mov     cur_ar_path_end,di
  3956.                 ret
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964. public  get_msg_high
  3965. get_msg_high:
  3966.                 call    names
  3967.  
  3968.                 jnc     x83
  3969.  
  3970.                 call    make_msg1
  3971.                 mov     word ptr highest_msg,1
  3972.                 ret
  3973.  
  3974. x83:
  3975. ;l1:
  3976.                 push    ds
  3977.                 mov     cx,max_find
  3978.                 mov     ds,sel_names
  3979.                 push    ds
  3980.                 pop     es
  3981.  
  3982.                 push    cx
  3983.                 call    name_num
  3984.                 pop     cx
  3985.                 mov     si,8000h        ;point it at the start of the list just made
  3986.                 call    highest
  3987.                 pop     ds
  3988.                 mov     highest_msg,bx
  3989.                 ret
  3990.  
  3991.  
  3992. public  clean_buffer
  3993. clean_buffer:                   ;rec the buffer start in es:di and the length
  3994.                                 ;to clean in cx. rets with the buffer all 0h.
  3995.  
  3996.                 push    ax
  3997.                 push di
  3998.                 mov     ax,0
  3999.                 cld
  4000.         rep     stosb
  4001.                 pop     di
  4002.                 pop     ax
  4003.                 ret
  4004.  
  4005.  
  4006. public  clean_wbuffer
  4007. clean_wbuffer:                  ;buffer must start on word boundary
  4008.                                 ;rec the buffer start in es:di and the length
  4009.                                 ;to clean in cx. in bytes.
  4010.                                 ;rets with the buffer all 0h.
  4011.  
  4012.                 push    ax
  4013.                 push di
  4014.                 mov     ax,0
  4015.                 cld
  4016.         rep     stosb
  4017.                 pop     di
  4018.                 pop     ax
  4019.                 ret
  4020.  
  4021.  
  4022. public  Strip_CRs
  4023. Strip_CRs:                      ;removes the CR or CRLF's from the string
  4024.                                 ;-> by es:di to limit of dx.
  4025.                                 ;ax,cx,di trashed. New end in dx
  4026.                 mov     al,0dh
  4027. x84:
  4028. ;l1:
  4029.                 scasb
  4030.                 jnz     x85
  4031.                 call    SCR
  4032. x85:
  4033. ;l2:
  4034.                 cmp     di,dx
  4035.                 jb      y12
  4036.                 ret
  4037. y12:
  4038.                 jmp     short x84
  4039.  
  4040.  
  4041.  
  4042. SCR:
  4043.                 push    di
  4044.                 dec     di
  4045.                 mov     cx,1
  4046.                 cmp     byte ptr es:[di+1],0ah
  4047.                 jnz     x86
  4048.                 inc     cx
  4049. x86:
  4050. ;l3:
  4051.                 call    delete_cx_chars
  4052.                 mov     dx,di
  4053.                 pop     di
  4054.                 ret
  4055.  
  4056.  
  4057. public  name_num
  4058. name_num:                       ;enters w/ ds:si -> at start of dosfindfirst
  4059.                                 ;generated file list of cx entries.
  4060.                                 ;es and ds -> to a segment 2*cx longer than
  4061.                                 ;8000h. On ret there are cx words of filenames
  4062.                                 ;converted to hex beginning at 8000h
  4063.                 mov     ah,0
  4064.                 mov     al,'.'
  4065.                 mov     si,0
  4066.                 mov     di,8000h
  4067. x87:
  4068. ;l1:
  4069.                 call    one_name
  4070.                 dec     cx
  4071.                 jz      x88
  4072.                 jmp     short x87
  4073. x88:
  4074. ;f1:
  4075.                 ret
  4076.  
  4077.  
  4078. public  highest
  4079. highest:                        ;rets w/ highest of cx numbers -> to by ds:si
  4080.                                 ;hexvalue is returned in BX
  4081.                 xor     bx,bx
  4082. x89:
  4083. ;l2:
  4084.                 lodsw
  4085.                 cmp     ax,bx
  4086.                 jb      x90
  4087.                 mov     bx,ax
  4088. x90:
  4089. ;l1:
  4090.                 dec     cx
  4091.                 jnz     x89
  4092.                 ret
  4093.  
  4094.  
  4095.  
  4096. one_name:                     ;rets with si->at next structure, . replaced w/ 0
  4097.                               ;dx trashed.
  4098.                               ;ax reloaded,numeric value entered at di,
  4099.                               ;and di updated
  4100.  
  4101.                 add     si,offset ffilename
  4102.                 push    di
  4103.                 push cx
  4104.                 mov     di,si
  4105.                 mov     cl,byte ptr[si-1]
  4106.                 xor     ch,ch
  4107.                 mov     dx,cx
  4108.                 add     dx,si
  4109.                 mov     di,si
  4110.         repnz   scasb
  4111.                 mov     byte ptr[di-1],ah
  4112.                 sub     di,si
  4113.                 mov     cx,di
  4114.                 dec     cx
  4115.                 call    dechex
  4116.                 pop     cx
  4117.                 pop     di
  4118.                 stosw
  4119.                 mov     si,dx
  4120.                 inc     si
  4121.                 mov     ax,002eh
  4122.                 ret
  4123.  
  4124.  
  4125. public  Get_next_packet
  4126. Get_next_packet:
  4127.                 mov     ax,pkt_handle
  4128.                 mdosclose
  4129.                 push    ds
  4130.                 push offset netfile_path
  4131.                 xor     ax,ax
  4132.                 push    ax
  4133.                 push    ax
  4134.                 call    DosDelete
  4135.                 mov     no_more_pkts,0
  4136.  
  4137.                 call    get_packet
  4138.                 jnc     gnp1
  4139.                 mov     no_more_pkts,1
  4140. gnp1:
  4141.                 ret
  4142.  
  4143.  
  4144. public  load_more_packet
  4145. load_more_packet:
  4146.                 mov     di,offset cur_pkt_file_ptr
  4147.                 mov     si,offset pkt_size
  4148.                 mov     ax,[di]
  4149.                 mov     dx,[di+2]
  4150.                 mov     cx,[si+2]
  4151.                 mov     bx,[si]
  4152.                 add     ax,4
  4153.                 adc     dx,0
  4154.                 sub     bx,ax
  4155.                 sbb     cx,dx
  4156.                 jc      x93
  4157.                 and     cx,cx
  4158.                 mov     cx,0ffffh
  4159.                 jnz     x92
  4160.                 mov     cx,bx
  4161.                 add     cx,4
  4162.                 mov     byte ptr large_packet,0
  4163. x92:
  4164. ;l1:
  4165.                 push    cx
  4166.                 mov     si,offset cur_pkt_file_ptr
  4167.                 ;;EXPAND: lodad
  4168. lodsw
  4169. mov dx,ax
  4170. lodsw
  4171. xchg dx,ax
  4172.                 mov     bx,ax
  4173.                 mov     ax,pkt_handle
  4174.                 mov     handle,ax
  4175.                 mov     cx,0
  4176.                 ;;EXPAND: m8doschgfileptr cur_pkt_file_ptr
  4177. push ax
  4178. push dx
  4179. push bx
  4180. push cx
  4181. mov  ax,offset cur_pkt_file_ptr
  4182. push ds
  4183. push ax
  4184. call DosChgFilePtr
  4185. ;;EXPAND: error_check
  4186. clc
  4187. and ax,ax
  4188. jz m16
  4189. stc
  4190. m16:
  4191.  
  4192.                 mov     ax,sel_pkt_buf
  4193.                 mov     es,ax
  4194.                 mov     doscall_inseg,ax
  4195.                 mov     si,0
  4196.                 pop     cx
  4197.                 mdosread
  4198.                 mov     cx,result
  4199.                 mov     current_read,cx
  4200.                 clc
  4201.                 ret
  4202.  
  4203. x93:
  4204. ;f1:
  4205.                 stc
  4206.                 ret
  4207.  
  4208. public  Make_msg1
  4209. Make_msg1:
  4210.                 push    highest_msg
  4211.                 mov     highest_msg,0
  4212.                 call    make_msg_pathname
  4213.  
  4214.  
  4215.  
  4216.                 mdosopen        scratch_path,replace,create
  4217.                 openerror       scratch_path,file_error
  4218.                 mov     ax,handle
  4219.                 mov     cx,msg1_end-msg1
  4220.                 mov     si,offset msg1
  4221.  
  4222.                 ;;EXPAND: m8doswrite ds,results
  4223. push ax
  4224. push ds
  4225. push si
  4226. push cx
  4227. push ds
  4228. push offset results
  4229. call doswrite
  4230. ;;EXPAND: error_check
  4231. clc
  4232. and ax,ax
  4233. jz m19
  4234. stc
  4235. m19:
  4236.  
  4237.                 mov     ax,handle
  4238.  
  4239.                 mdosclose
  4240.                 pop     highest_msg
  4241.                 inc     highest_msg
  4242.                 ret
  4243.  
  4244. print_tossing:
  4245. ;                push    di
  4246. ;                push    si
  4247. ;                ;;EXPAND: prt     vmsg_dot
  4248. ;mov di,offset vmsg_dot
  4249. ;call print_asciiz
  4250. ;                pop     si
  4251. ;                pop     di
  4252. ;                ret
  4253.                 push    ax
  4254.                 push    bx
  4255.                 push    cx
  4256.                 push    dx
  4257.                 push    di
  4258.                 push    si
  4259.                 push    es
  4260.                 and     area_changed,0ffh
  4261.                 jz      pt1
  4262.                 pcrlf
  4263. pt1:
  4264.                 prt     cr_only
  4265.                 prt     vmsg_toss_num
  4266. ;                prt     scratch_path
  4267. ;                pcrlf
  4268.                 mov     ax,highest_msg
  4269.                 call    disp_dec
  4270.                 prt     space2
  4271. ;                ;;EXPAND: prt     vmsg_to_area
  4272. mov di,offset vmsg_to_area
  4273. call print_asciiz
  4274. ;                mov     di,offset current_area
  4275. ;                call    print_asciiz
  4276. ;                pcrlf
  4277.                 prt scratch_path
  4278.                 pop     es
  4279.                 pop     si
  4280.                 pop     di
  4281.                 pop     dx
  4282.                 pop     cx
  4283.                 pop     bx
  4284.                 pop     ax
  4285.                 ret
  4286.  
  4287.  
  4288. comp_strings:                   ;comps strings ds:si with es:di to length cx
  4289.  
  4290.                 push    di
  4291.                 push    si
  4292.         repz    cmpsb
  4293.                 and     cx,cx
  4294.                 pop     si
  4295.                 pop     di
  4296.                 ret
  4297.  
  4298.  
  4299. ;ERRORS
  4300.  
  4301. file_error:
  4302.                 ddata
  4303.                 edata
  4304.                 push    ax
  4305.                 cmp     ax,0deh
  4306.                 jb      fc1
  4307.                 mov     ax,0deh
  4308. fc1:
  4309.                 shl     ax,1
  4310.                 mov     bx,ax
  4311.                 pop     ax
  4312.                 push    si
  4313.                 mov     si,offset err_index
  4314.                 mov     di,[si+bx]
  4315.                 call    print_asciiz
  4316.                 pcrlf
  4317.                 pop     di
  4318.                 call    print_asciiz
  4319.                 jmp     terminate
  4320.  
  4321.  
  4322. dos_error:
  4323.                 push    ds
  4324.                 push    es
  4325.                 push    si
  4326.                 push    di
  4327.                 ddata
  4328.                 edata
  4329.                 push    ax
  4330.                 cmp     ax,0deh
  4331.                 jb      fc1
  4332.                 mov     ax,0deh
  4333. de1:
  4334.                 shl     ax,1
  4335.                 mov     bx,ax
  4336.                 pop     ax
  4337.                 push    si
  4338.                 mov     si,offset err_index
  4339.                 mov     di,[si+bx]
  4340.                 call    print_asciiz
  4341.                 pcrlf
  4342.                 pop     di
  4343.                 call    print_asciiz
  4344.                 pop     di
  4345.                 pop     si
  4346.                 pop     es
  4347.                 pop     ds
  4348.  
  4349.  
  4350.  
  4351. no_toss:
  4352.                 pcrlf
  4353.                 prt     vmsg_allpkts
  4354.                 pcrlf
  4355.                 jmp     terminate
  4356. public no_such_area
  4357. no_such_area:
  4358.                 push    ds
  4359.                 push    _data
  4360.                 pop     ds
  4361.                 prt     ermsg_no_area
  4362.                 mov     di,offset current_area
  4363.                 call    print_asciiz
  4364.                 pcrlf
  4365.                 jmp     bad1
  4366. error:
  4367. Bad_msg:
  4368. ;                push    ds
  4369.                 push    _data
  4370.                 pop     ds
  4371.                 mov     sp,stack_start
  4372.                 mov     di,offset crlf
  4373.                 call    print_asciiz
  4374.                 prt     ermsg_bad_msg
  4375.                 mov     di,offset current_area
  4376.                 call    print_asciiz
  4377.                 pcrlf
  4378. bad1:
  4379.                 call    it_is_bad
  4380.                 mov     di,offset current_area
  4381.                 xor     al,al
  4382.                 stosb
  4383. ;                pop     ds
  4384.                 jmp     throw_this_msg
  4385.  
  4386. too_long:
  4387.  
  4388. load_dupes:                     ;loads the dupe file into the dupes_list area
  4389.                 push    ds
  4390.                 push    es
  4391.                 push    di
  4392.                 push    si
  4393.                 mov     ax,_data
  4394.                 mov     ds,ax
  4395.                 mov     es,ax
  4396.                 mov     di,cur_ar_path_end
  4397.                 mov     si,offset dupes_file
  4398.                 call    eozs
  4399.                 inc     cx
  4400.         rep     movsb
  4401.                 mdosopen       scratch_path,open,create
  4402.                 jc      x95
  4403.                 mov     ax,handle
  4404.                 mov     dupes_handle,ax
  4405.                 test    result,2
  4406.                 jnz     x94
  4407.                 push    ds
  4408.                 pop     word ptr doscall_inseg
  4409.                 mov     si,offset dupes_list
  4410.                 mov     cx,dupes_num
  4411.                 shl     cx,2
  4412.                 mdosread
  4413.                 clc
  4414. x94:
  4415. ;l1:
  4416.                 pop     si
  4417.                 pop     di
  4418.                 pop     es
  4419.                 pop     ds
  4420.                 ret
  4421.  
  4422. x95:
  4423. ;l2:             stc
  4424.                 jmp     short x94
  4425.  
  4426.  
  4427. write_dupes:                    ;writes dupes_list to dupes_file and closes it
  4428.  
  4429.                 mov     ax,dupes_handle
  4430.                 and     ax,ax
  4431.                 jnz     wd1
  4432.                 jmp     wd_end
  4433. wd1:
  4434.                 xor     bx,bx
  4435.                 mov     dx,bx
  4436.                 mov     cx,bx
  4437.                 ;;EXPAND: m8doschgfileptr
  4438. push ax
  4439. push dx
  4440. push bx
  4441. push cx
  4442. mov ax,offset cur_file_ptr
  4443. push ds
  4444. push ax
  4445. call DosChgFilePtr
  4446. ;;EXPAND: error_check
  4447. clc
  4448. and ax,ax
  4449. jz m23
  4450. stc
  4451. m23:
  4452.  
  4453.                 mov     cx,dupes_num
  4454.                 shl     cx,2
  4455.                 add     cx,offset dupes_list    ;this is the end of the list
  4456.                 sub     cx,dupes_ptr
  4457.                 mov     ax,dupes_handle
  4458.                 mov     si,dupes_ptr
  4459.                 push    ds
  4460.                 pop     word ptr doscall_inseg
  4461.                 ;;EXPAND: m8doswrite doscall_inseg,results
  4462. push ax
  4463. push word ptr doscall_inseg
  4464. push si
  4465. push cx
  4466. push ds
  4467. push offset results
  4468. call doswrite
  4469. ;;EXPAND: error_check
  4470. clc
  4471. and ax,ax
  4472. jz m24
  4473. stc
  4474. m24:
  4475.                 mov     ax,dupes_handle
  4476.                 mov     cx,dupes_ptr
  4477.                 mov     si,offset dupes_list
  4478.                 sub     cx,si
  4479.                 ;;EXPAND: m8doswrite      doscall_inseg,results
  4480. push ax
  4481. push word ptr doscall_inseg
  4482. push si
  4483. push cx
  4484. push ds
  4485. push offset results
  4486. call doswrite
  4487. ;;EXPAND: error_check
  4488. clc
  4489. and ax,ax
  4490. jz m25
  4491. stc
  4492. m25:
  4493.                 mov     ax,dupes_handle
  4494.                 mdosclose
  4495. wd_end:
  4496.                 ret
  4497.  
  4498. public  comp_crc
  4499. comp_crc:               ;rec a value in dx-ax. Comps this with each entry
  4500.                         ;in dupes_list. If matched rets a carry
  4501.                 push    si
  4502.                 mov     cx,dupes_num
  4503.                 mov     si,offset dupes_list
  4504.  
  4505. x96:
  4506. ;l2:
  4507.                 cmp     ax,[si]
  4508.                 jnz     x97
  4509.                 cmp     dx,[si+2]
  4510.                 jnz     x97
  4511.                 stc
  4512.                 pop     si
  4513.                 ret
  4514. x97:
  4515. ;l1:
  4516.                 add     si,4
  4517.                 dec     cx
  4518.                 jnz     x96
  4519.                 clc
  4520.                 pop     si
  4521.                 ret
  4522.  
  4523. add_crc:
  4524.                 push    di
  4525.                 mov     di,dupes_ptr
  4526.                 mov     [di],ax
  4527.                 mov     [di+2],dx
  4528.                 add     di,4
  4529.                 mov     cx,dupes_num
  4530.                 shl     cx,2
  4531.                 add     cx,offset dupes_list
  4532.                 cmp     di,cx
  4533.                 jb      x98
  4534.                 mov     di,offset dupes_list
  4535. x98:
  4536. ;l1:
  4537.                 mov     dupes_ptr,di
  4538.                 pop     di
  4539.                 ret
  4540.  
  4541. make_crc:
  4542.                 mov     es,sel_msg_buf
  4543.                 mov     di,0
  4544.                 mov     ax,0ffffh
  4545.                 mov     dx,ax
  4546.                 mov     cx,164
  4547.                 call    do_crc32
  4548.                 ret
  4549.  
  4550. crc_main:                       ;generates the new crc, checks it against the
  4551.                                 ;dupes list and installs it if it's new.
  4552.                                 ;rets a carry if it's a dupe. no entry or
  4553.                                 ;exit parameters.
  4554.                 push    es
  4555.                 push ds
  4556.                 push si
  4557.                 push di
  4558.                 ;;EXPAND: ddata
  4559. push _data
  4560. pop  ds
  4561.                 call    make_crc
  4562.                 call    comp_crc
  4563.                 jc      x99
  4564.                 call    add_crc
  4565.                 clc
  4566. x99:
  4567. ;l1:
  4568.                 pop     di
  4569.                 pop si
  4570.                 pop ds
  4571.                 pop     es
  4572.                 ret
  4573.  
  4574.  
  4575. add_t_area:
  4576.                 mov     di,toss_ptr
  4577.                 mov     si,offset current_area
  4578.                 call    eozs
  4579.         rep     movsb
  4580.                 mov     al,0dh
  4581.                 stosb
  4582.                 mov     al,0ah
  4583.                 stosb
  4584.                 mov     toss_ptr,di
  4585.                 ret
  4586.  
  4587. comp_t_area:
  4588.                 push    ds
  4589.                 push    es
  4590.                 push    di
  4591.                 push    si
  4592.                 mov     ax,seg _data
  4593.                 mov     ds,ax
  4594.                 mov     es,ax
  4595.                 mov     di,offset current_area
  4596.                 mov     si,offset toss_list
  4597.                 mov     cx,si
  4598.                 add     cx,8000
  4599.                 mov     ax,1
  4600.                 call    search_for
  4601.                 jnc     x100
  4602.                 call    add_t_area
  4603. x100:
  4604. ;l1:
  4605.                 pop     si
  4606.                 pop di
  4607.                 pop es
  4608.                 pop     ds
  4609.                 ret
  4610.  
  4611. write_t_area:
  4612.                 mdosopen       echo_toss,open,create
  4613.                 openerror      echo_toss,file_error
  4614.                 mov     ax,handle
  4615.                 push    ax
  4616.                 mov     bx,0
  4617.                 mov     dx,bx
  4618.                 mov     cx,2            ;append to end of file
  4619.                 ;;EXPAND: m8doschgfileptr
  4620. push ax
  4621. push dx
  4622. push bx
  4623. push cx
  4624. mov ax,offset cur_file_ptr
  4625. push ds
  4626. push ax
  4627. call DosChgFilePtr
  4628. ;;EXPAND: error_check
  4629. clc
  4630. and ax,ax
  4631. jz m28
  4632. stc
  4633. m28:
  4634.                 pop     ax
  4635.                 push    ax
  4636.                 push    ds
  4637.                 pop     word ptr doscall_inseg
  4638.                 mov     cx,toss_ptr
  4639.                 sub     cx,offset toss_list
  4640.                 mov     si,offset toss_list
  4641.                 ;;EXPAND: m8doswrite      doscall_inseg,results
  4642. push ax
  4643. push word ptr doscall_inseg
  4644. push si
  4645. push cx
  4646. push ds
  4647. push offset results
  4648. call doswrite
  4649. ;;EXPAND: error_check
  4650. clc
  4651. and ax,ax
  4652. jz m29
  4653. stc
  4654. m29:
  4655.                 pop     ax
  4656.                 mdosclose
  4657.                 ret
  4658.  
  4659.  
  4660. write_decf:
  4661.                 push    ax
  4662.                 push    bx
  4663.                 push    cx
  4664.                 push    dx
  4665.                 push    di
  4666.                 push    si
  4667.                 push    ds
  4668.                 push    es
  4669.                 push    _data
  4670.                 pop     ds
  4671.                 push    ds
  4672.                 pop     es
  4673.                 mov     di,offset scratch_ascii
  4674.                 mov     dx,ax
  4675.                 call    dx_to_ascii
  4676.                 mov     ax,20h
  4677.                 stosb
  4678.                 stosb
  4679.                 mov     al,0dh
  4680.                 stosb
  4681.                 mov     al,0ah
  4682.                 stosb
  4683.                 mov     ax,word ptr handle
  4684.                 mov     cx,8
  4685.                 mov     si,offset scratch_ascii
  4686.                 push    ds
  4687.                 pop     word ptr doscall_inseg
  4688.  
  4689.                                 ;;EXPAND: m8doswrite      doscall_inseg,results
  4690. push ax
  4691. push word ptr doscall_inseg
  4692. push si
  4693. push cx
  4694. push ds
  4695. push offset results
  4696. call doswrite
  4697. ;;EXPAND: error_check
  4698. clc
  4699. and ax,ax
  4700. jz m31
  4701. stc
  4702. m31:
  4703.  
  4704.                 pop     es
  4705.                 pop     ds
  4706.                 pop     si
  4707.                 pop     di
  4708.                 pop     dx
  4709.                 pop     cx
  4710.                 pop     bx
  4711.                 pop     ax
  4712.                 ret
  4713.  
  4714.  
  4715.  
  4716.  
  4717.  
  4718.  
  4719.                 mov     di,offset hex_buff
  4720.                 call    print_asciiz
  4721.                 pop     di
  4722.                 pop     es
  4723.                 ret
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729. disp_dec:               ;displays the hex number in ax as a decimal at the
  4730.                         ;current cursor position.
  4731.                 push    es
  4732.                 push    di
  4733.                 call    hexdec
  4734.  
  4735.                 push    ax
  4736.                 mov     ax,ds
  4737.                 mov     es,ax
  4738.                 mov     di,offset hex_buff
  4739.                 mov     ah,20h
  4740.                 mov     al,bh
  4741.                 and     al,al
  4742.                 jnz     kd10
  4743.                 mov     al,ah
  4744. kd10:
  4745.                 stosb
  4746.                 mov     al,bl
  4747.                 and     al,al
  4748.                 jnz     kd1
  4749.                 mov     al,ah
  4750. kd1:
  4751.                 stosb
  4752.                 mov     al,dh
  4753.                 and     al,al
  4754.                 jnz     hundd
  4755.                 mov     al,ah
  4756. hundd:
  4757.                 stosb
  4758.                 mov     al,dl
  4759.                 and     al,al
  4760.                 jnz     tend
  4761.                 mov     al,ah
  4762. tend:
  4763.                 stosb
  4764.                 mov     al,dh
  4765.                 and     al,al
  4766.                 jnz     unitd
  4767.                 mov     al,ah
  4768. unitd:
  4769.                 pop     ax
  4770.                 stosb
  4771.                 mov     ax,0
  4772.                 stosb
  4773.                 mov     di,offset hex_buff
  4774.                 call    print_asciiz
  4775.                 pop     di
  4776.                 pop     es
  4777.                 ret
  4778.  
  4779.  
  4780.  
  4781. DOSPRINT:
  4782.                 PUSH    DS
  4783.                 PUSH    DX
  4784.                 PUSH    CX
  4785.                 MOV     DX,OFFSET CRLF
  4786.                 MOV     CX,2
  4787.                 push    ds
  4788.                 push    dx           ;pointer to string (ds:dx)
  4789.                 push    cx              ;length of string  cx
  4790.                 push    0
  4791.                 call    VioWrtTTY
  4792.  
  4793.  
  4794.                 POP     CX
  4795.                 POP     DX
  4796.  
  4797.                 push    ds
  4798.                 push    dx
  4799.                 push    cx
  4800.                 push    0
  4801.                 call    VioWrtTTY
  4802.  
  4803.                 POP     DS
  4804.                 RET
  4805.  
  4806.  
  4807. print_asciiz:                           ;print asciiz pointed to by di
  4808.                 push    dx
  4809.                 push    ax
  4810.                 push    di
  4811.                 push    cx
  4812.                 push    es
  4813.                 push    di
  4814.                 push    ds
  4815.                 pop     es
  4816.                 call    eoz
  4817.                 mov     cx,di
  4818.                 pop     di
  4819.                 sub     cx,di
  4820.  
  4821.                 push    ds
  4822.                 push    di
  4823.                 push    cx
  4824.                 push    0
  4825.                 call    VioWrtTTY
  4826. print_end:
  4827.  
  4828.                 pop     es
  4829.                 pop cx
  4830.                 pop di
  4831.                 pop ax
  4832.                 pop dx
  4833.                 ret
  4834. ;
  4835.  
  4836.  
  4837. ;
  4838. HEXDEC:         ;THIS ROUTINE WILL TAKE A 4DIGIT HEXADECIMAL NUMBER IN AX AND
  4839.                 ;RETURNS A 5 DIGIT ASCII IN BH,BL,DH,DL,AL.
  4840.                 ;TIME AVERAGES ABOUT 140 CLOCKS PER DIGIT
  4841.                 ;LEADING 0'S ARE SUPRESSED
  4842.                 MOV     BX,0
  4843.                 MOV     CX,0
  4844.                 MOV     DX,0
  4845. A10K:           CMP     AX,10000
  4846.                 JB      A1K
  4847.                 SUB     AX,10000
  4848.                 INC     BH
  4849.                 JMP     A10K
  4850. A1K:            CMP     AX,1000
  4851.                 JB      HUNDREDS
  4852.                 SUB     AX,1000
  4853.                 INC     BL
  4854.                 JMP     A1K
  4855. HUNDREDS:       CMP     AX,100
  4856.                 JB      TENS
  4857.                 SUB     AX,100
  4858.                 INC     DH
  4859.                 JMP     HUNDREDS
  4860. TENS:           CMP     AX,10
  4861.                 JB      UNITS
  4862.                 SUB     AX,10
  4863.                 INC     DL
  4864.                 JMP     TENS
  4865. UNITS:
  4866.  
  4867.                 test    bh,0ffh
  4868.                 jz      x101
  4869.                 add     bh,"0"
  4870. d1:
  4871.                 add     bl,"0"
  4872. d2:
  4873.                 add     dh,"0"
  4874. d3:
  4875.                 add     dl,"0"
  4876. d4:
  4877.                 add     al,"0"
  4878. d5:
  4879.                 ret
  4880.  
  4881. x101:
  4882. ;l1:
  4883.                 test    bl,0ffh
  4884.                 jz      x102
  4885.                 jmp     short d1
  4886. x102:
  4887. ;l2:
  4888.                 test    dh,0ffh
  4889.                 jz      x103
  4890.                 jmp     short d2
  4891. x103:
  4892. ;l3:
  4893.                 test    dl,0ffh
  4894.                 jz      d4
  4895.                 jmp     short d3
  4896.  
  4897.  
  4898.  
  4899.  
  4900.  
  4901.  
  4902. DECHEX:                         ;THIS ROUTINE WILL TAKE A [CL] (MAX 5) DIGIT
  4903.                                 ;ASCII DECIMAL NUMBER POINTED TO BY SI AND
  4904.                                 ;RETURN A 4 DIGIT HEX NUMBER IN AX.*
  4905.                 push    dx
  4906.                 XOR     DH,DH
  4907.                 XOR     AX,AX
  4908. TRY:            CMP     CL,1
  4909.                 JBE     LAST
  4910.                 MOV     DL,[SI]
  4911.                 SUB     DL,"0"
  4912.                 ADD     AX,DX
  4913.                 MOV     BX,AX
  4914.                 SHL     AX,1
  4915.                 SHL     AX,1
  4916.                 SHL     AX,1
  4917.                 ADD     AX,BX
  4918.                 ADD     AX,BX
  4919.                 INC     SI
  4920.                 LOOP    TRY
  4921. LAST:           MOV     DL,[SI]
  4922.                 SUB     DX,"0"
  4923.                 ADD     AX,DX
  4924.                 pop     dx
  4925.                 RET
  4926.  
  4927. ;prt     macro
  4928. ;        mov     di,offset #1
  4929. ;        call    print_asciiz
  4930. ;#em
  4931.  
  4932. ;******************************************************************************
  4933. ; word_to_hex -
  4934. ;
  4935. ;
  4936. ;     ENTRY:    ax = value to convert
  4937. ;               si -> 4 character buffer to place text in
  4938. ;
  4939. ;      EXIT:
  4940. ;
  4941. ; DESTROYED:
  4942. ;
  4943. ;------------------------------------------------------------------------------
  4944. word_to_hex:
  4945.                 push    ax
  4946.  
  4947.                 mov     ah,al
  4948.                 shr     ah,1
  4949.                 shr     ah,1
  4950.                 shr     ah,1
  4951.                 shr     ah,1
  4952.                 and     ax,0f0fh
  4953.  
  4954.                 add     al,'0'
  4955.                 add     ah,'0'
  4956.                 mov     [si+2],ah
  4957.                 mov     [si+3],al
  4958.  
  4959.                 pop     ax
  4960.  
  4961.                 mov     al,ah
  4962.                 shr     ah,1
  4963.                 shr     ah,1
  4964.                 shr     ah,1
  4965.                 shr     ah,1
  4966.                 and     ax,0f0fh
  4967.  
  4968.                 add     al,'0'
  4969.                 add     ah,'0'
  4970.                 mov     [si+0],ah
  4971.                 mov     [si+1],al
  4972.  
  4973.                 ret
  4974.  
  4975.  
  4976.  
  4977. dx_to_ASCII:                    ;outputs to es:di the 4 digit hex in dx
  4978.         mov    al,dh
  4979.                 call    al_to_ascii
  4980.         mov    al,dl
  4981.   
  4982. al_to_ascii:
  4983.         mov    ah,al
  4984.         push    cx
  4985.         mov    cl,4
  4986.                 shr     al,cl
  4987.         pop    cx
  4988.                 call    lo_nib_al_to_as
  4989.         mov    al,ah
  4990.   
  4991.   
  4992. lo_nib_al_to_as:
  4993.         and    al,0Fh
  4994.         add    al,90h
  4995.                 daa
  4996.                 adc     al,40h
  4997.                 daa
  4998.                 stosb
  4999.                 ret
  5000.  
  5001. it_is_bad:
  5002.                 mov     si,offset bad_msgs
  5003. x211:
  5004.                 push    ds
  5005.                 pop     es
  5006.  
  5007.                 call    move_to_scratch
  5008.  
  5009.                 ret
  5010.  
  5011. it_is_net:
  5012.                 mov     si,offset netmail_path
  5013.                 push    ds
  5014.                 pop     es
  5015.                 call    move_to_scratch
  5016.                 jmp     throw_this_msg
  5017.  
  5018.  
  5019. next_z_limit:                   ;es:di->string. cx is the limit. rets cy if
  5020.                                 ;limit is reached without finding a null
  5021.                                 ;on exit di points to the zero
  5022.                 xor     al,al
  5023. x213:
  5024.                 scasb
  5025.                 jz      x214
  5026.                 cmp     di,cx
  5027.                 jb      x213
  5028.                 stc
  5029.                 ret
  5030. x214:
  5031.                 clc
  5032.                 ret
  5033.  
  5034.  
  5035.  
  5036. move_to_scratch:                ;moves the path pointed to by ds:si into
  5037.                                 ;scratch path and cleans it up.
  5038.                                 ;updates current_ar_path_end
  5039.  
  5040.                 mov     di,offset scratch_path
  5041.                 call    eozs
  5042.         rep     movsb
  5043.                 mov     al,'\'
  5044.                 cmp     al,[di-1]
  5045.                 jz      x210
  5046.                 stosb
  5047. x210:
  5048.                 mov     al,0
  5049.                 stosb
  5050.                 dec     di
  5051.                 mov     cur_ar_path_end,di
  5052.                 ret
  5053.  
  5054.  
  5055.  
  5056. _code ends
  5057.  
  5058.  
  5059.  
  5060.  
  5061.                 
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068. _data   segment
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075. message_one     db      512 dup (0)
  5076. this_scan       db      0
  5077. use_no_log      db      0
  5078. max_msg_cntr    dw      0
  5079. EVEN
  5080. scratch_nn_list db      256 dup (0)
  5081. prepack_nn_list db      256 dup (0)
  5082. nnlist          db      100 dup (5 dup (0))
  5083. nn_handle_list  dw      100  dup (0)
  5084. num_entries     dw      0               ;num of entries in the nn list
  5085.                                         ;of last call to length_nn
  5086. tot_count       dw      0
  5087. nn_cntr         db      0
  5088. temp_ptr        dw      0
  5089. msg_ascii       db      '.msg',0
  5090. current_node    dw      0
  5091. wkg_path        db      '.\'
  5092.                 db      80 dup (0)
  5093. wpe_end         label   byte
  5094.                 db      0
  5095. wkg_path_end    dw      0
  5096. time_info       label   byte
  5097. hour            db      0
  5098. minute          db      0
  5099. second          db      0
  5100. h_of_s          db      0
  5101. day             db      0
  5102. month           db      0
  5103. year            dw      0
  5104. t_zone          dw      0
  5105. day_o_week      dw      0
  5106. _data   ends
  5107.  
  5108. assume cs:_code
  5109. assume ds:_data
  5110. _code   segment byte public 'code'
  5111.  
  5112. public          scan
  5113. scan:
  5114.                 mov     di,offset tosslog_cmd
  5115.                 mov     ax,1
  5116.                 call    search_for
  5117.                 pop     ds
  5118.                 mov     access,read_write
  5119.                 jnc     scan1
  5120.                 mov     use_no_log,1
  5121. scan1:
  5122.                 mov     this_scan,1
  5123.                 call    clean_pm_buf
  5124.                 xor     ax,ax
  5125.                 mov     current_path,ax
  5126.                 jmp     scan_areas
  5127.  
  5128.  
  5129.  
  5130. public          nn_is_here
  5131. public nn_not_here
  5132. public  nn_seen
  5133. public          thats_all
  5134. public          try_next
  5135. public          bns1
  5136. public          build_nnn_seen
  5137. public          list_complete
  5138. public          mhl1
  5139. public          make_handle_list
  5140. public          gh1
  5141. public  get_handle_for_nn
  5142. public          adding_error
  5143. public  add_nn_to_list
  5144. public          check_for_end
  5145. public          not_in_list
  5146. public          this_is_it
  5147. public          sl1
  5148. public  search_list
  5149. public          get_time
  5150. public  end_of_file
  5151. public  find_wkg_path_end
  5152. public  nn_entry_num
  5153. public  pack_message
  5154. public  send_to_node
  5155. public          no_such_msg
  5156. public  get_msg_ax
  5157. public          lenn1
  5158. public          lenn2
  5159. public          length_nn
  5160. public          make_scratch_nn
  5161. public          lim2
  5162. public          lim1
  5163. public  limits
  5164. public          make_scratch_path
  5165. public          next_nn
  5166. public          area_done
  5167. public          next_msg_scan
  5168. public          sp1
  5169. public          sp2
  5170. public  scan_path
  5171. public          finished
  5172. public          sa1
  5173. public          scan_areas
  5174. public          cpb2
  5175. public  clean_pm_buf
  5176.  
  5177.  
  5178.  
  5179.  
  5180. clean_pm_buf:                           ;0's the pmsg_buf. ds is true data
  5181.                 mov     ax,sel_pmsg_buf
  5182.                 and     ax,ax
  5183.                 jnz     cpb2
  5184.                 mov     ax,0ffffh
  5185.                 mdosallocSeg sel_pmsg_buf,no_share
  5186.                 mov     ax,sel_pmsg_buf
  5187.                 mov     es,ax
  5188. cpb2:
  5189.                 mov     di,0
  5190. ;                mov     cx,upmsg_length
  5191.                 mov     cx,100
  5192.                 call    clean_wbuffer
  5193.                 ret
  5194.  
  5195. scan_areas:
  5196.                 mov     ax,sel_areas
  5197.                 mov     es,ax
  5198.                 call    find_wkg_path_end
  5199.                 mov     di,0
  5200.                 test    use_no_log,0ffh
  5201.                 jz      use_log
  5202. ;if no_tosslog
  5203. sal1:
  5204.                 push    di
  5205.                 call    scan_path
  5206.                 pop     di
  5207.                 add     di,type line_infos
  5208.                 mov     current_path,di
  5209.                 mov     ax,sel_areas
  5210.                 mov     es,ax
  5211.                 nop
  5212.                 cmp     byte ptr es:[di],0
  5213.                 jnz     sal1
  5214.                 jmp     finished
  5215.  
  5216. use_log:
  5217.                 call    get_tosslog
  5218.                 and     ax,ax           ;this tests tosslog for 0 length
  5219.                 jnz     sal1a
  5220.                 jmp     terminate
  5221. sal1a:
  5222.                 call    convert_crs
  5223. sa1:
  5224.                 call    get_nxt_toss_area
  5225.                 test    toss_flag,end_log
  5226.                 jnz     finished
  5227.                 test    toss_flag,no_area
  5228.                 jnz     sa1
  5229.                 mov     di,si
  5230.                 mov     current_path,di
  5231.                 call    scan_path
  5232.                 mov     ax,sel_areas
  5233.                 mov     es,ax
  5234.                 jmp     short sa1
  5235. ;endif
  5236.  
  5237. finished:
  5238. ;                call    spawn_pack
  5239.                 edata
  5240.                 mov     di,offset vmsg_scanned
  5241.                 call    print_asciiz
  5242.  
  5243.  
  5244.  
  5245.  
  5246.                 call    get_time
  5247.                 mov     di,offset scratch_ascii
  5248.                 mov     si,offset logmsg_end
  5249.                 call    write_asciiz
  5250.                 call    write_time
  5251.  
  5252.                 mov     al,0dh
  5253.                 stosb
  5254.                 mov     al,0ah
  5255.                 stosb
  5256.                 xor     al,al
  5257.                 stosb
  5258.                 logaz   scratch_ascii
  5259.  
  5260.                 mov     al,minute
  5261.                 xor     ah,ah
  5262.                 mov     bx,60
  5263.                 mul     bx
  5264.                 add     al,second
  5265.                 adc     ah,0
  5266.                 mov     end_in_secs,ax
  5267.                 sub     ax,start_in_secs
  5268.                 mov     bx,60
  5269.                 div     bx
  5270.                 push    dx
  5271.                 push    ax
  5272.                 mov     di,offset scratch_ascii
  5273.                 mov     al,0dh
  5274.                 stosb
  5275.                 mov     al,0ah
  5276.                 stosb
  5277.                 mov     si,offset logmsg_sscan
  5278.                 call    write_asciiz
  5279.                 mov     ax,tot_count
  5280.                 call    write_h_ascii
  5281.                 mov     si,offset logmsg_smsg
  5282.                 call    write_asciiz
  5283.                 pop     ax
  5284.                 call    write_h_ascii
  5285.                 mov     si,offset logmsg_smins
  5286.                 call    write_asciiz
  5287.                 pop     ax
  5288.                 call    write_h_ascii
  5289.                 mov     si,offset logmsg_ssecs
  5290.                 call    write_asciiz
  5291.                 mov     al,0
  5292.                 stosb
  5293.                 logaz   scratch_ascii
  5294.                 mov     di,offset scratch_ascii
  5295.                 call    print_asciiz
  5296.  
  5297.  
  5298.  
  5299.  
  5300.  
  5301.                 mov     ax,0
  5302. term_scan:
  5303.                 push    1
  5304.                 push    ax
  5305.                 call    dosexit
  5306.  
  5307.  
  5308. scan_path:                      ;di->an area_line. This area is scanned and the
  5309.                                 ;messages put in working files for each node
  5310.                 call    get_scan_area
  5311.                 call    make_scratch_path
  5312.                 push    di
  5313.                 pcrlf
  5314.                 prt     vmsg_scan
  5315.                 mov     di,offset scratch_path
  5316.                 call    print_asciiz
  5317.                 pcrlf
  5318.                 pop     di
  5319.                 call    limits
  5320.                 jc      next_msg_scan
  5321.                 call    make_scratch_nn
  5322.                 mov     ax,lowest_msg
  5323. sp2:
  5324.                 mov     bx,offset scratch_nn_list
  5325.                 call    get_msg_ax
  5326.                 jc      next_msg_scan
  5327.                 call    pack_message
  5328.                 jc      next_msg_scan
  5329.                 mov     si,offset prepack_nn_list
  5330. sp1:
  5331.                 call    send_to_node
  5332.                 call    next_nn
  5333.                 jz      next_msg_scan
  5334.                 jmp     short sp1
  5335. next_msg_scan:
  5336.                 mov     ax,lowest_msg
  5337.                 inc     ax
  5338.                 mov     lowest_msg,ax
  5339.                 mov     hw_reply,ax
  5340.                 cmp     ax,highest_msg
  5341.                 ja      area_done
  5342.                 jmp     short sp2
  5343. area_done:
  5344.                 mov     area_changed,1
  5345.                 call    log_area_toss
  5346.                 mov     ax,scan_count
  5347.                 add     tot_count,ax
  5348.                 mov     scan_count,0
  5349.                 mov     di,cur_ar_path_end
  5350.                 mov     al,'1'
  5351.                 stosb
  5352.                 mov     al,'.'
  5353.                 stosb
  5354.                 mov     al,'m'
  5355.                 stosb
  5356.                 mov     al,'s'
  5357.                 stosb
  5358.                 mov     al,'g'
  5359.                 stosb
  5360.                 mov     al,0
  5361.                 stosb
  5362.                 mov     access,read_write
  5363.                 mdosopen        scratch_path,open,create
  5364.                 jc      ad1
  5365.                 mov     ax,handle
  5366.                 mov     cx,msg1_end-offset msg1
  5367. ;                mov     cx,offset mtext
  5368.                 dec     hw_reply
  5369.                 mov     si,offset msg1
  5370.                 mov     doscall_inseg,ds
  5371.                 mdoswrite doscall_inseg,results
  5372.                 mov     ax,handle
  5373.                 mdosclose
  5374. ad1:
  5375.                 ret
  5376.  
  5377.  
  5378.  
  5379.  
  5380.  
  5381. next_nn:
  5382.                 add     si,5
  5383.                 mov     di,si
  5384.                 nodediz
  5385.                 ret
  5386.  
  5387.  
  5388.  
  5389. make_scratch_path:
  5390.                 call    mov_cur_path_to_data
  5391. ;                push    ds
  5392. ;                pop     es
  5393. ;                mov     si,current_path
  5394. ;                mov     ax,sel_areas
  5395. ;                mov     ds,ax
  5396. ;                call    eozs
  5397. ;                mov     di,offset scratch_path
  5398. ;        rep     movsb
  5399. ;                ddata
  5400.                 ret
  5401.  
  5402.  
  5403.  
  5404. limits:                         ;scratch_path is valid, rets w/ lowest_msg
  5405.                                 ;and highest_msg valid. ax has lowest_msg
  5406.                 call    get_msg_high
  5407. ;                mov     highest_msg,ax
  5408.                 mov     ax,1
  5409.                 call    get_msg_ax
  5410.                 jnc     lim1
  5411.                 mov     lowest_msg,2
  5412.                 jmp     short lim2
  5413. lim1:
  5414.                 mov     ax,handle
  5415.                 mdosclose
  5416.                 mov     ax,sel_msg_buf
  5417.                 mov     es,ax
  5418.                 mov     si,offset mreply_to
  5419.                 mov     ax,es:[si]
  5420.  
  5421.                 cmp     ax,2
  5422.                 jae     lim3
  5423.  
  5424.                 mov     ax,2
  5425. lim3:
  5426.                 cmp     ax,highest_msg
  5427.                 jb      lim5
  5428.                 mov     ax,highest_msg
  5429. lim5:
  5430.                 mov     lowest_msg,ax
  5431.                 cmp     ax,highest_msg
  5432.                 jae     lim4
  5433. lim2:
  5434.                 clc
  5435.                 ret
  5436. lim4:
  5437.                 stc
  5438.                 ret
  5439.  
  5440.  
  5441.  
  5442.  
  5443. make_scratch_nn:
  5444.                 edata
  5445.                 mov     di,offset scratch_nn_list
  5446.                 mov     cx,512                  ;this also cleans prepack buf
  5447.                 call    clean_wbuffer
  5448.                 mov     es,sel_areas
  5449. ;                mov     current_path,di
  5450.                 mov     si,current_path         ;pointer to current line in areas
  5451.                 add     si,offset li_nodes
  5452.                 mov     di,offset scratch_nn_list
  5453.                 xdses
  5454.                 call    length_nn
  5455.         rep     movsb
  5456.                 ddata
  5457.                 ret
  5458.  
  5459. length_nn:
  5460.                 push    si
  5461.                 xor     cx,cx
  5462. lenn2:
  5463.                 nodesiz
  5464.                 jz      lenn1
  5465.                 add     si,5
  5466.                 add     cx,5
  5467.                 jmp     short lenn2
  5468. lenn1:
  5469.                 pop     si
  5470.                 ret
  5471.  
  5472.  
  5473. get_msg_ax:                     ;rec the HEX VALUE of a file in ax
  5474.                                 ;rets w/nc and the file in the umsg_buf if
  5475.                                 ;successful, otherwise carry is set.
  5476.                                 ;upmsg_length is updated
  5477.                 push    ax
  5478. ;                pcrlf
  5479.                 prt     vmsg_dot
  5480.                 pop     ax
  5481.                 push    ax
  5482. ;                call    print_h_ascii
  5483. ;                prt     space3
  5484.                 mov     ax,sel_msg_buf
  5485.                 mov     es,ax
  5486.                 mov     di,0
  5487.                 mov     cx,upmsg_length
  5488.                 call    clean_wbuffer
  5489. ;                push    ds
  5490. ;                pop     es
  5491. ;;                mov     di,offset scratch_ascii
  5492. ;;                mov     dx,lowest_msg
  5493. ;
  5494. ;
  5495. ;
  5496. ;
  5497. ;                call    dx_to_ascii
  5498. ;                mov     si,offset scratch_ascii
  5499. ;                mov     cx,4
  5500. ;                mov     di,cur_ar_path_end
  5501. ;gma1:
  5502. ;                cmp     byte ptr [si],30h
  5503. ;                jbe     gma2
  5504. ;        rep     movsb
  5505. ;                jmp     short gma4
  5506. ;gma2:
  5507. ;                inc     si
  5508. ;gma3:
  5509. ;                loop    gma1
  5510. ;gma4:
  5511.  
  5512.                 edata
  5513.                 mov     di,cur_ar_path_end
  5514.                 pop     ax
  5515.                 call    write_h_ascii
  5516.  
  5517.  
  5518.  
  5519.                 mov     si,offset msg_ascii
  5520.                 call    eozs
  5521.                 inc     cx
  5522.         rep     movsb
  5523.                 mdosopen        scratch_path,open,fail
  5524.                 jc      no_such_msg
  5525.                 mov     ax,sel_msg_buf
  5526.                 mov     doscall_inseg,ax
  5527.                 mov     cx,0ffffh
  5528.                 xor     si,si
  5529.                 mdosread
  5530.                 mov     ax,result
  5531.                 mov     upmsg_length,ax
  5532.                 clc
  5533.                 ret
  5534. no_such_msg:
  5535.                 stc
  5536.                 ret
  5537.  
  5538.  
  5539. send_to_node:                   ;si ->to net/node in prepack_nn_list.
  5540.                                 ;creates or appends msg to time.pkt
  5541.                 mov     di,offset prepack_nn_list
  5542.                 mov     ax,[si+1]
  5543.                 mov     es,sel_pmsg_buf
  5544.                 mov     di,offset spmdest_net
  5545.                 stosw
  5546.                 mov     ax,[si+3]
  5547.                 mov     di,offset spmdest_node
  5548.                 stosw
  5549.                 call    get_handle_for_nn
  5550.                 mov     cx,msg_length
  5551.                 push    si
  5552.                 mov     si,0
  5553.                 mdoswrite      sel_pmsg_buf,results
  5554. f3:
  5555.                 inc     word ptr max_msg_cntr
  5556.                 inc     scan_count
  5557.                 mov     ax,max_msgs
  5558.                 cmp     max_msg_cntr,ax
  5559.                 jb      stn1
  5560.                 push    word ptr sharing
  5561.                 push    word ptr access
  5562.                 call    close_handles
  5563.                 call    clean_nn_list
  5564.                 call    spawn_pack
  5565.                 mov     ax,1                    ;****
  5566. ;                jmp     term_scan               ;****
  5567.                 pop     word ptr access
  5568.                 pop     word ptr sharing
  5569.                 xor     ax,ax
  5570.                 mov     max_msg_cntr,ax
  5571. stn1:
  5572.                 pop     si
  5573.                 ret
  5574.  
  5575.  
  5576. pack_message:                           ;receives a message in upmsg_buf
  5577.                                         ;ds is true data. Rets with the msg
  5578.                                         ;packed in the pm buffer,msg_length
  5579.                                         ;valid for pmsg
  5580.                 push    ds
  5581.                 pop     es
  5582.                 call    strip_path
  5583.                 call    strip_seen_bys
  5584. ;                mov     si,current_path
  5585. ;                add     si,offset li_nodes
  5586. ;                mov     di,offset scratch_nn_list
  5587. ;                mov     ax,sel_areas
  5588. ;                mov     ds,ax
  5589. ;                edata
  5590. ;                call    length_nn
  5591. ;        rep     movsb
  5592.  
  5593. ;                ddata                   ;both point at true data now
  5594.                 mov     si,offset scratch_nn_list
  5595.                 mov     di,offset seen_by_list
  5596.                 call    build_nnn_seen
  5597.                 jnz     pm1
  5598.                 stc
  5599.                 jmp pm2
  5600. pm1:
  5601.                 call    add_net_nodes
  5602.                 mov     ax,sel_msg_buf
  5603.                 mov     es,ax
  5604.                 mov     di,upmsg_length
  5605.                 call    write_seen_bys
  5606.                 call    write_path_line
  5607.  
  5608.  
  5609.  
  5610.                 xor     bx,bx
  5611.                 mov     dx,bx
  5612.                 mov     ax,handle
  5613.                 mdoschgfileptr rel_beg
  5614.                 mov     ax,handle
  5615.                 mov     cx,upmsg_length
  5616.                 mov     si,0
  5617.                 mdoswrite       sel_msg_buf,results
  5618.                 mov     ax,handle
  5619. public test2
  5620. test2:
  5621.                 mdosclose
  5622.  
  5623.  
  5624.  
  5625.                 mov     es,sel_pmsg_buf
  5626.                 call    clean_pm_buf
  5627.                 push    ds
  5628.                 mov     ax,sel_msg_buf
  5629.                 mov     ds,ax
  5630.                 mov     di,0
  5631.                 mov     ax,2
  5632.                 stosw                   ;this is the packed msg code
  5633.                 mov     si,offset morigin_node
  5634.                 lodsw
  5635.                 stosw
  5636.                 mov     si,offset mdest_node
  5637.                 lodsw
  5638.                 stosw
  5639.                 mov     si,offset morigin_net
  5640.                 lodsw
  5641.                 stosw
  5642.                 mov     si,offset mdest_net
  5643.                 lodsw
  5644.                 stosw
  5645.                 mov     si,offset mattribute
  5646.                 lodsw
  5647.                 stosw
  5648.                 mov     si,offset mcost
  5649.                 lodsw
  5650.                 stosw
  5651.                 mov     si,offset mdatetime
  5652.                 call    write_asciiz
  5653.                 mov     al,0
  5654.                 stosb
  5655.                 mov     si,offset mtouser
  5656.                 call    write_asciiz
  5657.                 mov     al,0
  5658.                 stosb
  5659.                 mov     si,offset mfromuser
  5660.                 call    write_asciiz
  5661.                 mov     al,0
  5662.                 stosb
  5663.                 mov     si,offset msubject
  5664.                 call    write_asciiz
  5665.                 mov     al,0
  5666.                 stosb
  5667.                 push    ds
  5668.  
  5669.                 ddata
  5670.                 mov     si,offset area_line
  5671.                 call    write_asciiz
  5672.                 mov     si,offset current_area
  5673.                 call    write_asciiz
  5674.                 mov     si,offset crlf
  5675.                 call    write_asciiz
  5676.  
  5677.  
  5678.                 pop     ds
  5679.                 mov     si,offset mtext
  5680.                 mov     dx,ds
  5681.                 pop     ds
  5682.                 push    ds
  5683.                 mov     cx,upmsg_length
  5684.                 sub     cx,si
  5685.                 mov     ds,dx
  5686.         rep     movsb
  5687. ;                mov     al,0
  5688. ;                stosb
  5689.                                 ;message is now packed
  5690.                 pop     ds
  5691.                 mov     msg_length,di
  5692.                 clc
  5693.                 ret
  5694. pm2:
  5695.                 mov     ax,handle
  5696.                 mdosclose
  5697.                 stc
  5698.                 ret
  5699.  
  5700.  
  5701.  
  5702.  
  5703.  
  5704.  
  5705.  
  5706.  
  5707. nn_entry_num:           ;ds:si -> at entry in prepack_nn_list
  5708.                         ;rets with bx containing the entry number (0 based)
  5709.                         ;all regs preserved
  5710.                 mov     bx,si
  5711.                 sub     bx,offset prepack_nn_list
  5712.                 shr     bx,2
  5713.                 ret
  5714.  
  5715. find_wkg_path_end:      ;ds true data. rets w/ the end of the working path
  5716.                         ;in di, length in cx, and wkg_path_end valid
  5717.                 mov     ax,ds
  5718.                 mov     es,ax
  5719.                 mov     di,offset wkg_path
  5720.                 call    eoz
  5721.                 cmp     byte ptr es:[di-1],'\'
  5722.                 jz      l6
  5723.                 mov     al,'\'
  5724.                 stosb
  5725. l6:
  5726.                 mov     wkg_path_end,di
  5727.                 ret
  5728.  
  5729.  
  5730.  
  5731.  
  5732. ;public  dx_to_ASCII
  5733. ;dx_to_ASCII:                    ;outputs to es:di the 4 digit hex in dx
  5734. ;                mov     al,dh
  5735. ;                call    al_to_ascii
  5736. ;                mov     al,dl
  5737. ;
  5738. ;al_to_ascii:
  5739. ;                mov     ah,al
  5740. ;                push    cx
  5741. ;                mov     cl,4
  5742. ;                shr     al,cl
  5743. ;                pop     cx
  5744. ;                call    lo_nib_al_to_as
  5745. ;                mov     al,ah
  5746. ;
  5747. ;
  5748. ;lo_nib_al_to_as:
  5749. ;                and     al,0Fh
  5750. ;                add     al,90h
  5751. ;                daa
  5752. ;                adc     al,40h
  5753. ;                daa
  5754. ;                stosb
  5755.  
  5756. end_of_file:            ;rec handle in ax
  5757.                 push    bx
  5758.                 push    cx
  5759.                 push    dx
  5760.                 xor     bx,bx
  5761.                 mov     dx,bx
  5762.                 mov     cx,2
  5763.                 mdoschgfileptr  rel_end
  5764.                 pop     dx
  5765.                 pop     cx
  5766.                 pop     bx
  5767.                 ret
  5768.  
  5769.  
  5770.  
  5771. get_time:
  5772.                 mov     ax,offset time_info
  5773.                 push    ds
  5774.                 push    ax
  5775.                 call    dosgetdatetime
  5776.                 ret
  5777.  
  5778. search_list:                    ;ds:si -> at target nc=found with the
  5779.                                 ;entry number in cx
  5780.                                 ;if not found, first blank is pointed to
  5781.                                 ;by di, with its number incx
  5782.  
  5783.                 xor     cx,cx
  5784.                 mov     ah,ch
  5785.                 edata
  5786.                 mov     di,offset nnlist
  5787. sl1:
  5788.                 call    check_for_end
  5789.                 jz      not_in_list
  5790.                 call    triple_comp
  5791.                 jz      this_is_it
  5792.                 inc     cx
  5793.                 add     di,5
  5794.                 jmp     sl1
  5795. this_is_it:
  5796.                 clc
  5797.                 ret
  5798. not_in_list:
  5799.                 stc
  5800.                 ret
  5801.  
  5802. check_for_end:
  5803.                 mov     ax,[di+1]
  5804.                 or      al,[di]
  5805.                 or      ax,[di+3]
  5806.                 ret
  5807.  
  5808.  
  5809. ;nn_comp:                        ;ds:si -> target si -> into list to search
  5810. ;                push    si
  5811. ;                push    di
  5812. ;                cmpsb
  5813. ;                jnz     not_this
  5814. ;                cmpsw
  5815. ;                jnz     not_this
  5816. ;                cmpsw
  5817. ;not_this:
  5818. ;                pop     di
  5819. ;                pop     si
  5820. ;                ret
  5821.  
  5822. add_nn_to_list:                 ;di -> to first blank entry, si carries a
  5823.                                 ;pointer into the prepack_nn_list
  5824.                                 ;cx the number of the entry
  5825.                 push    si
  5826.                 push    di
  5827.                 edata
  5828. ;                call    get_time
  5829. ;                mov     di,wkg_path_end
  5830. ;                mov     dx,word ptr hour
  5831. ;                call    dx_to_ascii
  5832. ;                mov     dx,word ptr second
  5833. ;                call    dx_to_ascii
  5834.  
  5835.                 mov     di,wkg_path_end
  5836.                 mov     dx,word ptr[si+1]
  5837.                 call    dx_to_ascii
  5838.                 mov     dx,word ptr[si+3]
  5839.                 call    dx_to_ascii
  5840.  
  5841.                 mov     al,'.'
  5842.                 stosb
  5843.                 mov     al,'o'
  5844.                 stosb
  5845.                 mov     al,'u'
  5846.                 stosb
  5847.                 mov     al,'t'
  5848.                 stosb
  5849.                 xor     al,al
  5850.                 stosb
  5851.                 mdosopen        wkg_path,open,create
  5852.                 jc      adding_error
  5853.                 call    append
  5854.                 mov     ax,handle
  5855.                 xor     bx,bx
  5856.                 mov     dx,bx
  5857.                 mdoschgfileptr rel_end
  5858.                 mov     ax,handle
  5859.                 mov     bx,cx
  5860.                 shl     bx,1
  5861.                 mov     si,offset nn_handle_list
  5862.                 mov     [si+bx],ax
  5863.                 mov     bp,sp
  5864.                 mov     si,[bp+2]
  5865.                 mov     di,[bp]
  5866.                 mov     cx,5
  5867.         rep     movsb
  5868.                 mov     si,[bp+2]
  5869.                 call    build_header
  5870.                 mov     cx,offset packet_hdr_end-offset packet_hdr
  5871.                 mov     si,offset packet_hdr
  5872.                 mov     ax,handle
  5873.                 mdoswrite       this_seg,results
  5874.                 jc      adding_error
  5875.                 mov     ax,handle
  5876.                 clc
  5877.                 pop     di
  5878.                 pop     si
  5879.                 ret
  5880.  
  5881. adding_error:
  5882.  
  5883.                 jmp     file_error
  5884.  
  5885.  
  5886. get_handle_for_nn:              ;ds:si -> at entry in scratch nn list
  5887.                                 ;rets with handle in ax
  5888.                 push    si
  5889.                 push    di
  5890.                 call    print_node
  5891.                 mov     di,offset nnlist
  5892.                 call    search_list
  5893.                 jc      gh1
  5894.                 mov     bx,cx
  5895.                 shl     bx,1
  5896.                 mov     si,offset nn_handle_list
  5897.                 mov     ax,[si+bx]
  5898.                 clc
  5899.                 pop     di
  5900.                 pop     si
  5901.                 ret
  5902. gh1:
  5903.                 call    add_nn_to_list
  5904.                 jc      gh2
  5905. gh3:
  5906.                 pop     di
  5907.                 pop     si
  5908.                 ret
  5909. gh2:
  5910.                 push    ax
  5911.                 mov     di,offset vmsg_error
  5912.                 call    print_asciiz
  5913.                 pop     ax
  5914.                 call    print_h_ascii
  5915.                 jmp     short gh3
  5916.  
  5917.  
  5918.  
  5919. make_handle_list:
  5920.                 xor     ax,ax
  5921.                 mov     cx,30
  5922.                 mov     di,offset nn_handle_list
  5923.         rep     stosw
  5924.                 mov     si,offset scratch_nn_list
  5925.                 mov     di,offset nn_handle_list
  5926. mhl1:
  5927.                 call    check_for_end
  5928.                 jz      list_complete
  5929.                 call    get_handle_for_nn
  5930.                 stosw
  5931.                 jmp     short mhl1
  5932. list_complete:
  5933.                 ret
  5934.  
  5935. build_nnn_seen:
  5936.                 push    si
  5937.                 push    di
  5938.                 edata
  5939.                 mov     nn_cntr,0
  5940.                 mov     ax,offset prepack_nn_list
  5941.                 mov     temp_ptr,ax
  5942.                 mov     si,offset scratch_nn_list
  5943. bns1:
  5944.                 mov     di,offset seen_by_list
  5945.                 call    nn_seen
  5946.                 jc      try_next
  5947.                 inc     byte ptr nn_cntr
  5948.                 push    di
  5949.                 mov     di,temp_ptr
  5950.                 mov     cx,5
  5951.         mov     byte ptr[si],0          ;* no zone stuff
  5952.         rep     movsb
  5953.                 mov     temp_ptr,di
  5954.                 pop     di
  5955.                 xchg    di,si
  5956.                 nodediz
  5957.                 xchg    di,si
  5958.                 jz      thats_all
  5959.                 jmp     bns1
  5960. try_next:
  5961.                 add     si,5
  5962.                 nodesiz
  5963.                 jnz     bns1
  5964. thats_all:
  5965.                 test    byte ptr nn_cntr,0ffh
  5966.                 pop     di
  5967.                 pop     si
  5968.                 ret
  5969.  
  5970. nn_seen:                ;si->at source node di-> at target list
  5971.                 mov     ax,[di+1]
  5972. ;no zone        or      al,[di]
  5973.                 or      ax,[di+3]
  5974.                 jz      nn_not_here
  5975.                 call    triple_comp
  5976.                 jz      nn_is_here
  5977.                 add     di,5
  5978.                 jmp     short nn_seen
  5979.  
  5980. nn_not_here:
  5981.                 clc
  5982.                 ret
  5983. nn_is_here:
  5984.                 stc
  5985.                 ret
  5986.  
  5987.  
  5988. build_header:
  5989.                                 ;si points at hex z/n/n to build the header
  5990.                                 ;for. Header is built into packet_hdr
  5991.                 push    si
  5992.                 mov     ax,[si+1]
  5993.                 mov     phdest_net,ax
  5994.                 mov     ax,[si+3]
  5995.                 mov     phdest_node,ax
  5996.                 mov     al,[si]
  5997.                 mov     phdest_zone,al
  5998.                 mov     si,offset this_add
  5999.                 mov     ax,[si+1]
  6000.                 mov     phorigin_net,ax
  6001.                 mov     ax,[si+3]
  6002.                 mov     phorigin_node,ax
  6003.                 mov     al,[si]
  6004.                 mov     phorigin_zone,al
  6005.                 mov     ax,year
  6006.                 mov     phyear,ax
  6007.                 xor     ah,ah
  6008.                 mov     al,month
  6009.                 dec     al
  6010.                 mov     phmonth,ax
  6011.                 mov     al,day
  6012.                 mov     phday,ax
  6013.                 mov     al,hour
  6014.                 mov     phhour,ax
  6015.                 mov     al,minute
  6016.                 mov     phminute,ax
  6017.                 mov     al,second
  6018.                 mov     phsecond,ax
  6019.                 mov     ax,2
  6020.                 mov     phcode,ax
  6021.                 pop     si
  6022.                 ret
  6023.  
  6024.  
  6025. print_node:
  6026.                                ;ds:si points at a z:n/n
  6027.                 push    di
  6028.                 push    si
  6029.                 push    es
  6030.                 push    ds
  6031.                 edata
  6032.                 mov     byte ptr es:temp_def_zone,0ffh
  6033.                 mov     word ptr es:temp_def_net,0ffffh
  6034.                 mov     di,offset scratch_ascii
  6035.                 push    di
  6036.                 call    write_node
  6037.                 mov     al,0
  6038.                 stosw
  6039.                 ddata
  6040.                 pop     di
  6041.                 call    print_asciiz
  6042.                 pop     ds
  6043.                 pop     es
  6044.                 pop     si
  6045.                 pop     di
  6046.                 ret
  6047.  
  6048.  
  6049. print_h_ascii:
  6050.                                 ;prints the hex in ax as ascii to the screen
  6051.  
  6052.                 push    bx
  6053.                 push    cx
  6054.                 push    dx
  6055.                 push    si
  6056.                 push    di
  6057.                 push    ds
  6058.                 push    es
  6059.                 ddata
  6060.                 edata
  6061.                 mov     di,offset scratch_ascii
  6062.                 push    di
  6063.                 call    write_h_ascii
  6064.                 mov     al,0
  6065.                 stosb
  6066.                 pop     di
  6067.                 call    print_asciiz
  6068.                 pop     es
  6069.                 pop     ds
  6070.                 pop     di
  6071.                 pop     si
  6072.                 pop     dx
  6073.                 pop     cx
  6074.                 pop     bx
  6075.                 ret
  6076.  
  6077. find_limit_2null:               ;finds double null terminator. entry ds:si ->
  6078.                                 ;at start of string. rets limit (first null)
  6079.                                 ;in cx
  6080.                 push    ax
  6081.                 push    si
  6082.                 xor     ax,ax
  6083. fle1:
  6084.                 cmp     al,[si]
  6085.                 jne     fle2
  6086.                 cmp     al,[si+1]
  6087.                 jne     fle2
  6088.                 mov     cx,si
  6089.                 pop     si
  6090.                 pop     ax
  6091.                 ret
  6092. fle2:
  6093.                 inc     si
  6094.                 jmp     short fle1
  6095.  
  6096.  
  6097. get_bundle:
  6098.                 mov     ax,sel_names
  6099.                 and     ax,ax
  6100.                 jnz     getbund_noalloc
  6101.                 mov     ax,0a000h
  6102.                 push    ax
  6103.                 mov     ax,offset sel_names
  6104.                 push    ds
  6105.                 push    ax
  6106.                 mov     ax,0
  6107. ;this shuld be implemented as a discardable segment (ax=2)
  6108.                 push    ax
  6109.                 call    DosAllocSeg
  6110. getbund_noalloc:
  6111.  
  6112.                 cmp     path_end,0
  6113.                 jnz     gbun1
  6114.  
  6115.                 mov     si,offset netfile_path
  6116.                 mov     di,si
  6117.                 mov     ax,ds
  6118.                 mov     es,ax
  6119.                 call    eoz
  6120.                 mov     al,'\'
  6121.                 cmp     al,[di-1]
  6122.                 jz      gb1
  6123.                 stosb
  6124. gb1:
  6125.                 mov     path_end,di
  6126.                 mov     pkt_path_end,di
  6127. gbun1:
  6128.                 mov     si,offset bundmo
  6129. gbun4:
  6130.                 mov     bp,si
  6131.                 mov     cx,0
  6132.                 mov     bx,0
  6133.                 mov     dx,bx
  6134.                 mov     di,8000h
  6135.                 mov     ax,sel_names
  6136.                 mov     doscall_inseg,ax
  6137.                 mov     find_ptr,si
  6138.  
  6139. gbun2:
  6140.                 mov     cx,6
  6141.                 mov     di,path_end
  6142.         rep     movsb
  6143.                 mov     max_find,300
  6144.                 mov     si,0
  6145.                 mov     di,8000h
  6146.                 mov     cx,ds
  6147.                 mov     ax,1
  6148.                 mov     search_handle,ax
  6149.                 mov     ax,offset netfile_path
  6150.                 mdosfindfirst
  6151.                 cmp     ax,12h
  6152.                 je      gbun5
  6153.                 cmp     ax,0
  6154.                 jne     gbun_error
  6155. gbun5:
  6156.                 mov     cx,max_find
  6157.                 and     cx,cx
  6158.                 clc
  6159.                 jnz     nd1
  6160.                 add     total_finds,cx
  6161.                 and     cx,cx
  6162.                 jz      next_day
  6163.                 mov     bx,offset flen_filename
  6164. gbun3:
  6165.                 add     si,bx
  6166.                 xor     ax,ax
  6167.                 mov     al,[si]
  6168.                 add     si,ax
  6169.                 loop    gbun3
  6170.  
  6171.  
  6172. next_day:
  6173.                 cmp     bp,offset bundsu
  6174.                 jae     nd2
  6175.                 mov     si,bp
  6176.                 add     si,6
  6177.                 jmp     gbun4
  6178. nd2:
  6179.                 stc
  6180. nd1:
  6181.                 ret
  6182.  
  6183. gbun_error:
  6184.                 jmp     file_error
  6185.  
  6186.  
  6187. up_bundle:
  6188.                 call    get_bundle
  6189.                 jnc     ub5
  6190.                 jmp     bundle_up
  6191. ub5:
  6192.                 mov     si,offset flen_filename
  6193.                 mov     ax,sel_names
  6194.                 edata
  6195.                 mov     ds,ax
  6196.                 xor     cx,cx
  6197.                 mov     cl,[si]
  6198.                 inc     si
  6199.                 mov     di,es:path_end
  6200.         rep     movsb
  6201.                 ddata
  6202.                 mov     byte ptr[di],cl
  6203.  
  6204.                 push    word ptr access
  6205.  
  6206.                 mov     sharing,deny_none
  6207.                 mov     access,read_only_access
  6208.                 mdosopen netfile_path,open,fail
  6209.  
  6210.                 pop     word ptr access
  6211.  
  6212.                 jnc     ub1
  6213.                 mov     si,offset netfile_path
  6214.                 jmp     file_error
  6215. ub1:                
  6216.                 pusha
  6217.                 mov     di,offset scratch_ascii
  6218.                 mov     si,offset logmsg_bndl
  6219.                 call    write_asciiz
  6220.                 mov     si, offset netfile_path
  6221.                 call    write_asciiz
  6222.                 mov     si,offset crlf
  6223.                 call    write_asciiz
  6224.                 mov     si,pkt_path_end
  6225.                 call    bndl_to_node
  6226.                 mov     al,0
  6227.                 stosb
  6228.                 pusha
  6229.                 prt     scratch_ascii
  6230.                 popa
  6231.                 logaz   scratch_ascii
  6232.                 popa
  6233.  
  6234.  
  6235.                 mov     ax,ds
  6236.                 mov     doscall_inseg,ax
  6237.                 mov     si,offset scratch_ascii
  6238.                 mov     cx,10
  6239.                 mdosread
  6240.                 jnc     ub2
  6241.                 jmp     file_error
  6242. ub2:
  6243.                 mov     ax,handle
  6244.                 mdosclose
  6245.                 call    check_arc
  6246.                 jc      ub3
  6247.                 call    unarc_bundle
  6248.                 jmp     bundle_up
  6249. ub3:
  6250.                 call    check_zip
  6251.                 jc      ub4
  6252.                 call    unzip_bundle
  6253.                 jmp     bundle_up
  6254. ub4:
  6255.                 call    unarc_bundle
  6256. bundle_up:
  6257.                 ret
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263. unlh_bundle:
  6264.                 call    unpack_sr1
  6265.                 mov     si,path_end
  6266.                 mov     di,offset lh_file
  6267.                 call    eozs
  6268.         rep     movsb
  6269.                 mov     bx,offset lh_args
  6270.                 mov     cx,offset null_target
  6271.                 mov     si,offset lh_pathname
  6272.                 jmp     unpack_sr2
  6273.  
  6274.  
  6275. unzip_bundle:
  6276.                 call    unpack_sr1
  6277.                 mov     si,path_end
  6278.                 mov     di,offset zip_file
  6279.                 call    eozs
  6280.         rep     movsb
  6281.                 mov     bx,offset zip_args
  6282.                 mov     cx,offset null_target
  6283.                 mov     si,offset zip_pathname
  6284.                 jmp     unpack_sr2
  6285.  
  6286.  
  6287.  
  6288. public unarc_bundle
  6289. unarc_bundle:
  6290.                 call    unpack_sr1
  6291.                 mov     si,path_end
  6292.                 mov     di,offset arc_file
  6293.                 call    eozs
  6294.         rep     movsb
  6295.                 mov     bx,offset arc_args
  6296.                 mov     cx,offset null_target
  6297.                 mov     si,offset arc_pathname
  6298.                 jmp     unpack_sr2
  6299.  
  6300. public unpack_sr2
  6301. unpack_sr2:
  6302.                 xor     ax,ax
  6303.                 stosb
  6304.                 mdosexecpgm
  6305.                 jnc     unpack_sr2b
  6306.  
  6307. unpack_sr2b:
  6308.                 cmp     result2,0
  6309.                 jz      unpack_sr2a
  6310.                 call    rename_bad_arc
  6311. unpack_sr2a:
  6312.                 mov     si,offset netfile_path
  6313.                 mdosdelete
  6314.                 call    retr_cur_ddir
  6315.                 ret
  6316.  
  6317.  
  6318. unpack_sr1:
  6319.                 call    save_cur_ddir
  6320.                 mov     si,offset netfile_path
  6321.                 mov     cx,path_end
  6322. unb2:
  6323.                 sub     cx,si
  6324.                 dec     cx
  6325.                 mov     di,offset scratch_path
  6326.         rep     movsb
  6327.                 mov     byte ptr[di],0
  6328.                 mov     si,offset scratch_path
  6329.                 mov     ax,[si]
  6330.                 xor     ah,ah
  6331.                 cmp     al,'Z'
  6332.                 jb      unb1
  6333.                 sub     al,20h
  6334. unb1:
  6335.                 sub     al,'@'
  6336.                 mdosselectdisk
  6337.                 mdoschdir
  6338.                 ret
  6339.  
  6340. rename_bad_arc:
  6341.                 mov     si,offset netfile_path
  6342.                 mov     cx,path_end
  6343.                 sub     cx,si
  6344.                 mov     di,offset scratch_path
  6345.         rep     movsb
  6346.                 mov     si,offset bad_arc_string
  6347.                 mov     cx,10
  6348.                 push    si
  6349.         rep     movsb
  6350.                 call    get_bad_high
  6351.                 pop     si
  6352.                 push    ax
  6353.                 edata
  6354.                 mov     cx,63
  6355.                 mov     di,offset scratch_path
  6356.                 call    clean_buffer
  6357.                 mov     si,offset netfile_path
  6358.                 mov     cx,path_end
  6359.                 sub     cx,si
  6360.                 mov     di,offset scratch_path
  6361.         rep     movsb
  6362.                 mov     si,offset bad_arc_string
  6363.                 mov     cx,8
  6364.         rep     movsb
  6365.                 pop     ax
  6366.                 xor     ah,ah
  6367.                 call    hexdec
  6368.                 and     dh,dh
  6369.                 jnz     renb2
  6370.                 add     dh,30h
  6371. renb2:
  6372.                 mov     [di],dh
  6373.                 inc     di
  6374.                 and     dl,dl
  6375.                 jnz     renb3
  6376.                 add     dl,30h
  6377. renb3:
  6378.                 mov     [di],dl
  6379.                 inc     di
  6380.                 and     al,al
  6381.                 jnz     renb4
  6382.                 add     bl,30h
  6383. renb4:
  6384.                 mov     [di],al
  6385.                 inc     di
  6386.                 xor     ax,ax
  6387.                 mov     [di],al
  6388.  
  6389.                 mov     si,offset netfile_path
  6390.                 mov     di,offset scratch_path
  6391.                 mdosmove
  6392.                 ret
  6393.  
  6394.  
  6395.  
  6396.  
  6397.  
  6398.  
  6399.  
  6400.  
  6401. get_bad_high:                   ;rets w/next number of bad_arc in al
  6402.                 mov     ax,sel_names
  6403.                 and     ax,ax
  6404.                 jnz     getbad_noalloc
  6405.                 mov     ax,0a000h
  6406.                 push    ax
  6407.                 mov     ax,offset sel_names
  6408.                 push    ds
  6409.                 push    ax
  6410.                 mov     ax,0
  6411. ;this shuld be implemented as a discardable segment (ax=2)
  6412.                 push    ax
  6413.                 call    DosAllocSeg
  6414. getbad_noalloc:
  6415.                 push    ds
  6416.                 pop     es
  6417.                 mov     di,offset scratch_path
  6418.                 mov     si,offset bad_arc_string
  6419.                 mov     cx,10
  6420.         rep     movsb
  6421.                 mov     di,path_end
  6422.                 mov     ax,sel_names
  6423.                 mov     doscall_inseg,ax
  6424.                 mov     search_handle,1
  6425.                 mov     dx,0
  6426.                 mov     si,dx
  6427.                 mov     di,08000h
  6428.                 mov     cx,900          ;the size of the buffer and this value
  6429.                                         ;limit the number of messages that can
  6430.                                         ;be handled
  6431.                 mov     max_find,cx
  6432.                 mov     cx,ds
  6433.                 mov     ax,offset scratch_path
  6434.                 mdosfindfirst
  6435.                 jnc     gbh1
  6436. gbh1:
  6437.                 mov     si,0
  6438.                 add     si,offset ffilename
  6439.                 add     si,8
  6440.                 mov     di,8000h
  6441.                 mov     cx,max_find
  6442.                 and     cx,cx
  6443.                 jz      gbh_end
  6444. gbh2:
  6445.                 mov     ax,sel_names
  6446.                 mov     ds,ax
  6447.                 mov     es,ax
  6448. public gbh2a
  6449. gbh2a:
  6450.                 push    cx
  6451.                 push    si              ;si is offset of filename extension
  6452.                 mov     cx,3
  6453.                 call    dechex
  6454.                 pop     si
  6455.                 stosb
  6456.                 add     si,4
  6457.                 add     si,offset ffilename
  6458.                 add     si,8
  6459.                 pop     cx
  6460.                 loop    gbh2a
  6461.  
  6462. gbh3:
  6463.                 ddata
  6464.                 mov     di,8000h
  6465.                 mov     cx,max_find
  6466.                 xor     ax,ax
  6467. gbh5:
  6468.                 cmp     al,es:[di]
  6469.                 jae     gbh4
  6470.                 mov     al,es:[di]
  6471. gbh4:
  6472.                 inc     di
  6473.                 loop    gbh5
  6474.                 inc     al
  6475. gbh_end:
  6476.                 ret
  6477.  
  6478.  
  6479.  
  6480. cmp_rm_double:
  6481.                                 ;ds:si points to a dword, dx:ax has comp value
  6482.                                 ;rets carry if mem higher than dx:ax z flag valid
  6483.  
  6484.                 push    bx
  6485.                 push    cx
  6486.                 mov     cx,dx
  6487.                 mov     bx,ax
  6488.                 sub     bx,[si]
  6489.                 sbb     cx,[si+2]
  6490.                 pop     cx
  6491.                 pop     bx
  6492.                 ret
  6493.  
  6494. get_lengths:
  6495.                                 ;updates 2 variables si_length and di_length
  6496.                                 ;with the lengths of the strings pointed
  6497.                                 ;to by ds:si and es:di
  6498.                                 ;also updates shortest and longest
  6499.                                 ;cx has value of shortest,ax value of longest
  6500.  
  6501.                 push    di
  6502.                 call    eoz
  6503.                 mov     di_length,cx
  6504.                 call    eozs
  6505.                 mov     si_length,cx
  6506.                 pop     di
  6507.                 mov     cx,di_length
  6508.                 sub     cx,si_length
  6509.                 jc      di_low
  6510.                 mov     cx,si_length
  6511.                 mov     ax,di_length
  6512. glen1:
  6513.                 mov     shortest,cx
  6514.                 mov     longest,ax
  6515.                 ret
  6516. di_low:
  6517.                 mov     ax,si_length
  6518.                 mov     cx,di_length
  6519.                 jmp     short glen1
  6520.                 ret
  6521.  
  6522.  
  6523. string_compare:
  6524.                 call    get_lengths
  6525.         repz    cmpsb
  6526.                 and     cx,cx
  6527.                 jz      same_so_far
  6528.                 dec     di
  6529.                 dec     si
  6530.                 mov     al,[di]
  6531.                 cmp     al,[si]
  6532.                 ret                     ;carry says si is larger
  6533. same_so_far:
  6534.                 mov     ax,di_length
  6535.                 cmp     ax,si_length
  6536.                 ret
  6537.  
  6538.  
  6539. unpack_bdls:
  6540.  
  6541.  
  6542. save_cur_ddir:
  6543.                 push    es
  6544.                 push    di
  6545.                 edata
  6546.                 mdosqcurdisk home_drive,results
  6547.                 mov     cx,64
  6548.                 mov     ax,home_drive
  6549.                 add     ax,40h
  6550.                 mov     di,offset home_dr_ascii
  6551.                 stosb
  6552.                 mov     al,':'
  6553.                 stosb
  6554.                 mov     al,'\'
  6555.                 stosb
  6556.                 mdosqcurdir home_directory
  6557.                 pop     di
  6558.                 pop     es
  6559.                 ret
  6560.  
  6561. retr_cur_ddir:
  6562.                 mov     ax,home_drive
  6563.                 mdosselectdisk
  6564.                 mov     si,offset home_dr_ascii
  6565.                 mdoschdir
  6566.                 ret
  6567.  
  6568. check_arc:
  6569.                 mov     al,9
  6570.                 cmp     al,[si+1]
  6571.                 ret
  6572.  
  6573.  
  6574. check_lh:
  6575.                 push    si
  6576.                 mov     cx,10h
  6577.                 mov     si,offset scratch_ascii
  6578.                 mov     di,offset lzh_string
  6579.                 call    search_for
  6580.                 pop     si
  6581.                 ret
  6582.  
  6583. check_zip:
  6584.                 push    si
  6585.                 mov     cx,10h
  6586.                 mov     si,offset scratch_ascii
  6587.                 mov     di,offset zip_string
  6588.                 call    search_for
  6589.                 pop     si
  6590.                 ret
  6591.  
  6592.  
  6593. public spawn_pack
  6594. spawn_pack:
  6595.                 call    save_cur_ddir
  6596.                 mov     si,offset comspec_srch
  6597.                 mdosscanenv
  6598.                 jnc      spp1
  6599.                 jmp     file_error
  6600. spp1:
  6601.                 edata
  6602.                 mov     si,result
  6603.                 mov     ax,sel_environ
  6604.                 push    ds
  6605.                 mov     ds,ax
  6606.                 call    eozs
  6607.                 mov     di,offset cmd_path
  6608.         rep     movsb
  6609.                 pop     ds
  6610.                 mov     si,offset cmd_path
  6611.                 mov     di,offset cmd_simple
  6612.                 call    get_simple
  6613.                 mov     al,0
  6614.                 stosb
  6615.                 mov     al,'/'
  6616.                 stosb
  6617.                 mov     al,'c'
  6618.                 stosb
  6619.                 mov     si,offset pack_path
  6620.                 call    eozs
  6621.         rep     movsb
  6622.                 prt     vmsg_pspawn
  6623.                 prt     space3
  6624.                 prt     cmd_simple
  6625.                 mov     cx,offset null_target
  6626.                 mov     bx,offset cmd_simple
  6627.                 mov     si,offset cmd_path
  6628.                 xor     ax,ax
  6629.                 mdosexecpgm
  6630.                 ret
  6631.  
  6632.  
  6633. get_simple:                     ;must only be called with si -> at fully
  6634.                                 ;qualified pathname. di -> to location
  6635.                                 ;for the simple name. The simple name is
  6636.                                 ;considered to be the string between the
  6637.                                 ;last \ and the first period (less than 20
  6638.                                 ;chars.
  6639.                 push    di
  6640.                 call    eozs
  6641.                 mov     di,si
  6642.                 add     di,cx
  6643.                 mov     bx,cx
  6644.                 call    back_to_back
  6645.                 xchg    bx,cx
  6646.                 sub     cx,bx
  6647.                 inc     di
  6648.                 mov     si,di
  6649.                 pop     di
  6650. gs1:
  6651.                 lodsb
  6652.                 cmp     al,'.'
  6653.                 jz      got_simple
  6654.                 stosb
  6655.                 loop    gs1
  6656. got_simple:
  6657.                 ret
  6658.  
  6659. back_to_back:           ;enter with di-> at end of string, cx length of string
  6660.                         ;rets with di-> to last \ in string
  6661.                 mov     al,'\'
  6662.                 std
  6663.         repnz   scasb
  6664.                 cld
  6665.                 inc     di
  6666.                 ret
  6667. clean_nn_list:
  6668.                 mov     di,offset nnlist
  6669.                 mov     cx,600
  6670.                 call    clean_wbuffer
  6671.                 ret
  6672.  
  6673. close_handles:
  6674.                 mov     si,offset nn_handle_list
  6675. chan1:
  6676.                 lodsw
  6677.                 and     ax,ax
  6678.                 jz      chan2
  6679.                 push    ax
  6680.                 push    si
  6681.                 mov     si,offset scratch_ascii
  6682.                 mov     word ptr [si],0
  6683.                 mov     cx,ds
  6684.                 mov     doscall_inseg,cx
  6685.                 mov     cx,2
  6686.                 mdoswrite doscall_inseg,results
  6687.                 pop     si
  6688.                 pop     ax
  6689.                 mdosclose
  6690.                 jmp     short chan1
  6691. chan2:
  6692.                 ret
  6693.  
  6694.  
  6695. append:
  6696.                                 ;moves the file pointer of <handle> to eof
  6697.                                 ;handle must be valid
  6698.                 push    ax
  6699.                 push    bx                
  6700.                 push    cx
  6701.                 push    dx
  6702.                 xor     bx,bx
  6703.                 mov     dx,bx
  6704.                 mov     ax,handle
  6705.                 mdoschgfileptr rel_end
  6706.                 pop     dx
  6707.                 pop     cx
  6708.                 pop     bx
  6709.                 pop     ax
  6710.                 ret
  6711.  
  6712. fptr_begin:
  6713.                                 ;moves the file pointer to beginning of file
  6714.                 push    ax
  6715.                 push    bx
  6716.                 push    dx
  6717.                 xor     bx,bx
  6718.                 mov     dx,bx
  6719.                 mov     ax,handle
  6720.                 mdoschgfileptr rel_beg
  6721.                 pop     dx
  6722.                 pop     bx
  6723.                 pop     ax
  6724.                 ret
  6725.  
  6726.  
  6727.  
  6728. public delete_rtn
  6729. delete_rtn:
  6730.                 ddata
  6731.  ;               mov     ds,ax
  6732.                 mov     di,0
  6733. delr1:
  6734.                 mov     ax,sel_areas
  6735.                 mov     es,ax
  6736.                 push    di
  6737.                 cmp     byte ptr es:[di],0
  6738.                 jz      del_end
  6739.                 call    try_delete
  6740.                 pop     di
  6741.                 add     di,type line_infos
  6742.                 mov     current_path,di
  6743.                 jmp     short delr1
  6744. del_end:
  6745.                 pop     di
  6746.                 xor     ax,ax
  6747.                 jmp     term_scan
  6748.  
  6749. public try_delete
  6750. try_delete:
  6751.                 mov     ax,sel_areas
  6752.                 mov     es,ax
  6753.                 mov     di,current_path
  6754.                 cmp     byte ptr es:[di+offset li_flag],'#'
  6755. ;                add     di,offset li_flag
  6756. ;                mov     al,byte ptr es:[di]
  6757. ;                cmp     al,'#'
  6758.                 jnz     td1
  6759.                 call    mov_cur_path_to_data
  6760.                 call    names
  6761.                 call    delete_msgs
  6762. td1:
  6763.                 ret
  6764.  
  6765. public delete_msgs
  6766. delete_msgs:
  6767.                 push    ds
  6768.                 pop     es
  6769. ;                mov     cx,offset wpe_end
  6770. ;                mov     di,wkg_path_end
  6771. ;                sub     cx,di
  6772. ;                call    clean_buffer
  6773.                 mov     di,cur_ar_path_end
  6774.                 mov     si,0
  6775.                 cmp     max_find,0
  6776.                 jz      dmsg2
  6777.                 mov     ax,sel_names
  6778.                 mov     ds,ax
  6779.  
  6780.                 push    di
  6781.                 push    ds
  6782.                 ddata
  6783.                 prt     vmsg_delete
  6784.                 mov     di,es:current_path
  6785.                 mov     ax,es:sel_areas
  6786.                 mov     ds,ax
  6787.                 add     di,offset li_area
  6788.                 call    print_asciiz
  6789.                 pop     ds
  6790.                 pop     di
  6791.  
  6792.  dmsg3:
  6793.  
  6794.                 mov     di,es:cur_ar_path_end
  6795.                 xor     cx,cx
  6796.                 add     si,offset flen_filename
  6797.                 mov     cl,[si]
  6798.                 and     cl,cl
  6799.                 jz      dmsg2
  6800.                 inc     cl
  6801.                 inc     si
  6802.         rep     movsb
  6803.                 push    ds
  6804.                 push    si
  6805.                 ddata
  6806.                 mov     si,offset scratch_path
  6807.                 mdosdelete
  6808.                 jnc     dmsg1
  6809.                 jmp     file_error
  6810. dmsg1:
  6811.                 prt     vmsg_dot
  6812.                 pop     di
  6813.                 pop     es
  6814.  
  6815.                 dec     max_find
  6816.                 cmp     max_find,0
  6817.                 jz      dmsg2
  6818.  
  6819.                 push    es
  6820.                 pop     ds
  6821.                 edata
  6822.                 mov     si,di
  6823.                 jmp     short dmsg3
  6824. dmsg2:
  6825.                 ddata
  6826.                 ret
  6827.  
  6828.  
  6829. write_time:                     ;writes the current date time to es:di
  6830.                 xor     ax,ax
  6831.                 mov     al,month
  6832.                 call    write_h_ascii
  6833.                 mov     al,'-'
  6834.                 stosb
  6835.                 mov     al,day
  6836.                 call    write_h_ascii
  6837.                 mov     al,'-'
  6838.                 stosb
  6839.                 mov     ax,year
  6840. ;                add     ax,1980
  6841.                 call    write_h_ascii
  6842.                 mov     al,' '
  6843.                 stosb
  6844.                 xor     ax,ax
  6845.                 mov     al,hour
  6846.                 call    write_h_ascii2d
  6847.                 mov     al,':'
  6848.                 stosb
  6849.                 mov     al,minute
  6850.                 call    write_h_ascii2d
  6851.                 mov     al,':'
  6852.                 stosb
  6853.                 mov     al,second
  6854.                 call    write_h_ascii2d
  6855.                 ret
  6856.  
  6857.  
  6858.  
  6859. public log_pkt_info
  6860. log_pkt_info:
  6861.                 mov     di,offset scratch_ascii
  6862.                 wstring logmsg_pkt1
  6863.                 mov     si,path_end
  6864.                 call    write_asciiz
  6865.                 mov     al,' '
  6866.                 stosb
  6867.                 stosb
  6868.                 xor     ax,ax
  6869.                 mov     ax,phmonth
  6870.                 call    write_h_ascii2d
  6871.                 mov     al,'-'
  6872.                 stosb
  6873.                 mov     ax,phday
  6874.                 call    write_h_ascii2d
  6875.                 mov     al,'-'
  6876.                 stosb
  6877.                 mov     ax,phyear
  6878.                 add     ax,1900
  6879.                 call    write_h_ascii2d
  6880.                 mov     al,' '
  6881.                 stosb
  6882.                 mov     ax,phhour
  6883.                 call    write_h_ascii2d
  6884.                 mov     al,':'
  6885.                 stosb
  6886.                 mov     ax,phminute
  6887.                 call    write_h_ascii2d
  6888.                 mov     al,':'
  6889.                 stosb
  6890.                 mov     ax,phsecond
  6891.                 call    write_h_ascii2d
  6892.                 wstring logmsg_pkt2
  6893.                 mov     ax,phorigin_net
  6894.                 call    write_h_ascii
  6895.                 mov     al,'/'
  6896.                 stosb
  6897.                 mov     ax,phorigin_node
  6898.                 call    write_h_ascii
  6899.                 mov     al,' '
  6900.                 stosb
  6901.                 stosb
  6902.                 wstring logmsg_pkt3
  6903.                 mov     ax,phdest_net
  6904.                 call    write_h_ascii
  6905.                 mov     al,'/'
  6906.                 stosb
  6907.                 mov     ax,phdest_node
  6908.                 call    write_h_ascii
  6909.                 wstring logmsg_pkt4
  6910.                 xor     ah,ah
  6911.                 mov     al,phproduct
  6912.                 call    write_h_ascii
  6913.                 wstring logmsg_pkt5
  6914.                 mov     si,offset pkt_size
  6915.                 lodsw
  6916.                 mov     dx,[si]
  6917.                 call    dw_to_ascii
  6918.                 mov     al,0dh
  6919.                 stosb
  6920.                 mov     al,0ah
  6921.                 stosb
  6922.                 xor     al,al
  6923.                 stosb
  6924.  
  6925.  
  6926.                 logaz   scratch_ascii
  6927.  
  6928.                 ret
  6929.  
  6930. public dw_to_ascii
  6931. dw_to_ascii:
  6932.                 mov     first_digit,0
  6933.                 push    ax
  6934.                 push    dx
  6935.                 mov     bx,1000
  6936.                 div     bx
  6937.                 xor     dx,dx
  6938.                 div     bx
  6939.                 xor     dx,dx
  6940.                 and     ax,ax
  6941.                 jz      dww1
  6942.                 push    ax
  6943.                 add     al,30h
  6944.                 stosb
  6945.                 mov     first_digit,1
  6946.                 pop     ax
  6947.                 mul     bx
  6948.                 mul     bx
  6949.                 mov     cx,dx
  6950.                 mov     bx,ax
  6951.                 pop     dx
  6952.                 pop     ax
  6953.                 sub     ax,bx
  6954.                 sbb     dx,cx
  6955.                 push    ax
  6956.                 push    dx
  6957.  
  6958. dww1:
  6959.                 pop     dx
  6960.                 pop     ax
  6961.                 push    ax
  6962.                 push    dx
  6963.                 mov     bx,1000
  6964.                 div     bx
  6965.                 xor     dx,dx
  6966.                 mov     bx,100
  6967.                 div     bx
  6968.                 xor     dx,dx
  6969.                 and     ax,ax
  6970.                 jnz     dww1a
  6971.                 and     first_digit,0ffh
  6972.                 jz      dww2
  6973. dww1a:
  6974.                 push    ax
  6975.                 add     al,30h
  6976.                 stosb
  6977.                 mov     first_digit,1
  6978.                 pop     ax
  6979.                 mul     bx
  6980.                 mov     bx,1000
  6981.                 mul     bx
  6982.                 mov     cx,dx
  6983.                 mov     bx,ax
  6984.                 pop     dx
  6985.                 pop     ax
  6986.                 sub     ax,bx
  6987.                 sbb     dx,cx
  6988.                 push    ax
  6989.                 push    dx
  6990.  
  6991. dww2:
  6992.                 pop     dx
  6993.                 pop     ax
  6994.                 push    ax
  6995.                 push    dx
  6996.                 mov     bx,10000
  6997.                 div     bx
  6998.                 xor     dx,dx
  6999.                 and     ax,ax
  7000.                 jnz     dww2a
  7001.                 test     first_digit,0ffh
  7002.                 jz      dww3
  7003. dww2a:
  7004.                 push    ax
  7005.                 add     al,30h
  7006.                 stosb
  7007.                 mov     first_digit,1
  7008.                 pop     ax
  7009.                 mov     bx,10000
  7010.                 mul     bx
  7011.                 mov     cx,dx
  7012.                 mov     bx,ax
  7013.                 pop     dx
  7014.                 pop     ax
  7015.                 sub     ax,bx
  7016.                 sbb     dx,cx
  7017.                 push    ax
  7018.                 push    dx
  7019. dww3:
  7020.                 pop     dx
  7021.                 pop     ax
  7022.                 push    ax
  7023.                 xor     dx,dx
  7024.                 mov     bx,1000
  7025.                 div     bx
  7026.                 and     ax,ax
  7027.                 jnz     dww3a
  7028.                 test    first_digit,0ffh
  7029.                 jz      dww4
  7030. dww3a:
  7031.                 push    ax
  7032.                 add     al,30h
  7033.                 stosb
  7034.                 pop     ax
  7035.                 mul     bx
  7036.                 mov     bx,ax
  7037.                 pop     ax
  7038.                 sub     ax,bx
  7039.                 push    ax
  7040. dww4:
  7041.                 pop     ax
  7042.                 mov     bp,ax
  7043.                 mov     bx,100
  7044.                 xor     dx,dx
  7045.                 div     bx
  7046.                 mov     cx,ax
  7047.                 add     al,30h
  7048.                 stosb
  7049.                 mov     ax,cx
  7050.                 mul     bx
  7051.                 sub     bp,ax
  7052.                 mov     ax,bp
  7053.                 mov     bx,10
  7054.                 div     bx
  7055.                 mov     cx,ax
  7056.                 add     al,30h
  7057.                 stosb
  7058.                 mov     ax,cx
  7059.                 mul     bx
  7060.                 sub     bp,ax
  7061.                 mov     ax,bp
  7062.                 add     al,30h
  7063.                 stosb
  7064.                 ret
  7065.  
  7066. log_area_toss:
  7067.                 push    ax
  7068.                 push    bx
  7069.                 push    cx
  7070.                 push    dx
  7071.                 push    di
  7072.                 push    si
  7073.                 push    es
  7074.                 and     area_changed,0ffh
  7075.                 jz      lat1
  7076.                 edata
  7077.                 mov     di,offset scratch_ascii
  7078.                 wstring logmsg_echo1
  7079.                 wstring current_area
  7080.                 mov     al,20h
  7081.                 stosb
  7082.                 mov     al,'.'
  7083. lat2:
  7084.                 stosb
  7085.                 cmp     di,offset scratch_ascii+43
  7086.                 jbe     lat2
  7087.                 mov     al,20h
  7088.                 stosb
  7089.                 mov     ax,msg_cntr
  7090.                 add     tot_count,ax
  7091.                 call    write_h_ascii4d
  7092.                 wstring logmsg_echo2
  7093.                 mov     ax,scan_count
  7094.                 call    write_h_ascii4d
  7095.                 mov     al,')'
  7096.                 stosb
  7097.  
  7098.                 wstring crlf
  7099.                 mov     al,0
  7100.                 stosb
  7101.                 logaz scratch_ascii
  7102.                 mov     msg_cntr,0
  7103.  
  7104. lat1:
  7105.                 pop     es
  7106.                 pop     si
  7107.                 pop     di
  7108.                 pop     dx
  7109.                 pop     cx
  7110.                 pop     bx
  7111.                 pop     ax
  7112.                 ret
  7113.  
  7114. get_scan_area:
  7115.                                 ;di -> at area entry in sel areas
  7116.                                 ;moves it to current_area
  7117.                 push    es
  7118.                 push    di
  7119.                 push    si
  7120.                 xchg    di,si
  7121.                 mov     ax,sel_areas
  7122.                 mov     es,ax
  7123.                 xdses
  7124.                 add     si,offset li_area
  7125.                 mov     di,offset current_area
  7126.                 call    eozs
  7127.         rep     movsb
  7128.                 xor     al,al
  7129.                 stosb
  7130.                 xdses
  7131.                 pop     si
  7132.                 pop     di
  7133.                 pop     es
  7134.                 ret
  7135.  
  7136. names:
  7137.                 mov     ax,sel_names
  7138.                 and     ax,ax
  7139.                 jnz     gethigh_noalloc
  7140.                 mov     ax,0a000h
  7141.                 push    ax
  7142.                 mov     ax,offset sel_names
  7143.                 push    ds
  7144.                 push    ax
  7145.                 mov     ax,0
  7146. ;this shuld be implemented as a discardable segment (ax=2)
  7147.                 push    ax
  7148.                 call    DosAllocSeg
  7149. public  gethigh_noalloc
  7150. gethigh_noalloc:
  7151.                 push    ds
  7152.                 pop     es
  7153.                 mov     di,cur_ar_path_end
  7154.                 mov     si,offset msg_search
  7155.                 mov     cx,6
  7156.         rep     movsb
  7157.  
  7158.                 mov     ax,sel_names
  7159.                 mov     doscall_inseg,ax
  7160.                 mov     search_handle,1
  7161.                 mov     dx,0
  7162.                 mov     si,dx
  7163.                 mov     di,08000h
  7164.                 mov     cx,900          ;the size of the buffer and this value
  7165.                                         ;limit the number of messages that can
  7166.                                         ;be handled
  7167.                 mov     max_find,cx
  7168.                 mov     cx,ds
  7169.                 mov     ax,offset scratch_path
  7170.  
  7171.                 mdosfindfirst
  7172.                 ret
  7173.  
  7174.  
  7175. public get_tosslog
  7176. get_tosslog:
  7177.                 mov     toss_add,0
  7178.                 mov     ax,0ffffh
  7179.                 mdosallocseg sel_tosslog,no_share
  7180.                 push    word ptr sharing
  7181.                 push    word ptr access
  7182.                 mov     sharing,deny_none
  7183.                 mov     access,read_only_access
  7184.                 mdosopen echo_toss,open,fail
  7185.                 pop     word ptr access
  7186.                 pop     word ptr sharing
  7187.                 openerror echo_toss,file_error
  7188.                 mov     ax,sel_tosslog
  7189.                 mov     doscall_inseg,ax
  7190.                 mov     si,0
  7191.                 mov     cx,0ffffh
  7192.                 mdosread
  7193.                 jnc     gtoss1
  7194.                 jmp     short gtoss2
  7195. gtoss1:
  7196.                 mov     ax,result
  7197.                 mov     tosslog_length,ax
  7198. gtoss2:
  7199.                 ret
  7200.  
  7201. convert_crs:
  7202.                 mov     ax,sel_tosslog
  7203.                 mov     cx,tosslog_length
  7204.                 mov     es,ax
  7205.                 mov     di,0
  7206.                 mov     bx,di
  7207.                 mov     al,0dh
  7208. cc1:
  7209.         repnz   scasb
  7210.                 mov     es:[di-1],bl
  7211.                 and     cx,cx
  7212.                 jnz     cc1
  7213.                 ret
  7214.  
  7215.  
  7216. get_nxt_toss_area:
  7217.                                         ;on entry di is pointing at the
  7218.                                         ;area line in the tosslog to be
  7219.                                         ;scanned now. on exit it will point
  7220.                                         ;at the next one.
  7221.                                         ;rets carry on error. toss_flag
  7222.                                         ;end_log if at end of log or
  7223.                                         ;toss_flag no_area if area not found
  7224.                                         ;otherwise si is pointing to the area
  7225.                                         ;line.
  7226.                 push    ds
  7227.                 mov     ax,sel_tosslog
  7228.                 mov     es,ax
  7229.                 mov     di,toss_add
  7230.                 mov     cx,limit_areas
  7231.                 cmp     di,tosslog_length
  7232.                 jae     gnta2
  7233.                 mov     ax,sel_areas
  7234.                 mov     ds,ax
  7235.                 mov     si,0
  7236.                 mov     ax,1
  7237.                 call    search_for
  7238.                 ddata
  7239.                 pushf
  7240.                 mov     cx,limit_areas
  7241.                 call    next_z_limit    ;di should not have varied til now
  7242.                 inc     di              ;moves di to start of next line
  7243.                 mov     toss_add,di
  7244.                 popf
  7245.                 jc      gnta3
  7246.                 xor     dx,dx
  7247.                 mov     bx,type line_infos
  7248.                 mov     bh,0
  7249.                 mov     ax,si
  7250.                 div     bx
  7251.                 xor     dx,dx
  7252.                 mul     bx
  7253.                 mov     si,ax
  7254.                 pop     ds
  7255.                 ret
  7256.  
  7257. gnta2:
  7258.                 or toss_flag,end_log
  7259.                 pop     ds
  7260.                 ret
  7261. gnta3:
  7262.                 or toss_flag,no_area
  7263.                 pop     ds
  7264.                 ret
  7265.  
  7266. pull_atag:
  7267.                                         ;
  7268.  
  7269.                 push    es
  7270.                 mov     ax,sel_msg_buf
  7271.                 mov     es,ax
  7272.                 mov     di,offset mtext
  7273.                 call    dlen
  7274.                 inc     cx
  7275.                 mov     bx,di
  7276.                 add     bx,cx
  7277.                 cmp     byte ptr es:[bx],0dh
  7278.                 jnz     pa1
  7279.                 inc     cx
  7280. pa1:
  7281.                 cmp     byte ptr es:[bx],0ah
  7282.                 jnz     pa2
  7283.                 inc     cx
  7284. pa2:
  7285.                 mov     dx,upmsg_length
  7286.                 call    delete_cx_chars
  7287.                 mov     upmsg_length,di
  7288.                 pop     es
  7289.                 ret
  7290.  
  7291.  
  7292.  
  7293.  
  7294.  
  7295. parse_route:            ;enters with ds = local data
  7296. public parse_route
  7297.                 mov     ax,08000h
  7298.                 mdosopen       routing,open,fail
  7299.                 jnc     route1
  7300.                 mov     si,offset routing
  7301.                 jmp     file_error
  7302. route1:
  7303.                 mdosQfileinfo  all_file_info
  7304.                 mov     bx,offset all_file_info
  7305.                 add     bx,offset ffile_size
  7306.                 mov     ax,word ptr [bx]
  7307.                 add     ax,0100h
  7308.                 push    ax
  7309.                 mdosallocseg   sel_route,no_share
  7310.                 pop     cx
  7311.                 dec     cx
  7312.                 mov     es,sel_route
  7313.                 mov     di,0
  7314.                 call    clean_buffer
  7315.                 mov     cx,word ptr [bx]
  7316.                 mov     si,0
  7317.                 mov     ax,sel_route
  7318.                 mov     doscall_inseg,ax
  7319.                 mdosread
  7320.                 push    ds
  7321.                 pop     es
  7322.                 mov     ds,sel_route
  7323.                 mov     si,es:all_file_info.ffile_size
  7324.                 mov     al,0dh
  7325.                 mov     cx,4
  7326. parr1:
  7327.                 inc     si
  7328.                 mov     byte ptr[si],al
  7329.                 loop    parr1
  7330.                 mov     si,0
  7331. parr2:
  7332.                 call    find_config_line
  7333.                 cmp     si,es:all_file_info.ffile_size
  7334.                 jae     parr6
  7335.                 call    sstart
  7336.                 jc      parr2
  7337.                 push    si
  7338.                 mov     bx,0
  7339.  
  7340. parr3:
  7341.                 mov     si,offset route_index
  7342.                 mov     di,es:[si+bx]
  7343.                 mov     cx,es:[si+bx+2]
  7344.                 sub     cx,di
  7345.                 mov     ax,si
  7346.                 add     ax,bx
  7347.                 cmp     ax,offset end_index
  7348.                 jae     parr5              ;this line didn't match
  7349.                 pop     si
  7350.                 push    si
  7351.         repz    cmpsb
  7352.                 and     cx,cx
  7353.                 jz      parr4              ;it's been found
  7354.                 inc     bx
  7355.                 inc     bx
  7356.                 jmp     short parr3
  7357.  
  7358. parr4:
  7359.                 pop     ax              ;throw it away
  7360.                 call    sstart
  7361.                 mov     di,offset route_sr_ind
  7362.                 call    es:[di+bx]
  7363.                 jmp     short parr2
  7364.  
  7365. parr5:
  7366.                 jmp     short parr2
  7367.  
  7368. parr6:
  7369.                 ret
  7370.  
  7371.  
  7372. route_sr_1:
  7373.                 mov     bx,offset route_work_area
  7374.                 lea     di,offset rt_crash [bx]
  7375.                 call    net_nodes
  7376.                 ret
  7377.  
  7378. route_sr_2:
  7379.                 mov     bx,offset route_work_area
  7380.                 lea     di,offset rt_hold [bx]
  7381.                 call    net_nodes
  7382.                 ret
  7383. route_sr_3:
  7384.                 mov     di,offset akas
  7385.                 call    net_nodes
  7386.                 ret
  7387.  
  7388. each_out:
  7389.                 edata
  7390.                 mov     si,offset outbound
  7391.                 mov     si,offset out_search
  7392.                 call    find_file
  7393. ;look for a .out file
  7394. ;check first crash then hold
  7395. ;look for bundle to that node
  7396. ;add it to or create new
  7397. ;if new, add to carrier
  7398. ;adjust carrier type
  7399. ;
  7400.  
  7401.  
  7402. ;for packing/routing netmail
  7403. ;get list of msgs
  7404. ;open each
  7405. ;        check to/from
  7406. ;        if not to us and if not sent
  7407. ;                adjust and put in outbound
  7408. ;                delete if k/s
  7409.  
  7410.  
  7411. out_node:
  7412.                                 ;on entry si points at .out file name
  7413.                                 ;on exit ax contains the node dx has the net
  7414.                 push    si
  7415.                 mov     cx,4
  7416.                 call    dechex
  7417.                 pop     si
  7418.                 push    ax
  7419.                 mov     cx,4
  7420.                 add     si,cx
  7421.                 call    dechex
  7422.                 pop     dx
  7423.                 ret
  7424.  
  7425.  
  7426.  
  7427. public find_file
  7428. find_file:
  7429.                                 ;enters with si pointing at the path to
  7430.                                 ;search, di pointing at search pattern
  7431.                                 ;exits with the first file found in
  7432.                                 ;scratch path rets w/ carry if no file
  7433.                                 ;found
  7434.  
  7435.                 push    di
  7436.                 mov     di,offset all_file_info.ffilename
  7437.                 mov     cx,20
  7438.                 call    clean_buffer
  7439.                 pop     di
  7440.                 mov     search_pattern_offset,di
  7441.                 call    eozs
  7442.                 inc     cx
  7443.  
  7444.                 mov     di,offset scratch_path
  7445.                 push    di
  7446.         rep     movsb
  7447.                 pop     di
  7448.                 mov     ax,ds
  7449.                 mov     es,ax
  7450.                 call    eoz
  7451.                 mov     al,'\'
  7452.                 cmp     al,[di-1]
  7453.                 jz      ff1a
  7454.                 stosb
  7455. ;gb1:
  7456. ff1a:
  7457.                 mov     scratch_path_end,di
  7458. ff1:
  7459. ff4:
  7460.                 mov     cx,0
  7461.                 mov     bx,0
  7462.                 mov     dx,bx
  7463.                 mov     di,40
  7464.                 mov     ax,_data
  7465.                 mov     doscall_inseg,ax
  7466.                 mov     find_ptr,si
  7467.  
  7468. ff2:
  7469.                 mov     si,search_pattern_offset
  7470.                 call    eozs
  7471.                 inc     cx
  7472.                 mov     di,scratch_path_end
  7473.         rep     movsb
  7474.                 mov     max_find,1
  7475.                 mov     si,0
  7476.                 mov     di,40
  7477.                 mov     cx,ds
  7478.                 mov     ax,1
  7479.                 mov     search_handle,ax
  7480.                 mov     ax,offset scratch_path
  7481.                 mdosfindfirst
  7482.                 cmp     ax,12h
  7483.                 je      ff5
  7484.                 cmp     ax,0
  7485.                 jne     ff_error
  7486. ff5:
  7487.                 mov     cx,offset flen_filename
  7488.                 inc     cx
  7489.                 mov     si,offset all_file_info.ffilename
  7490.                 mov     di,scratch_path_end
  7491.         rep     movsb
  7492.                 clc
  7493. ff_error:
  7494.                 ret
  7495.  
  7496.  
  7497. asciih_to_hexd:
  7498.                                 ;on entry si points to a 4 digit ascii
  7499.                                 ;hex number. On exit ax conts the value
  7500.  
  7501.                 call    si_to_hexd
  7502.                 mov     bh,al
  7503.                 call    si_to_hexd
  7504.                 mov     bl,al
  7505.                 call    si_to_hexd
  7506.                 mov     ah,al
  7507.                 call    si_to_hexd
  7508.                 shl     bh,4
  7509.                 shl     ah,4
  7510.                 add     bl,bh
  7511.                 add     al,ah
  7512.                 mov     ah,bl
  7513.                 ret
  7514.  
  7515. bndl_to_node:
  7516.                                 ;on entry si points at the bndl number
  7517.                                 ;es:di points to place to write the net/node
  7518.  
  7519.                 push    di
  7520.                 call    asciih_to_hexd
  7521.                 push    ax
  7522.                 call    asciih_to_hexd
  7523.                 push    ax
  7524.                 xor     ax,ax
  7525.                 mov     di,offset scratch_node
  7526.                 stosb
  7527.                 pop     dx
  7528.                 pop     ax
  7529.                 mov     si,offset this_add
  7530.                 inc     si
  7531. ;                mov     bx,0ffffh
  7532. ;                xor     ax,bx
  7533.                 add     ax,word ptr[si]
  7534.                 stosw
  7535.                 inc     si
  7536.                 inc     si
  7537.                 mov     ax,dx
  7538. ;                xor     ax,bx
  7539.                 add     ax,word ptr[si]
  7540.                 stosw
  7541.                 mov     si,offset scratch_node
  7542.                 pop     di
  7543.                 call    write_node
  7544.                 ret
  7545.  
  7546. si_to_hexd:
  7547.                 lodsb
  7548.                 cmp     al,39h
  7549.                 jbe     ath1
  7550.                 sub     al,7
  7551. ath1:
  7552.                 sub     al,30h
  7553.                 ret
  7554.  
  7555.  
  7556. _code   ends
  7557.  
  7558.  
  7559. end     main
  7560. 
  7561.