home *** CD-ROM | disk | FTP | other *** search
-
- ;Sat Sat 04-06-1991
-
- ; FMAIL ver 1.00
-
-
-
- ;********************************************************************************
- ;
- ;This code is only slightly commented, but most of the subroutines are well
- ;headed with entry and exit characteristics. The code is written in a
- ;"self commenting" manner so there should be little difficulty in following
- ;it.
- ;
- ;I'll not claim that this is "great" code, It's not! It is very loose and
- ;wasteful in both size and speed. It is easy to work with though and easy to
- ;modify. (easier to write too).
- ;
- ;The entire first section (up to the start of the data segment) is a set of
- ;macros and structures to ease the calling conventions of the API and reduce
- ;errors. I'm still adding to this regularly and it could easily be put in an
- ;include file.
- ;
- ;As a general rule (that is often broken) the subroutines follow the parent.
- ;
- ;You will often find non attached pieces of code in this file. These will
- ;usually be parts of features in progress of debugging aids.
- ;
- ;The entire program is my exclusive work with the exception on the crc
- ;computation routine which was found in public domain file and entirely
- ;rewritten with the exception of the table of values. My thanks to the unknown
- ;author.
- ;
- ;This work is copyrite 1991 by Patrick O'Riva, all rights reserved.
- ;
- ;You may use, modify, distribute, or whatever else you wish to do with it as
- ;long as no money is asked for it. As long as pieces of it are recognizable
- ;you must include my copyrite and this notice.
- ;
- ;If you are adding features to FMAIL as a whole (rather than writing a new
- ;mailer using parts of this) send the changes to me for inclusion in an
- ;"official" release.
- ;
- ;**********************************************************************************
-
-
-
- .286
-
- false equ 0
- true equ 1
-
- tight equ false
- debug equ false
- drived equ false
- no_tosslog equ false
-
-
- lodad macro
- lodsw
- mov dx,ax
- lodsw
- xchg dx,ax
- endm
-
-
- ddata macro
- push _data
- pop ds
- endm
-
- edata macro
- push _data
- pop es
- endm
-
- xdses macro
- push ds
- push es
- pop ds
- pop es
- endm
-
- prt macro message
- mov di,offset message
- call print_asciiz
- endm
-
- add_m32_rax macro m32
- push dx
- xor dx,dx
- add word ptr m32,ax
- adc word ptr m32+2,dx
- pop dx
- endm
-
-
-
- error_check macro
- local mend
- and ax,ax
- jz mend
- stc
- mend:
- endm
-
- openerror macro path,jump
- local endoe
- jnc endoe
- mov si,offset path
- jmp jump
- endoe:
- endm
-
-
- mdosallocseg macro selname,sharing_mode
- push ax
- mov ax,offset selname
- push ds
- push ax
- push sharing_mode
- call dosallocseg
- error_check
- endm
-
- ;doschdir....ds:si -> at a path (may contain drive(1 based))
-
- mdoschdir macro
- push ds
- push si
- xor ax,ax
- push ax
- push ax
- call doschdir
- error_check
- endm
-
-
- ;doschgfileptr
- ;changes the dos file pointer. Receives the handle in ax, delta in dx:bx
- ; rets the new file pointer in cur_file_ptr
- ;cur_file_ptr dd 0
-
- rel_end equ 2
- rel_beg equ 0
- rel_cur equ 1
-
-
- mdoschgfileptr macro relative
- push ax
- push dx
- push bx
- push relative
- mov ax,offset cur_file_ptr
- push ds
- push ax
- call doschgfileptr
- error_check
- endm
-
-
-
-
- mdosclose macro
- local mnoopen
- and ax,ax
- jz mnoopen
- push ax
- call dosclose
- error_check
- mnoopen:
-
- endm
-
-
-
- ;mdosdelete si -> at the pathname to delete
- mdosdelete macro
- push ds
- push si
- xor ax,ax
- push ax
- push ax
- call dosdelete
- error_check
- endm
-
-
-
-
- ;for DosExecPgm the following should be defined before the macro call
- ;objname db 20 dup(0) ;this recs failing .dll
- ;arg_strings label byte
- ; simple program name asciiz
- ; string, followed by one or
- ; more asciiz args. 2null
- ; terminated
- ;
- ;env_strings label byte
- ; 0 or more asciiz env strings
- ; 2null terminated
- ;child_pathname asciiz
- ;
- ;on entry si is offset of pathname, bx is offset of arg strings, cx offset
- ; of envstrings, ax = 0 for synchronous mode
- ;
- ;on exit result is child termination type and result2 is termination code
-
- mdosexecpgm macro
- push ds
- push offset objname
- push 20
- push ax
- push ds
- push bx
- push ds
- push cx
- push ds
- push offset results
- push ds
- push si
- call dosexecpgm
- error_check
- endm
-
-
-
-
-
- mdosfindfirst macro
- push cx
- push ax
- push ds
- push offset search_handle
- push dx
- push word ptr doscall_inseg
- push si
- push di
- push ds
- push offset max_find
- xor ax,ax
- push ax
- push ax
- call dosfindfirst
- and ax,ax
- error_check
- endm
-
- ;mdosmove si points at old pathname, di points at new pathname
- ;used for renaming or moving file within a drive, and renaming directories
- ;directories must exist.
-
- extrn dosmove:far
- mdosmove macro
- push ds
- push si
- push ds
- push di
- xor ax,ax
- push ax
- push ax
- call dosmove
- error_check
- endm
-
-
- mmdosopen macro
- push ds
- push si
- push ds
- push offset handle
- push ds
- push offset result
- push bx
- push cx
- mov si,ax
- mov al,ah
- xor ah,ah
- push ax
- mov ax,si
- xor ah,ah
- push ax
- push dx
- xor ax,ax
- push ax
- push ax
- call dosopen
- endm
-
-
- mdosopen macro l_o_pathname,if_exist,if_n_exist
- local m1
- push bx
- push cx
- push dx
- push si
- mov dl,sharing
- add dl,access
- mov dh,other_open_flags
- mov al,if_exist+if_n_exist
- mov ah,attrib_create
- mov si,offset filesize
- mov cx,[si]
- mov bx,[si+2]
- mov si,offset l_o_pathname
- mmdosopen
- and ax,ax
- jz m1
- stc
- m1:
- pop si
- pop dx
- pop cx
- pop bx
- endm
-
-
- ;mdosqcurdir parameter receives the directory pathname. cx hold the
- ; length of the buffer, ax has the drive number (1 based)
-
- mdosqcurdir macro dirpath
- mov result,cx
- push ax
- push ds
- push offset dirpath
- push ds
- push offset result
- call dosqcurdir
- error_check
- endm
-
-
- ;mdosqcurdisk first parameter receives a word giving the drive number
- ; (1 based). The second parameter receives a dword drive bitmap
- ; (bits 0-25 indicate logical drives)
-
- mdosqcurdisk macro drive_code,bitmap
- push ds
- push offset drive_code
- push ds
- push offset bitmap
- call dosqcurdisk
- error_check
- endm
-
-
-
-
- mdosqfileinfo macro struc_file_info
- push handle
- push 1
- push ds
- push offset struc_file_info
- push type file_info
- call dosqfileinfo
- error_check
- endm
-
-
-
-
- mdosread macro
- mov ax,handle
- push ax
- push doscall_inseg
- push si
- push cx
- push ds
- push offset results
- call dosread
- error_check
- endm
-
- ;mdosscanenv searches the current environment for string pointed to by si
- ; returns the offset in result if found.
- mdosscanenv macro
- push ds
- push si
- push ds
- push offset result
- call dosscanenv
- error_check
- endm
-
-
- ;mdossearchpath searches an explicit list of directories (seperated by semicolons)
- ; or as contained in an environment variable(bare name only) pointed to by si
- ; for the filename pointed to by di (wildcards ok). bx points to the buffer to
- ; receive the fully qualified pathname (wildcards NOT expanded) cx is the length
- ; of the buffer pointed to by bx. Ax is search control. 0 = search current only
- ; if explicitly listed. 1 = always search current first.
-
- mdossearchpath macro
- push ax
- push ds
- push si
- push ds
- push di
- push ds
- push bx
- push cx
- call dossearchpath
- error_check
- endm
-
-
-
-
-
- ;mdosselectdisk requires drive number (1 based) in ax
-
- mdosselectdisk macro
- push ax
- call dosselectdisk
- error_check
- endm
-
- ;mdoswrite - receives the handle in ax,the count in cx, offset of buffer in si
-
-
- mdoswrite macro l_o_buffseg,l_o_bytes_written
- push ax
- mov ax,l_o_buffseg
- push ax
- push si
- push cx
- push ds
- push offset l_o_bytes_written
- call doswrite
- error_check
- endm
-
-
- ;uses viocall and sends a crlf to the console
-
- pcrlf macro
- mov di,offset CRLF
- call print_asciiz
- endm
-
-
-
- nodediz macro
- mov ax,[di+1]
- ; or al,[di]
- or ax,[di+3]
- endm
-
-
- nodesiz macro
- mov ax,[si+1]
- ; or al,[si]
- or ax,[si+3]
- endm
-
-
- wstring macro azstring
- mov si,offset azstring
- call write_asciiz
- endm
-
-
- logaz macro azstring
- mov si,offset azstring
- call eozs
- mov ax,log_handle
- push ds
- pop doscall_inseg
- mdoswrite doscall_inseg,results
- endm
-
-
-
- extrn dosallocseg:far
- extrn doschdir:far
- extrn doschgfileptr:far
- extrn dosclose:far
- extrn dosdelete:far
- extrn dosdelete:far
- extrn dosexecpgm:far
- extrn dosexit:far
- extrn dosfindfirst:far
- extrn dosfreeseg:far
- extrn dosgetdatetime:far
- extrn dosopen:far
- extrn dosqcurdisk:far
- extrn dosqcurdir:far
- extrn dosqfileinfo:far
- extrn dosread:far
- extrn dosscanenv:far
- extrn dossearchpath:far
- extrn dosselectdisk:far
- extrn dossetmaxfh:far
- extrn doswrite:far
- extrn viowrttty:far
-
- dupes_no equ 2000
-
- route_area struc
- rt_crash db 200 dup (5 dup (0))
- rt_hold db 200 dup (5 dup (0))
- rt_send db 200 dup (5 dup (0))
- rt_leave db 200 dup (5 dup (0))
- rt_this_one db 100 dup (5 dup (0))
- rt_through db 100 dup (5 dup (0))
- route_area ends
-
-
-
- read_only_attrib equ 1
- hidden equ 2
- ssystem equ 4
- archive equ 32
- open equ 1
- fail equ 0
- replace equ 2
- create equ 010h
- read_only_access equ 0
- write_only equ 1
- read_write equ 2
- deny_all equ 16
- deny_write equ 32
- deny_read equ 48
- deny_none equ 64
- no_share equ 0
- ;standard data used in file manipulation
-
-
- file_info struc
- ffile_date_create dw 0
- ffile_time_create dw 0
- ffile_date_access dw 0
- ffile_time_access dw 0
- ffile_date_write dw 0
- ffile_time_write dw 0
- ffile_size dw 0
- ffile_size_hi dw 0
- ffile_alloc dd 0
- ffile_attrib dw 0
- flen_filename db 0
- ffilename db 20 dup (0)
- file_info ends
-
- config_info struc ;[bx]
- sys_default db 40 dup (0)
- config_akas dw 5 dup (0)
- toss_log db 40 dup (0)
- net_file db 40 dup (0)
- net_mail db 40 dup (0)
- config_info ends
-
-
- smessage_header struc
- msg_from_net dw 0
- msg_from_node dw 0
- smessage_header ends
-
- line_infos struc
- li_path db 61 dup (0)
- li_highest dw 0 ;hex of highest message number. 0 if not yet determined
- li_flag db 0
- li_area db 20 dup (0)
- li_nodes dw 40 dup (0)
- line_infos ends
-
-
- message_format struc
- mFromUser db 36 dup (0)
- mToUser db 36 dup (0)
- mSubject db 72 dup (0)
- mDateTime db 20 dup (0)
- mtimes_read dw 0
- mdest_node dw 0
- morigin_node dw 0
- mcost dw 0
- morigin_net dw 0
- mdest_net dw 0
- mdest_Zone dw 0
- morigin_Zone dw 0
- mdest_point dw 0
- morigin_point dw 0
- mreply_to dw 0
- mattribute dw 0
- mnext_reply dw 0
- mtext db 0
- message_format ends
-
- pmsg_format struc ; [si]
- ;pmcode dw 0002h ;This structure is used in get_msg
- pmorigin_node dw 0
- pmdest_node dw 0
- pmorigin_net dw 0
- pmdest_net dw 0
- pmattribute dw 0
- pmcost dw 0
- pmDateTime dw 0
- pmsg_format ends
-
-
- spmsg_format struc ; [si]
- spmcode dw 0002h ;This structure is used in scanning
- spmorigin_node dw 0 ;by send_to_node
- spmdest_node dw 0
- spmorigin_net dw 0
- spmdest_net dw 0
- spmattribute dw 0
- spmcost dw 0
- spmDateTime dw 0
- spmsg_format ends
-
-
-
- bad_flag equ 1
- netmail_flag equ 2
- split_flag equ 4
- no_more_flag equ 8
-
-
- ;toss equ's
- no_area equ 1
- end_log equ 2
-
-
- assume cs:_code
- assume ds:_data
- DGROUP group _DATA
-
- _DATA SEGMENT para PUBLIC 'DATA'
-
- ;
- ;filesize dd 0 ;??
- ;sharing db 0 ;deny_all | deny_none | deny_read | deny_write
- ;Attrib_creat db 0 ;sum of read_only_attrib + hidden + system + archive
- ;access db 0 ;read_only_access | write_only | read_write
- ;other_open_flags db 0 ;(nominal 0) ;high 8bits of mode word
-
- config_index label word
- dw offset config$1
- dw offset config$2
- dw offset config$3
- dw offset config$4
- dw offset config$5
- dw offset config$6
- dw offset config$7
- dw offset config$8
- dw offset config$9
- dw offset config$10
- dw offset config$11
- dw offset config$12
- dw offset config$13
- dw offset config$14
- dw offset config$15
- dw offset config$16
- dw offset config$17
- dw offset config$18
- dw offset config$19
- dw offset config$20
- dw offset config$21
- dw offset config$22
- dw offset config_sr_ind
- end_index label byte
-
- config_strings label byte
-
- config$1 db 'Primary_Zone',0
- config$2 db 'Address',0
- config$3 db 'aka',0
- config$4 db 'Add_To_Seen',0
- config$5 db 'NetMail',0
- config$6 db 'NetFile',0
- config$7 db 'Outbound',0
- config$8 db 'Status_Log',0
- config$9 db 'Sysop',0
- config$10 db 'Bad_Msgs',0
- config$11 db 'Dupes',0
- config$12 db 'No_Net_Dupes',0
- config$13 db 'No_Content',0
- config$14 db 'Echo_Toss_Log',0
- config$15 db 'Net_Sent',0
- config$16 db 'No_Private_EchoMail',0
- config$17 db 'Max_Msgs',0
- config$18 db 'Routing_Config_File',0
- config$19 db 'No_Forward',0
- config$20 db 'Kill_Forwarded_Files',0
- config$21 db 'Packet_Path',0
- config$22 db 'OMMM_CMD_file',0
-
-
-
- config_sr_ind label word
- dw offset config_sr_1
- dw offset config_sr_2
- dw offset config_sr_3
- dw offset config_sr_4
- dw offset config_sr_5
- dw offset config_sr_6
- dw offset config_sr_7
- dw offset config_sr_8
- dw offset config_sr_9
- dw offset config_sr_10
- dw offset config_sr_11
- dw offset config_sr_12
- dw offset config_sr_13
- dw offset config_sr_14
- dw offset config_sr_15
- dw offset config_sr_16
- dw offset config_sr_17
- dw offset config_sr_18
- dw offset config_sr_19
- dw offset config_sr_20
- dw offset config_sr_21
- dw offset config_sr_22
-
-
- route_index label word
- dw offset route$1
- route_strings label byte
- route$1 db 'CRASH',0
- route$2 db 'HOLD',0
- route_sr_ind label word
- dw offset route_sr_1
-
-
- pri_zone dw 0
- this_add db 5 dup (0)
- akas db 10 dup (5 dup (0))
- seens db 10 dup (5 dup (0))
- netmail_path db 64 dup (0)
- netfile_path db 64 dup (0)
- outbound db 64 dup (0)
- log_file db 64 dup (0)
- bad_msgs db 64 dup (0)
- echo_toss db 64 dup (0)
- routing db 64 dup (0)
- cmd_file_head db 20 dup (0)
- pack_path db 80 dup (0)
- sysop db 20 dup (0)
- objname db 20 dup (0)
- dupes dw 1000
- max_msgs dw 0ffffh
-
- this_seg dw 0
- cmd_offset dw 0
- size_of_dgroup dw 0
- size_of_stack dw 0
- crlf db 0dh,0ah,0
- cr_only db 0dh,0
- space3 db 20h
- space2 db 20h
- space1 db 20h,0
- toss_cmd db 'toss',0
- scan_cmd db 'scan',0
- test_cmd db 'test',0
- tosslog_cmd db 'tlog',0
- delete_cmd db 'delete',0
- stack_start dw 0
- handle dw 0
- results label dword
- result dw 0
- result2 dw 0
- doscall_inseg dw 0
- doscall_outseg dw 0
- search_path_ptr dd 0
- search_pattern_offset dw 0
- search_handle dw 0
- search_attrib dw 0
- max_find dw 0
- find_ptr dw 0
- total_finds dw 0
- cur_file_ptr dd 0
- comspec_srch db 'COMSPEC',0
- cmd_path db 80 dup (0)
- cmd_simple db 80 dup (0)
- filesize dd 0
- sharing db deny_all
- Attrib_create db 0
- access db read_write
- other_open_flags db 0
- device_name db "COM2:",0
- Null_target dw 0
- dw 0
- lzh_string db '-lh',0
- zip_string db 'PK',0
- home_drive dw 4
- home_dr_ascii db 3 dup(0)
- home_directory db 64 dup(0)
- Dev_cont_blk dw 0
- dw 0
- dflagsb1 db 0
- dflagsb2 db 0
- dflagsb3 db 0
- db 0
- db 0
- db 0
- db 0
- end_dev_cont_blk db 0
- zero db 0
- rail db 0
- msg_cntr dw 0
- scan_count dw 0
- first_digit db 0
- temp_def_net dw 0
- temp_def_zone db 0
- error_code dw 0
- system db 180 dup (0)
- sel_environ dw 0
- sel_areas dw 0
- sel_ar_bbs dw 0
- sel_config_file dw 0
- sel_config dw 0
- sel_pkt_buf dw 0
- sel_msg_buf dw 0
- sel_pmsg_buf dw 0
- sel_names dw 0
- sel_tosslog dw 0
- sel_route dw 0
-
- if debug
- ife drived
- areas_name db 'h:\work\areas.bbs',0
- limit_areas dw 0
- area_changed db 0
- config_name db 'h:\work\FMAIL.CFG',0
-
- else
-
- areas_name db 'd:\binkp\areas.bbs',0
- limit_areas dw 0
- area_changed db 0
- config_name db 'd:\binkp\FMAIL.CFG',0
- endif
-
- else
-
- areas_name db '.\areas.bbs',0
- limit_areas dw 0
- area_changed db 0
- config_name db '.\FMAIL.CFG',0
-
- endif
-
-
- no_more_bndls db 0
- packet_path db 60 dup (0) ;place where the pkt path is assembled
- pkt_handle dw 0
- pkt_path_end dw 0
- pkt_size dd 0
- cur_pkt_file_ptr dd 0
- large_packet db 0 ;flag for .pkt >64k
- packet_search db '*.pkt',0
- bundmo db '*.mo?',0
- bundtu db '*.tu?',0
- bundwe db '*.we?',0
- bundth db '*.th?',0
- bundfr db '*.fr?',0
- bundsa db '*.sa?',0
- bundsu db '*.su?',0
-
- all_file_info db type file_info dup (0)
- end_file_info equ $
- configuration db type config_info dup (0) ;obsolete
- packet_hdr label byte
- phorigin_node dw 0
- phdest_node dw 0
- phyear dw 0
- phmonth dw 0
- phday dw 0
- phhour dw 0
- phminute dw 0
- phsecond dw 0
- phbaud dw 0
- phcode dw 0 ;0002h
- phorigin_net dw 0
- phdest_net dw 0
- phproduct db 089h
- phserial db 1
- ; db 0
- phpassword db 8 dup (0)
- phorigin_Zone db 0
- phdest_Zone db 0
- ; db 0
- phfill db 22 dup (0)
- packet_hdr_end label byte
- current_read dw 0
- bad_packet db 0
- empty_pkt db 0
- mail_flags db 0
- message_is_split db 0
- no_more_msgs db 0
- no_more_pkts db 0
- current_area_info label dword ;no, do NOT put value here
- areas_segment dw 0
- current_path dw 0 ;pointer to the path part of the parsed areas file.
-
- path_line db 1,'PATH:',0 ;search prototype
- origin_line db ' * Origin:',0 ;search prototype
- area_line db 'AREA:',0
- tear_line db '---',0
- seen_by_line db 'SEEN-BY:',0
- find_buffer db type file_info dup (0)
- msg_start dw 0
- pathline_start dw 0 ;generally refers to the current version
- ;of the message (packed or unpacked)
- msg_length dw 0
- upmsg_length dw 0
- end_of_msg dw 0
- prev_end dw 0
- text_start dw 0
- EVEN
- current_area db 20 dup (0) ;as extracted from the areas buffer
- route_work_area label byte
- seen_by_list db 4096 dup (0) ;expanded hex format
- path_list db 4096 dup (0) ;expanded hex format
- message_pathname label byte ;that's right no value
- cur_path_line db 80 dup (0)
- first_seen_by dw 0
- first_path dw 0
- target_end dw 0
- null_node dd 0
- highest_msg dw 0
- lowest_msg dw 0
- column_ctr db 0
- path_end dw 0
- cur_ar_path_end dw 0
- msg_counter dw 0
- msg_search db '*.msg',(0)
- out_search db '*.out',(0)
- EVEN
- scratch_path db 64 dup (0)
- scratch_path_end dw 0
- vmsg_dot db '.',0
- vmsg_delete db 0dh,0ah,'Deleting msgs in area - ',0
- vmsg_get db 'Getting msg ',0
- vmsg_to_area db ' to area ',0
- vmsg_scan db 'Scanning directory ',0
- vmsg_scanned db 'Scan Complete',0
- vmsg_toss_num db 'Tossing message ',0
- vmsg_pconfig db 'Parsing Configuration File',0
- vmsg_pareas db 'Parsing Areas.bbs',0
- vmsg_allpkts db 'All packets tossed',0
- vmsg_done db 'Done',0
- vmsg_error db 'ERROR **** number ',0
- vmsg_nocmd db 'No commands given',0
- vmsg_pspawn db 'Spawning to Packer',0
- logmsg_begin db 'BEGIN ',0
- logmsg_end db 'END ',0
- logmsg_pkt1 db ' @ ',0
- logmsg_pkt2 db ' O=',0
- logmsg_pkt3 db ' D=',0
- logmsg_pkt4 db ' ID=',0
- logmsg_pkt5 db ' S=',0
- logmsg_echo1 db ' + ECHO: ',0
- logmsg_echo2 db ' (Sent=',0
- logmsg_stossed db 'Tossed ',0
- logmsg_sscan db 'Scanned out ',0
- logmsg_smsg db ' messages in ',0
- logmsg_smins db ' minutes ',0
- logmsg_ssecs db ' seconds.',0
- logmsg_bndl db '& Unpacking ',0
- ermsg_no_log db 'Unable to open Log File',0dh,0ah,0
- ermsg_no_area db 0dh,0ah,'No such area as ',0
- ermsg_bad_msg db 'Bad message or ???',0
- ermsg_bad_open db 'Open/Create failed by explicit command',0
- title_msg_l1 db 'FMAIL - Echomail utility ver 1.00',0
- title_msg_l2 db 'The FAST Mail processor for OS/2',0
- title_msg_l3 db 'Copyright 1991 by Patrick O',027h,'Riva 1:143/37',0
-
-
- msg1 label byte ;in format: message_format
- fr_fmail db 'Fmail version 1.00 '
- db 13 dup (20h),0
- to_whom db 'Whom it may concern'
- db 16 dup (20h),0
- sub_why db 'Storage of "High water" mark'
- db 43 dup (20h),0
- dat_un db '21 Mar 91 16:54:32 ',0
- hw_misc db 20 dup (0)
- hw_reply dw 2
- hw_attrib dw 0108h
- dw 0
- hw_text db 'High water mark at offset 0B8h',0dh,0ah
- hw_tear db '---',0dh,0ah
- hw_origin db 100 dup (20h)
- msg1_end equ $
- hex_buff db 6 dup (0)
- toss_ptr dw 0
- EVEN
- toss_list label byte
- db 8000 dup (0)
- dupes_list label byte
- dd dupes_no dup (0)
- scratch_ascii db 80 dup (0)
- scratch_node db 5 dup (0)
- dupes_file db 'fdups.dat',(0)
- dupes_num dw dupes_no
- dupes_ptr dw offset dupes_list
- dupes_handle dw 0
- first_time db 0
- fm_debug db 'h:\work\debug.log',0
- debug_handle dw 0
- log_handle dw 0
- si_length dw 0
- di_length dw 0
- shortest dw 0
- longest dw 0
- arc_pathname db 'arc2.exe',0
- arc_args db 'arc2',0
- db 'x'
- db 'o '
- arc_file db 'filename.ext',0
- arc_other db 20 dup(0)
- db 0
- zip_pathname db 'pkunzip2.exe',0
- zip_args db 'pkunzip2 ',0
- db '-o '
- zip_file db 'filename.ext '
- zip_other db 20 dup(0)
- db 0
- lh_pathname db 'lh.exe',0
- lh_args db 'lh ',0
- db 'X '
- db '/o '
- lh_file db 'filename.ext ',0
- lh_other db 20 dup(0)
- bad_arc_string db 'BAD_ARC.*',0
- start_in_secs dw 0
- end_in_secs dw 0
-
- toss_flag db 0
- tosslog_length dw 0
- toss_add dw 0
- err_index label word
-
- dw offset os_err000
- dw offset os_err001
- dw offset os_err002
- dw offset os_err003
- dw offset os_err004
- dw offset os_err005
- dw offset os_err006
- dw offset os_errx
- dw offset os_err008
- dw offset os_errx
- dw offset os_err00a
- dw offset os_err00b
- dw offset os_err00c
- dw offset os_err00d
- dw offset os_err00e
- dw offset os_err00f
- dw offset os_err010
- dw offset os_err011
- dw offset os_err012
- dw offset os_err013
- dw offset os_errx
- dw offset os_err015
- dw offset os_err016
- dw offset os_err017
- dw offset os_err018
- dw offset os_err019
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_err01f
- dw offset os_err020
- dw offset os_err021
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_err050
- dw offset os_errx
- dw offset os_err052
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_err05b
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_err06e
- dw offset os_err06f
- dw offset os_err070
- dw offset os_err071
- dw offset os_errx
- dw offset os_errx
- dw offset os_err074
- dw offset os_err075
- dw offset os_errx
- dw offset os_errx
- dw offset os_err078
- dw offset os_errx
- dw offset os_errx
- dw offset os_err07b
- dw offset os_errx
- dw offset os_err07d
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_err099
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_err0a0
- dw offset os_err0a1
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_err0bc
- dw offset os_err0bd
- dw offset os_err0be
- dw offset os_err0bf
- dw offset os_err0c0
- dw offset os_err0c1
- dw offset os_err0c2
- dw offset os_err0c3
- dw offset os_err0c4
- dw offset os_err0c5
- dw offset os_errx
- dw offset os_err0c7
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_err0cb
- dw offset os_errx
- dw offset os_errx
- dw offset os_err0ce
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_err0d3
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
- dw offset os_errx
-
-
-
- os_err000 db 'No Error',0
- os_err001 db 'Invalid Function Number',0
- os_err002 db 'File not found',0
- os_err003 db 'Path not found',0
- os_err004 db 'Out of handles',0
- os_err005 db 'Access denied',0
- os_err006 db 'Invalid handle',0
- os_err008 db 'Insufficient memory',0
- os_err00a db 'invalid environment',0
- os_err00b db 'invalid format',0
- os_err00c db 'invalid access code',0
- os_err00d db 'invalid data',0
- os_err00e db 'unknown unit',0
- os_err00f db 'invalid disk drive',0
- os_err010 db 'cannot remove current directory',0
- os_err011 db 'Not same device',0
- os_err012 db 'No more files',0
- os_err013 db 'Disk write protected',0
- os_err015 db 'Drive not ready',0
- os_err016 db 'Unknown unit',0
- os_err017 db 'Unknown command',0
- os_err018 db 'Data error',0
- os_err019 db 'Bad request structure length',0
- os_err01f db 'General failure',0
- os_err020 db 'Sharing violation',0
- os_err021 db 'Lock violation',0
- os_err050 db 'File already exists',0
- os_err052 db 'Cannot make directory',0
- os_err05b db 'System Error',0
- os_err06e db 'Open/create failed due to explicit fail command',0
- os_err06f db 'Buffer too small',0
- os_err070 db 'Disk is full',0
- os_err071 db 'No more search handles',0
- os_err074 db 'Error on display write or keyboard read',0
- os_err075 db 'Invalid DosDevIOCTL catagory',0
- os_err078 db 'Invalid function called',0
- os_err07b db 'Invalid character or bad filename',0
- os_err07d db 'No volume label found',0
- os_err099 db 'Invalid list format',0
- os_err0a0 db 'Bad environment pointer',0
- os_err0a1 db 'Bad pathname for DosExecPgm',0
- os_err0bc db 'Invalid starting code segment',0
- os_err0bd db 'invalid stack segment',0
- os_err0be db 'Invalid module type',0
- os_err0bf db 'Wrong EXE file header',0
- os_err0c0 db 'Invalid EXE file,link errors',0
- os_err0c1 db 'Invalid EXE format',0
- os_err0c2 db 'Iterated data exceeds 64KB',0
- os_err0c3 db 'Invalid minium allocation size',0
- os_err0c4 db 'Invalid Dynamic link fron ring 2 segment',0
- os_err0c5 db 'IOPL not enabled in Config.sys',0
- os_err0c7 db 'Automatic data segment exceeds 64KB',0
- os_err0cb db 'Environment variable not found',0
- os_err0ce db 'Filename or extension too long',0
- os_err0d3 db 'File system information not available',0
- os_errx db 'Undefined error',0
-
-
-
- _DATA ENDS
-
- _data segment
-
- ;------------------------------------------------------------------------------
- ; data for crc-32 routine
- ;------------------------------------------------------------------------------
-
- crc_32_table label dword
- .radix 010h
-
- dw 00000h, 00000h, 07707h, 03096h, 0ee0eh, 0612ch, 09909h, 051bah, 0076dh, 0c419h, 0706ah, 0f48fh, 0e963h, 0a535h, 09e64h, 095a3h
- dw 00edbh, 08832h, 079dch, 0b8a4h, 0e0d5h, 0e91eh, 097d2h, 0d988h, 009b6h, 04c2bh, 07eb1h, 07cbdh, 0e7b8h, 02d07h, 090bfh, 01d91h
- dw 01db7h, 01064h, 06ab0h, 020f2h, 0f3b9h, 07148h, 084beh, 041deh, 01adah, 0d47dh, 06dddh, 0e4ebh, 0f4d4h, 0b551h, 083d3h, 085c7h
- dw 0136ch, 09856h, 0646bh, 0a8c0h, 0fd62h, 0f97ah, 08a65h, 0c9ech, 01401h, 05c4fh, 06306h, 06cd9h, 0fa0fh, 03d63h, 08d08h, 00df5h
- dw 03b6eh, 020c8h, 04c69h, 0105eh, 0d560h, 041e4h, 0a267h, 07172h, 03c03h, 0e4d1h, 04b04h, 0d447h, 0d20dh, 085fdh, 0a50ah, 0b56bh
- dw 035b5h, 0a8fah, 042b2h, 0986ch, 0dbbbh, 0c9d6h, 0acbch, 0f940h, 032d8h, 06ce3h, 045dfh, 05c75h, 0dcd6h, 00dcfh, 0abd1h, 03d59h
- dw 026d9h, 030ach, 051deh, 0003ah, 0c8d7h, 05180h, 0bfd0h, 06116h, 021b4h, 0f4b5h, 056b3h, 0c423h, 0cfbah, 09599h, 0b8bdh, 0a50fh
- dw 02802h, 0b89eh, 05f05h, 08808h, 0c60ch, 0d9b2h, 0b10bh, 0e924h, 02f6fh, 07c87h, 05868h, 04c11h, 0c161h, 01dabh, 0b666h, 02d3dh
- dw 076dch, 04190h, 001dbh, 07106h, 098d2h, 020bch, 0efd5h, 0102ah, 071b1h, 08589h, 006b6h, 0b51fh, 09fbfh, 0e4a5h, 0e8b8h, 0d433h
- dw 07807h, 0c9a2h, 00f00h, 0f934h, 09609h, 0a88eh, 0e10eh, 09818h, 07f6ah, 00dbbh, 0086dh, 03d2dh, 09164h, 06c97h, 0e663h, 05c01h
- dw 06b6bh, 051f4h, 01c6ch, 06162h, 08565h, 030d8h, 0f262h, 0004eh, 06c06h, 095edh, 01b01h, 0a57bh, 08208h, 0f4c1h, 0f50fh, 0c457h
- dw 065b0h, 0d9c6h, 012b7h, 0e950h, 08bbeh, 0b8eah, 0fcb9h, 0887ch, 062ddh, 01ddfh, 015dah, 02d49h, 08cd3h, 07cf3h, 0fbd4h, 04c65h
- dw 04db2h, 06158h, 03ab5h, 051ceh, 0a3bch, 00074h, 0d4bbh, 030e2h, 04adfh, 0a541h, 03dd8h, 095d7h, 0a4d1h, 0c46dh, 0d3d6h, 0f4fbh
- dw 04369h, 0e96ah, 0346eh, 0d9fch, 0ad67h, 08846h, 0da60h, 0b8d0h, 04404h, 02d73h, 03303h, 01de5h, 0aa0ah, 04c5fh, 0dd0dh, 07cc9h
- dw 05005h, 0713ch, 02702h, 041aah, 0be0bh, 01010h, 0c90ch, 02086h, 05768h, 0b525h, 0206fh, 085b3h, 0b966h, 0d409h, 0ce61h, 0e49fh
- dw 05edeh, 0f90eh, 029d9h, 0c998h, 0b0d0h, 09822h, 0c7d7h, 0a8b4h, 059b3h, 03d17h, 02eb4h, 00d81h, 0b7bdh, 05c3bh, 0c0bah, 06cadh
- dw 0edb8h, 08320h, 09abfh, 0b3b6h, 003b6h, 0e20ch, 074b1h, 0d29ah, 0ead5h, 04739h, 09dd2h, 077afh, 004dbh, 02615h, 073dch, 01683h
- dw 0e363h, 00b12h, 09464h, 03b84h, 00d6dh, 06a3eh, 07a6ah, 05aa8h, 0e40eh, 0cf0bh, 09309h, 0ff9dh, 00a00h, 0ae27h, 07d07h, 09eb1h
- dw 0f00fh, 09344h, 08708h, 0a3d2h, 01e01h, 0f268h, 06906h, 0c2feh, 0f762h, 0575dh, 08065h, 067cbh, 0196ch, 03671h, 06e6bh, 006e7h
- dw 0fed4h, 01b76h, 089d3h, 02be0h, 010dah, 07a5ah, 067ddh, 04acch, 0f9b9h, 0df6fh, 08ebeh, 0eff9h, 017b7h, 0be43h, 060b0h, 08ed5h
- dw 0d6d6h, 0a3e8h, 0a1d1h, 0937eh, 038d8h, 0c2c4h, 04fdfh, 0f252h, 0d1bbh, 067f1h, 0a6bch, 05767h, 03fb5h, 006ddh, 048b2h, 0364bh
- dw 0d80dh, 02bdah, 0af0ah, 01b4ch, 03603h, 04af6h, 04104h, 07a60h, 0df60h, 0efc3h, 0a867h, 0df55h, 0316eh, 08eefh, 04669h, 0be79h
- dw 0cb61h, 0b38ch, 0bc66h, 0831ah, 0256fh, 0d2a0h, 05268h, 0e236h, 0cc0ch, 07795h, 0bb0bh, 04703h, 02202h, 016b9h, 05505h, 0262fh
- dw 0c5bah, 03bbeh, 0b2bdh, 00b28h, 02bb4h, 05a92h, 05cb3h, 06a04h, 0c2d7h, 0ffa7h, 0b5d0h, 0cf31h, 02cd9h, 09e8bh, 05bdeh, 0ae1dh
- dw 09b64h, 0c2b0h, 0ec63h, 0f226h, 0756ah, 0a39ch, 0026dh, 0930ah, 09c09h, 006a9h, 0eb0eh, 0363fh, 07207h, 06785h, 00500h, 05713h
- dw 095bfh, 04a82h, 0e2b8h, 07a14h, 07bb1h, 02baeh, 00cb6h, 01b38h, 092d2h, 08e9bh, 0e5d5h, 0be0dh, 07cdch, 0efb7h, 00bdbh, 0df21h
- dw 086d3h, 0d2d4h, 0f1d4h, 0e242h, 068ddh, 0b3f8h, 01fdah, 0836eh, 081beh, 016cdh, 0f6b9h, 0265bh, 06fb0h, 077e1h, 018b7h, 04777h
- dw 08808h, 05ae6h, 0ff0fh, 06a70h, 06606h, 03bcah, 01101h, 00b5ch, 08f65h, 09effh, 0f862h, 0ae69h, 0616bh, 0ffd3h, 0166ch, 0cf45h
- dw 0a00ah, 0e278h, 0d70dh, 0d2eeh, 04e04h, 08354h, 03903h, 0b3c2h, 0a767h, 02661h, 0d060h, 016f7h, 04969h, 0474dh, 03e6eh, 077dbh
- dw 0aed1h, 06a4ah, 0d9d6h, 05adch, 040dfh, 00b66h, 037d8h, 03bf0h, 0a9bch, 0ae53h, 0debbh, 09ec5h, 047b2h, 0cf7fh, 030b5h, 0ffe9h
- dw 0bdbdh, 0f21ch, 0cabah, 0c28ah, 053b3h, 09330h, 024b4h, 0a3a6h, 0bad0h, 03605h, 0cdd7h, 00693h, 054deh, 05729h, 023d9h, 067bfh
- dw 0b366h, 07a2eh, 0c461h, 04ab8h, 05d68h, 01b02h, 02a6fh, 02b94h, 0b40bh, 0be37h, 0c30ch, 08ea1h, 05a05h, 0df1bh, 02d02h, 0ef8dh
- _data ends
- .radix 00ah
- assume cs:_code
- assume ds:_data
-
- public make_msg_pathname
- public terminate
- public main_tonextpkt
- public main_nxtmsg
- public main_nxtpkt
-
- _code segment public 'code'
- .286
-
- ;******************************************************************************
- ; do_crc32 -
- ;
- ;
- ; ENTRY: es:di -> buffer to crc
- ; cx = # of bytes to crc
- ; dx:ax = current crc (use FFFFFFFF if new check)
- ; ds -> segment with the crc table
- ;
- ; EXIT: dx:ax = new crc of buffer
- ; this should be xor'd with FFFFFFFF if it is the final CRC
- ;
- ; DESTROYED:
- ;
- ;------------------------------------------------------------------------------
- do_crc32:
- public do_crc32
- push bx
- push cx
- push di
-
- l1:
- mov bl,es:[di]
- inc di
- xor bl,al
-
- mov al,ah
- mov ah,dl
- mov dl,dh
- xor dh,dh
-
- xor bh,bh
- shl bx,1
- shl bx,1
-
- xor ax,word ptr crc_32_table[bx+2]
- xor dx,word ptr crc_32_table[bx]
-
- loop l1
-
- pop di
- pop cx
- pop bx
- ret
-
-
-
- parse_config: ;enters with ds = local data
- public parse_config
- mov ax,08000h
- ; m8dosallocseg sel_config,no_share
- mdosopen config_name,open,fail
- jnc config1
- mov si,offset config_name
- jmp file_error
- config1:
- ;;EXPAND: m8dosQfileinfo all_file_info
- push handle
- push 1
- push ds
- push offset all_file_info
- push type file_info
- call dosqfileinfo
- ;;EXPAND: error_check
- clc
- and ax,ax
- jz m2
- stc
- m2:
- mov bx,offset all_file_info
- add bx,offset ffile_size
- mov ax,word ptr [bx]
- add ax,0100h
- push ax
- ;;EXPAND: m8dosallocseg sel_config_file,no_share
- push ax
- mov ax,offset sel_config_file
- push ds
- push ax
- push no_share
- call dosallocseg
- pop cx
- dec cx
- mov es,sel_config_file
- mov di,0
- call clean_buffer
- mov cx,word ptr [bx]
- mov si,0
- mov ax,sel_config_file
- mov doscall_inseg,ax
- ;;EXPAND: m8dosread
- mov ax,handle
- push ax
- push word ptr doscall_inseg
- push si
- push cx
- push ds
- push offset result
- call dosread
- and ax,ax
- jz m3
- stc
- m3:
- push ds
- pop es
- mov ds,sel_config_file
- mov si,es:all_file_info.ffile_size
- mov al,0dh
- mov cx,4
- ;l5:
- x1:
- inc si
- mov byte ptr[si],al
- loop x1
- mov si,0
- mov di,offset configuration
- push di
- ;l4:
- x2:
- call find_config_line
- cmp si,es:all_file_info.ffile_size
- jae x6
- call sstart
- jc x2
- push si
- mov bx,0
-
- ;l3:
- x3:
- mov si,offset config_index
- mov di,es:[si+bx]
- mov cx,es:[si+bx+2]
- sub cx,di
- mov ax,si
- add ax,bx
- cmp ax,offset end_index
- jae x5 ;this line didn't match
- pop si
- push si
- repz cmpsb
- and cx,cx
- jz x4 ;it's been found
- inc bx
- inc bx
- jmp short x3
-
- ;l1:
- x4:
- pop ax ;throw it away
- call sstart
- mov di,offset config_sr_ind
- call es:[di+bx]
- jmp short x2
-
- ;l2:
- x5:
- pop si
- jmp short x2
-
- ;f1:
- x6:
- pop di
- ret
-
- config_sr_1:
- push si
- call find_eol
- call backup_to_eol
- mov cx,si
- pop si
- sub cx,si
- cmp cx,5
- jbe x7
- mov cx,5
- ;l1:
- x7:
- call dechex
- mov es:pri_zone,ax
- ret
- config_sr_2:
- mov di,offset this_add
- call net_nodes
- ret
- config_sr_3:
- mov di,offset akas
- call net_nodes
- ret
- config_sr_4:
- mov di,offset seens
- call net_nodes
- ret
- config_sr_5:
- mov bx,offset netmail_path
- call xfer_path
- ret
- config_sr_6:
- mov bx,offset netfile_path
- call xfer_path
- ret
- config_sr_7:
- mov bx,offset outbound
- call xfer_path
- ret
- config_sr_8:
- mov bx,offset log_file
- call xfer_path
- ret
- config_sr_9:
- push si
- call find_eol
- mov cx,si
- pop si
- sub cx,si
- mov di,offset sysop
- rep movsb
- mov al,0
- stosb
- ret
- config_sr_10:
- mov bx,offset bad_msgs
- call xfer_path
- ret
- config_sr_11:
- call slen
- call dechex
- mov es:dupes,ax
- ret
- config_sr_12:
- ret
- config_sr_13:
- ret
- config_sr_14:
- mov bx,offset echo_toss
- call xfer_path
- ret
- config_sr_15:
- ret
- config_sr_16:
- ret
- config_sr_17:
- call slen
- call dechex
- mov es:max_msgs,ax
- ret
- config_sr_18:
- mov bx,offset routing
- call xfer_path
- ret
- config_sr_19:
- ret
- config_sr_20:
- ret
- config_sr_21:
- mov bx,offset wkg_path
- call xfer_path
- ret
-
- config_sr_22:
- mov bx,offset pack_path
- call xfer_path
- ret
-
-
-
-
-
-
- parse_areas: ;enters with ds = local data
- public parse_areas
- mov ax,0f000h
- push ax
- mdosallocseg sel_areas,no_share
- pop cx
- dec cx
- mov es,sel_areas
- mov di,0
- call clean_buffer
-
-
- mdosopen areas_name,open,fail
- jnc par1
- mov si,offset areas_name
- jmp file_error
- par1:
- ;;EXPAND: m8dosQfileinfo all_file_info
- push handle
- push 1
- push ds
- push offset all_file_info
- push type file_info
- call dosqfileinfo
- ;;EXPAND: error_check
- clc
- and ax,ax
- jz m6
- stc
- m6:
- mov ax,word ptr all_file_info.ffile_size
- add ax,010h
- mdosallocseg sel_ar_bbs,no_share
- mov cx,word ptr all_file_info.ffile_size
-
- mov si,0
- mov ax,sel_ar_bbs
- mov doscall_inseg,ax
- mdosread
- mov ax,handle
- mdosclose
- push ds
- pop es
- mov ds,sel_ar_bbs
-
-
-
- mov si,word ptr es:results
- mov al,0dh
- mov cx,4
- ;l2:
- x8:
- inc si
- mov byte ptr[si],al
- loop x8
-
-
-
-
-
-
- mov si,0
-
-
- call sstart
- push si
- call find_eol
- call backup_to_eol
- mov cx,si
- pop si
- sub cx,si
-
-
- mov di,offset system
- rep movsb
-
- push es ;true data is on top of the stack
- mov di,0
- ;l1:
- x9:
-
-
- call find_eol
-
-
-
-
- push di
- call parse_aline
- pop di
- mov dx,es
- pop es
- push es
- mov cx,es:all_file_info.ffile_size
- dec cx
- cmp si,cx
- jb y1
- jmp short x10
- y1:
- mov es,dx
- add di,type line_infos
- jmp short x9
- ;f1:
- x10:
- pop es
- mov es:limit_areas,di
- push ds
- call DosFreeSeg
- push es
- pop ds
-
- mov si,offset origin_line
- mov di,offset hw_origin
- call write_asciiz
- mov si,offset system
- call write_asciiz
- mov al,20h
- stosb
- mov al,'('
- stosb
- mov si,offset this_add
- call write_node
- mov al,')'
- stosb
- mov si,offset crlf
- call write_asciiz
- mov si,offset crlf
- call write_asciiz
- mov al,0
- stosb
-
- ret
-
-
-
-
-
- parse_aline: ;ds:si points at start of line, di points at next
- ;available structure in areas segment.
- ;es has true data
- push es
- push di
- cmp byte ptr [si],'0'
- jb x13
- cmp byte ptr [si],'z'
- ja x13
- cmp byte ptr [si],';'
- je x13
- cmp byte ptr [si],'@'
- je x13
-
-
- ;l3:
- x11:
- call slen
- cld
- mov ax,es:sel_areas
- mov es,ax
- rep movsb
- call sstart
- jc x12
- pop di
- push di
- add di,offset li_area
- call slen
- rep movsb
- pop di
- push di
- add di,offset li_nodes
- call sstart
- call net_nodes
- ;l2:
- x12:
- pop di
- pop es
- ret
- ;l1:
- x13:
- mov dx,es
- mov es,es:sel_areas
- push di
- add di,offset li_flag
- movsb
- mov es,dx
- pop di
- jmp short x11
- Net_nodes: ;converts to expanded hex at es:di a
- ;line of net/nodes at ds:si
- ;format is: byte;zone word;node word;net
- call sstart
- jc x104
- call slash_to_word
- push ax
- push ds
- ddata
- mov al,temp_def_zone
- stosb
- pop ds
- mov ax,dx
- and ax,07fffh
- stosw
- pop ax
- and ax,07fffh
- stosw
- jmp short net_nodes
- ;l1:
- x104:
- ret
-
-
-
-
-
- main:
- public main
- mov sel_environ,ax
- mov cmd_offset,bx
- mov size_of_dgroup,cx
- mov size_of_stack,dx
- mov this_seg,ds
- ;if debug
- ;
- ; mov ax,home_drive
- ; mdosselectdisk
- ; mov si,offset home_dr_ascii
- ; mdoschdir
- ;endif
-
- push 50
- call dossetmaxfh
- mov sharing,deny_all
- mov byte ptr other_open_flags,020h
- mov word ptr toss_ptr,offset toss_list
- pcrlf
- prt title_msg_l1
- pcrlf
- prt title_msg_l2
- pcrlf
- prt title_msg_l3
- pcrlf
- pcrlf
- pcrlf
- push ds
- mov stack_start,sp
- prt vmsg_pconfig
- pcrlf
- call parse_config
- pop ds
- push ds
- prt vmsg_done
- pcrlf
- prt vmsg_pareas
- pcrlf
- call parse_areas
- prt vmsg_done
- pcrlf
-
- mov sharing,deny_write
- mdosopen log_file,open,create
- jnc main4
- prt ermsg_no_log
- jmp short main5
- main4:
- mov ax,handle
- mov log_handle,ax
- call append
- call get_time
- mov di,offset scratch_ascii
- mov al,0dh
- stosb
- mov al,0ah
- stosb
- mov si,offset logmsg_begin
- call write_asciiz
- call write_time
-
- mov al,0dh
- stosb
- mov al,0ah
- stosb
- logaz scratch_ascii
- xor dx,dx
- mov ah,dh
- mov al,minute
- mov bx,60
- mul bx
- add al,second
- adc ah,0
- mov start_in_secs,ax
-
-
- main5:
-
- pop ds
- push ds
-
- mov ax,0ffffh
- ;allocate message buffer
- mdosallocSeg sel_msg_buf,no_share
- ;*** clean buffer
- pop ds
- push ds
- mov cx,0fffeh
- mov es,sel_msg_buf
- mov di,0
- call clean_buffer
-
- mov si,cmd_offset
- mov ax,sel_environ
- push ds
- mov ds,ax
- call find_limit_2null
- push si
- push cx
- edata
- mov di,offset toss_cmd
- mov ax,1
- call search_for
- jnc main2
- pop cx
- pop si
- push si
- push cx
- mov di,offset scan_cmd
- mov ax,1
- call search_for
- jnc to_scan
- pop cx
- pop si
- push si
- push cx
- mov di,offset delete_cmd
- mov ax,1
- call search_for
- jnc to_delete
- pop cx
- pop si
- mov di,offset test_cmd
- mov ax,1
- call search_for
- jnc to_test
- pop ds
- prt vmsg_nocmd
- pcrlf
- jmp terminate
- to_delete:
- pop cx
- pop si
- jmp delete_rtn
-
- to_test:
- ddata
- jmp up_bundle
-
- to_scan:
- pop cx
- pop si
- jmp scan
- main2:
- pop cx
- pop si
- pop ds
- main2b:
- call up_bundle
- mov no_more_bndls,0
- jnc main2a
- mov no_more_bndls,1
- main2a:
- mov access,read_write
- call get_packet
- main_test_pkt:
- jc main2c
- cmp empty_pkt,0
- jz main_nxtpkt
- main2c:
- jmp main_tonextpkt
- ;------------------------------------------------------------------------------
- ; each packet
- ;------------------------------------------------------------------------------
- main_nxtpkt:
- push ds
- call get_header ;this is the Pkt header
- call log_pkt_info
- pop ds
-
- mov msg_start,36
- mov msg_length,0
-
- ;------------------------------------------------------------------------------
- ; each message
- ;------------------------------------------------------------------------------
- main_nxtmsg:
- ; push ds
- mov si,msg_start
- add si,msg_length
- call get_msg ;This unpacks the message and puts it
- ;in the message buffer
-
- pop ds
- push ds ;ds true data,es msg buffer
-
- test mail_flags,split_flag
- ; cmp message_is_split,0
- jz x15 ; message split across 64K bound?
- ;p1:
- x14:
- call load_more_packet
- mov msg_start,0
- mov msg_length,0
- jnc y2
- jmp main_tonextpkt
- y2:
- jmp main_nxtmsg
- ;l1:
- x15:
- test mail_flags,no_more_flag
- jz x17
- ;temp patch to exit
- ; jmp terminate
- jmp main_tonextpkt
- ;p2:
- x16:
- jmp x14
- ;l1:
- x17:
- test mail_flags,netmail_flag
- jz x250
- jmp it_is_net
- x250:
- test mail_flags,bad_flag
- jz x251
- jmp bad_msg
- x251:
-
- ;message must be skipped if it's a dupe
- call get_message_area
- call dlen
- if tight
- and cx,cx
- jzx 251a
- endif
- inc cx
- mov area_changed,0
- mov si,offset current_area
- call comp_strings
- jz x20
- mov area_changed,1
- xchg di,si
- xdses
-
-
- push si
- push di
- push cx
- mov cx,20
- xor ax,ax
- rep stosb
- pop cx
- pop di
- pop si
-
- call slen
- push cx
- rep movsb ;bring area string to data seg
- xdses ;ds: true data es: msg buffer
- pop cx ;bring back length of tag
- mov si,offset current_area
- pop ds
- push ds
- call locate_area
- jnc x18
- x251a:
- jmp no_such_area
- ;l1:
- x18:
- pop ds
- push ds
-
- mov current_path,di
-
-
- call mov_cur_path_to_data
- call comp_t_area
- test first_time,0ffh
- mov first_time,1
- jz x19
- call write_dupes
- ;p1:
- x19:
- call load_dupes
- ;o1:
- x20:
-
- public atag_pull
- atag_pull:
- push di
- push cx
- call pull_atag
- pop cx
- pop di
-
-
- call crc_main
- jnc y3
- jmp main_nxtmsg
- y3:
- pop ds
- push ds
- call strip_path
- pop ds
- push ds
- call strip_seen_bys
- push ds
- pop es ;es must -> at true data for next call
- mov si,offset akas
- mov di,offset seen_by_list
- call add_net_nodes
- mov si,offset seens
- mov di,offset seen_by_list
- call add_net_nodes
-
- ;might also have to ad the nodes from the areas list!
-
- ; mov di,offset path_list
- ; mov si,offset null_node
- ;;l2:
- ;x21:
- ; call double_comp
- ; jz x22
- ; add di,4
- ; jmp short x21
- ;;l3:
- ;x22:
- ; mov si,offset this_add
- ; movsw
- ; movsw ;the path list is updated!
- mov di,upmsg_length
- mov es,sel_msg_buf
- call write_seen_bys ;this passes the endofmsg in di to next.
- call write_path_line
- test area_changed,0ffh
- jz x23
- Throw_this_msg:
- call get_msg_high
- ;o2:
- public x23
- x23:
- ;now we can toss it!
- call make_msg_pathname
- call print_tossing
- call log_area_toss
-
- mdosopen scratch_path,replace,create
- jnc main3
- mov si,offset scratch_path
- call dos_error
- jmp bad_msg
- main3:
- mov ax,handle
- mov cx,upmsg_length
- mov si,0
-
- ;;EXPAND: m8doswrite sel_msg_buf,results
- push ax
- push sel_msg_buf
- push si
- push cx
- push ds
- push offset results
- call doswrite
- ;;EXPAND: error_check
- clc
- and ax,ax
- jz m9
- stc
- m9:
-
- mov ax,handle
-
- mdosclose
- inc msg_cntr
-
- ;it's time to look for next msg in packet or next packet
-
- jmp main_nxtmsg
-
- main_tonextpkt:
- call get_next_packet
- cmp byte ptr no_more_pkts,0
- jne mtep2
- jmp main_test_pkt
-
- mtep2:
- call up_bundle
- jnc main_tonextpkt
- ; mov al,no_more_bndls
- ; and al,al
- ; jnz terminate
- ; jmp main2b
-
- terminate:
-
- x24:
- ;l1:
-
- call write_t_area ;write out the toss log
- mov ax,msg_cntr
- and ax,ax
- jz x24b
- call write_dupes
- x24b:
- call get_time
- mov di,offset scratch_ascii
- mov si,offset logmsg_end
- call write_asciiz
- call write_time
-
- mov al,0dh
- stosb
- mov al,0ah
- stosb
- mov al,0
- stosb
- logaz scratch_ascii
-
-
- mov al,minute
- xor ah,ah
- mov bx,60
- mul bx
- add al,second
- adc ah,0
- mov end_in_secs,ax
- sub ax,start_in_secs
- mov bx,60
- div bx
- push dx
- push ax
- mov di,offset scratch_ascii
- mov al,0dh
- stosb
- mov al,0ah
- stosb
- mov si,offset logmsg_stossed
- call write_asciiz
- mov ax,tot_count
- call write_h_ascii
- mov si,offset logmsg_smsg
- call write_asciiz
- pop ax
- call write_h_ascii
- mov si,offset logmsg_smins
- call write_asciiz
- pop ax
- call write_h_ascii
- mov si,offset logmsg_ssecs
- call write_asciiz
- mov al,0
- stosb
- logaz scratch_ascii
- mov di,offset scratch_ascii
- call print_asciiz
-
-
- mov ax,log_handle
- mdosclose
- mov ax,dupes_handle
- mdosclose
-
- mov ax,1
- push ax ;terminate the process
- push error_code
- call dosExit
-
- ;END of MAIN for TOSS
-
- make_msg_pathname:
- mov di,cur_ar_path_end
- push _data
- pop es
- mov ax,highest_msg
- inc ax ;we'll put the message in the next one
- mov highest_msg,ax ;update the value
- call write_h_ascii
- mov al,'.'
- stosb
- mov al,'m'
- stosb
- mov al,'s'
- stosb
- mov al,'g'
- stosb
- xor ax,ax
- stosb
- ret
- ;
- ;call update_msg1
-
- ;lodad macro
- ; lodsw
- ; mov dx,ax
- ; lodsw
- ; xchg dx,ax
- ;#em
-
- write_path_line:
- public write_path_line
-
- mov si,offset path_line
- mov temp_def_net,0
- call write_asciiz
- mov al,020h
- stosb
- mov si,offset path_list
- x24a:
- ;l1:
- call write_node
- nodesiz
- jnz x24a
-
- push es
- mov ax,[si-4]
- mov temp_def_net,ax
- mov ax,si
- sub ax,5 ;ax points at last one written
- mov si,offset this_add
- push di
- edata
- mov di,ax
- call triple_comp ;if we're already listed
- pop di
- pop es
- jz wpl1 ;don't list us again
- call write_node
- wpl1:
- mov si,offset crlf
- call write_asciiz
- mov si,offset crlf
- call write_asciiz
- xor ax,ax
- stosb
- mov upmsg_length,di
- ret
-
-
- write_seen_bys: ;writes the seen_by lines to es:di
- public write_seen_bys
- mov temp_def_net,0
- mov si,offset seen_by_list
- x25:
- ;l1:
- call write_sb_line
- push si
- mov si,offset CRLF
- pushf
- call write_asciiz
- popf
- pop si
- jnz x25
- ret
-
-
-
- write_sb_line: ;rec pos in the nn_list in si
- public write_sb_line
- ;the position in the msg in es:di
- ;ds as true data. rets with a seen_by
- ;line written to the message.
- ;bx=zero and the z flag set if the end
- ;of the nn_list was reached
- push si
- mov si,offset seen_by_line
- call write_asciiz
- mov al,020h
- stosb
- mov column_ctr,10
- mov temp_def_net,0
- pop si
- x26:
- ;l1:
- push di
- call write_node
- mov ax,di
- mov bx,di
- pop di
- sub ax,di
- mov di,bx
- add al,column_ctr
- mov column_ctr,al
- cmp al,60
- jb x27
- mov bx,[si]
- or bx,[si+2]
- ret
-
- x27:
- ;l2:
- mov bx,[si]
- or bx,[si+2]
- jnz x26
- ret
- public write_node
- write_node: ;rec the pos in the nn_list in si
- ;the position in the msg in es:di
- ;ds as true data. rets with a net/node
- ;or node written to the msg
- lodsb
- ; cmp al,temp_def_zone
- ; jz wn1
- ; mov temp_def_zone,al
- ; xor ah,ah
- ; call write_h_ascii
- ; mov al,':'
- ; stosb
- wn1:
- lodad
- xchg ax,dx
- cmp dx,temp_def_net
- je x28
- mov temp_def_net,dx
- jmp short x29
- x28:
- ;l1:
- call write_h_ascii
- mov al,020h
- stosb
- ret
- x29:
- ;l2:
- push ax
- mov ax,dx
- call write_h_ascii
- mov al,'/'
- stosb
- pop ax
- jmp short x28
-
- public write_asciiz
- write_asciiz: ;writes the ASCIIZ string -> ds:si
- ;to es:di. di is updated, si trashed
- ;remainder preserved
- push es
- push ds
- pop es
- xchg si,di
- push di
- call eoz
- pop di
- xchg di,si
- pop es
- cld
- rep movsb
- ret
-
- public write_h_ascii
- write_h_ascii: ;recs 4 digit hex in ax, and writes the
- ;5 digit (leading 0's supressed) ascii
- ;to es:di ax,bx,cx,dx,si may be trashed
- ;di is updated.
- call hexdec
- push ax
- mov al,bh
- or al,al
- jz x30
- stosb
- x30:
- ;l1:
- mov al,bl
- or al,al
- jz x31
- stosb
- x31:
- ;l2:
- mov al,dh
- or al,al
- jz x32
- stosb
- x32:
- ;l3:
- mov al,dl
- or al,al
- jz x33
- stosb
- x33:
- ;l4:
- pop ax
- stosb
- ret
-
-
- public write_h_ascii2d
- write_h_ascii2d: ;recs 4 digit hex in ax, and writes the
- ;5 digit (leading 0's supressed) ascii
- ;to es:di ax,bx,cx,dx,si may be trashed
- ;di is updated.
- call hexdec
- push ax
- mov al,bh
- or al,al
- jz x30a
- stosb
- x30a:
- ;l1:
- mov al,bl
- or al,al
- jz x31a
- stosb
- x31a:
- ;l2:
- mov al,dh
- or al,al
- jz x32a
- stosb
- x32a:
- jmp short wh4d4
-
-
-
- public write_h_ascii4d
- write_h_ascii4d: ;recs 4 digit hex in ax, and writes the
- ;5 digit (leading 0's supressed) ascii
- ;to es:di ax,bx,cx,dx,si may be trashed
- ;di is updated.
- call hexdec
- push ax
- mov al,bh
- or al,al
- jz x30b
- stosb
- x30b:
- mov al,bl
- or al,al
- jnz wh4d1
- mov al,30h
- wh4d1:
- stosb
- mov al,dh
- or al,al
- jnz wh4d2
- mov al,30h
- wh4d2:
- stosb
- wh4d4:
- mov al,dl
- or al,al
- jnz wh4d3
- mov al,30h
- wh4d3:
- stosb
- pop ax
- stosb
- ret
-
-
-
-
- log_ascii:
-
-
- public double_comp
- double_comp: ;si->dd w/ di->dd
- ;rets with cl ne 0 if {si} > {di}
- ;rets with ch ne 0 if {si} < {di}
- ;z (equal) flag is valid
- mov ax,es:[di]
- mov dx,es:[di+2]
- sub ax,[si]
- sbb dx,[si+2]
- cmp dx,0
- jg x34 ;si <= di
- jl x35 ;si > di
- or ax,ax
- ja x34
- xor cx,cx
- ret
-
- x34:
- ;l1:
- mov cx,0100h
- ret
-
- x35:
- ;l2:
- mov cx,1
- ret
-
- triple_comp: ;a return of carry indicates put it here
- ;zero flag says entries are equal
- push di
- push si
- inc si ;*no zone
- inc di ;*no zone
- ;no zone stuff cmpsb
- ; jb tc1
- ; ja next_slot ;check next slot in list
- cmpsw
- jb tc1
- ja next_slot
- cmpsw
- jb tc1
- next_slot:
- clc
- tc1:
- pop si
- pop di
- ret
-
- public add_net_nodes
- add_net_nodes: ;di points at target list, si points at
- ;source list. es and ds -> at true data
- ;Upon return target list
- ;has been updated.
- push es
- push si
- push di
- push si
- mov si,di
- call find_targ_len
- mov es:target_end,si
- pop si
- push ds
- pop es
- x36:
- x37:
- mov ax,[si]
- or ax,[si+2] ;this checks for a zero source
- jz x42
-
- cmp es:target_end,0
- je x38
- ann3:
- call triple_comp
- jz x40
- jae x41
- x38: ;put it here
- call stretch_target ;we'll put it here (es must =true data)
- ann4:
- lodsb
- mov byte ptr [di],al
- lodsw
- mov word ptr [di+1],ax
- lodsw
- mov word ptr [di+3],ax
- x39:
- xor ah,ah
- mov al,[si]
- or ax,[si+1]
- or ax,[si+3]
- jz x42 ;source finished
- jmp short ann3
- x40: ;move to next in source
- add si,5
- jmp short x39
- x41: ;look at next target
- add di,5
- cmp di,es:target_end
- jae ann4
- jmp short x37
- x42:
- pop di
- pop si
- pop es
- ret
-
-
- public stretch_target
- stretch_target: ;di points to place hole is to be made.
- ;es->at true data
- ;target_end is valid. di is preserved
-
- push si
- push di
- push cx
- mov cx,es:target_end
- sub cx,di
- je st01
- mov di,es:target_end
- mov si,di
- add di,4
- sub si,1
- std
- rep movsb
- st01:
- cld
- add es:target_end,5
- pop cx
- pop di
- pop si
- ret
-
- public find_targ_len
- find_targ_len: ;si points at start. rets the number of
- ;of entries in cx, offset of first empty
- ;double in si
-
- xor cx,cx
- x43:
- ;l1:
- nodesiz
- jz x44
- add si,5
- inc cx
- jmp short x43
- x44:
- ;l2:
- ret
-
- ;public get_path_list
- ;get_path_list: ;copies the path line to Cur_path_line
- ; mov es,sel_msg_buf
- ;
- ;
- ; mov di,offset path_line
- ; mov cx,upmsg_length
- ;
- ; xdses
- ; mov si,0b8h ;approx end of header
- ; mov ax,1
- ; call search_for
- ; xdses
- ;
- ; mov pathline_start,si
- ; add si,6
- ; mov di,offset Cur_path_line
- ;
- ; xdses
- ; call net_nodes
- ; xdses ;should have true data in ds:
- ;
- ; mov ax,pathline_start
- ; mov upmsg_length,ax
- ; ret
-
- ;get_path_list: ;pulls of the path line and puts it
- ; ;into the path_list in expanded hes
- ; ;format. DS must be valid. upmsg_length
- ; ;is updated
- ; mov es,sel_msg_buf
- ; mov si,pathline_start
- ; add si,6
- ; mov di,offset path_list
- ; xdses
- ; call net_nodes
- ; xdses
- ; mov ax,pathline_start
- ; mov upmsg_length,ax
- ; ret
- ;
-
-
- public Strip_Path
- Strip_Path: ;this pulls off the path and puts it
- ;into the path_list in expanded
- ;hex format. DS must be valid, upmsg_length
- ;is updated
- edata
- mov di,offset path_list
- xor ax,ax
- mov cx,4096
- rep stosb
- mov si,upmsg_length ;start at end and look
- push si ;towards
- mov cx,offset mtext ;beginning for
- mov di,offset origin_line ;the origin line
- mov ax,sel_msg_buf
- mov es,ax
- mov ax,-1
- xdses
- call search_for
- jnc x200
- jmp bad_msg
- x200:
- mov di,offset path_line
- mov ax,1
- pop cx
- call search_for
- xdses
- jnc x201
- edata
- mov di,offset path_list
- mov si,offset this_add ;if no path is
- mov cx,5 ;found, then one is added
- rep movsb
- jmp short x203a ;upmsg_length should be ok
-
- x201:
- mov first_path,si ;now pointing at first path string
- mov di,si
- mov cx,6
- mov dx,upmsg_length
- call delete_cx_chars
- mov upmsg_length,di
- x202:
- mov di,offset path_line
- mov ax,1
- mov cx,upmsg_length
- xdses
- call search_for
- xdses
- jc x203
- mov di,si
- mov cx,6
- mov dx,upmsg_length
- call delete_cx_chars
- mov upmsg_length,di
- jmp short x202
- x203:
- mov di,first_path
- mov dx,upmsg_length
- call strip_CRs
- mov upmsg_length,dx
-
- mov dx,temp_def_net
- mov di,offset path_list
- mov si,first_path
- xdses
- call net_nodes
- xdses
- mov ax,first_path
- mov upmsg_length,ax
- x203a:
- ret
-
-
-
- public Strip_seen_bys
- Strip_seen_bys: ;this pulls off the seen-bys and puts them
- ;them into the seen_by_list in expanded
- ;hex format. DS must be valid, upmsg_length
- ;is updated
- edata
- mov di,offset seen_by_list
- xor ax,ax
- mov cx,4096
- rep stosb
- mov si,upmsg_length ;start at end and look
- push si ;towards
- mov cx,offset mtext ;beginning for
- mov di,offset origin_line ;the origin line
- mov ax,sel_msg_buf
- mov es,ax
- mov ax,-1
- xdses
- call search_for
- jnc y4
- jmp bad_msg
- y4:
- mov di,offset seen_by_line
- mov ax,1
- pop cx
- call search_for
- xdses
- jnc y5
- edata
- mov di,offset seen_by_list
- mov si,offset this_add
- mov cx,25
- rep movsb
- mov ax,upmsg_length
- ret
- y5:
- mov first_seen_by,si ;now pointing at first seen by string
- mov di,si
- mov cx,8
- mov dx,upmsg_length
- call delete_cx_chars
- mov upmsg_length,di
- x45:
- ;l1:
- mov di,offset seen_by_line
- mov ax,1
- mov cx,upmsg_length
- xdses
- call search_for
- xdses
- jc x46
- mov di,si
- mov cx,8
- mov dx,upmsg_length
- call delete_cx_chars
- mov upmsg_length,di
- jmp short x45
- x46:
- ;l3:
- mov di,first_seen_by
- mov dx,upmsg_length
- call strip_CRs
- mov upmsg_length,dx
-
- mov dx,temp_def_net
- mov di,offset seen_by_list
- mov si,first_seen_by
- xdses
- call net_nodes
- xdses
- mov si,first_seen_by
- mov upmsg_length,si
- mov ax,si
- ret
-
-
- public locate_area
- locate_area: ;enters ds:si->current area, cx = length of tag
- ;rets with es:di ->at path to current area.
-
- mov ax,sel_areas
- mov es,ax
- mov di,offset li_area
- x47:
- ;l1:
- push si
- push di
- push cx
- repz cmpsb
- jz x48
- la1:
- pop cx
- pop di
- pop si
- add di,0a4h
- cmp di,limit_areas
- jb x47
- stc
- ret
- x48:
- ;l2:
- cmp byte ptr es:[di],0
- jnz la1
- pop cx
- pop di
- pop si
- sub di,offset li_area
- mov current_path,di
- clc
- ret
-
-
-
-
- get_message_area: ;es = message buffer;rets with es:di ->area string
- mov cx,upmsg_length
- mov si,offset mtext
- dec si
- dec si
- sub cx,si
- mov di,offset area_line
- xdses
- mov ax,1
- call search_for
- jnc y6
- jmp bad_msg
- y6:
- add si,5
- mov di,si
- xdses
-
- ife tight
-
- gma2:
- cmp byte ptr es:[di],20h
- jnz gma1
- inc di
- jmp short gma2
-
- gma1:
-
- endif
- ret
-
-
-
- public get_msg
- get_msg:
- mov mail_flags,0
- mov ax,end_of_msg
- mov prev_end,ax
- mov ax,sel_pkt_buf
- mov es,ax
- mov di,si
- xor dx,dx
- mov cx,current_read
- cmp cx,160
- ja gmsg2
- jmp short x52
- gmsg2:
- sub cx,di
- cmp cx,160
- jb x49
- mov cx,160
- x49:
- ;o1:
- mov ax,0002h
- x50:
- ;l1:
- repnz scasb
- and cl,cl
- jz x52
- cmp es:[di],ah
- jne x51
- jmp short x55
- x51:
- ;n1:
- and cx,cx
- jnz x50
- cmp di,current_read
-
-
-
- jb x54
- x52:
- ;o2:
- or mail_flags,no_more_flag
- x53:
- ;o3:
- mov ax,cx
- mov end_of_msg,ax
- stc
- ret
-
- x54:
- ;o4:
- mov byte ptr bad_packet,1
- jmp short x52
-
- x55:
- ;n2:
- inc di
- mov msg_start,di
-
-
-
- ;this is the start of the new checker
-
- mov cx,current_read
- sub cx,di
- cmp cx,34
- jb to_split
-
-
- add di,12
- mov cx,current_read
- cmp cx,0ffffh
- jb x55a
- dec cx
- x55a:
- call next_z_limit
- jc to_split ;points at to_user
- call next_z_limit
- jc to_split ;points at from_user
- call next_z_limit
- jc to_split ;points at subject
- call next_z_limit
- jc to_split ;points at area tag
- mov text_start,di
- call next_z_limit
- jc to_split ;points at end of message
- mov end_of_msg,di
- sub di,msg_start
- mov msg_length,di
-
- ;now we see it is netmail. i.e. no tagline
-
- mov si,text_start
- mov cx,si
- add cx,5 ;it must be right here
- xdses ;xchange ds,es
- mov di,offset area_line
- mov ax,1
- call search_for
- jnc not_netmail
- ; jmp is_netmail
-
- xdses
- or mail_flags,netmail_flag
- jmp x57
-
- to_split:
- mov end_of_msg,0
- jmp no_eom
-
-
- not_netmail:
- mov si,es:msg_start
-
-
-
-
- if tight
-
- mov di,offset path_line
- mov cx,es:end_of_msg
- sub cx,8 ;correction for length of path_line
- mov ax,1
- call search_for
- jc x56
- xdses
- mov pathline_start,si
- jmp x57
- x56:
- ;o5:
- xdses
- or mail_flags,bad_flag
- mov ax,end_of_msg
- add_m32_rax cur_pkt_file_ptr
- stc
- ret
-
- else
-
- xdses
- endif
-
- x57:
- push cx
- push es
- mov di,end_of_msg
- push di
- ;this cleans buf where msg will go
- mov es,sel_msg_buf
- xor ax,ax
- mov di,ax
- mov cx,msg_length
- add cx,03bh
- rep stosb
- pop di
- pop es
- pop cx
-
- ;this little snip updates the packet read pointer
-
- push dx
- push si
-
- edata
- xor dx,dx
- ; mov ax,word ptr cur_pkt_file_ptr
- ; or ax,word ptr cur_pkt_file_ptr+2
- ; jnz x58
- ; mov ax,msg_start
- ; sub ax,3
- ; mov word ptr cur_pkt_file_ptr,ax
- ;x58:
- ;;o6:
- ; mov ax,msg_length
- ; add ax,3
-
- mov ax,end_of_msg
- sub ax,prev_end
-
- add word ptr cur_pkt_file_ptr,ax
- adc word ptr cur_pkt_file_ptr+2,dx
- ; mov si,offset cur_pkt_file_ptr
- pop si
- pop dx
-
- mov cx,di
- push ds
- mov ax,sel_pkt_buf
- mov si,msg_start
- mov es,sel_msg_buf
- mov ds,ax
-
- mov ax,pmorigin_node[si]
- mov es:morigin_node,ax
- mov ax,pmdest_node[si]
- mov es:mdest_node,ax
- mov ax,pmorigin_net[si]
- mov es:morigin_net,ax
- mov ax,pmdest_net[si]
- mov es:mdest_net,ax
- mov ax,pmattribute[si]
- mov es:mattribute,ax
- mov ax,pmcost[si]
- mov es:mcost,ax
- add si,offset pmdatetime
- mov di,offset mdatetime
-
- call eozs
-
- repnz movsb
- mov di,dx
- add di,offset mtouser
- inc si
- call eozs
- repnz movsb
- mov di,dx
- add di,offset mfromuser
- inc si
- call eozs
- repnz movsb
- mov di,dx
- add di,offset msubject
- inc si
- call eozs
- repnz movsb
- mov di,dx
- inc si
- add di,offset mtext
- mov ax,ds ;local data seg saved in ax
- pop ds
- push ds ;ds should now have true data
- mov cx,msg_length
- sub cx,si ;correct for header already done
- add cx,msg_start
- mov ds,ax
- rep movsb
- pop ds
- dec di ;normal rep correction
- mov upmsg_length,di
- inc msg_counter
-
- ; mov ax,debug_handle
- ; mov handle,ax
- ; mov ax,word ptr cur_pkt_file_ptr
- ; call write_decf
- ; mov ax,word ptr cur_pkt_file_ptr+2
- ; call write_decf
- ; mov ax,msg_counter
- ; call write_decf
- clc
- ret
-
- no_eom:
- public no_eom
- mov ax,08001h ;local error 1 eom not found
- or mail_flags,split_flag
- stc
- ret
-
- ;is_netmail:
- ; push ds
- ; pop es
- ; ddata
- ; xor dx,dx
- ; mov ax,word ptr cur_pkt_file_ptr
- ; or ax,word ptr cur_pkt_file_ptr+2
- ; jnz gmsg1
- ; mov ax,msg_start
- ; sub ax,3
- ; mov word ptr cur_pkt_file_ptr,ax
- ;gmsg1:
- ; mov ax,msg_length
- ; add ax,2
- ; add word ptr cur_pkt_file_ptr,ax
- ; adc word ptr cur_pkt_file_ptr+2,dx
- ;
- ; or mail_flags,netmail_flag
- ;
- ; stc
- ; ret
-
-
-
-
-
-
- get_packet:
- public get_packet
- mov empty_pkt,0
- mov ax,sel_pkt_buf
- and ax,ax
- jnz x59
- mov ax,0ffffh
- mdosallocseg sel_pkt_buf,no_share
- jmp short x60
- x59:
- ;n1:
- mov ax,pkt_path_end
- mov path_end,ax
- mov di,ax
- push ds
- pop es
- jmp short x61
- x60:
- ;n2:
- mov ax,pkt_path_end
- and ax,ax
- jz gpkt1
- mov di,path_end
- jmp short x61
- gpkt1:
- mov si,offset netfile_path
- mov di,si
- mov ax,ds
- mov es,ax
- call eoz
- mov al,'\'
- cmp al,[di-1]
- jz y7
- stosb
- y7:
- mov path_end,di
- mov pkt_path_end,di
- x61:
- ;n3:
- mov si,offset packet_search
- mov cx,6
- rep movsb
- mov dx,0 ;search attribute
- mov search_handle,1
- ;generic search handle
- mov di,36 ;36 bytes/requested found
- mov max_find,1
- push ds
- pop word ptr doscall_inseg
- mov ax,offset netfile_path
- mov cx,ds
- mov si,offset find_buffer
- mdosfindfirst
-
-
-
-
- jnc y11
- ; jmp no_toss
- ret
- y11:
- mov byte ptr large_packet,0
- mov cx,find_buffer.ffile_size_hi
- mov word ptr pkt_size+2,cx
- mov ax,find_buffer.ffile_size
- mov word ptr pkt_size,ax
- and cx,cx
- jnz gpkt2
- cmp ax,100
- jae gpkt2
- mov empty_pkt,1
- gpkt2:
- and cx,cx
- jz x62
- mov large_packet,1
- x62:
- ;l1:
- ; xor cx,cx
- ; mov bx,cx
- ; dec bx
- ; sub word ptr find_buffer.ffile_size,bx
- ;
- ; sbb word ptr find_buffer.ffile_size_hi,cx
- lea si,find_buffer.ffilename
- mov cl,find_buffer.flen_filename
- xor ch,ch
- mov di,path_end
- push ds
- pop es
- cld
- rep movsb
- mov al,0
- stosb
- mdosopen netfile_path,open,fail
- openerror netfile_path,file_error
- mov ax,handle
- mov pkt_handle,ax
- mov ax,sel_pkt_buf
- mov doscall_inseg,ax
- mov si,0
- test byte ptr large_packet,0ffh
- jz x66
- mov cx,0ffffh
- x63:
- ;l5:
- mov current_read,cx
- x64:
- ;l3:
- mdosRead
- jnc y8
- jmp error
- y8:
- add si,result
- cmp cx,result
- jz short x65
- sub cx,result
- jmp short x64
- x65:
- ;l2:
- push si
- mov si,offset cur_pkt_file_ptr
- xor ax,ax
- mov [si],ax
- mov [si+2],ax
- pop si
- clc
- ret
- x66:
- ;l4:
- mov cx,find_buffer.ffile_size
- jmp short x63
-
- ;e1:
- ; ret
-
-
-
-
- get_header:
- push ds
- mov di,offset packet_hdr
- mov cx,offset packet_hdr_end
- sub cx,di
- push es
- push ds
- pop es
- pop ds
- mov ds,es:sel_pkt_buf
- mov si,0
- rep movsb
- pop ds
- ret
-
-
- backup_to_eol: ;after a find_eol this adjusts si so that
- ;it is pointing at the CR
- x66a:
- ;l1:
- dec si
- cmp byte ptr [si],0dh
- jnz x66a
- ret
-
-
-
- xfer_path:
-
- call slen
- mov di,bx
- rep movsb
- mov al,0
- stosb
- ret
-
-
- slash_to_word: ;si points at string, temp_def_net has last net #
- ;and is updated if new found.
- ;Same with temp_def_zone.
- ;rets node in AX
- ;si points string+1(;dx carries temp_def_net value)
-
- push cx
- push si
- call sclength
- pop si
- jc has_zone
- has_net:
- test ch,0ffh
- jz node
- xor ch,ch
- call dechex
-
- ;***
- push ds
- push ss
- pop ds
-
- mov temp_def_net,ax
-
- pop ds
-
-
- call sclength
- node:
- push ds
- ddata
- mov bx,word ptr temp_def_zone
- mov dx,temp_def_net
- pop ds
- push si
- call sclength
- pop si
- push dx
- call dechex
- pop dx
- inc si
- pop cx
- ret
-
- has_zone:
- push cx
- call dechex
- pop cx
- xor ch,ch
- add si,cx
- inc si
- push ds
- ddata
- mov temp_def_zone,al
- pop ds
- push si
- call sclength
- pop si
- jmp short has_net
-
- public slen
- slen: ;si points at string, rets length of ascii string
- ;in cx. other regs unchanged.
- push si
- xor cx,cx
- x67:
- ;l1:
- cmp byte ptr [si],020h ;space
- jz x68
- cmp byte ptr [si],9 ;tab
- jz x68
- cmp byte ptr [si],0dh ;CR
- jz x68
- cmp byte ptr [si],0ah ;lf
- jz x68
- inc si
- inc cl
- jmp short x67
- x68:
- ;l2:
- pop si
- ret
-
-
-
- public dlen
- dlen: ;si points at string, rets length of ascii string
- ;in cx. other regs unchanged.
- push di
- xor cx,cx
- xd67:
- cmp byte ptr es:[di],020h ;space
- jz xd68
- cmp byte ptr es:[di],9 ;tab
- jz xd68
- cmp byte ptr es:[di],0dh ;CR
- jz xd68
- cmp byte ptr es:[di],0ah ;lf
- jz xd68
- inc di
- inc cl
- jmp short xd67
- xd68:
- pop di
- ret
-
-
-
-
- ;public slength
- ;slength: ;si points at string, rets end of string+1 in si
- ; ;presence of slash in ch, # of chars in cl
- ; ;if slash present only chars before are counted
- ;
- ; xor cx,cx
- ;x69:
- ;;l1:
- ; cmp byte ptr [si],020h ;space
- ; jz x70
- ; cmp byte ptr [si],9 ;tab
- ; jz x70
- ; cmp byte ptr [si],0dh ;CR
- ; jz x70
- ; cmp byte ptr [si],0ah ;lf
- ; jz x70
- ; cmp byte ptr [si],'/'
- ; jne y9
- ; mov ch,1
- ;y9:
- ; jz x70
- ; inc si
- ; inc cl
- ; jmp short x69
- ;x70:
- ;;l2:
- ; inc si
- ; clc
- ; ret
-
-
- sclength: ;si points at string, rets end of string+1 in si
- ;presence of slash in ch, # of chars in cl
- ;if slash present only chars before are counted
- ;presence of colon in carry
- xor cx,cx
- x69:
- ;l1:
- cmp byte ptr [si],020h ;space
- jz x70
- cmp byte ptr [si],9 ;tab
- jz x70
- cmp byte ptr [si],0dh ;CR
- jz x70
- cmp byte ptr [si],0ah ;lf
- jz x70
- cmp byte ptr [si],':'
- jz x260
- cmp byte ptr [si],'/'
- jne y9
- mov ch,1
- y9:
- jz x70
- inc si
- inc cl
- jmp short x69
- x70:
- ;l2:
- inc si
- clc
- ret
- x260:
- stc
- ret
-
-
-
- ;
- ;public dlength
- ;dlength: ;es:di points at string, rets end of string+1 in di
- ; ;presence of slash in ch, # of chars in cl
- ; ;if slash present only chars before are counted
- ;
- ; xor cx,cx
- ;x71:
- ;;l1:
- ; cmp byte ptr es:[di],020h ;space
- ; jz x72
- ; cmp byte ptr es:[di],9 ;tab
- ; jz x72
- ; cmp byte ptr es:[di],0dh ;CR
- ; jz x72
- ; cmp byte ptr es:[di],0ah ;lf
- ; jz x72
- ; cmp byte ptr es:[di],'/'
- ; jne y10
- ; mov ch,1
- ;y10:
- ; jz x72
- ; inc di
- ; inc cl
- ; jmp short x71
- ;x72:
- ;;l2:
- ; inc di
- ; ret
- ;
- sstart:
- public sstart
- cmp byte ptr [si],020h
- jz x73
- cmp byte ptr [si],0h
- jz x73
- cmp byte ptr [si],09h
- jz x73
- cmp byte ptr [si],0dh
- jz x75
- cmp byte ptr [si],'\'
- jz x73a
-
- jmp short x74
- x73:
- ;l1:
- inc si
- jmp short sstart
- x73a:
- add si,3
- jmp short sstart
-
-
- x74:
- ;l2:
- clc
- ret
- x75:
- ;l3:
- stc
- ret
- ;dstart:
- ;public dstart
- ; cmp byte ptr es:[di],020h
- ; jz xd73
- ; cmp byte ptr es:[di],0h
- ; jz xd73
- ; cmp byte ptr es:[di],09h
- ; jz xd73
- ; cmp byte ptr es:[di],0dh
- ; jz xd75
- ; jmp short xd74
- ;xd73:
- ;;l1:
- ; inc si
- ; jmp short dstart
- ;
- ;xd74:
- ;;l2:
- ; clc
- ; ret
- ;xd75:
- ;;l3:
- ; stc
- ; ret
- ;
- public find_eol
- find_eol: ;ds:si in line, rets with si pointing at 1st char of
- ;the next line. other regs preserved (lf's ignored)
- push ax
- push cx
- push di
- push es
- mov ax,ds
- mov es,ax
- mov di,si
- mov al,0dh
- mov cx,512
- repnz scasb
- inc di
- mov al,0ah
- cmp al,[si]
- jnz x76
- inc di
- x76:
- ;l1:
- mov si,di
- pop es
- pop di
- pop cx
- pop ax
- ret
-
- find_config_line: ;ds:si in config file segment. Rets sith SI
- ;pointing at start of next valid line
- x77:
- ;l1:
- call find_eol
- cmp byte ptr[si],0
- jz x78
- cmp byte ptr[si],'#'
- jz x77
- cmp byte ptr[si],' '
- je x78
- cmp byte ptr[si],'0'
- jb x77
- cmp byte ptr[si],'z'
- ja x77
- x78:
- ;l2:
- ret
-
- public search_for
- ;search_forz: ;searches ds:si to limit cx for asciiz string
- ; ;by es:di. rets carry if not found, or si
- ; ;pointing to start of string if found
- ; ;search is forward if ax=01h search is from end
- ; ;toward the start of ds:si if ax=-1
- ; push ax
- ; push dx
- ; mov dx,di
- ;x79:
- ;;l3:
- ; push si
- ;
- ;x80:
- ;;l1:
- ; cmpsb
- ;
- ; jnz not_yet
- ;x81:
- ;;l2:
- ; test byte ptr es:[di],0ffh
- ; jz maybe_found
- ; cmpsb
- ;
- ; jz x81
- ;not_yet:
- ; pop si
- ; mov di,dx
- ; add si,ax
- ; cmp si,cx
- ; je not_here
- ; jmp short x79
- ;found:
- ; pop si
- ; pop dx
- ; pop ax
- ; clc
- ; ret
- ;not_here:
- ; pop dx
- ; pop ax
- ; stc
- ; ret
- ;
- ;maybe_found:
- ; cmp byte ptr [si],0
- ; jnz not_yet
- ; jmp found
-
- search_for: ;searches ds:si to limit cx for asciiz string
- ;by es:di. rets carry if not found, or si
- ;pointing to start of string if found
- ;search is forward if ax=01h search is from end
- ;toward the start of ds:si if ax=-1
- push ax
- push dx
- mov dx,di
- x79:
- ;l3:
- push si
-
- x80:
- ;l1:
- cmpsb
-
- jnz not_yet
- x81:
- ;l2:
- test byte ptr es:[di],0ffh
- jz found
- cmpsb
-
- jz x81
- not_yet:
- pop si
- mov di,dx
- add si,ax
- cmp si,cx
- je not_here
- jmp short x79
- found:
- pop si
- pop dx
- pop ax
- clc
- ret
- not_here:
- pop dx
- pop ax
- stc
- ret
-
-
- public delete_cx_chars
- delete_cx_chars: ;es:di -> 1st char to remove, cx is # to remove
- ;dx is the offset of the end of the text.
- ;di rets w/ the new offset of the eot
- ;dx and cx undefined.
- push si
- push ds
- mov si,di
- push es
- pop ds
- mov si,di
- add si,cx
- sub dx,di
- sub dx,cx
- mov cx,dx
-
- rep movsb
- pop ds
- pop si
- ret
-
- public eoz
- eoz: ;rec start of asciiz in es:di. on exit di points at
- ;the zero. length in cx
- push di
- mov al,0
- mov cx,80h
- cld
- repnz scasb
- dec di
- mov cx,di
- pop ax
- sub cx,ax
- ret
-
-
-
-
- public eozs
- eozs: ;rec start of asciiz in ds:si.
- ;rets length in cx
- push si
- xdses
- xchg di,si
- call eoz
- xchg di,si
- xdses
- pop si
- ret
-
-
-
-
- mov_cur_path_to_data: ;takes the pathline from the areas buffer and
- ;moves it to local data
- ; assures ending in '\',
- ;and assures a '0' terminator. places offset of
- ;the 0 in cur_ar_path_end.
- ;entered with ds=true data, cur_path_line valid.
- ;on ret es=sel_areas, ax, dx, si trashed
- mov ax,sel_areas
- mov es,ax
- mov di,current_path
- push di
- call eoz
- pop si
- mov di,offset scratch_path
- xdses
- rep movsb
- mov al,'\'
- cmp al,[di-1]
- jz x82
- stosb
- x82:
- ;l1:
- mov al,0
- stosb
- dec di
- xdses
- mov cur_ar_path_end,di
- ret
-
-
-
-
-
-
-
- public get_msg_high
- get_msg_high:
- call names
-
- jnc x83
-
- call make_msg1
- mov word ptr highest_msg,1
- ret
-
- x83:
- ;l1:
- push ds
- mov cx,max_find
- mov ds,sel_names
- push ds
- pop es
-
- push cx
- call name_num
- pop cx
- mov si,8000h ;point it at the start of the list just made
- call highest
- pop ds
- mov highest_msg,bx
- ret
-
-
- public clean_buffer
- clean_buffer: ;rec the buffer start in es:di and the length
- ;to clean in cx. rets with the buffer all 0h.
-
- push ax
- push di
- mov ax,0
- cld
- rep stosb
- pop di
- pop ax
- ret
-
-
- public clean_wbuffer
- clean_wbuffer: ;buffer must start on word boundary
- ;rec the buffer start in es:di and the length
- ;to clean in cx. in bytes.
- ;rets with the buffer all 0h.
-
- push ax
- push di
- mov ax,0
- cld
- rep stosb
- pop di
- pop ax
- ret
-
-
- public Strip_CRs
- Strip_CRs: ;removes the CR or CRLF's from the string
- ;-> by es:di to limit of dx.
- ;ax,cx,di trashed. New end in dx
- mov al,0dh
- x84:
- ;l1:
- scasb
- jnz x85
- call SCR
- x85:
- ;l2:
- cmp di,dx
- jb y12
- ret
- y12:
- jmp short x84
-
-
-
- SCR:
- push di
- dec di
- mov cx,1
- cmp byte ptr es:[di+1],0ah
- jnz x86
- inc cx
- x86:
- ;l3:
- call delete_cx_chars
- mov dx,di
- pop di
- ret
-
-
- public name_num
- name_num: ;enters w/ ds:si -> at start of dosfindfirst
- ;generated file list of cx entries.
- ;es and ds -> to a segment 2*cx longer than
- ;8000h. On ret there are cx words of filenames
- ;converted to hex beginning at 8000h
- mov ah,0
- mov al,'.'
- mov si,0
- mov di,8000h
- x87:
- ;l1:
- call one_name
- dec cx
- jz x88
- jmp short x87
- x88:
- ;f1:
- ret
-
-
- public highest
- highest: ;rets w/ highest of cx numbers -> to by ds:si
- ;hexvalue is returned in BX
- xor bx,bx
- x89:
- ;l2:
- lodsw
- cmp ax,bx
- jb x90
- mov bx,ax
- x90:
- ;l1:
- dec cx
- jnz x89
- ret
-
-
-
- one_name: ;rets with si->at next structure, . replaced w/ 0
- ;dx trashed.
- ;ax reloaded,numeric value entered at di,
- ;and di updated
-
- add si,offset ffilename
- push di
- push cx
- mov di,si
- mov cl,byte ptr[si-1]
- xor ch,ch
- mov dx,cx
- add dx,si
- mov di,si
- repnz scasb
- mov byte ptr[di-1],ah
- sub di,si
- mov cx,di
- dec cx
- call dechex
- pop cx
- pop di
- stosw
- mov si,dx
- inc si
- mov ax,002eh
- ret
-
-
- public Get_next_packet
- Get_next_packet:
- mov ax,pkt_handle
- mdosclose
- push ds
- push offset netfile_path
- xor ax,ax
- push ax
- push ax
- call DosDelete
- mov no_more_pkts,0
-
- call get_packet
- jnc gnp1
- mov no_more_pkts,1
- gnp1:
- ret
-
-
- public load_more_packet
- load_more_packet:
- mov di,offset cur_pkt_file_ptr
- mov si,offset pkt_size
- mov ax,[di]
- mov dx,[di+2]
- mov cx,[si+2]
- mov bx,[si]
- add ax,4
- adc dx,0
- sub bx,ax
- sbb cx,dx
- jc x93
- and cx,cx
- mov cx,0ffffh
- jnz x92
- mov cx,bx
- add cx,4
- mov byte ptr large_packet,0
- x92:
- ;l1:
- push cx
- mov si,offset cur_pkt_file_ptr
- ;;EXPAND: lodad
- lodsw
- mov dx,ax
- lodsw
- xchg dx,ax
- mov bx,ax
- mov ax,pkt_handle
- mov handle,ax
- mov cx,0
- ;;EXPAND: m8doschgfileptr cur_pkt_file_ptr
- push ax
- push dx
- push bx
- push cx
- mov ax,offset cur_pkt_file_ptr
- push ds
- push ax
- call DosChgFilePtr
- ;;EXPAND: error_check
- clc
- and ax,ax
- jz m16
- stc
- m16:
-
- mov ax,sel_pkt_buf
- mov es,ax
- mov doscall_inseg,ax
- mov si,0
- pop cx
- mdosread
- mov cx,result
- mov current_read,cx
- clc
- ret
-
- x93:
- ;f1:
- stc
- ret
-
- public Make_msg1
- Make_msg1:
- push highest_msg
- mov highest_msg,0
- call make_msg_pathname
-
-
-
- mdosopen scratch_path,replace,create
- openerror scratch_path,file_error
- mov ax,handle
- mov cx,msg1_end-msg1
- mov si,offset msg1
-
- ;;EXPAND: m8doswrite ds,results
- push ax
- push ds
- push si
- push cx
- push ds
- push offset results
- call doswrite
- ;;EXPAND: error_check
- clc
- and ax,ax
- jz m19
- stc
- m19:
-
- mov ax,handle
-
- mdosclose
- pop highest_msg
- inc highest_msg
- ret
-
- print_tossing:
- ; push di
- ; push si
- ; ;;EXPAND: prt vmsg_dot
- ;mov di,offset vmsg_dot
- ;call print_asciiz
- ; pop si
- ; pop di
- ; ret
- push ax
- push bx
- push cx
- push dx
- push di
- push si
- push es
- and area_changed,0ffh
- jz pt1
- pcrlf
- pt1:
- prt cr_only
- prt vmsg_toss_num
- ; prt scratch_path
- ; pcrlf
- mov ax,highest_msg
- call disp_dec
- prt space2
- ; ;;EXPAND: prt vmsg_to_area
- mov di,offset vmsg_to_area
- call print_asciiz
- ; mov di,offset current_area
- ; call print_asciiz
- ; pcrlf
- prt scratch_path
- pop es
- pop si
- pop di
- pop dx
- pop cx
- pop bx
- pop ax
- ret
-
-
- comp_strings: ;comps strings ds:si with es:di to length cx
-
- push di
- push si
- repz cmpsb
- and cx,cx
- pop si
- pop di
- ret
-
-
- ;ERRORS
-
- file_error:
- ddata
- edata
- push ax
- cmp ax,0deh
- jb fc1
- mov ax,0deh
- fc1:
- shl ax,1
- mov bx,ax
- pop ax
- push si
- mov si,offset err_index
- mov di,[si+bx]
- call print_asciiz
- pcrlf
- pop di
- call print_asciiz
- jmp terminate
-
-
- dos_error:
- push ds
- push es
- push si
- push di
- ddata
- edata
- push ax
- cmp ax,0deh
- jb fc1
- mov ax,0deh
- de1:
- shl ax,1
- mov bx,ax
- pop ax
- push si
- mov si,offset err_index
- mov di,[si+bx]
- call print_asciiz
- pcrlf
- pop di
- call print_asciiz
- pop di
- pop si
- pop es
- pop ds
-
-
-
- no_toss:
- pcrlf
- prt vmsg_allpkts
- pcrlf
- jmp terminate
- public no_such_area
- no_such_area:
- push ds
- push _data
- pop ds
- prt ermsg_no_area
- mov di,offset current_area
- call print_asciiz
- pcrlf
- jmp bad1
- error:
- Bad_msg:
- ; push ds
- push _data
- pop ds
- mov sp,stack_start
- mov di,offset crlf
- call print_asciiz
- prt ermsg_bad_msg
- mov di,offset current_area
- call print_asciiz
- pcrlf
- bad1:
- call it_is_bad
- mov di,offset current_area
- xor al,al
- stosb
- ; pop ds
- jmp throw_this_msg
-
- too_long:
-
- load_dupes: ;loads the dupe file into the dupes_list area
- push ds
- push es
- push di
- push si
- mov ax,_data
- mov ds,ax
- mov es,ax
- mov di,cur_ar_path_end
- mov si,offset dupes_file
- call eozs
- inc cx
- rep movsb
- mdosopen scratch_path,open,create
- jc x95
- mov ax,handle
- mov dupes_handle,ax
- test result,2
- jnz x94
- push ds
- pop word ptr doscall_inseg
- mov si,offset dupes_list
- mov cx,dupes_num
- shl cx,2
- mdosread
- clc
- x94:
- ;l1:
- pop si
- pop di
- pop es
- pop ds
- ret
-
- x95:
- ;l2: stc
- jmp short x94
-
-
- write_dupes: ;writes dupes_list to dupes_file and closes it
-
- mov ax,dupes_handle
- and ax,ax
- jnz wd1
- jmp wd_end
- wd1:
- xor bx,bx
- mov dx,bx
- mov cx,bx
- ;;EXPAND: m8doschgfileptr
- push ax
- push dx
- push bx
- push cx
- mov ax,offset cur_file_ptr
- push ds
- push ax
- call DosChgFilePtr
- ;;EXPAND: error_check
- clc
- and ax,ax
- jz m23
- stc
- m23:
-
- mov cx,dupes_num
- shl cx,2
- add cx,offset dupes_list ;this is the end of the list
- sub cx,dupes_ptr
- mov ax,dupes_handle
- mov si,dupes_ptr
- push ds
- pop word ptr doscall_inseg
- ;;EXPAND: m8doswrite doscall_inseg,results
- push ax
- push word ptr doscall_inseg
- push si
- push cx
- push ds
- push offset results
- call doswrite
- ;;EXPAND: error_check
- clc
- and ax,ax
- jz m24
- stc
- m24:
- mov ax,dupes_handle
- mov cx,dupes_ptr
- mov si,offset dupes_list
- sub cx,si
- ;;EXPAND: m8doswrite doscall_inseg,results
- push ax
- push word ptr doscall_inseg
- push si
- push cx
- push ds
- push offset results
- call doswrite
- ;;EXPAND: error_check
- clc
- and ax,ax
- jz m25
- stc
- m25:
- mov ax,dupes_handle
- mdosclose
- wd_end:
- ret
-
- public comp_crc
- comp_crc: ;rec a value in dx-ax. Comps this with each entry
- ;in dupes_list. If matched rets a carry
- push si
- mov cx,dupes_num
- mov si,offset dupes_list
-
- x96:
- ;l2:
- cmp ax,[si]
- jnz x97
- cmp dx,[si+2]
- jnz x97
- stc
- pop si
- ret
- x97:
- ;l1:
- add si,4
- dec cx
- jnz x96
- clc
- pop si
- ret
-
- add_crc:
- push di
- mov di,dupes_ptr
- mov [di],ax
- mov [di+2],dx
- add di,4
- mov cx,dupes_num
- shl cx,2
- add cx,offset dupes_list
- cmp di,cx
- jb x98
- mov di,offset dupes_list
- x98:
- ;l1:
- mov dupes_ptr,di
- pop di
- ret
-
- make_crc:
- mov es,sel_msg_buf
- mov di,0
- mov ax,0ffffh
- mov dx,ax
- mov cx,164
- call do_crc32
- ret
-
- crc_main: ;generates the new crc, checks it against the
- ;dupes list and installs it if it's new.
- ;rets a carry if it's a dupe. no entry or
- ;exit parameters.
- push es
- push ds
- push si
- push di
- ;;EXPAND: ddata
- push _data
- pop ds
- call make_crc
- call comp_crc
- jc x99
- call add_crc
- clc
- x99:
- ;l1:
- pop di
- pop si
- pop ds
- pop es
- ret
-
-
- add_t_area:
- mov di,toss_ptr
- mov si,offset current_area
- call eozs
- rep movsb
- mov al,0dh
- stosb
- mov al,0ah
- stosb
- mov toss_ptr,di
- ret
-
- comp_t_area:
- push ds
- push es
- push di
- push si
- mov ax,seg _data
- mov ds,ax
- mov es,ax
- mov di,offset current_area
- mov si,offset toss_list
- mov cx,si
- add cx,8000
- mov ax,1
- call search_for
- jnc x100
- call add_t_area
- x100:
- ;l1:
- pop si
- pop di
- pop es
- pop ds
- ret
-
- write_t_area:
- mdosopen echo_toss,open,create
- openerror echo_toss,file_error
- mov ax,handle
- push ax
- mov bx,0
- mov dx,bx
- mov cx,2 ;append to end of file
- ;;EXPAND: m8doschgfileptr
- push ax
- push dx
- push bx
- push cx
- mov ax,offset cur_file_ptr
- push ds
- push ax
- call DosChgFilePtr
- ;;EXPAND: error_check
- clc
- and ax,ax
- jz m28
- stc
- m28:
- pop ax
- push ax
- push ds
- pop word ptr doscall_inseg
- mov cx,toss_ptr
- sub cx,offset toss_list
- mov si,offset toss_list
- ;;EXPAND: m8doswrite doscall_inseg,results
- push ax
- push word ptr doscall_inseg
- push si
- push cx
- push ds
- push offset results
- call doswrite
- ;;EXPAND: error_check
- clc
- and ax,ax
- jz m29
- stc
- m29:
- pop ax
- mdosclose
- ret
-
-
- write_decf:
- push ax
- push bx
- push cx
- push dx
- push di
- push si
- push ds
- push es
- push _data
- pop ds
- push ds
- pop es
- mov di,offset scratch_ascii
- mov dx,ax
- call dx_to_ascii
- mov ax,20h
- stosb
- stosb
- mov al,0dh
- stosb
- mov al,0ah
- stosb
- mov ax,word ptr handle
- mov cx,8
- mov si,offset scratch_ascii
- push ds
- pop word ptr doscall_inseg
-
- ;;EXPAND: m8doswrite doscall_inseg,results
- push ax
- push word ptr doscall_inseg
- push si
- push cx
- push ds
- push offset results
- call doswrite
- ;;EXPAND: error_check
- clc
- and ax,ax
- jz m31
- stc
- m31:
-
- pop es
- pop ds
- pop si
- pop di
- pop dx
- pop cx
- pop bx
- pop ax
- ret
-
-
-
-
-
-
- mov di,offset hex_buff
- call print_asciiz
- pop di
- pop es
- ret
-
-
-
-
-
- disp_dec: ;displays the hex number in ax as a decimal at the
- ;current cursor position.
- push es
- push di
- call hexdec
-
- push ax
- mov ax,ds
- mov es,ax
- mov di,offset hex_buff
- mov ah,20h
- mov al,bh
- and al,al
- jnz kd10
- mov al,ah
- kd10:
- stosb
- mov al,bl
- and al,al
- jnz kd1
- mov al,ah
- kd1:
- stosb
- mov al,dh
- and al,al
- jnz hundd
- mov al,ah
- hundd:
- stosb
- mov al,dl
- and al,al
- jnz tend
- mov al,ah
- tend:
- stosb
- mov al,dh
- and al,al
- jnz unitd
- mov al,ah
- unitd:
- pop ax
- stosb
- mov ax,0
- stosb
- mov di,offset hex_buff
- call print_asciiz
- pop di
- pop es
- ret
-
-
-
- DOSPRINT:
- PUSH DS
- PUSH DX
- PUSH CX
- MOV DX,OFFSET CRLF
- MOV CX,2
- push ds
- push dx ;pointer to string (ds:dx)
- push cx ;length of string cx
- push 0
- call VioWrtTTY
-
-
- POP CX
- POP DX
-
- push ds
- push dx
- push cx
- push 0
- call VioWrtTTY
-
- POP DS
- RET
-
-
- print_asciiz: ;print asciiz pointed to by di
- push dx
- push ax
- push di
- push cx
- push es
- push di
- push ds
- pop es
- call eoz
- mov cx,di
- pop di
- sub cx,di
-
- push ds
- push di
- push cx
- push 0
- call VioWrtTTY
- print_end:
-
- pop es
- pop cx
- pop di
- pop ax
- pop dx
- ret
- ;
-
-
- ;
- HEXDEC: ;THIS ROUTINE WILL TAKE A 4DIGIT HEXADECIMAL NUMBER IN AX AND
- ;RETURNS A 5 DIGIT ASCII IN BH,BL,DH,DL,AL.
- ;TIME AVERAGES ABOUT 140 CLOCKS PER DIGIT
- ;LEADING 0'S ARE SUPRESSED
- MOV BX,0
- MOV CX,0
- MOV DX,0
- A10K: CMP AX,10000
- JB A1K
- SUB AX,10000
- INC BH
- JMP A10K
- A1K: CMP AX,1000
- JB HUNDREDS
- SUB AX,1000
- INC BL
- JMP A1K
- HUNDREDS: CMP AX,100
- JB TENS
- SUB AX,100
- INC DH
- JMP HUNDREDS
- TENS: CMP AX,10
- JB UNITS
- SUB AX,10
- INC DL
- JMP TENS
- UNITS:
-
- test bh,0ffh
- jz x101
- add bh,"0"
- d1:
- add bl,"0"
- d2:
- add dh,"0"
- d3:
- add dl,"0"
- d4:
- add al,"0"
- d5:
- ret
-
- x101:
- ;l1:
- test bl,0ffh
- jz x102
- jmp short d1
- x102:
- ;l2:
- test dh,0ffh
- jz x103
- jmp short d2
- x103:
- ;l3:
- test dl,0ffh
- jz d4
- jmp short d3
-
-
-
-
-
-
- DECHEX: ;THIS ROUTINE WILL TAKE A [CL] (MAX 5) DIGIT
- ;ASCII DECIMAL NUMBER POINTED TO BY SI AND
- ;RETURN A 4 DIGIT HEX NUMBER IN AX.*
- push dx
- XOR DH,DH
- XOR AX,AX
- TRY: CMP CL,1
- JBE LAST
- MOV DL,[SI]
- SUB DL,"0"
- ADD AX,DX
- MOV BX,AX
- SHL AX,1
- SHL AX,1
- SHL AX,1
- ADD AX,BX
- ADD AX,BX
- INC SI
- LOOP TRY
- LAST: MOV DL,[SI]
- SUB DX,"0"
- ADD AX,DX
- pop dx
- RET
-
- ;prt macro
- ; mov di,offset #1
- ; call print_asciiz
- ;#em
-
- ;******************************************************************************
- ; word_to_hex -
- ;
- ;
- ; ENTRY: ax = value to convert
- ; si -> 4 character buffer to place text in
- ;
- ; EXIT:
- ;
- ; DESTROYED:
- ;
- ;------------------------------------------------------------------------------
- word_to_hex:
- push ax
-
- mov ah,al
- shr ah,1
- shr ah,1
- shr ah,1
- shr ah,1
- and ax,0f0fh
-
- add al,'0'
- add ah,'0'
- mov [si+2],ah
- mov [si+3],al
-
- pop ax
-
- mov al,ah
- shr ah,1
- shr ah,1
- shr ah,1
- shr ah,1
- and ax,0f0fh
-
- add al,'0'
- add ah,'0'
- mov [si+0],ah
- mov [si+1],al
-
- ret
-
-
-
- dx_to_ASCII: ;outputs to es:di the 4 digit hex in dx
- mov al,dh
- call al_to_ascii
- mov al,dl
-
- al_to_ascii:
- mov ah,al
- push cx
- mov cl,4
- shr al,cl
- pop cx
- call lo_nib_al_to_as
- mov al,ah
-
-
- lo_nib_al_to_as:
- and al,0Fh
- add al,90h
- daa
- adc al,40h
- daa
- stosb
- ret
-
- it_is_bad:
- mov si,offset bad_msgs
- x211:
- push ds
- pop es
-
- call move_to_scratch
-
- ret
-
- it_is_net:
- mov si,offset netmail_path
- push ds
- pop es
- call move_to_scratch
- jmp throw_this_msg
-
-
- next_z_limit: ;es:di->string. cx is the limit. rets cy if
- ;limit is reached without finding a null
- ;on exit di points to the zero
- xor al,al
- x213:
- scasb
- jz x214
- cmp di,cx
- jb x213
- stc
- ret
- x214:
- clc
- ret
-
-
-
- move_to_scratch: ;moves the path pointed to by ds:si into
- ;scratch path and cleans it up.
- ;updates current_ar_path_end
-
- mov di,offset scratch_path
- call eozs
- rep movsb
- mov al,'\'
- cmp al,[di-1]
- jz x210
- stosb
- x210:
- mov al,0
- stosb
- dec di
- mov cur_ar_path_end,di
- ret
-
-
-
- _code ends
-
-
-
-
-
-
-
-
-
-
-
- _data segment
-
-
-
-
-
-
- message_one db 512 dup (0)
- this_scan db 0
- use_no_log db 0
- max_msg_cntr dw 0
- EVEN
- scratch_nn_list db 256 dup (0)
- prepack_nn_list db 256 dup (0)
- nnlist db 100 dup (5 dup (0))
- nn_handle_list dw 100 dup (0)
- num_entries dw 0 ;num of entries in the nn list
- ;of last call to length_nn
- tot_count dw 0
- nn_cntr db 0
- temp_ptr dw 0
- msg_ascii db '.msg',0
- current_node dw 0
- wkg_path db '.\'
- db 80 dup (0)
- wpe_end label byte
- db 0
- wkg_path_end dw 0
- time_info label byte
- hour db 0
- minute db 0
- second db 0
- h_of_s db 0
- day db 0
- month db 0
- year dw 0
- t_zone dw 0
- day_o_week dw 0
- _data ends
-
- assume cs:_code
- assume ds:_data
- _code segment byte public 'code'
-
- public scan
- scan:
- mov di,offset tosslog_cmd
- mov ax,1
- call search_for
- pop ds
- mov access,read_write
- jnc scan1
- mov use_no_log,1
- scan1:
- mov this_scan,1
- call clean_pm_buf
- xor ax,ax
- mov current_path,ax
- jmp scan_areas
-
-
-
- public nn_is_here
- public nn_not_here
- public nn_seen
- public thats_all
- public try_next
- public bns1
- public build_nnn_seen
- public list_complete
- public mhl1
- public make_handle_list
- public gh1
- public get_handle_for_nn
- public adding_error
- public add_nn_to_list
- public check_for_end
- public not_in_list
- public this_is_it
- public sl1
- public search_list
- public get_time
- public end_of_file
- public find_wkg_path_end
- public nn_entry_num
- public pack_message
- public send_to_node
- public no_such_msg
- public get_msg_ax
- public lenn1
- public lenn2
- public length_nn
- public make_scratch_nn
- public lim2
- public lim1
- public limits
- public make_scratch_path
- public next_nn
- public area_done
- public next_msg_scan
- public sp1
- public sp2
- public scan_path
- public finished
- public sa1
- public scan_areas
- public cpb2
- public clean_pm_buf
-
-
-
-
- clean_pm_buf: ;0's the pmsg_buf. ds is true data
- mov ax,sel_pmsg_buf
- and ax,ax
- jnz cpb2
- mov ax,0ffffh
- mdosallocSeg sel_pmsg_buf,no_share
- mov ax,sel_pmsg_buf
- mov es,ax
- cpb2:
- mov di,0
- ; mov cx,upmsg_length
- mov cx,100
- call clean_wbuffer
- ret
-
- scan_areas:
- mov ax,sel_areas
- mov es,ax
- call find_wkg_path_end
- mov di,0
- test use_no_log,0ffh
- jz use_log
- ;if no_tosslog
- sal1:
- push di
- call scan_path
- pop di
- add di,type line_infos
- mov current_path,di
- mov ax,sel_areas
- mov es,ax
- nop
- cmp byte ptr es:[di],0
- jnz sal1
- jmp finished
-
- use_log:
- call get_tosslog
- and ax,ax ;this tests tosslog for 0 length
- jnz sal1a
- jmp terminate
- sal1a:
- call convert_crs
- sa1:
- call get_nxt_toss_area
- test toss_flag,end_log
- jnz finished
- test toss_flag,no_area
- jnz sa1
- mov di,si
- mov current_path,di
- call scan_path
- mov ax,sel_areas
- mov es,ax
- jmp short sa1
- ;endif
-
- finished:
- ; call spawn_pack
- edata
- mov di,offset vmsg_scanned
- call print_asciiz
-
-
-
-
- call get_time
- mov di,offset scratch_ascii
- mov si,offset logmsg_end
- call write_asciiz
- call write_time
-
- mov al,0dh
- stosb
- mov al,0ah
- stosb
- xor al,al
- stosb
- logaz scratch_ascii
-
- mov al,minute
- xor ah,ah
- mov bx,60
- mul bx
- add al,second
- adc ah,0
- mov end_in_secs,ax
- sub ax,start_in_secs
- mov bx,60
- div bx
- push dx
- push ax
- mov di,offset scratch_ascii
- mov al,0dh
- stosb
- mov al,0ah
- stosb
- mov si,offset logmsg_sscan
- call write_asciiz
- mov ax,tot_count
- call write_h_ascii
- mov si,offset logmsg_smsg
- call write_asciiz
- pop ax
- call write_h_ascii
- mov si,offset logmsg_smins
- call write_asciiz
- pop ax
- call write_h_ascii
- mov si,offset logmsg_ssecs
- call write_asciiz
- mov al,0
- stosb
- logaz scratch_ascii
- mov di,offset scratch_ascii
- call print_asciiz
-
-
-
-
-
- mov ax,0
- term_scan:
- push 1
- push ax
- call dosexit
-
-
- scan_path: ;di->an area_line. This area is scanned and the
- ;messages put in working files for each node
- call get_scan_area
- call make_scratch_path
- push di
- pcrlf
- prt vmsg_scan
- mov di,offset scratch_path
- call print_asciiz
- pcrlf
- pop di
- call limits
- jc next_msg_scan
- call make_scratch_nn
- mov ax,lowest_msg
- sp2:
- mov bx,offset scratch_nn_list
- call get_msg_ax
- jc next_msg_scan
- call pack_message
- jc next_msg_scan
- mov si,offset prepack_nn_list
- sp1:
- call send_to_node
- call next_nn
- jz next_msg_scan
- jmp short sp1
- next_msg_scan:
- mov ax,lowest_msg
- inc ax
- mov lowest_msg,ax
- mov hw_reply,ax
- cmp ax,highest_msg
- ja area_done
- jmp short sp2
- area_done:
- mov area_changed,1
- call log_area_toss
- mov ax,scan_count
- add tot_count,ax
- mov scan_count,0
- mov di,cur_ar_path_end
- mov al,'1'
- stosb
- mov al,'.'
- stosb
- mov al,'m'
- stosb
- mov al,'s'
- stosb
- mov al,'g'
- stosb
- mov al,0
- stosb
- mov access,read_write
- mdosopen scratch_path,open,create
- jc ad1
- mov ax,handle
- mov cx,msg1_end-offset msg1
- ; mov cx,offset mtext
- dec hw_reply
- mov si,offset msg1
- mov doscall_inseg,ds
- mdoswrite doscall_inseg,results
- mov ax,handle
- mdosclose
- ad1:
- ret
-
-
-
-
-
- next_nn:
- add si,5
- mov di,si
- nodediz
- ret
-
-
-
- make_scratch_path:
- call mov_cur_path_to_data
- ; push ds
- ; pop es
- ; mov si,current_path
- ; mov ax,sel_areas
- ; mov ds,ax
- ; call eozs
- ; mov di,offset scratch_path
- ; rep movsb
- ; ddata
- ret
-
-
-
- limits: ;scratch_path is valid, rets w/ lowest_msg
- ;and highest_msg valid. ax has lowest_msg
- call get_msg_high
- ; mov highest_msg,ax
- mov ax,1
- call get_msg_ax
- jnc lim1
- mov lowest_msg,2
- jmp short lim2
- lim1:
- mov ax,handle
- mdosclose
- mov ax,sel_msg_buf
- mov es,ax
- mov si,offset mreply_to
- mov ax,es:[si]
-
- cmp ax,2
- jae lim3
-
- mov ax,2
- lim3:
- cmp ax,highest_msg
- jb lim5
- mov ax,highest_msg
- lim5:
- mov lowest_msg,ax
- cmp ax,highest_msg
- jae lim4
- lim2:
- clc
- ret
- lim4:
- stc
- ret
-
-
-
-
- make_scratch_nn:
- edata
- mov di,offset scratch_nn_list
- mov cx,512 ;this also cleans prepack buf
- call clean_wbuffer
- mov es,sel_areas
- ; mov current_path,di
- mov si,current_path ;pointer to current line in areas
- add si,offset li_nodes
- mov di,offset scratch_nn_list
- xdses
- call length_nn
- rep movsb
- ddata
- ret
-
- length_nn:
- push si
- xor cx,cx
- lenn2:
- nodesiz
- jz lenn1
- add si,5
- add cx,5
- jmp short lenn2
- lenn1:
- pop si
- ret
-
-
- get_msg_ax: ;rec the HEX VALUE of a file in ax
- ;rets w/nc and the file in the umsg_buf if
- ;successful, otherwise carry is set.
- ;upmsg_length is updated
- push ax
- ; pcrlf
- prt vmsg_dot
- pop ax
- push ax
- ; call print_h_ascii
- ; prt space3
- mov ax,sel_msg_buf
- mov es,ax
- mov di,0
- mov cx,upmsg_length
- call clean_wbuffer
- ; push ds
- ; pop es
- ;; mov di,offset scratch_ascii
- ;; mov dx,lowest_msg
- ;
- ;
- ;
- ;
- ; call dx_to_ascii
- ; mov si,offset scratch_ascii
- ; mov cx,4
- ; mov di,cur_ar_path_end
- ;gma1:
- ; cmp byte ptr [si],30h
- ; jbe gma2
- ; rep movsb
- ; jmp short gma4
- ;gma2:
- ; inc si
- ;gma3:
- ; loop gma1
- ;gma4:
-
- edata
- mov di,cur_ar_path_end
- pop ax
- call write_h_ascii
-
-
-
- mov si,offset msg_ascii
- call eozs
- inc cx
- rep movsb
- mdosopen scratch_path,open,fail
- jc no_such_msg
- mov ax,sel_msg_buf
- mov doscall_inseg,ax
- mov cx,0ffffh
- xor si,si
- mdosread
- mov ax,result
- mov upmsg_length,ax
- clc
- ret
- no_such_msg:
- stc
- ret
-
-
- send_to_node: ;si ->to net/node in prepack_nn_list.
- ;creates or appends msg to time.pkt
- mov di,offset prepack_nn_list
- mov ax,[si+1]
- mov es,sel_pmsg_buf
- mov di,offset spmdest_net
- stosw
- mov ax,[si+3]
- mov di,offset spmdest_node
- stosw
- call get_handle_for_nn
- mov cx,msg_length
- push si
- mov si,0
- mdoswrite sel_pmsg_buf,results
- f3:
- inc word ptr max_msg_cntr
- inc scan_count
- mov ax,max_msgs
- cmp max_msg_cntr,ax
- jb stn1
- push word ptr sharing
- push word ptr access
- call close_handles
- call clean_nn_list
- call spawn_pack
- mov ax,1 ;****
- ; jmp term_scan ;****
- pop word ptr access
- pop word ptr sharing
- xor ax,ax
- mov max_msg_cntr,ax
- stn1:
- pop si
- ret
-
-
- pack_message: ;receives a message in upmsg_buf
- ;ds is true data. Rets with the msg
- ;packed in the pm buffer,msg_length
- ;valid for pmsg
- push ds
- pop es
- call strip_path
- call strip_seen_bys
- ; mov si,current_path
- ; add si,offset li_nodes
- ; mov di,offset scratch_nn_list
- ; mov ax,sel_areas
- ; mov ds,ax
- ; edata
- ; call length_nn
- ; rep movsb
-
- ; ddata ;both point at true data now
- mov si,offset scratch_nn_list
- mov di,offset seen_by_list
- call build_nnn_seen
- jnz pm1
- stc
- jmp pm2
- pm1:
- call add_net_nodes
- mov ax,sel_msg_buf
- mov es,ax
- mov di,upmsg_length
- call write_seen_bys
- call write_path_line
-
-
-
- xor bx,bx
- mov dx,bx
- mov ax,handle
- mdoschgfileptr rel_beg
- mov ax,handle
- mov cx,upmsg_length
- mov si,0
- mdoswrite sel_msg_buf,results
- mov ax,handle
- public test2
- test2:
- mdosclose
-
-
-
- mov es,sel_pmsg_buf
- call clean_pm_buf
- push ds
- mov ax,sel_msg_buf
- mov ds,ax
- mov di,0
- mov ax,2
- stosw ;this is the packed msg code
- mov si,offset morigin_node
- lodsw
- stosw
- mov si,offset mdest_node
- lodsw
- stosw
- mov si,offset morigin_net
- lodsw
- stosw
- mov si,offset mdest_net
- lodsw
- stosw
- mov si,offset mattribute
- lodsw
- stosw
- mov si,offset mcost
- lodsw
- stosw
- mov si,offset mdatetime
- call write_asciiz
- mov al,0
- stosb
- mov si,offset mtouser
- call write_asciiz
- mov al,0
- stosb
- mov si,offset mfromuser
- call write_asciiz
- mov al,0
- stosb
- mov si,offset msubject
- call write_asciiz
- mov al,0
- stosb
- push ds
-
- ddata
- mov si,offset area_line
- call write_asciiz
- mov si,offset current_area
- call write_asciiz
- mov si,offset crlf
- call write_asciiz
-
-
- pop ds
- mov si,offset mtext
- mov dx,ds
- pop ds
- push ds
- mov cx,upmsg_length
- sub cx,si
- mov ds,dx
- rep movsb
- ; mov al,0
- ; stosb
- ;message is now packed
- pop ds
- mov msg_length,di
- clc
- ret
- pm2:
- mov ax,handle
- mdosclose
- stc
- ret
-
-
-
-
-
-
-
-
- nn_entry_num: ;ds:si -> at entry in prepack_nn_list
- ;rets with bx containing the entry number (0 based)
- ;all regs preserved
- mov bx,si
- sub bx,offset prepack_nn_list
- shr bx,2
- ret
-
- find_wkg_path_end: ;ds true data. rets w/ the end of the working path
- ;in di, length in cx, and wkg_path_end valid
- mov ax,ds
- mov es,ax
- mov di,offset wkg_path
- call eoz
- cmp byte ptr es:[di-1],'\'
- jz l6
- mov al,'\'
- stosb
- l6:
- mov wkg_path_end,di
- ret
-
-
-
-
- ;public dx_to_ASCII
- ;dx_to_ASCII: ;outputs to es:di the 4 digit hex in dx
- ; mov al,dh
- ; call al_to_ascii
- ; mov al,dl
- ;
- ;al_to_ascii:
- ; mov ah,al
- ; push cx
- ; mov cl,4
- ; shr al,cl
- ; pop cx
- ; call lo_nib_al_to_as
- ; mov al,ah
- ;
- ;
- ;lo_nib_al_to_as:
- ; and al,0Fh
- ; add al,90h
- ; daa
- ; adc al,40h
- ; daa
- ; stosb
-
- end_of_file: ;rec handle in ax
- push bx
- push cx
- push dx
- xor bx,bx
- mov dx,bx
- mov cx,2
- mdoschgfileptr rel_end
- pop dx
- pop cx
- pop bx
- ret
-
-
-
- get_time:
- mov ax,offset time_info
- push ds
- push ax
- call dosgetdatetime
- ret
-
- search_list: ;ds:si -> at target nc=found with the
- ;entry number in cx
- ;if not found, first blank is pointed to
- ;by di, with its number incx
-
- xor cx,cx
- mov ah,ch
- edata
- mov di,offset nnlist
- sl1:
- call check_for_end
- jz not_in_list
- call triple_comp
- jz this_is_it
- inc cx
- add di,5
- jmp sl1
- this_is_it:
- clc
- ret
- not_in_list:
- stc
- ret
-
- check_for_end:
- mov ax,[di+1]
- or al,[di]
- or ax,[di+3]
- ret
-
-
- ;nn_comp: ;ds:si -> target si -> into list to search
- ; push si
- ; push di
- ; cmpsb
- ; jnz not_this
- ; cmpsw
- ; jnz not_this
- ; cmpsw
- ;not_this:
- ; pop di
- ; pop si
- ; ret
-
- add_nn_to_list: ;di -> to first blank entry, si carries a
- ;pointer into the prepack_nn_list
- ;cx the number of the entry
- push si
- push di
- edata
- ; call get_time
- ; mov di,wkg_path_end
- ; mov dx,word ptr hour
- ; call dx_to_ascii
- ; mov dx,word ptr second
- ; call dx_to_ascii
-
- mov di,wkg_path_end
- mov dx,word ptr[si+1]
- call dx_to_ascii
- mov dx,word ptr[si+3]
- call dx_to_ascii
-
- mov al,'.'
- stosb
- mov al,'o'
- stosb
- mov al,'u'
- stosb
- mov al,'t'
- stosb
- xor al,al
- stosb
- mdosopen wkg_path,open,create
- jc adding_error
- call append
- mov ax,handle
- xor bx,bx
- mov dx,bx
- mdoschgfileptr rel_end
- mov ax,handle
- mov bx,cx
- shl bx,1
- mov si,offset nn_handle_list
- mov [si+bx],ax
- mov bp,sp
- mov si,[bp+2]
- mov di,[bp]
- mov cx,5
- rep movsb
- mov si,[bp+2]
- call build_header
- mov cx,offset packet_hdr_end-offset packet_hdr
- mov si,offset packet_hdr
- mov ax,handle
- mdoswrite this_seg,results
- jc adding_error
- mov ax,handle
- clc
- pop di
- pop si
- ret
-
- adding_error:
-
- jmp file_error
-
-
- get_handle_for_nn: ;ds:si -> at entry in scratch nn list
- ;rets with handle in ax
- push si
- push di
- call print_node
- mov di,offset nnlist
- call search_list
- jc gh1
- mov bx,cx
- shl bx,1
- mov si,offset nn_handle_list
- mov ax,[si+bx]
- clc
- pop di
- pop si
- ret
- gh1:
- call add_nn_to_list
- jc gh2
- gh3:
- pop di
- pop si
- ret
- gh2:
- push ax
- mov di,offset vmsg_error
- call print_asciiz
- pop ax
- call print_h_ascii
- jmp short gh3
-
-
-
- make_handle_list:
- xor ax,ax
- mov cx,30
- mov di,offset nn_handle_list
- rep stosw
- mov si,offset scratch_nn_list
- mov di,offset nn_handle_list
- mhl1:
- call check_for_end
- jz list_complete
- call get_handle_for_nn
- stosw
- jmp short mhl1
- list_complete:
- ret
-
- build_nnn_seen:
- push si
- push di
- edata
- mov nn_cntr,0
- mov ax,offset prepack_nn_list
- mov temp_ptr,ax
- mov si,offset scratch_nn_list
- bns1:
- mov di,offset seen_by_list
- call nn_seen
- jc try_next
- inc byte ptr nn_cntr
- push di
- mov di,temp_ptr
- mov cx,5
- mov byte ptr[si],0 ;* no zone stuff
- rep movsb
- mov temp_ptr,di
- pop di
- xchg di,si
- nodediz
- xchg di,si
- jz thats_all
- jmp bns1
- try_next:
- add si,5
- nodesiz
- jnz bns1
- thats_all:
- test byte ptr nn_cntr,0ffh
- pop di
- pop si
- ret
-
- nn_seen: ;si->at source node di-> at target list
- mov ax,[di+1]
- ;no zone or al,[di]
- or ax,[di+3]
- jz nn_not_here
- call triple_comp
- jz nn_is_here
- add di,5
- jmp short nn_seen
-
- nn_not_here:
- clc
- ret
- nn_is_here:
- stc
- ret
-
-
- build_header:
- ;si points at hex z/n/n to build the header
- ;for. Header is built into packet_hdr
- push si
- mov ax,[si+1]
- mov phdest_net,ax
- mov ax,[si+3]
- mov phdest_node,ax
- mov al,[si]
- mov phdest_zone,al
- mov si,offset this_add
- mov ax,[si+1]
- mov phorigin_net,ax
- mov ax,[si+3]
- mov phorigin_node,ax
- mov al,[si]
- mov phorigin_zone,al
- mov ax,year
- mov phyear,ax
- xor ah,ah
- mov al,month
- dec al
- mov phmonth,ax
- mov al,day
- mov phday,ax
- mov al,hour
- mov phhour,ax
- mov al,minute
- mov phminute,ax
- mov al,second
- mov phsecond,ax
- mov ax,2
- mov phcode,ax
- pop si
- ret
-
-
- print_node:
- ;ds:si points at a z:n/n
- push di
- push si
- push es
- push ds
- edata
- mov byte ptr es:temp_def_zone,0ffh
- mov word ptr es:temp_def_net,0ffffh
- mov di,offset scratch_ascii
- push di
- call write_node
- mov al,0
- stosw
- ddata
- pop di
- call print_asciiz
- pop ds
- pop es
- pop si
- pop di
- ret
-
-
- print_h_ascii:
- ;prints the hex in ax as ascii to the screen
-
- push bx
- push cx
- push dx
- push si
- push di
- push ds
- push es
- ddata
- edata
- mov di,offset scratch_ascii
- push di
- call write_h_ascii
- mov al,0
- stosb
- pop di
- call print_asciiz
- pop es
- pop ds
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- ret
-
- find_limit_2null: ;finds double null terminator. entry ds:si ->
- ;at start of string. rets limit (first null)
- ;in cx
- push ax
- push si
- xor ax,ax
- fle1:
- cmp al,[si]
- jne fle2
- cmp al,[si+1]
- jne fle2
- mov cx,si
- pop si
- pop ax
- ret
- fle2:
- inc si
- jmp short fle1
-
-
- get_bundle:
- mov ax,sel_names
- and ax,ax
- jnz getbund_noalloc
- mov ax,0a000h
- push ax
- mov ax,offset sel_names
- push ds
- push ax
- mov ax,0
- ;this shuld be implemented as a discardable segment (ax=2)
- push ax
- call DosAllocSeg
- getbund_noalloc:
-
- cmp path_end,0
- jnz gbun1
-
- mov si,offset netfile_path
- mov di,si
- mov ax,ds
- mov es,ax
- call eoz
- mov al,'\'
- cmp al,[di-1]
- jz gb1
- stosb
- gb1:
- mov path_end,di
- mov pkt_path_end,di
- gbun1:
- mov si,offset bundmo
- gbun4:
- mov bp,si
- mov cx,0
- mov bx,0
- mov dx,bx
- mov di,8000h
- mov ax,sel_names
- mov doscall_inseg,ax
- mov find_ptr,si
-
- gbun2:
- mov cx,6
- mov di,path_end
- rep movsb
- mov max_find,300
- mov si,0
- mov di,8000h
- mov cx,ds
- mov ax,1
- mov search_handle,ax
- mov ax,offset netfile_path
- mdosfindfirst
- cmp ax,12h
- je gbun5
- cmp ax,0
- jne gbun_error
- gbun5:
- mov cx,max_find
- and cx,cx
- clc
- jnz nd1
- add total_finds,cx
- and cx,cx
- jz next_day
- mov bx,offset flen_filename
- gbun3:
- add si,bx
- xor ax,ax
- mov al,[si]
- add si,ax
- loop gbun3
-
-
- next_day:
- cmp bp,offset bundsu
- jae nd2
- mov si,bp
- add si,6
- jmp gbun4
- nd2:
- stc
- nd1:
- ret
-
- gbun_error:
- jmp file_error
-
-
- up_bundle:
- call get_bundle
- jnc ub5
- jmp bundle_up
- ub5:
- mov si,offset flen_filename
- mov ax,sel_names
- edata
- mov ds,ax
- xor cx,cx
- mov cl,[si]
- inc si
- mov di,es:path_end
- rep movsb
- ddata
- mov byte ptr[di],cl
-
- push word ptr access
-
- mov sharing,deny_none
- mov access,read_only_access
- mdosopen netfile_path,open,fail
-
- pop word ptr access
-
- jnc ub1
- mov si,offset netfile_path
- jmp file_error
- ub1:
- pusha
- mov di,offset scratch_ascii
- mov si,offset logmsg_bndl
- call write_asciiz
- mov si, offset netfile_path
- call write_asciiz
- mov si,offset crlf
- call write_asciiz
- mov si,pkt_path_end
- call bndl_to_node
- mov al,0
- stosb
- pusha
- prt scratch_ascii
- popa
- logaz scratch_ascii
- popa
-
-
- mov ax,ds
- mov doscall_inseg,ax
- mov si,offset scratch_ascii
- mov cx,10
- mdosread
- jnc ub2
- jmp file_error
- ub2:
- mov ax,handle
- mdosclose
- call check_arc
- jc ub3
- call unarc_bundle
- jmp bundle_up
- ub3:
- call check_zip
- jc ub4
- call unzip_bundle
- jmp bundle_up
- ub4:
- call unarc_bundle
- bundle_up:
- ret
-
-
-
-
-
- unlh_bundle:
- call unpack_sr1
- mov si,path_end
- mov di,offset lh_file
- call eozs
- rep movsb
- mov bx,offset lh_args
- mov cx,offset null_target
- mov si,offset lh_pathname
- jmp unpack_sr2
-
-
- unzip_bundle:
- call unpack_sr1
- mov si,path_end
- mov di,offset zip_file
- call eozs
- rep movsb
- mov bx,offset zip_args
- mov cx,offset null_target
- mov si,offset zip_pathname
- jmp unpack_sr2
-
-
-
- public unarc_bundle
- unarc_bundle:
- call unpack_sr1
- mov si,path_end
- mov di,offset arc_file
- call eozs
- rep movsb
- mov bx,offset arc_args
- mov cx,offset null_target
- mov si,offset arc_pathname
- jmp unpack_sr2
-
- public unpack_sr2
- unpack_sr2:
- xor ax,ax
- stosb
- mdosexecpgm
- jnc unpack_sr2b
-
- unpack_sr2b:
- cmp result2,0
- jz unpack_sr2a
- call rename_bad_arc
- unpack_sr2a:
- mov si,offset netfile_path
- mdosdelete
- call retr_cur_ddir
- ret
-
-
- unpack_sr1:
- call save_cur_ddir
- mov si,offset netfile_path
- mov cx,path_end
- unb2:
- sub cx,si
- dec cx
- mov di,offset scratch_path
- rep movsb
- mov byte ptr[di],0
- mov si,offset scratch_path
- mov ax,[si]
- xor ah,ah
- cmp al,'Z'
- jb unb1
- sub al,20h
- unb1:
- sub al,'@'
- mdosselectdisk
- mdoschdir
- ret
-
- rename_bad_arc:
- mov si,offset netfile_path
- mov cx,path_end
- sub cx,si
- mov di,offset scratch_path
- rep movsb
- mov si,offset bad_arc_string
- mov cx,10
- push si
- rep movsb
- call get_bad_high
- pop si
- push ax
- edata
- mov cx,63
- mov di,offset scratch_path
- call clean_buffer
- mov si,offset netfile_path
- mov cx,path_end
- sub cx,si
- mov di,offset scratch_path
- rep movsb
- mov si,offset bad_arc_string
- mov cx,8
- rep movsb
- pop ax
- xor ah,ah
- call hexdec
- and dh,dh
- jnz renb2
- add dh,30h
- renb2:
- mov [di],dh
- inc di
- and dl,dl
- jnz renb3
- add dl,30h
- renb3:
- mov [di],dl
- inc di
- and al,al
- jnz renb4
- add bl,30h
- renb4:
- mov [di],al
- inc di
- xor ax,ax
- mov [di],al
-
- mov si,offset netfile_path
- mov di,offset scratch_path
- mdosmove
- ret
-
-
-
-
-
-
-
-
- get_bad_high: ;rets w/next number of bad_arc in al
- mov ax,sel_names
- and ax,ax
- jnz getbad_noalloc
- mov ax,0a000h
- push ax
- mov ax,offset sel_names
- push ds
- push ax
- mov ax,0
- ;this shuld be implemented as a discardable segment (ax=2)
- push ax
- call DosAllocSeg
- getbad_noalloc:
- push ds
- pop es
- mov di,offset scratch_path
- mov si,offset bad_arc_string
- mov cx,10
- rep movsb
- mov di,path_end
- mov ax,sel_names
- mov doscall_inseg,ax
- mov search_handle,1
- mov dx,0
- mov si,dx
- mov di,08000h
- mov cx,900 ;the size of the buffer and this value
- ;limit the number of messages that can
- ;be handled
- mov max_find,cx
- mov cx,ds
- mov ax,offset scratch_path
- mdosfindfirst
- jnc gbh1
- gbh1:
- mov si,0
- add si,offset ffilename
- add si,8
- mov di,8000h
- mov cx,max_find
- and cx,cx
- jz gbh_end
- gbh2:
- mov ax,sel_names
- mov ds,ax
- mov es,ax
- public gbh2a
- gbh2a:
- push cx
- push si ;si is offset of filename extension
- mov cx,3
- call dechex
- pop si
- stosb
- add si,4
- add si,offset ffilename
- add si,8
- pop cx
- loop gbh2a
-
- gbh3:
- ddata
- mov di,8000h
- mov cx,max_find
- xor ax,ax
- gbh5:
- cmp al,es:[di]
- jae gbh4
- mov al,es:[di]
- gbh4:
- inc di
- loop gbh5
- inc al
- gbh_end:
- ret
-
-
-
- cmp_rm_double:
- ;ds:si points to a dword, dx:ax has comp value
- ;rets carry if mem higher than dx:ax z flag valid
-
- push bx
- push cx
- mov cx,dx
- mov bx,ax
- sub bx,[si]
- sbb cx,[si+2]
- pop cx
- pop bx
- ret
-
- get_lengths:
- ;updates 2 variables si_length and di_length
- ;with the lengths of the strings pointed
- ;to by ds:si and es:di
- ;also updates shortest and longest
- ;cx has value of shortest,ax value of longest
-
- push di
- call eoz
- mov di_length,cx
- call eozs
- mov si_length,cx
- pop di
- mov cx,di_length
- sub cx,si_length
- jc di_low
- mov cx,si_length
- mov ax,di_length
- glen1:
- mov shortest,cx
- mov longest,ax
- ret
- di_low:
- mov ax,si_length
- mov cx,di_length
- jmp short glen1
- ret
-
-
- string_compare:
- call get_lengths
- repz cmpsb
- and cx,cx
- jz same_so_far
- dec di
- dec si
- mov al,[di]
- cmp al,[si]
- ret ;carry says si is larger
- same_so_far:
- mov ax,di_length
- cmp ax,si_length
- ret
-
-
- unpack_bdls:
-
-
- save_cur_ddir:
- push es
- push di
- edata
- mdosqcurdisk home_drive,results
- mov cx,64
- mov ax,home_drive
- add ax,40h
- mov di,offset home_dr_ascii
- stosb
- mov al,':'
- stosb
- mov al,'\'
- stosb
- mdosqcurdir home_directory
- pop di
- pop es
- ret
-
- retr_cur_ddir:
- mov ax,home_drive
- mdosselectdisk
- mov si,offset home_dr_ascii
- mdoschdir
- ret
-
- check_arc:
- mov al,9
- cmp al,[si+1]
- ret
-
-
- check_lh:
- push si
- mov cx,10h
- mov si,offset scratch_ascii
- mov di,offset lzh_string
- call search_for
- pop si
- ret
-
- check_zip:
- push si
- mov cx,10h
- mov si,offset scratch_ascii
- mov di,offset zip_string
- call search_for
- pop si
- ret
-
-
- public spawn_pack
- spawn_pack:
- call save_cur_ddir
- mov si,offset comspec_srch
- mdosscanenv
- jnc spp1
- jmp file_error
- spp1:
- edata
- mov si,result
- mov ax,sel_environ
- push ds
- mov ds,ax
- call eozs
- mov di,offset cmd_path
- rep movsb
- pop ds
- mov si,offset cmd_path
- mov di,offset cmd_simple
- call get_simple
- mov al,0
- stosb
- mov al,'/'
- stosb
- mov al,'c'
- stosb
- mov si,offset pack_path
- call eozs
- rep movsb
- prt vmsg_pspawn
- prt space3
- prt cmd_simple
- mov cx,offset null_target
- mov bx,offset cmd_simple
- mov si,offset cmd_path
- xor ax,ax
- mdosexecpgm
- ret
-
-
- get_simple: ;must only be called with si -> at fully
- ;qualified pathname. di -> to location
- ;for the simple name. The simple name is
- ;considered to be the string between the
- ;last \ and the first period (less than 20
- ;chars.
- push di
- call eozs
- mov di,si
- add di,cx
- mov bx,cx
- call back_to_back
- xchg bx,cx
- sub cx,bx
- inc di
- mov si,di
- pop di
- gs1:
- lodsb
- cmp al,'.'
- jz got_simple
- stosb
- loop gs1
- got_simple:
- ret
-
- back_to_back: ;enter with di-> at end of string, cx length of string
- ;rets with di-> to last \ in string
- mov al,'\'
- std
- repnz scasb
- cld
- inc di
- ret
- clean_nn_list:
- mov di,offset nnlist
- mov cx,600
- call clean_wbuffer
- ret
-
- close_handles:
- mov si,offset nn_handle_list
- chan1:
- lodsw
- and ax,ax
- jz chan2
- push ax
- push si
- mov si,offset scratch_ascii
- mov word ptr [si],0
- mov cx,ds
- mov doscall_inseg,cx
- mov cx,2
- mdoswrite doscall_inseg,results
- pop si
- pop ax
- mdosclose
- jmp short chan1
- chan2:
- ret
-
-
- append:
- ;moves the file pointer of <handle> to eof
- ;handle must be valid
- push ax
- push bx
- push cx
- push dx
- xor bx,bx
- mov dx,bx
- mov ax,handle
- mdoschgfileptr rel_end
- pop dx
- pop cx
- pop bx
- pop ax
- ret
-
- fptr_begin:
- ;moves the file pointer to beginning of file
- push ax
- push bx
- push dx
- xor bx,bx
- mov dx,bx
- mov ax,handle
- mdoschgfileptr rel_beg
- pop dx
- pop bx
- pop ax
- ret
-
-
-
- public delete_rtn
- delete_rtn:
- ddata
- ; mov ds,ax
- mov di,0
- delr1:
- mov ax,sel_areas
- mov es,ax
- push di
- cmp byte ptr es:[di],0
- jz del_end
- call try_delete
- pop di
- add di,type line_infos
- mov current_path,di
- jmp short delr1
- del_end:
- pop di
- xor ax,ax
- jmp term_scan
-
- public try_delete
- try_delete:
- mov ax,sel_areas
- mov es,ax
- mov di,current_path
- cmp byte ptr es:[di+offset li_flag],'#'
- ; add di,offset li_flag
- ; mov al,byte ptr es:[di]
- ; cmp al,'#'
- jnz td1
- call mov_cur_path_to_data
- call names
- call delete_msgs
- td1:
- ret
-
- public delete_msgs
- delete_msgs:
- push ds
- pop es
- ; mov cx,offset wpe_end
- ; mov di,wkg_path_end
- ; sub cx,di
- ; call clean_buffer
- mov di,cur_ar_path_end
- mov si,0
- cmp max_find,0
- jz dmsg2
- mov ax,sel_names
- mov ds,ax
-
- push di
- push ds
- ddata
- prt vmsg_delete
- mov di,es:current_path
- mov ax,es:sel_areas
- mov ds,ax
- add di,offset li_area
- call print_asciiz
- pop ds
- pop di
-
- dmsg3:
-
- mov di,es:cur_ar_path_end
- xor cx,cx
- add si,offset flen_filename
- mov cl,[si]
- and cl,cl
- jz dmsg2
- inc cl
- inc si
- rep movsb
- push ds
- push si
- ddata
- mov si,offset scratch_path
- mdosdelete
- jnc dmsg1
- jmp file_error
- dmsg1:
- prt vmsg_dot
- pop di
- pop es
-
- dec max_find
- cmp max_find,0
- jz dmsg2
-
- push es
- pop ds
- edata
- mov si,di
- jmp short dmsg3
- dmsg2:
- ddata
- ret
-
-
- write_time: ;writes the current date time to es:di
- xor ax,ax
- mov al,month
- call write_h_ascii
- mov al,'-'
- stosb
- mov al,day
- call write_h_ascii
- mov al,'-'
- stosb
- mov ax,year
- ; add ax,1980
- call write_h_ascii
- mov al,' '
- stosb
- xor ax,ax
- mov al,hour
- call write_h_ascii2d
- mov al,':'
- stosb
- mov al,minute
- call write_h_ascii2d
- mov al,':'
- stosb
- mov al,second
- call write_h_ascii2d
- ret
-
-
-
- public log_pkt_info
- log_pkt_info:
- mov di,offset scratch_ascii
- wstring logmsg_pkt1
- mov si,path_end
- call write_asciiz
- mov al,' '
- stosb
- stosb
- xor ax,ax
- mov ax,phmonth
- call write_h_ascii2d
- mov al,'-'
- stosb
- mov ax,phday
- call write_h_ascii2d
- mov al,'-'
- stosb
- mov ax,phyear
- add ax,1900
- call write_h_ascii2d
- mov al,' '
- stosb
- mov ax,phhour
- call write_h_ascii2d
- mov al,':'
- stosb
- mov ax,phminute
- call write_h_ascii2d
- mov al,':'
- stosb
- mov ax,phsecond
- call write_h_ascii2d
- wstring logmsg_pkt2
- mov ax,phorigin_net
- call write_h_ascii
- mov al,'/'
- stosb
- mov ax,phorigin_node
- call write_h_ascii
- mov al,' '
- stosb
- stosb
- wstring logmsg_pkt3
- mov ax,phdest_net
- call write_h_ascii
- mov al,'/'
- stosb
- mov ax,phdest_node
- call write_h_ascii
- wstring logmsg_pkt4
- xor ah,ah
- mov al,phproduct
- call write_h_ascii
- wstring logmsg_pkt5
- mov si,offset pkt_size
- lodsw
- mov dx,[si]
- call dw_to_ascii
- mov al,0dh
- stosb
- mov al,0ah
- stosb
- xor al,al
- stosb
-
-
- logaz scratch_ascii
-
- ret
-
- public dw_to_ascii
- dw_to_ascii:
- mov first_digit,0
- push ax
- push dx
- mov bx,1000
- div bx
- xor dx,dx
- div bx
- xor dx,dx
- and ax,ax
- jz dww1
- push ax
- add al,30h
- stosb
- mov first_digit,1
- pop ax
- mul bx
- mul bx
- mov cx,dx
- mov bx,ax
- pop dx
- pop ax
- sub ax,bx
- sbb dx,cx
- push ax
- push dx
-
- dww1:
- pop dx
- pop ax
- push ax
- push dx
- mov bx,1000
- div bx
- xor dx,dx
- mov bx,100
- div bx
- xor dx,dx
- and ax,ax
- jnz dww1a
- and first_digit,0ffh
- jz dww2
- dww1a:
- push ax
- add al,30h
- stosb
- mov first_digit,1
- pop ax
- mul bx
- mov bx,1000
- mul bx
- mov cx,dx
- mov bx,ax
- pop dx
- pop ax
- sub ax,bx
- sbb dx,cx
- push ax
- push dx
-
- dww2:
- pop dx
- pop ax
- push ax
- push dx
- mov bx,10000
- div bx
- xor dx,dx
- and ax,ax
- jnz dww2a
- test first_digit,0ffh
- jz dww3
- dww2a:
- push ax
- add al,30h
- stosb
- mov first_digit,1
- pop ax
- mov bx,10000
- mul bx
- mov cx,dx
- mov bx,ax
- pop dx
- pop ax
- sub ax,bx
- sbb dx,cx
- push ax
- push dx
- dww3:
- pop dx
- pop ax
- push ax
- xor dx,dx
- mov bx,1000
- div bx
- and ax,ax
- jnz dww3a
- test first_digit,0ffh
- jz dww4
- dww3a:
- push ax
- add al,30h
- stosb
- pop ax
- mul bx
- mov bx,ax
- pop ax
- sub ax,bx
- push ax
- dww4:
- pop ax
- mov bp,ax
- mov bx,100
- xor dx,dx
- div bx
- mov cx,ax
- add al,30h
- stosb
- mov ax,cx
- mul bx
- sub bp,ax
- mov ax,bp
- mov bx,10
- div bx
- mov cx,ax
- add al,30h
- stosb
- mov ax,cx
- mul bx
- sub bp,ax
- mov ax,bp
- add al,30h
- stosb
- ret
-
- log_area_toss:
- push ax
- push bx
- push cx
- push dx
- push di
- push si
- push es
- and area_changed,0ffh
- jz lat1
- edata
- mov di,offset scratch_ascii
- wstring logmsg_echo1
- wstring current_area
- mov al,20h
- stosb
- mov al,'.'
- lat2:
- stosb
- cmp di,offset scratch_ascii+43
- jbe lat2
- mov al,20h
- stosb
- mov ax,msg_cntr
- add tot_count,ax
- call write_h_ascii4d
- wstring logmsg_echo2
- mov ax,scan_count
- call write_h_ascii4d
- mov al,')'
- stosb
-
- wstring crlf
- mov al,0
- stosb
- logaz scratch_ascii
- mov msg_cntr,0
-
- lat1:
- pop es
- pop si
- pop di
- pop dx
- pop cx
- pop bx
- pop ax
- ret
-
- get_scan_area:
- ;di -> at area entry in sel areas
- ;moves it to current_area
- push es
- push di
- push si
- xchg di,si
- mov ax,sel_areas
- mov es,ax
- xdses
- add si,offset li_area
- mov di,offset current_area
- call eozs
- rep movsb
- xor al,al
- stosb
- xdses
- pop si
- pop di
- pop es
- ret
-
- names:
- mov ax,sel_names
- and ax,ax
- jnz gethigh_noalloc
- mov ax,0a000h
- push ax
- mov ax,offset sel_names
- push ds
- push ax
- mov ax,0
- ;this shuld be implemented as a discardable segment (ax=2)
- push ax
- call DosAllocSeg
- public gethigh_noalloc
- gethigh_noalloc:
- push ds
- pop es
- mov di,cur_ar_path_end
- mov si,offset msg_search
- mov cx,6
- rep movsb
-
- mov ax,sel_names
- mov doscall_inseg,ax
- mov search_handle,1
- mov dx,0
- mov si,dx
- mov di,08000h
- mov cx,900 ;the size of the buffer and this value
- ;limit the number of messages that can
- ;be handled
- mov max_find,cx
- mov cx,ds
- mov ax,offset scratch_path
-
- mdosfindfirst
- ret
-
-
- public get_tosslog
- get_tosslog:
- mov toss_add,0
- mov ax,0ffffh
- mdosallocseg sel_tosslog,no_share
- push word ptr sharing
- push word ptr access
- mov sharing,deny_none
- mov access,read_only_access
- mdosopen echo_toss,open,fail
- pop word ptr access
- pop word ptr sharing
- openerror echo_toss,file_error
- mov ax,sel_tosslog
- mov doscall_inseg,ax
- mov si,0
- mov cx,0ffffh
- mdosread
- jnc gtoss1
- jmp short gtoss2
- gtoss1:
- mov ax,result
- mov tosslog_length,ax
- gtoss2:
- ret
-
- convert_crs:
- mov ax,sel_tosslog
- mov cx,tosslog_length
- mov es,ax
- mov di,0
- mov bx,di
- mov al,0dh
- cc1:
- repnz scasb
- mov es:[di-1],bl
- and cx,cx
- jnz cc1
- ret
-
-
- get_nxt_toss_area:
- ;on entry di is pointing at the
- ;area line in the tosslog to be
- ;scanned now. on exit it will point
- ;at the next one.
- ;rets carry on error. toss_flag
- ;end_log if at end of log or
- ;toss_flag no_area if area not found
- ;otherwise si is pointing to the area
- ;line.
- push ds
- mov ax,sel_tosslog
- mov es,ax
- mov di,toss_add
- mov cx,limit_areas
- cmp di,tosslog_length
- jae gnta2
- mov ax,sel_areas
- mov ds,ax
- mov si,0
- mov ax,1
- call search_for
- ddata
- pushf
- mov cx,limit_areas
- call next_z_limit ;di should not have varied til now
- inc di ;moves di to start of next line
- mov toss_add,di
- popf
- jc gnta3
- xor dx,dx
- mov bx,type line_infos
- mov bh,0
- mov ax,si
- div bx
- xor dx,dx
- mul bx
- mov si,ax
- pop ds
- ret
-
- gnta2:
- or toss_flag,end_log
- pop ds
- ret
- gnta3:
- or toss_flag,no_area
- pop ds
- ret
-
- pull_atag:
- ;
-
- push es
- mov ax,sel_msg_buf
- mov es,ax
- mov di,offset mtext
- call dlen
- inc cx
- mov bx,di
- add bx,cx
- cmp byte ptr es:[bx],0dh
- jnz pa1
- inc cx
- pa1:
- cmp byte ptr es:[bx],0ah
- jnz pa2
- inc cx
- pa2:
- mov dx,upmsg_length
- call delete_cx_chars
- mov upmsg_length,di
- pop es
- ret
-
-
-
-
-
- parse_route: ;enters with ds = local data
- public parse_route
- mov ax,08000h
- mdosopen routing,open,fail
- jnc route1
- mov si,offset routing
- jmp file_error
- route1:
- mdosQfileinfo all_file_info
- mov bx,offset all_file_info
- add bx,offset ffile_size
- mov ax,word ptr [bx]
- add ax,0100h
- push ax
- mdosallocseg sel_route,no_share
- pop cx
- dec cx
- mov es,sel_route
- mov di,0
- call clean_buffer
- mov cx,word ptr [bx]
- mov si,0
- mov ax,sel_route
- mov doscall_inseg,ax
- mdosread
- push ds
- pop es
- mov ds,sel_route
- mov si,es:all_file_info.ffile_size
- mov al,0dh
- mov cx,4
- parr1:
- inc si
- mov byte ptr[si],al
- loop parr1
- mov si,0
- parr2:
- call find_config_line
- cmp si,es:all_file_info.ffile_size
- jae parr6
- call sstart
- jc parr2
- push si
- mov bx,0
-
- parr3:
- mov si,offset route_index
- mov di,es:[si+bx]
- mov cx,es:[si+bx+2]
- sub cx,di
- mov ax,si
- add ax,bx
- cmp ax,offset end_index
- jae parr5 ;this line didn't match
- pop si
- push si
- repz cmpsb
- and cx,cx
- jz parr4 ;it's been found
- inc bx
- inc bx
- jmp short parr3
-
- parr4:
- pop ax ;throw it away
- call sstart
- mov di,offset route_sr_ind
- call es:[di+bx]
- jmp short parr2
-
- parr5:
- jmp short parr2
-
- parr6:
- ret
-
-
- route_sr_1:
- mov bx,offset route_work_area
- lea di,offset rt_crash [bx]
- call net_nodes
- ret
-
- route_sr_2:
- mov bx,offset route_work_area
- lea di,offset rt_hold [bx]
- call net_nodes
- ret
- route_sr_3:
- mov di,offset akas
- call net_nodes
- ret
-
- each_out:
- edata
- mov si,offset outbound
- mov si,offset out_search
- call find_file
- ;look for a .out file
- ;check first crash then hold
- ;look for bundle to that node
- ;add it to or create new
- ;if new, add to carrier
- ;adjust carrier type
- ;
-
-
- ;for packing/routing netmail
- ;get list of msgs
- ;open each
- ; check to/from
- ; if not to us and if not sent
- ; adjust and put in outbound
- ; delete if k/s
-
-
- out_node:
- ;on entry si points at .out file name
- ;on exit ax contains the node dx has the net
- push si
- mov cx,4
- call dechex
- pop si
- push ax
- mov cx,4
- add si,cx
- call dechex
- pop dx
- ret
-
-
-
- public find_file
- find_file:
- ;enters with si pointing at the path to
- ;search, di pointing at search pattern
- ;exits with the first file found in
- ;scratch path rets w/ carry if no file
- ;found
-
- push di
- mov di,offset all_file_info.ffilename
- mov cx,20
- call clean_buffer
- pop di
- mov search_pattern_offset,di
- call eozs
- inc cx
-
- mov di,offset scratch_path
- push di
- rep movsb
- pop di
- mov ax,ds
- mov es,ax
- call eoz
- mov al,'\'
- cmp al,[di-1]
- jz ff1a
- stosb
- ;gb1:
- ff1a:
- mov scratch_path_end,di
- ff1:
- ff4:
- mov cx,0
- mov bx,0
- mov dx,bx
- mov di,40
- mov ax,_data
- mov doscall_inseg,ax
- mov find_ptr,si
-
- ff2:
- mov si,search_pattern_offset
- call eozs
- inc cx
- mov di,scratch_path_end
- rep movsb
- mov max_find,1
- mov si,0
- mov di,40
- mov cx,ds
- mov ax,1
- mov search_handle,ax
- mov ax,offset scratch_path
- mdosfindfirst
- cmp ax,12h
- je ff5
- cmp ax,0
- jne ff_error
- ff5:
- mov cx,offset flen_filename
- inc cx
- mov si,offset all_file_info.ffilename
- mov di,scratch_path_end
- rep movsb
- clc
- ff_error:
- ret
-
-
- asciih_to_hexd:
- ;on entry si points to a 4 digit ascii
- ;hex number. On exit ax conts the value
-
- call si_to_hexd
- mov bh,al
- call si_to_hexd
- mov bl,al
- call si_to_hexd
- mov ah,al
- call si_to_hexd
- shl bh,4
- shl ah,4
- add bl,bh
- add al,ah
- mov ah,bl
- ret
-
- bndl_to_node:
- ;on entry si points at the bndl number
- ;es:di points to place to write the net/node
-
- push di
- call asciih_to_hexd
- push ax
- call asciih_to_hexd
- push ax
- xor ax,ax
- mov di,offset scratch_node
- stosb
- pop dx
- pop ax
- mov si,offset this_add
- inc si
- ; mov bx,0ffffh
- ; xor ax,bx
- add ax,word ptr[si]
- stosw
- inc si
- inc si
- mov ax,dx
- ; xor ax,bx
- add ax,word ptr[si]
- stosw
- mov si,offset scratch_node
- pop di
- call write_node
- ret
-
- si_to_hexd:
- lodsb
- cmp al,39h
- jbe ath1
- sub al,7
- ath1:
- sub al,30h
- ret
-
-
- _code ends
-
-
- end main
-