From 2d04cacc5322951f187bb17e017c12920ac8ebe2 Mon Sep 17 00:00:00 2001 From: Mark Zbikowski Date: Thu, 25 Apr 2024 21:24:10 +0100 Subject: MZ is back! --- v4.0/src/CMD/FILESYS/FILESYS.C | 922 +++++++++++++++++++++++++++++++++++++++ v4.0/src/CMD/FILESYS/FILESYS.SKL | 15 + v4.0/src/CMD/FILESYS/FSCHNG.INC | 24 + v4.0/src/CMD/FILESYS/MAKEFILE | 35 ++ v4.0/src/CMD/FILESYS/MSGRET.H | 53 +++ v4.0/src/CMD/FILESYS/PARSE.H | 155 +++++++ v4.0/src/CMD/FILESYS/PSDATA.H | 146 +++++++ v4.0/src/CMD/FILESYS/_MSGRET.ASM | 190 ++++++++ v4.0/src/CMD/FILESYS/_PARSE.ASM | 165 +++++++ 9 files changed, 1705 insertions(+) create mode 100644 v4.0/src/CMD/FILESYS/FILESYS.C create mode 100644 v4.0/src/CMD/FILESYS/FILESYS.SKL create mode 100644 v4.0/src/CMD/FILESYS/FSCHNG.INC create mode 100644 v4.0/src/CMD/FILESYS/MAKEFILE create mode 100644 v4.0/src/CMD/FILESYS/MSGRET.H create mode 100644 v4.0/src/CMD/FILESYS/PARSE.H create mode 100644 v4.0/src/CMD/FILESYS/PSDATA.H create mode 100644 v4.0/src/CMD/FILESYS/_MSGRET.ASM create mode 100644 v4.0/src/CMD/FILESYS/_PARSE.ASM (limited to 'v4.0/src/CMD/FILESYS') diff --git a/v4.0/src/CMD/FILESYS/FILESYS.C b/v4.0/src/CMD/FILESYS/FILESYS.C new file mode 100644 index 0000000..9ae7f41 --- /dev/null +++ b/v4.0/src/CMD/FILESYS/FILESYS.C @@ -0,0 +1,922 @@ +/*  */ +/*----------------------------------------------------------------------+ +| | +| FILESYS provides an interface to IFSFUNC to allow assignment of | +| logical drive letters to various devices. | +| | +| FILESYS also allows the user to cancel the attach for a drive | +| or device or list the currently attched devices. | +| | +| | +| ALIAS provides an interface to IFSFUNC that allows the user | +| to cause automatic substitution of an alternate filename string | +| for a pseudo-device driver name. | +| | +| PROGRAM PROPERTY OF Microsoft, Copyright 1988 Microsoft Corp. | +| | +| INPUT: | +| Command line from user. | +| | +| OUTPUT: | +| Attached device, detached device, or list of attached devices. | +| | ++----------------------------------------------------------------------*/ + +#include "stdio.h" /* ;an000; */ +#include "stdlib.h" /* ;an000; */ +#include "dos.h" /* allows use of intdos calls */ /* ;an000; */ +#include "string.h" /* allows use of str* calls */ /* ;an000; */ +#include "parse.h" /* allows use of parser */ /* ;an000; */ +#include "msgret.h" /* allows use of msg ret */ /* ;an000; */ + /* ;an000; */ +#define ZERO 0 /* ;an002; */ +#define NULL 0 /* ;an000; */ +#define FALSE 0 /* ;an000; */ +#define TRUE 1 /* ;an000; */ + /* ;an000; */ +#define MORE_DEVICES 0x0000 /* more devices in list */ /* ;an000; */ +#define NO_MORE_FILES 0x0012 /* no more files DOS error */ /* ;an000; */ +#define INVALID_FUNCTION_NUM 0x0001 /* invalid function - Get RDR list */ /* ;an000; */ + /* ;an000; */ +#define IFS_DEVICE 0X01 /* IFS device type */ /* ;an000; */ +#define IFS_DRIVE 0X02 /* IFS drive type */ /* ;an000; */ +#define NET_PRINTER 0x03 /* network printer device type */ /* ;an000; */ +#define NET_DRIVE 0x04 /* network drive device type */ /* ;an000; */ + /* ;an000; */ +#define GET_PAUSE_STATUS 0x5f00 /* DOS call to get pause status */ /* ;an000; */ +#define GET_REDIR_LIST_ENTRY 0x5f02 /* DOS call to get redir entry */ /* ;an000; */ +#define REDIRECT_DEVICE 0x5f03 /* DOS call to redir device */ /* ;an000; */ +#define CANCEL_REDIRECTION 0x5f04 /* DOS call to cancel redirection */ /* ;an000; */ +#define GET_ATTACH_LIST 0x5f06 /* DOS call to get attached devices*/ /* ;an000; */ +#define GET_EXTENDED_ERROR 0x5900 /* DOS call to get extended error */ /* ;an000; */ + /* ;an000; */ +#define CARRY_FLAG 0x0001 /* mask for carry flag */ /* ;an000; */ +#define PARITY_FLAG 0x0004 /* mask for parity flag */ /* ;an000; */ +#define ACARRY_FLAG 0x0010 /* mask for aux carry flag */ /* ;an000; */ +#define ZERO_FLAG 0x0040 /* mask for zero flag */ /* ;an000; */ +#define SIGN_FLAG 0x0080 /* mask for sign flag */ /* ;an000; */ +#define TRAP_FLAG 0x0100 /* mask for trap flag */ /* ;an000; */ +#define INTERRUPT_FLAG 0x0200 /* mask for interrupt flag */ /* ;an000; */ +#define DIRECTION_FLAG 0x0400 /* mask for direction flag */ /* ;an000; */ +#define OVERFLOW_FLAG 0x0800 /* mask for overflow flag */ /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/************************************************************************/ /* ;an000; */ +/* */ /* ;an000; */ +/* Define subroutines */ /* ;an000; */ +/* */ /* ;an000; */ +/************************************************************************/ /* ;an000; */ +void main(int, char *[]); /* ;an000; */ +void parse_init(void); /* ;an000; */ +void device_attach(int, char *, char *, char *); /* ;an000; */ +void device_detach(char *); /* ;an000; */ +void fs_status(char *); /* ;an000; */ +int get_pause_stat(unsigned char); /* ;an000; */ +void fs_error(int); /* ;an000; */ +void fs_build_print_message(int, char *, char *, char *); /* ;an000; */ +void string_build(void); /* ;an000; */ +void check_pause_status(unsigned char, int *, int *, int *); /* ;an000; */ +void print_status(int, int, int, int *); /* ;an000; */ +void Sub0_Message(int,int,unsigned char); /* ;an000; */ +void fs_strcpy(char *, char far *); /* ;an000; */ +int fs_strlen(char far *); /* ;an000; */ + /* ;an000; */ +extern void sysloadmsg(union REGS *, union REGS *); /* ;an000; */ +extern void sysdispmsg(union REGS *, union REGS *); /* ;an000; */ +extern void parse(union REGS *, union REGS *); /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +struct p_parms p_p; /* ;an000; */ +struct p_parms p_p1; /* ;an000; */ + /* ;an000; */ +struct p_parmsx p_px; /* ;an000; */ +struct p_parmsx p_px1; /* ;an000; */ + /* ;an000; */ +struct p_control_blk p_con1; /* ;an000; */ +struct p_control_blk p_con1a; /* ;an000; */ +struct p_control_blk p_con2; /* ;an000; */ +struct p_control_blk p_con3; /* ;an000; */ +struct p_control_blk p_con4; /* ;an000; */ + /* ;an000; */ +struct p_control_blk p_swt1; /* ;an000; */ + /* ;an000; */ +struct p_result_blk p_result1; /* ;an000; */ +struct p_result_blk_D p_resultD; /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +struct p_value_blk p_noval; /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +char cmd_line[128]; /* ;an000; */ +char far *cmdline; /* ;an000; */ + /* ;an000; */ + /* ;an000; */ + struct sublistx /* sublist for replaceable parms. */ /* ;an000; */ + { /* ;an000; */ + unsigned char size; /* sublist size */ /* ;an000; */ + unsigned char reserved; /* reserved for future growth */ /* ;an000; */ + unsigned far *value; /* pointer to replaceable parm */ /* ;an000; */ + unsigned char id; /* type of replaceable parm */ /* ;an000; */ + unsigned char flags; /* how parm is to be displayed */ /* ;an000; */ + unsigned char max_width; /* max width of replaceable field */ /* ;an000; */ + unsigned char min_width; /* min width of replaceable field */ /* ;an000; */ + unsigned char pad_char; /* pad character for replaceable field */ /* ;an000; */ + } sublist[4]; /* end of sublis */ /* ;an000; */ + /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +struct /* ;an000; */ + { /* ;an000; */ + char *target_fs_name; /* ;an000; */ + unsigned int target_count; /* ;an000; */ + char target_string[128]; /* ;an000; */ + } GAL_Target; /* ;an000; */ + /* ;an000; */ +struct /* ;an000; */ + { /* ;an000; */ + char device_string[9]; /* ;an000; */ + } GAL_Device; /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +struct /* ;an000; */ + { /* ;an000; */ + char *attach_system; /* pointer to filesys arg */ /* ;an000; */ + unsigned int attach_parms_num; /* number of additional parms */ /* ;an000; */ + char attach_addl_parms[128];/* additional parms */ /* ;an000; */ + /* ;an000; */ + } Attach_block; /* ;an000; */ + /* ;an000; */ +/*----------------------------------------------------------------------+ +| define register variables | ++----------------------------------------------------------------------*/ +union REGS inregs, outregs; /* ;an000; */ +struct SREGS segregs; /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/*----------------------------------------------------------------------+ +| | +| main - filesys and alias main routine | +| | +| handle parsing command line and calling all other routines | +| | ++----------------------------------------------------------------------*/ + /* ;an000; */ +void main(argc,argv) /* ;an000; */ + /* ;an000; */ +int argc; /* number of arguments passed on command line */ /* ;an000; */ +char *argv[]; /* array of pointer to arguments */ /* ;an000; */ + /* ;an000; */ + { /* ;an000; */ +/*----------------------------------------------------------------------+ +| define some local variables | ++----------------------------------------------------------------------*/ + int arg_index; /* index used for stepping through args */ /* ;an000; */ + int more_arguments; /* flag used while looping calls to parser */ /* ;an000; */ + int i; /* loop counter */ /* ;an000; */ + int detach_flag; /* signal to detach device */ /* ;an000; */ + int good_parse; /* signal a good parse occurred */ /* ;an000; */ + /* ;an000; */ + char *string_ptr; /* pointer to a string */ /* ;an000; */ + char file_spec_buf[64]; /* buffer to hold drive or device name */ /* ;an000; */ + char fs_name_buf[64]; /* buffer to hold file system name */ /* ;an000; */ + char string_buf[128]; /* buffer to hold device parms */ /* ;an000; */ + char drive_letter; /* drive letter to attach/detach */ /* ;an000; */ + /* ;an000; */ +/*----------------------------------------------------------------------+ +| get started by calling the parser | ++----------------------------------------------------------------------*/ + /* ;an000; */ + sysloadmsg(&inregs, &outregs); /* load the messages */ /* ;an000; */ + if ((outregs.x.cflag & CARRY_FLAG) == CARRY_FLAG) /* error? */ /* ;an000; */ + sysdispmsg(&outregs,&outregs); /* tell user error and exit */ /* ;an000; */ + else /* execute program */ /* ;an000; */ + { /* ;an000; */ + inregs.h.ah = (unsigned char) 0x62; /* ;an000; */ + intdosx(&inregs, &inregs, &segregs); /* ;an000; */ + /* ;an000; */ + FP_OFF(cmdline) = 0x81; /* ;an000; */ + FP_SEG(cmdline) = inregs.x.bx; /* ;an000; */ + /* ;an000; */ + i = 0; /* ;an000; */ + while ( *cmdline != (char) '\x0d' ) cmd_line[i++] = *cmdline++; /* ;an000; */ + cmd_line[i++] = (char) '\x0d'; /* ;an000; */ + cmd_line[i++] = (char) '\0'; /* ;an000; */ + /* ;an000; */ + /* ;an000; */ + file_spec_buf[0] = NULL; /* ;an000; */ + string_ptr = Attach_block.attach_addl_parms; /* ;an000; */ + detach_flag = FALSE; /* ;an000; */ + good_parse = TRUE; /* ;an000; */ + /* ;an000; */ + parse_init(); /* ;an000; */ + inregs.x.si = (unsigned)cmd_line; /* ;an000; */ + inregs.x.cx = (unsigned)0; /* ;an000; */ + inregs.x.dx = (unsigned)0; /* ;an000; */ + inregs.x.di = (unsigned)&p_p; /* point to drive spec block */ /* ;an000; */ + /* ;an000; */ + i = 0; /* ;an000; */ + parse(&inregs,&outregs); /* ;an000; */ + if (outregs.x.ax != p_no_error) /* ;an000; */ + { /* ;an000; */ + inregs.x.si = (unsigned)cmd_line; /* ;an000; */ + inregs.x.cx = (unsigned)0; /* ;an000; */ + inregs.x.dx = (unsigned)0; /* ;an000; */ + inregs.x.di = (unsigned)&p_p1; /* point to simple string block */ /* ;an000; */ + parse(&inregs,&outregs); /* ;an000; */ + } /* ;an000; */ + while ((outregs.x.ax == p_no_error) && (good_parse == TRUE)) /* ;an000; */ + { /* ;an000; */ + i++; /* ;an000; */ + if (p_resultD.D_Type == p_drive) /* ;an000; */ + { /* ;an000; */ + drive_letter = (char) p_resultD.D_Res_Drive + ('A'-1); /* ;an000; */ + file_spec_buf[0] = drive_letter; /* ;an000; */ + file_spec_buf[1] = (char) ':'; /* ;an000; */ + file_spec_buf[2] = (char) '\0'; /* ;an000; */ + } /* ;an000; */ + /* ;an000; */ + if ((p_result1.P_Type == p_string) && ( i == 1)) /* ;an000; */ + fs_strcpy(file_spec_buf,p_result1.p_result_buff); /* ;an000; */ + /* ;an000; */ + if ((p_result1.P_Type == p_string) && (i == 2)) /* ;an000; */ + fs_strcpy(fs_name_buf,p_result1.p_result_buff); /* ;an000; */ + /* ;an000; */ + if ((p_result1.P_Type == p_string) && (i > 2)) /* ;an000; */ + { /* ;an000; */ + fs_strcpy(string_ptr,p_result1.p_result_buff); /* ;an000; */ + string_ptr += fs_strlen(p_result1.p_result_buff); /* ;an000; */ + string_ptr++; /* ;an000; */ + } /* ;an000; */ + if (p_result1.P_SYNONYM_Ptr == (unsigned int)p_swt1.p_keyorsw) /* ;an000; */ + { /* ;an000; */ + if (i != 2) /* switch in wrong place */ /* ;an000; */ + { /* ;an000; */ + outregs.x.ax = p_syntax; /* signal error type */ /* ;an000; */ + good_parse = FALSE; /* ;an000; */ + } /* ;an000; */ + detach_flag = TRUE; /* ;an000; */ + } /* ;an000; */ + if (good_parse == TRUE) /* ;an000; */ + parse(&outregs,&outregs); /* ;an000; */ + } /* ;an000; */ + /* ;an000; */ + if (outregs.x.ax != p_rc_eol) /* an000; dms; parse error */ /* ;an000; */ + { /* ;an000; */ + Sub0_Message(outregs.x.ax,STDOUT,Parse_Err_Class); /* an000; dms; tell user error */ /* ;an000; */ + exit(1); /* an000; dms; exit program */ /* ;an000; */ + } /* ;an000; */ + /* ;an000; */ + /* which routine to invoke? */ /* ;an000; */ + switch (i) /* ;an000; */ + { /* ;an000; */ + case 0: fs_status(file_spec_buf); /* an000; dms; no parms - status */ /* ;an000; */ + break; /* ;an000; */ + /* ;an000; */ + case 1: fs_status(file_spec_buf); /* an000; dms; 1 parm - selective status*/ /* ;an000; */ + break; /* ;an000; */ + /* ;an000; */ + default : if ((i == 2) && (detach_flag == TRUE)) /* an000; dms; detach request? */ /* ;an000; */ + device_detach(file_spec_buf); /* an000; dms; yes */ /* ;an000; */ + else /* ;an000; */ + device_attach(i,file_spec_buf,fs_name_buf,string_buf); /*an000; dms; attach request */ /* ;an000; */ + break; /* ;an000; */ + } /* ;an000; */ + /* ;an000; */ + /* ;an000; */ + } /* end FILESYS MAIN */ /* ;an000; */ + } /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/*----------------------------------------------------------------------+ +| | +| SUBROUTINE NAME: PARSE_INIT | +| | +| SUBROUTINE FUNCTION: | +| | +| This routine is called by the FILESYS MAIN routine to initialize| +| the parser data structures. | +| | +| INPUT: | +| none | +| | +| OUTPUT: | +| properly initialized parser control blocks | +| | ++----------------------------------------------------------------------*/ +void parse_init() /* ;an000; */ + { /* ;an000; */ + p_p.p_parmsx_address = &p_px; /* address of extended parm list */ /* ;an000; */ + p_p.p_num_extra = 0; /* ;an000; */ + /* ;an000; */ + p_p1.p_parmsx_address = &p_px1; /* address of extended parm list */ /* ;an000; */ + p_p1.p_num_extra = 0; /* ;an000; */ + /* ;an000; */ + p_px.p_minp = 0; /* ;an000; */ + p_px.p_maxp = 4; /* ;an000; */ + p_px.p_control[0] = &p_con1; /* ;an000; */ + p_px.p_control[1] = &p_con2; /* ;an000; */ + p_px.p_control[2] = &p_con3; /* ;an000; */ + p_px.p_control[3] = &p_con4; /* ;an000; */ + p_px.p_maxswitch = 1; /* ;an000; */ + p_px.p_switch[0] = &p_swt1; /* ;an000; */ + p_px.p_maxkeyword = 0; /* ;an000; */ + /* ;an000; */ + p_px1.p_minp = 0; /* ;an000; */ + p_px1.p_maxp = 4; /* ;an000; */ + p_px1.p_control[0] = &p_con1a; /* ;an000; */ + p_px1.p_control[1] = &p_con2; /* ;an000; */ + p_px1.p_control[2] = &p_con3; /* ;an000; */ + p_px1.p_control[3] = &p_con4; /* ;an000; */ + p_px1.p_maxswitch = 1; /* ;an000; */ + p_px1.p_switch[0] = &p_swt1; /* ;an000; */ + p_px1.p_maxkeyword = 0; /* ;an000; */ + /* ;an000; */ + p_con1.p_match_flag = p_drv_only+ p_ig_colon+ p_optional; /* ;an000; */ + p_con1.p_function_flag = p_cap_char+ p_rm_colon; /* ;an000; */ + p_con1.p_result_buf = (unsigned int)&p_resultD; /* ;an000; */ + p_con1.p_value_list = (unsigned int)&p_noval; /* ;an000; */ + p_con1.p_nid = 0; /* ;an000; */ + p_con1.p_keyorsw[0] = 0; /* ;an000; */ + /* ;an000; */ + p_con1a.p_match_flag = p_simple_s+ p_optional; /* ;an000; */ + p_con1a.p_function_flag = p_cap_char; /* ;an000; */ + p_con1a.p_result_buf = (unsigned int)&p_result1; /* ;an000; */ + p_con1a.p_value_list = (unsigned int)&p_noval; /* ;an000; */ + p_con1a.p_nid = 0; /* ;an000; */ + p_con1a.p_keyorsw[0] = 0; /* ;an000; */ + /* ;an000; */ + p_con2.p_match_flag = p_simple_s+ p_optional; /* ;an000; */ + p_con2.p_function_flag = p_cap_char; /* ;an000; */ + p_con2.p_result_buf = (unsigned int)&p_result1; /* ;an000; */ + p_con2.p_value_list = (unsigned int)&p_noval; /* ;an000; */ + p_con2.p_nid = 0; /* ;an000; */ + p_con2.p_keyorsw[0] = 0; /* ;an000; */ + /* ;an000; */ + p_con3.p_match_flag = p_simple_s+ p_optional; /* ;an000; */ + p_con3.p_function_flag = p_cap_char; /* ;an000; */ + p_con3.p_result_buf = (unsigned int)&p_result1; /* ;an000; */ + p_con3.p_value_list = (unsigned int)&p_noval; /* ;an000; */ + p_con3.p_nid = 0; /* ;an000; */ + p_con3.p_keyorsw[0] = 0; /* ;an000; */ + /* ;an000; */ + p_con4.p_match_flag = p_simple_s+ p_optional; /* ;an000; */ + p_con4.p_function_flag = p_cap_char; /* ;an000; */ + p_con4.p_result_buf = (unsigned int)&p_result1; /* ;an000; */ + p_con4.p_value_list = (unsigned int)&p_noval; /* ;an000; */ + p_con4.p_nid = 0; /* ;an000; */ + p_con4.p_keyorsw[0] = 0; /* ;an000; */ + /* ;an000; */ + p_swt1.p_match_flag = p_none; /* ;an000; */ + p_swt1.p_function_flag = p_cap_char; /* ;an000; */ + p_swt1.p_result_buf = (unsigned int)&p_result1; /* ;an000; */ + p_swt1.p_value_list = (unsigned int)&p_noval; /* ;an000; */ + p_swt1.p_nid = 1; /* ;an000; */ + strcpy(p_swt1.p_keyorsw,"/D"+NULL); /* ;an000; */ + /* ;an000; */ + p_noval.p_val_num = 0; /* ;an000; */ + /* ;an000; */ + p_result1.P_Type = 0; /* ;an000; */ + p_result1.P_Item_Tag = 0; /* ;an000; */ + p_result1.P_SYNONYM_Ptr = 0; /* ;an000; */ + /* ;an000; */ + /* ;an000; */ + p_resultD.D_Type = 0; /* ;an000; */ + p_resultD.D_Item_Tag = 0; /* ;an000; */ + p_resultD.D_SYNONYM_Ptr = 0; /* ;an000; */ + p_resultD.D_Res_Drive = 0; /* ;an000; */ + /* ;an000; */ + return; /* ;an000; */ + /* ;an000; */ + } /* end parse_init */ /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/*----------------------------------------------------------------------+ +| | +| SUBROUTINE NAME: DEVICE_ATTACH | +| | +| SUBROUTINE FUNCTION: | +| | +| This routine is called by the FILESYS MAIN routine when it has | +| determined that a device attach request has been included | +| on the FILESYS command line. | +| | +| INPUT: | +| device to attach and ifs name | +| | +| OUTPUT: | +| None | +| | ++----------------------------------------------------------------------*/ +void device_attach(parm_cnt, drive_ptr, fs_name_ptr, parm_ptr) /* ;an000; */ + /* ;an000; */ + int parm_cnt; /* ;an000; */ + char *drive_ptr; /* ;an000; */ + char *fs_name_ptr; /* ;an000; */ + char *parm_ptr; /* ;an000; */ + /* ;an000; */ + { /* ;an000; */ + /* ;an000; */ + strcpy(GAL_Device.device_string,drive_ptr); /* ;an000; */ + Attach_block.attach_system = fs_name_ptr; /* ;an000; */ + Attach_block.attach_parms_num = parm_cnt - 2; /* ;an000; */ + /* ;an000; */ + if (strchr(drive_ptr,(char)':') != 0) /* ;an000; */ + inregs.h.bl = IFS_DRIVE; /* ;an000; */ + else /* ;an000; */ + inregs.h.bl = IFS_DEVICE; /* ;an000; */ + /* ;an000; */ + /* ;an000; */ + inregs.x.ax = REDIRECT_DEVICE; /* fcn code for redir device */ /* ;an000; */ + inregs.x.si = (unsigned int) &GAL_Device; /* ;an000; */ + inregs.x.di = (unsigned int) &Attach_block; /* point to dest */ /* ;an000; */ + inregs.x.cx = 0; /* = 0 for network compat. */ /* ;an000; */ + /* ;an000; */ + intdos(&inregs, &outregs); /* make the call */ /* ;an000; */ + /* ;an000; */ + if ((outregs.x.cflag & CARRY_FLAG) == CARRY_FLAG) fs_error(outregs.x.ax); /* ;an000; */ + return; /* ;an000; */ + } /* end of device attach */ /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/*----------------------------------------------------------------------+ +| | +| SUBROUTINE NAME: DEVICE_DETACH | +| | +| SUBROUTINE FUNCTION: | +| | +| This routine is called by the FILESYS MAIN routine when it has | +| determined that a device detach request has been included | +| on the FILESYS command line. | +| | +| INPUT: | +| device to detach | +| | +| OUTPUT: | +| None | +| | ++----------------------------------------------------------------------*/ +void device_detach(char *rd_source) /* source for detach (e.g. LPT1:, E:) */ /* ;an000; */ + { /* ;an000; */ + inregs.x.ax = CANCEL_REDIRECTION; /* fcn code for cancel redir */ /* ;an000; */ + inregs.x.si = (unsigned int) rd_source; /* point to source */ /* ;an000; */ + /* ;an000; */ + intdos(&inregs, &outregs); /* make the call */ /* ;an000; */ + /* ;an000; */ + /* ;an000; */ + if ((outregs.x.cflag & CARRY_FLAG) == CARRY_FLAG) fs_error(outregs.x.ax); /* ;an000; */ + } /* end of device detach */ /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/*----------------------------------------------------------------------+ +| | +| fs_status - display attach or alias list | +| | +| Inputs : name - pointer to a specific device | +| | +| Outputs : status report of current attached state | +| | ++----------------------------------------------------------------------*/ +void fs_status(char *name) /* ;an000; */ + { /* ;an000; */ + int redir_index; /* counter variable */ /* ;an000; */ + int first_net_entry; /* flag */ /* ;an000; */ + int np_paused; /* flag */ /* ;an000; */ + int nd_paused; /* flag */ /* ;an000; */ + int entry_type; /* save the device entry type */ /* ;an000; */ + int error_type; /* save the device error type */ /* ;an002; */ + int message_type; /* value of message to build*/ /* ;an000; */ + int search_flag; /* flag */ /* ;an000; */ + int header_flag; /* flag used to help decide if header should be displayed */ /* ;an000; */ + char fs_name_array[9]; /* ;an000; */ + /* ;an000; */ + /* initialize some things */ /* ;an000; */ + /* ;an000; */ + GAL_Target.target_fs_name = (char *)fs_name_array; /* ;an000; */ + redir_index = 0; /* always start with entry 0 */ /* ;an000; */ + first_net_entry = TRUE; /* so we don't check for pause on */ /* ;an000; */ + /* every net entry */ /* ;an000; */ + np_paused = FALSE; /* always assume NOT paused */ /* ;an000; */ + nd_paused = FALSE; /* ;an000; */ + header_flag = FALSE; /* always initialze as false */ /* ;an000; */ + /* ;an000; */ + if (name[0] == NULL) /* an000; dms;specific device search? */ /* ;an000; */ + /* ;an000; */ + search_flag = FALSE; /* an000; dms;no */ /* ;an000; */ + /* ;an000; */ + else /* ;an000; */ + search_flag = TRUE; /* an000; dms;yes */ /* ;an000; */ + /* ;an000; */ + /* search through redir list */ /* ;an000; */ + /* ;an000; */ + inregs.x.ax = GET_ATTACH_LIST; /* an000; dms;get list of devices */ /* ;an000; */ + inregs.x.bx = redir_index; /* an000; dms;list entry number */ /* ;an000; */ + inregs.x.si = (unsigned int)&GAL_Device; /* an000; dms;point to device buffer */ /* ;an000; */ + inregs.x.di = (unsigned int)&GAL_Target; /* an000; dms;point to target buffer */ /* ;an000; */ + intdos(&inregs,&outregs); /* an000; dms;invoke call */ /* ;an000; */ + while ((outregs.x.ax != NO_MORE_FILES) && /* ;an000; */ + ((outregs.x.cflag & CARRY_FLAG) != CARRY_FLAG)) /* ;an000; */ + { /* ;an000; */ + error_type = outregs.h.bh; /* an000; drm;save error type */ /* ;an002; */ + entry_type = outregs.h.bl; /* an000; dms;save device type */ /* ;an000; */ + if (search_flag == TRUE) /* an000; dms;specific device? */ /* ;an000; */ + { /* ;an000; */ + if (strcmpi(GAL_Device.device_string,name) == 0) /* an000; dms;found the device? */ /* ;an000; */ + { /* ;an000; */ + Sub0_Message(TITLE1,STDOUT,Utility_Msg_Class); /* an000; dms; print header for status */ /* ;an000; */ + Sub0_Message(TITLE2,STDOUT,Utility_Msg_Class); /* ;an000; */ + Sub0_Message(TITLE3,STDOUT,Utility_Msg_Class); /* ;an000; */ + header_flag = TRUE; /* ;an000; */ + /* ;an000; */ + check_pause_status(entry_type, /* ;an001; */ + &np_paused, /* ;an000; */ + &nd_paused, /* ;an000; */ + &first_net_entry); /* ;an000; */ + string_build(); /* an000; dms;build string */ /* ;an000; */ + if (error_type != ZERO) + message_type = ERROR_RDR_MSG; /* ;an002; */ + else /* ;an002; */ + print_status(entry_type, /* ;an000; */ + np_paused, /* ;an000; */ + nd_paused, /* ;an000; */ + &message_type); /* ;an000; */ + fs_build_print_message(message_type, /* ;an000; */ + GAL_Device.device_string, /* ;an000; */ + GAL_Target.target_fs_name, /* ;an000; */ + GAL_Target.target_string); /* ;an000; */ + } /* ;an000; */ + } /* ;an000; */ + else /* ;an000; */ + { /* ;an000; */ + if (!header_flag) /* logic to display headers only once */ /* ;an000; */ + { /* ;an000; */ + Sub0_Message(TITLE1,STDOUT,Utility_Msg_Class); /* an000; dms; print header for status */ /* ;an000; */ + Sub0_Message(TITLE2,STDOUT,Utility_Msg_Class); /* ;an000; */ + Sub0_Message(TITLE3,STDOUT,Utility_Msg_Class); /* ;an000; */ + header_flag = TRUE; /* ;an000; */ + } /* ;an000; */ + /* ;an000; */ + check_pause_status(entry_type, /* ;an001; */ + &np_paused, /* ;an000; */ + &nd_paused, /* ;an000; */ + &first_net_entry); /* ;an000; */ + string_build(); /* an000; dms;build string */ /* ;an000; */ + if (error_type != ZERO) + message_type = ERROR_RDR_MSG; /* ;an002; */ + else /* ;an002; */ + print_status(entry_type, /* ;an000; */ + np_paused, /* ;an000; */ + nd_paused, /* ;an000; */ + &message_type); /* ;an000; */ + fs_build_print_message(message_type, /* ;an000; */ + GAL_Device.device_string, /* ;an000; */ + GAL_Target.target_fs_name, /* ;an000; */ + GAL_Target.target_string); /* ;an000; */ + } /* ;an000; */ + redir_index++; /* an000; dms;next entry */ /* ;an000; */ + inregs.x.ax = GET_ATTACH_LIST; /* an000; dms;get list of devices */ /* ;an000; */ + inregs.x.bx = redir_index; /* an000; dms;list entry number */ /* ;an000; */ + inregs.x.si = (unsigned int)&GAL_Device; /* an000; dms;point to device buffer */ /* ;an000; */ + inregs.x.di = (unsigned int)&GAL_Target; /* an000; dms;point to target buffer */ /* ;an000; */ + intdos(&inregs,&outregs); /* an000; dms;invoke call */ /* ;an000; */ + } /* ;an000; */ + /* ;an000; */ + if (header_flag == FALSE) /* ;an000; */ + Sub0_Message(NO_ENTRIES,STDOUT,Utility_Msg_Class); /* ;an000; */ + /* ;an000; */ + return; /* ;an000; */ +} /* ;an000; */ + /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/*----------------------------------------------------------------------+ +| | +| get_pause_stat - check the pause status of network printing or disk | +| redirection. | +| | ++----------------------------------------------------------------------*/ +get_pause_stat (unsigned char type) /* ;an000; */ + { /* ;an000; */ + int return_flag; /* flag to return paused status */ /* ;an000; */ + /* ;an000; */ + inregs.x.ax = GET_PAUSE_STATUS; /* ;an000; */ + inregs.h.bl = type; /* ;an000; */ + intdos(&inregs, &outregs); /* ;an000; */ + /* ;an000; */ + if (outregs.h.bh == 0) return_flag = TRUE; /* ;an000; */ + else return_flag = FALSE; /* ;an000; */ + /* ;an000; */ + return(return_flag); /* ;an000; */ + } /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/*----------------------------------------------------------------------+ +| | +| SUBROUTINE NAME: FS_ERROR | +| | +| SUBROUTINE FUNCTION: | +| | +| This routine is called to handle any error conditions that | +| are detected by the FILESYS routines. | +| | +| INPUT: | +| Error code (word) | +| | +| OUTPUT: | +| The corresponding error message is displayed on the screen. | +| (STDERR) | +| | ++----------------------------------------------------------------------*/ +void fs_error(int error_ax) /* error_ax holds error code */ /* ;an000; */ + /* ;an000; */ + { /* ;an000; */ + inregs.x.ax = GET_EXTENDED_ERROR; /* get the extended error */ /* ;an000; */ + inregs.x.bx = NULL; /* clear bx to signal > DOS 3.0 */ /* ;an000; */ + intdos(&inregs, &outregs); /* INT 21h call */ /* ;an000; */ + /* ;an000; */ + inregs.x.ax = outregs.x.ax; /* get extended error in AX */ /* ;an000; */ + inregs.x.bx = STDERR; /* output to standard error */ /* ;an000; */ + inregs.x.cx = SubCnt0; /* no replaceables */ /* ;an000; */ + inregs.h.dl = No_Input; /* no keyboard input */ /* ;an000; */ + inregs.h.dh = Ext_Err_Class; /* extended error class */ /* ;an000; */ + sysdispmsg(&inregs,&outregs); /* display the message */ /* ;an000; */ + /* ;an000; */ + return; /* ;an000; */ + /* ;an000; */ + } /* end of fs_error */ /* ;an000; */ + /* ;an000; */ +/*=======================================================================*/ /* ;an000; */ +/* FS_Build_Print_Message:This routine builds the applicable message and */ /* ;an000; */ +/* prints it. */ /* ;an000; */ +/* Input : Msg_Num - The message number of the applicable */ /* ;an000; */ +/* message */ /* ;an000; */ +/* Output : The printed message */ /* ;an000; */ +/* */ /* ;an000; */ +/*=======================================================================*/ /* ;an000; */ + /* ;an000; */ +void fs_build_print_message(msg_num, outline1, outline2, outline3) /* ;an000; */ +int msg_num; /* ;an000; */ +char *outline1; /* ;an000; */ +char *outline2; /* ;an000; */ +char *outline3; /* ;an000; */ + /* ;an000; */ +{ /* ;an000; */ + unsigned status; /* ;an000; */ + unsigned char function; /* type of input function */ /* ;an000; */ + unsigned char msg_class; /* ;an000; */ + unsigned int message, /* message number */ /* ;an000; */ + sub_cnt, /* num. of replaceable parameters */ /* ;an000; */ + handle; /* display handle */ /* ;an000; */ + /* ;an000; */ + /* ;an000; */ + switch (msg_num) /* what message do we have? */ /* ;an000; */ + { /* ;an000; */ + case PAUSE_RDR_MSG: function = No_Input; /* no keyboard input */ /* ;an000; */ + message = PAUSE_RDR_MSG; /* message %1 REDIR %2 PAUSED */ /* ;an000; */ + msg_class = Utility_Msg_Class; /* utility message */ /* ;an000; */ + sub_cnt = SubCnt3; /* 2 replaceable parms */ /* ;an000; */ + handle = STDOUT; /* display to standard out */ /* ;an000; */ + break; /* end case statement */ /* ;an000; */ + /* ;an000; */ + case REDIR_MSG : function = No_Input; /* no keyboard input */ /* ;an000; */ + message = REDIR_MSG; /* message - %1 REDIR %2 */ /* ;an000; */ + msg_class = Utility_Msg_Class; /* utility message */ /* ;an000; */ + sub_cnt = SubCnt3; /* 2 replaceable parms */ /* ;an000; */ + handle = STDOUT; /* display to standard out */ /* ;an000; */ + break; /* end case statement */ /* ;an000; */ + + case ERROR_RDR_MSG: function = No_Input; /* no keyboard input */ /* ;an002; */ + message = ERROR_RDR_MSG; /* message %1 REDIR %2 ERROR */ /* ;an002; */ + msg_class = Utility_Msg_Class; /* utility message */ /* ;an002; */ + sub_cnt = SubCnt3; /* 2 replaceable parms */ /* ;an002; */ + handle = STDOUT; /* display to standard out */ /* ;an002; */ + break; /* end case statement */ /* ;an002; */ + } /* ;an000; */ + /* ;an000; */ + switch(msg_num) /* what message number to print? */ /* ;an000; */ + { /* ;an000; */ + /* ;an000; */ + case ERROR_RDR_MSG : /* message to print */ /* ;an002; */ + case PAUSE_RDR_MSG : /* message to print */ /* ;an000; */ + case REDIR_MSG : sublist[1].value = (unsigned far *)outline1; /* point to parm 1 */ /* ;an000; */ + sublist[1].size = Sublist_Length; /* length of sublist */ /* ;an000; */ + sublist[1].reserved = Reserved; /* reserved for future growth */ /* ;an000; */ + sublist[1].id = 1; /* number of replaceable parm */ /* ;an000; */ + sublist[1].flags = Char_Field_ASCIIZ+Left_Align; /* string input data */ /* ;an000; */ + sublist[1].max_width = 5; /* default max width - unlimited */ /* ;an000; */ + sublist[1].min_width = 5; /* min width of 1 */ /* ;an000; */ + sublist[1].pad_char = Blank; /* pad with blanks */ /* ;an000; */ + /* ;an000; */ + sublist[2].value = (unsigned far *)outline2; /* point to parm 2 */ /* ;an000; */ + sublist[2].size = Sublist_Length; /* length of sublist */ /* ;an000; */ + sublist[2].reserved = Reserved; /* reserved for future growth */ /* ;an000; */ + sublist[2].id = 2; /* number of replaceable parm */ /* ;an000; */ + sublist[2].flags = Char_Field_ASCIIZ+Left_Align; /* string input data */ /* ;an000; */ + sublist[2].max_width = 9; /* default max width - unlimited */ /* ;an000; */ + sublist[2].min_width = 9; /* min width of 1 */ /* ;an000; */ + sublist[2].pad_char = Blank; /* pad with blanks */ /* ;an000; */ + /* ;an000; */ + /* ;an000; */ + sublist[3].value = (unsigned far *)outline3; /* ;an000; */ + sublist[3].size = Sublist_Length; /* length of sublist */ /* ;an000; */ + sublist[3].reserved = Reserved; /* reserved for future growth */ /* ;an000; */ + sublist[3].id = 3; /* number of replaceable parm */ /* ;an000; */ + sublist[3].flags = Char_Field_ASCIIZ+Left_Align; /* string input data */ /* ;an000; */ + sublist[3].max_width = 0; /* default max width - unlimited */ /* ;an000; */ + sublist[3].min_width = 1; /* min width of 1 */ /* ;an000; */ + sublist[3].pad_char = Blank; /* pad with blanks */ /* ;an000; */ + /* ;an000; */ + inregs.x.ax = message; /* put message number in AX */ /* ;an000; */ + inregs.x.bx = handle; /* put handle in BX */ /* ;an000; */ + inregs.x.si = (unsigned int)&sublist[1]; /* put sublist pointer in SI */ /* ;an000; */ + inregs.x.cx = sub_cnt; /* put sublist count in CX */ /* ;an000; */ + inregs.h.dl = function; /* put function type in DL */ /* ;an000; */ + inregs.h.dh = msg_class; /* put message class in DH */ /* ;an000; */ + sysdispmsg(&inregs,&outregs); /* display the message */ /* ;an000; */ + break; /* end case statement */ /* ;an000; */ + } /* ;an000; */ + return; /* ;an000; */ +} /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/************************************************************************/ /* ;an000; */ +/* STRING_BUILD - This routine takes a buffer filled with */ /* ;an000; */ +/* multiple ASCIIZ strings and concatenates them */ /* ;an000; */ +/* into one string by convering all null chars. */ /* ;an000; */ +/* to a blank. */ /* ;an000; */ +/* */ /* ;an000; */ +/* Inputs - GAL_Target (struct) */ /* ;an000; */ +/* */ /* ;an000; */ +/* Outputs - converted buffer */ /* ;an000; */ +/* */ /* ;an000; */ +/************************************************************************/ /* ;an000; */ + /* ;an000; */ +void string_build() /* ;an000; */ + /* ;an000; */ +{ /* ;an000; */ + int x; /* ;an000; */ + int i; /* ;an000; */ + /* ;an000; */ + x = 0; /* an000; dms;index pointer */ /* ;an000; */ + i = 0; /* an000; dms;loop counter */ /* ;an000; */ + while (i != GAL_Target.target_count) /* an000; dms;while strings exist */ /* ;an000; */ + { /* ;an000; */ + while (GAL_Target.target_string[x] != NULL) /* an000; dms;while not end of string */ /* ;an000; */ + x++; /* an000; dms;increment pointer */ /* ;an000; */ + GAL_Target.target_string[x] = Blank; /* an000; dms;blank terminate string */ /* ;an000; */ + x++; /* an000; dms;increment pointer */ /* ;an000; */ + i++; /* an000; dms;next string */ /* ;an000; */ + } /* ;an000; */ + GAL_Target.target_string[x] = NULL; /* an000; null terminate buffer */ /* ;an000; */ + return; /* ;an000; */ +} /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/************************************************************************/ /* ;an000; */ +/* CHECK_PAUSE_STATUS - This routine determines if the net drive or */ /* ;an000; */ +/* printer is paused. */ /* ;an000; */ +/* */ /* ;an000; */ +/* Inputs : regbl - contents of register BL */ /* ;an000; */ +/* dr_pause - driver pause flag */ /* ;an000; */ +/* pr_pause - printer pause flag */ /* ;an000; */ +/* net_flag - signals 1st. occurrence */ /* ;an000; */ +/* */ /* ;an000; */ +/* Outputs : dr_pause - flag set appropriately */ /* ;an000; */ +/* pr_pause - flag set appropriately */ /* ;an000; */ +/* net_flag - flag set appropriately */ /* ;an000; */ +/* */ /* ;an000; */ +/************************************************************************/ /* ;an000; */ + /* ;an000; */ +void check_pause_status(regbl, pr_pause, dr_pause, net_flag) /* ;an001; */ + /* ;an000; */ + unsigned char regbl; /* ;an000; */ + int *dr_pause; /* ;an000; */ + int *pr_pause; /* ;an000; */ + int *net_flag; /* ;an000; */ +{ /* ;an000; */ + if (((regbl == NET_PRINTER) || /* an000; dms; if net drive or printer */ /* ;an000; */ + (regbl == NET_DRIVE)) && /* ;an001; */ + (*net_flag == TRUE)) /* ;an001; */ + { /* ;an000; */ + *net_flag = FALSE; /* an000; dms; set flag to false */ /* ;an001; */ + *pr_pause = get_pause_stat(NET_PRINTER); /* an000; dms; see if printer paused */ /* ;an000; */ + *dr_pause = get_pause_stat(NET_DRIVE); /* an000; dms; see if drive paused */ /* ;an000; */ + } /* ;an000; */ + return; /* ;an000; */ +} /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/************************************************************************/ /* ;an000; */ +/* PRINT_STATUS - This routine determines the type of print */ /* ;an000; */ +/* message that is to be used. */ /* ;an000; */ +/* */ /* ;an000; */ +/* Inputs : entry_type - type of device */ /* ;an000; */ +/* np_paused - flag */ /* ;an000; */ +/* nd_paused - flag */ /* ;an000; */ +/* message_type - type of message to print */ /* ;an000; */ +/* */ /* ;an000; */ +/* Outputs : message_type - message type to be printed */ /* ;an000; */ +/* */ /* ;an000; */ +/************************************************************************/ /* ;an000; */ + /* ;an000; */ +void print_status(entry_type, np_paused, nd_paused, message_type) /* ;an000; */ + /* ;an000; */ + int entry_type; /* ;an000; */ + int np_paused; /* ;an000; */ + int nd_paused; /* ;an000; */ + int *message_type; /* ;an000; */ +{ /* ;an000; */ + if ((entry_type == NET_PRINTER) && (np_paused == TRUE)) /* ;an000; */ + *message_type = PAUSE_RDR_MSG; /* ;an000; */ + else /* printing not paused, try disk redir */ /* ;an000; */ + { /* ;an000; */ + if ((entry_type == NET_DRIVE) && (nd_paused == TRUE)) /* ;an000; */ + *message_type = PAUSE_RDR_MSG; /* ;an000; */ + else /* ;an000; */ + *message_type = REDIR_MSG; /* ;an000; */ + } /* ;an000; */ + /* ;an000; */ + if (entry_type == NET_PRINTER) /* always want to add ":" to LPTx */ /* ;an000; */ + strncat(GAL_Device.device_string,":",1); /* ;an000; */ + /* ;an000; */ + return; /* ;an000; */ +} /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/************************************************************************/ /* ;an000; */ +/* SUB0_MESSAGE - This routine will print only those */ /* ;an000; */ +/* messages that do not require a */ /* ;an000; */ +/* a sublist. */ /* ;an000; */ +/* */ /* ;an000; */ +/* Inputs : Msg_Num - number of applicable message */ /* ;an000; */ +/* Handle - display type */ /* ;an000; */ +/* Message_Type - type of message to display */ /* ;an000; */ +/* */ /* ;an000; */ +/* Outputs : message */ /* ;an000; */ +/* */ /* ;an000; */ +/************************************************************************/ /* ;an000; */ + /* ;an000; */ +void Sub0_Message(Msg_Num,Handle,Message_Type) /* print messages with no subs */ /* ;an000; */ + /* ;an000; */ +int Msg_Num; /* ;an000; */ +int Handle; /* ;an000; */ +unsigned char Message_Type; /* ;an000; */ + /* extended, parse, or utility */ /* ;an000; */ + { /* ;an000; */ + inregs.x.ax = Msg_Num; /* put message number in AX */ /* ;an000; */ + inregs.x.bx = Handle; /* put handle in BX */ /* ;an000; */ + inregs.x.cx = No_Replace; /* no replaceable subparms */ /* ;an000; */ + inregs.h.dl = No_Input; /* no keyboard input */ /* ;an000; */ + inregs.h.dh = Message_Type; /* type of message to display */ /* ;an000; */ + sysdispmsg(&inregs,&outregs); /* display the message */ /* ;an000; */ + /* ;an000; */ + return; /* ;an000; */ + } /* ;an000; */ + /* ;an000; */ +/************************************************************************/ /* ;an000; */ +/* FS_STRCPY - This routine will provide the string copy */ /* ;an000; */ +/* capability for a far pointer. */ /* ;an000; */ +/* */ /* ;an000; */ +/* Inputs : buffer - pointer to the destination */ /* ;an000; */ +/* parse_ptr - far pointer to source */ /* ;an000; */ +/* */ /* ;an000; */ +/* Outputs : buffer - new string */ /* ;an000; */ +/* */ /* ;an000; */ +/************************************************************************/ /* ;an000; */ + /* ;an000; */ +void fs_strcpy(buffer, parse_ptr) /* ;an000; */ + /* ;an000; */ + char *buffer; /* ;an000; */ + char far *parse_ptr; /* ;an000; */ + /* ;an000; */ + { /* ;an000; */ + /* ;an000; */ + while ((*buffer = *parse_ptr) != NULL) /* ;an000; */ + { /* ;an000; */ + buffer++; /* ;an000; */ + parse_ptr++; /* ;an000; */ + } /* ;an000; */ + return; /* ;an000; */ + } /* ;an000; */ + /* ;an000; */ + /* ;an000; */ +/************************************************************************/ /* ;an000; */ +/* FS_STRLEN - This routine calculates the string's length. */ /* ;an000; */ +/* */ /* ;an000; */ +/* Inputs : parse_ptr - pointer to the string to measure */ /* ;an000; */ +/* */ /* ;an000; */ +/* Outputs : i - string's length */ /* ;an000; */ +/* */ /* ;an000; */ +/************************************************************************/ /* ;an000; */ + /* ;an000; */ +int fs_strlen(parse_ptr) /* ;an000; */ + /* ;an000; */ + char far *parse_ptr; /* ;an000; */ + /* ;an000; */ + { /* ;an000; */ + int i; /* ;an000; */ + /* ;an000; */ + for (i = 0; *parse_ptr != NULL; parse_ptr++) /* ;an000; */ + i++; /* ;an000; */ + /* ;an000; */ + return(i); /* ;an000; */ + } /* ;an000; */ diff --git a/v4.0/src/CMD/FILESYS/FILESYS.SKL b/v4.0/src/CMD/FILESYS/FILESYS.SKL new file mode 100644 index 0000000..734246d --- /dev/null +++ b/v4.0/src/CMD/FILESYS/FILESYS.SKL @@ -0,0 +1,15 @@ + +:util FILESYS + +:class 1 + +:class A +:use COMMON1 ;"Incorrect DOS version",cr,lf +:def 10 " PAUSED %1 %2 %3",CR,LF +:def 11 " %1 %2 %3",CR,LF +:def 12 " Local IFS",CR,LF ;an001;bgb +:def 13 " Status Device Name Parameters",CR,LF ;an001;bgb +:def 14 " ______ ______ _________ ___________________",CR,LF,CR,LF +:def 15 "No entries found",CR,LF +:def 16 " ERROR %1 %2 %3",CR,LF +:end diff --git a/v4.0/src/CMD/FILESYS/FSCHNG.INC b/v4.0/src/CMD/FILESYS/FSCHNG.INC new file mode 100644 index 0000000..1145ea1 --- /dev/null +++ b/v4.0/src/CMD/FILESYS/FSCHNG.INC @@ -0,0 +1,24 @@ +.xlist +; +; +;***************************************************************************** +;* * +;* Change list to FILESYS modules * +;* * +;* Lines are tagged ANxxx for new, ACxxx for changed * +;* --------------------------------------------------------------------------* +;* 000 - DOS 4.00 Spec additions and DCR's thru unit/function test * +;* Date: 12/31/87 Developer: GA, DS * +;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * +;* 001 - DOS 4.00 PTM P4249 FILESYS adds extra ":" on forth entry of display.* +;* Date: 04/22/88 Developer: DM * +;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * +;* 002 - DOS 4.00 PTM P4248 FILESYS does not show PAUSED in status field, * +;* also added was ERROR to the status field. * +;* Date: 04/22/88 Developer: DM * +;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * +;***************************************************************************** +;* Note: This is file FSCHNG.INC for updating purposes * +;***************************************************************************** +.list + diff --git a/v4.0/src/CMD/FILESYS/MAKEFILE b/v4.0/src/CMD/FILESYS/MAKEFILE new file mode 100644 index 0000000..f29975e --- /dev/null +++ b/v4.0/src/CMD/FILESYS/MAKEFILE @@ -0,0 +1,35 @@ +#************************** makefile for cmd\... *************************** + +msg =..\..\messages +dos =..\..\dos +inc =..\..\inc +hinc =..\..\h + +# +####################### dependencies begin here. ######################### +# + +all: filesys.exe + +filesys.ctl: filesys.skl \ + $(msg)\$(COUNTRY).msg \ + makefile + +_msgret.obj: _msgret.asm \ + filesys.ctl \ + makefile \ + $(inc)\msgserv.asm \ + $(inc)\sysmsg.inc + +_parse.obj: _parse.asm \ + makefile \ + $(inc)\PARSE.ASM \ + $(inc)\PSDATA.INC + +filesys.obj: filesys.c parse.h + +filesys.exe: filesys.obj \ + _parse.obj \ + _msgret.obj + link filesys+ _parse+ _msgret; /NOI + diff --git a/v4.0/src/CMD/FILESYS/MSGRET.H b/v4.0/src/CMD/FILESYS/MSGRET.H new file mode 100644 index 0000000..778c079 --- /dev/null +++ b/v4.0/src/CMD/FILESYS/MSGRET.H @@ -0,0 +1,53 @@ +/************************************************************************/ +/* MSGRET.H - This include file defines each message type */ +/* that can occur in FILESYS. The defines will */ +/* be used to build the proper message. */ +/* */ +/* Date : 10/29/87 */ +/************************************************************************/ + +/************************************************************************/ +/* Message Retriever Standard Equates */ +/************************************************************************/ + +#define PAUSE_RDR_MSG 0x000A +#define REDIR_MSG 0x000B +#define TITLE1 0x000C +#define TITLE2 0x000D +#define TITLE3 0x000E +#define NO_ENTRIES 0x000F +#define ERROR_RDR_MSG 0x0010 + +#define Ext_Err_Class 0x0001 +#define Parse_Err_Class 0x0002 +#define Utility_Msg_Class 0x00ff +#define No_Handle 0xffff +#define No_Replace 0x0000 +#define Sublist_Length 0x000b +#define Reserved 0x0000 +#define Left_Align 0x0000 +#define Right_Align 0x0080 +#define Char_Field_Char 0x0000 +#define Char_Field_ASCIIZ 0x0010 +#define Unsgn_Bin_Byte 0x0011 +#define Unsgn_Bin_Word 0x0021 +#define Unsgn_Bin_DWord 0x0031 +#define Sgn_Bin_Byte 0x0012 +#define Sgn_Bin_Word 0x0022 +#define Sgn_Bin_DWord 0x0032 +#define Bin_Hex_Byte 0x0013 +#define Bin_Hex_Word 0x0023 +#define Bin_Hex_DWord 0x0033 +#define No_Input 0x0000 +#define STDIN 0x0000 +#define STDOUT 0x0001 +#define STDERR 0x0002 +#define Blank 0x0020 + +#define SubCnt0 0x0000 +#define SubCnt1 0x0001 +#define SubCnt2 0x0002 +#define SubCnt3 0x0003 +#define SubCnt4 0x0004 +#define SubCnt5 0x0005 + diff --git a/v4.0/src/CMD/FILESYS/PARSE.H b/v4.0/src/CMD/FILESYS/PARSE.H new file mode 100644 index 0000000..cbfc3c0 --- /dev/null +++ b/v4.0/src/CMD/FILESYS/PARSE.H @@ -0,0 +1,155 @@ +/*  */ +/*----------------------------------------------------------------------+ +| | +| This file contains the structures and defines that are needed to use | +| the parser from a C program. | +| | +| | +| Date: 5-21-87 | +| | ++----------------------------------------------------------------------*/ + + +#define p_len_parms 4 /* length of p_parms */ +#define p_i_use_default 0 /* no extra stuff specified */ +#define p_i_have_delim 1 /* extra delimiter specified */ +#define p_i_have_eol 2 /* extra EOL specified */ + +struct p_parms + { + struct p_parmsx *p_parmsx_address; /* address of p_parmsx */ + unsigned char p_num_extra; /* number of extra stuff */ + unsigned char p_len_extra_delim; /* length of extra delimiter */ + char p_extra_delim[30]; /* extra delimiters */ + }; + +struct p_parmsx + { + unsigned char p_minp; /* Minimum positional number */ + unsigned char p_maxp; /* Maximum positional number */ + struct p_control_blk *p_control[4]; /* Address of the 1st CONTROL block */ + unsigned char p_maxswitch; /* Maximum switches */ + struct p_control_blk *p_switch[1]; /* Pointer to switch block */ + unsigned char p_maxkeyword; /* Maximum keywords */ + }; + + +struct p_control_blk + { + unsigned int p_match_flag; /* Controls type matched */ + unsigned int p_function_flag; /* Function should be taken */ + unsigned int p_result_buf; /* Result buffer address */ + unsigned int p_value_list; /* Value list address */ + unsigned char p_nid; /* # of keyword/SW synonyms */ + unsigned char p_keyorsw[20]; /* keyword or sw */ + }; + +/* Match_Flags */ + +#define p_num_val 0x8000 /* Numeric Value */ +#define p_snum_val 0x4000 /* Signed numeric value */ +#define p_simple_s 0x2000 /* Simple string */ +#define p_date_s 0x1000 /* Date string */ +#define p_time_s 0x0800 /* Time string */ +#define p_cmpx_s 0x0400 /* Complex string */ +#define p_file_spc 0x0200 /* File Spec */ +#define p_drv_only 0x0100 /* Drive Only */ +#define p_qu_string 0x0080 /* Quoted string */ +#define p_ig_colon 0x0010 /* Ignore colon at end in match */ +#define p_repeat 0x0002 /* Repeat allowed */ +#define p_optional 0x0001 /* Optional */ +#define p_none 0x0000 + +/*----------------------------------------------------------------------+ +| | +| Value block structure | +| | ++----------------------------------------------------------------------*/ + +struct p_value_blk + { + unsigned char p_val_num; + }; + + +/*----------------------------------------------------------------------+ +| | +| Function flags | +| | ++----------------------------------------------------------------------*/ + +#define p_cap_file 0x0001 /* CAP result by file table */ +#define p_cap_char 0x0002 /* CAP result by character table */ +#define p_rm_colon 0x0010 /* Remove ":" at the end */ + + + +#define p_nval_none 0 /* no value list ID */ +#define p_nval_range 1 /* range list ID */ +#define p_nval_value 2 /* value list ID */ +#define p_nval_string 3 /* string list ID */ +#define p_len_range 9 /* Length of a range choice(two DD plus one DB) */ +#define p_len_value 5 /* Length of a value choice(one DD plus one DB) */ +#define p_len_string 3 /* Length of a string choice(one DW plus one DB) */ + + +/*----------------------------------------------------------------------+ +| | +| Result block structure | +| | ++----------------------------------------------------------------------*/ + +struct p_result_blk + { + unsigned char P_Type; /* Type returned */ + unsigned char P_Item_Tag; /* Matched item tag */ + unsigned int P_SYNONYM_Ptr; /* pointer to Synonym list returned */ + char far *p_result_buff; /* result value */ + }; + + +struct p_result_blk_D + { + unsigned char D_Type; /* Type returned */ + unsigned char D_Item_Tag; /* Matched item tag */ + unsigned int D_SYNONYM_Ptr; /* pointer to Synonym list returned */ + unsigned int D_Res_Drive; /* drive value */ + }; + +/*----------------------------------------------------------------------+ +| | +| type | +| | ++----------------------------------------------------------------------*/ + +#define p_eol 0 /* End of line */ +#define p_number 1 /* Number */ +#define p_list_idx 2 /* List Index */ +#define p_string 3 /* String */ +#define p_complex 4 /* Complex */ +#define p_file_spec 5 /* File Spec */ +#define p_drive 6 /* Drive */ +#define p_date_f 7 /* Date */ +#define p_time_f 8 /* Time */ +#define p_quoted_string 9 /* Quoted String */ + +#define p_no_tag 0x0FF /* No ITEM_TAG found */ + +/*----------------------------------------------------------------------+ +| | +| following return code will be returned in the AX register. | +| | ++----------------------------------------------------------------------*/ + +#define p_no_error 0 /* No error */ +#define p_too_many 1 /* Too many operands */ +#define p_op_missing 2 /* Required operand missing */ +#define p_not_in_sw 3 /* Not in switch list provided */ +#define p_not_in_key 4 /* Not in keyword list provided */ +#define p_out_of_range 6 /* Out of range specified */ +#define p_not_in_val 7 /* Not in value list provided */ +#define p_not_in_str 8 /* Not in string list provided */ +#define p_syntax 9 /* Syntax error */ +#define p_rc_eol 0x0ffff /* End of command line */ + + diff --git a/v4.0/src/CMD/FILESYS/PSDATA.H b/v4.0/src/CMD/FILESYS/PSDATA.H new file mode 100644 index 0000000..569fc1c --- /dev/null +++ b/v4.0/src/CMD/FILESYS/PSDATA.H @@ -0,0 +1,146 @@ +/*  */ +/*----------------------------------------------------------------------+ +| | +| This file contains the structures and defines that are needed to use | +| the parser from a C program. | +| | +| | +| Date: 5-21-87 | +| | ++----------------------------------------------------------------------*/ + + +#define P_Len_PARMS 4 /* length of p_parms */ +#define P_I_Use_Default 0 /* no extra stuff specified */ +#define P_I_Have_Delim 1 /* extra delimiter specified */ +#define P_I_Have_EOL 2 /* extra EOL specified */ + +struct p_parms + { + struct p_parmsx *p_parmsx_address; /* address of p_parmsx */ + unsigned char p_num_extra; /* number of extra stuff */ + unsigned char p_len_extra_delim; /* length of extra delimiter */ + }; + +struct p_parmsx + { + unsigned char p_minp; /* Minimum positional number */ + unsigned char p_maxp; /* Maximum positional number */ + unsigned int p_1st_control; /* Address of the 1st CONTROL block */ + }; + + +struct p_control_blk + { + unsigned int p_match_flag; /* Controls type matched */ + unsigned int p_function_flag; /* Function should be taken */ + unsigned int p_result_buf; /* Result buffer address */ + unsigned int p_value_list; /* Value list address */ + unsigned char p_nid; /* # of keyword/SW synonyms */ + unsigned char p_keyorsw; /* keyword or sw */ + }; + +/* Match_Flags */ + +#define P_Num_Val 0x8000 /* Numeric Value */ +#define P_SNum_Val 0x4000 /* Signed numeric value */ +#define P_Simple_S 0x2000 /* Simple string */ +#define P_Date_S 0x1000 /* Date string */ +#define P_Time_S 0x0800 /* Time string */ +#define P_Cmpx_S 0x0400 /* Complex string */ +#define P_File_Spc 0x0200 /* File Spec */ +#define P_Drv_Only 0x0100 /* Drive Only */ +#define P_Qu_String 0x0080 /* Quoted string */ +#define P_Ig_Colon 0x0010 /* Ignore colon at end in match */ +#define P_Repeat 0x0002 /* Repeat allowed */ +#define P_Optional 0x0001 /* Optional */ + +/*----------------------------------------------------------------------+ +| | +| Function flags | +| | ++----------------------------------------------------------------------*/ + +#define P_CAP_File 0x0001 /* CAP result by file table */ +#define P_CAP_Char 0x0002 /* CAP result by character table */ +#define P_Rm_Colon 0x0010 /* Remove ":" at the end */ + + + + + +#define P_nval_None 0 /* no value list ID */ +#define P_nval_Range 1 /* range list ID */ +#define P_nval_Value 2 /* value list ID */ +#define P_nval_String 3 /* string list ID */ +#define P_Len_Range 9 /* Length of a range choice(two DD plus one DB) */ +#define P_Len_Value 5 /* Length of a value choice(one DD plus one DB) */ +#define P_Len_String 3 /* Length of a string choice(one DW plus one DB) */ + + +/*----------------------------------------------------------------------+ +| | +| problem with doing this in C | +| | ++----------------------------------------------------------------------*/ +struct p_val_list + { + unsigned char P_NumofList; /* number of following choice */ + unsigned int P_Val_XL; /* lower word of value */ + unsigned int P_Val_XH; /* higher word of value */ + unsigned int P_Val_YL; /* lower word of another value */ + unsigned int P_Val_YH; /* higher word of another value */ + }; + + +/*----------------------------------------------------------------------+ +| | +| Result block structure | +| | ++----------------------------------------------------------------------*/ + +struct p_result_blk + { + unsigned char P_Type; /* Type returned */ + unsigned char P_Item_Tag; /* Matched item tag */ + unsigned int P_SYNONYM_Ptr; /* pointer to Synonym list returned */ + unsigned char P_Picked_Val[4]; /* value */ + }; + +/*----------------------------------------------------------------------+ +| | +| type | +| | ++----------------------------------------------------------------------*/ + +#define P_EOL 0 /* End of line */ +#define P_Number 1 /* Number */ +#define P_List_Idx 2 /* List Index */ +#define P_String 3 /* String */ +#define P_Complex 4 /* Complex */ +#define P_File_Spec 5 /* File Spec */ +#define P_Drive 6 /* Drive */ +#define P_Date_F 7 /* Date */ +#define P_Time_F 8 /* Time */ +#define P_Quoted_String 9 /* Quoted String */ + +#define P_No_Tag 0x0FF /* No ITEM_TAG found */ + +/*----------------------------------------------------------------------+ +| | +| following return code will be returned in the AX register. | +| | ++----------------------------------------------------------------------*/ + +#define P_No_Error 0 /* No error */ +#define P_Too_Many 1 /* Too many operands */ +#define P_Op_Missing 2 /* Required operand missing */ +#define P_Not_In_SW 3 /* Not in switch list provided */ +#define P_Not_In_Key 4 /* Not in keyword list provided */ +#define P_Out_Of_Range 6 /* Out of range specified */ +#define P_Not_In_Val 7 /* Not in value list provided */ +#define P_Not_In_Str 8 /* Not in string list provided */ +#define P_Syntax 9 /* Syntax error */ +#define P_RC_EOL 0x0ffff /* End of command line */ + + diff --git a/v4.0/src/CMD/FILESYS/_MSGRET.ASM b/v4.0/src/CMD/FILESYS/_MSGRET.ASM new file mode 100644 index 0000000..832529c --- /dev/null +++ b/v4.0/src/CMD/FILESYS/_MSGRET.ASM @@ -0,0 +1,190 @@ +page 60,132 +name _msgret +title C to Message Retriever +;------------------------------------------------------------------- +; +; MODULE: _msgret +; +; PURPOSE: Supplies an interface between C programs and +; the DOS 3.3 message retriever +; +; CALLING FORMAT: +; msgret(&inregs,&outregs); +; +; DATE: 5-21-87 +; +;------------------------------------------------------------------- + + INCLUDE SYSMSG.INC ;PERMIT SYSTEM MESSAGE HANDLER DEFINITION ;AN000; + + MSG_UTILNAME ;IDENTIFY THE COMPONENT ;AN000; + +;------------------------------------------------------------------- +;------------------------------------------------------------------- + + +_TEXT SEGMENT BYTE PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: DGROUP, DS: DGROUP, SS: DGROUP, ES: NOTHING + + public data_sysloadmsg + public data_sysdispmsg + +_DATA SEGMENT + + MSG_SERVICES + MSG_SERVICES + MSG_SERVICES + MSG_SERVICES ;AN000; + + +data_sysloadmsg proc far + + push bp ; save user's base pointer + mov bp,sp ; set bp to current sp + push di ; save some registers + push si + +; copy C inregs into proper registers + + mov di,[bp+4+4] ; fix di (arg 0) + +;------------------------------------------------------------------- + + mov ax,[di+0ah] ; load di + push ax ; the di value from inregs is now on stack + + mov ax,[di+00] ; get inregs.x.ax + mov bx,[di+02] ; get inregs.x.bx + mov cx,[di+04] ; get inregs.x.cx + mov dx,[di+06] ; get inregs.x.dx + mov si,[di+08] ; get inregs.x.si + pop di ; get inregs.x.di from stack + + push bp ; save base pointer + +;------------------------------------------------------------------- + + call sysloadmsg ; call the message retriever + +;------------------------------------------------------------------- + + pop bp ; restore base pointer + push di ; the di value from call is now on stack + mov di,[bp+6+4] ; fix di (arg 1) + + mov [di+00],ax ; load outregs.x.ax + mov [di+02],bx ; load outregs.x.bx + mov [di+04],cx ; load outregs.x.cx + mov [di+06],dx ; load outregs.x.dx + mov [di+08],si ; load outregs.x.si + + lahf ; get flags into ax + mov al,ah ; move into low byte + mov [di+0ch],ax ; load outregs.x.cflag + + pop ax ; get di from stack + mov [di+0ah],ax ; load outregs.x.di + +;------------------------------------------------------------------- + + pop si ; restore registers + pop di + mov sp,bp ; restore sp + pop bp ; restore user's bp + ret + +data_sysloadmsg endp + + +data_sysdispmsg proc far + + push bp ; save user's base pointer + mov bp,sp ; set bp to current sp + push di ; save some registers + push si + +; copy C inregs into proper registers + + mov di,[bp+4+4] ; fix di (arg 0) + +;------------------------------------------------------------------- + + mov ax,[di+0ah] ; load di + push ax ; the di value from inregs is now on stack + + mov ax,[di+00] ; get inregs.x.ax + mov bx,[di+02] ; get inregs.x.bx + mov cx,[di+04] ; get inregs.x.cx + mov dx,[di+06] ; get inregs.x.dx + mov si,[di+08] ; get inregs.x.si + pop di ; get inregs.x.di from stack + + push bp ; save base pointer + +;------------------------------------------------------------------- + + call sysdispmsg + +;------------------------------------------------------------------- + + pop bp ; restore base pointer + push di ; the di value from call is now on stack + mov di,[bp+6+4] ; fix di (arg 1) + + mov [di+00],ax ; load outregs.x.ax + mov [di+02],bx ; load outregs.x.bx + mov [di+04],cx ; load outregs.x.cx + mov [di+06],dx ; load outregs.x.dx + mov [di+08],si ; load outregs.x.si + + lahf ; get flags into ax + mov al,ah ; move into low byte + mov [di+0ch],ax ; load outregs.x.cflag + + pop ax ; get di from stack + mov [di+0ah],ax ; load outregs.x.di + +;------------------------------------------------------------------- + + pop si ; restore registers + pop di + mov sp,bp ; restore sp + pop bp ; restore user's bp + ret + +data_sysdispmsg endp + +include msgdcl.inc + + +_DATA ends ; end code segment + +_TEXT SEGMENT + + assume cs:_TEXT + + public _sysdispmsg + public _sysloadmsg + +_sysdispmsg proc near + call data_sysdispmsg + ret +_sysdispmsg endp + +_sysloadmsg proc near + call data_sysloadmsg + ret +_sysloadmsg endp + +_TEXT ENDS + end + diff --git a/v4.0/src/CMD/FILESYS/_PARSE.ASM b/v4.0/src/CMD/FILESYS/_PARSE.ASM new file mode 100644 index 0000000..d1424b7 --- /dev/null +++ b/v4.0/src/CMD/FILESYS/_PARSE.ASM @@ -0,0 +1,165 @@ +page 60,132 +name _parse +title C to PARSER interface +;------------------------------------------------------------------- +; +; MODULE: _parse +; +; PURPOSE: Supplies an interface between C programs and +; the DOS 3.3 parser +; +; CALLING FORMAT: +; parse(&inregs,&outregs); +; +; DATE: 5-21-87 +; +;------------------------------------------------------------------- + +; extrn sysparse:far + + public _parse + +;------------------------------------------------------------------- +;FarSW equ 0 ; make sysparse be a NEAR proc +;TimeSW equ 0 ; Check time format +;FileSW equ 0 ; Check file specification +;CAPSW equ 0 ; Perform CAPS if specified +;CmpxSW equ 0 ; Check complex list +;NumSW equ 1 ; Check numeric value +;KeySW equ 0 ; Support keywords +;SwSW equ 1 ; Support switches +;Val1SW equ 1 ; Support value definition 1 +;Val2SW equ 1 ; Support value definition 2 +;Val3SW equ 0 ; Support value definition 3 +;DrvSW equ 0 ; Support drive only format +;QusSW equ 0 ; Support quoted string format +;------------------------------------------------------------------- + + + + +_TEXT SEGMENT BYTE PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + + +DGROUP GROUP CONST, _BSS, _DATA + + +_DATA segment word public 'DATA' + + assume cs:DGROUP + assume ss:dgroup + + public SysParse + +;------------------------------------------------------------------- +.xlist +include parse.asm ; include the parser +.list +;------------------------------------------------------------------- + + public CallParser +CallParser proc far + + push ds + PUSH ES + + push cs + pop ds + assume ds:DGROUP + + push cs + pop es + assume es:DGROUP + + nop + + call SysParse + + POP ES + pop ds + + ret + +CallParser endp + + + +_DATA ends + +_TEXT segment byte public 'CODE' + + ASSUME CS:_TEXT + ASSUME DS:DGROUP + ASSUME ES:NOTHING + ASSUME SS:DGROUP + +_parse proc near + + push bp ; save user's base pointer + mov bp,sp ; set bp to current sp + push di ; save some registers + push si + +; copy C inregs into proper registers + + mov di,[bp+4] ; fix di (arg 0) + +;------------------------------------------------------------------- + + mov ax,[di+0ah] ; load di + push ax ; the di value from inregs is now on stack + + mov ax,[di+00] ; get inregs.x.ax + mov bx,[di+02] ; get inregs.x.bx + mov cx,[di+04] ; get inregs.x.cx + mov dx,[di+06] ; get inregs.x.dx + mov si,[di+08] ; get inregs.x.si + pop di ; get inregs.x.di from stack + + push bp ; save base pointer + +;------------------------------------------------------------------- +;------------------------------------------------------------------- + + call CallParser ; call the parser + +;------------------------------------------------------------------- +;------------------------------------------------------------------- + + pop bp ; restore base pointer + push di ; the di value from call is now on stack + mov di,[bp+6] ; fix di (arg 1) + + mov [di+00],ax ; load outregs.x.ax + mov [di+02],bx ; load outregs.x.bx + mov [di+04],cx ; load outregs.x.cx + mov [di+06],dx ; load outregs.x.dx + mov [di+08],si ; load outregs.x.si + + xor ax,ax ; clear ax + lahf ; get flags into ax + mov [di+0ch],ax ; load outregs.x.cflag + + pop ax ; get di from stack + mov [di+0ah],ax ; load outregs.x.di + +;------------------------------------------------------------------- + + pop si ; restore registers + pop di + mov sp,bp ; restore sp + pop bp ; restore user's bp + ret + +_parse endp + +_TEXT ends ; end code segment + end + -- cgit v1.2.3