Subversion Repositories SvarDOS

Rev

Rev 1987 | Rev 2213 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1987 Rev 2212
Line 20... Line 20...
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
 * DEALINGS IN THE SOFTWARE.
22
 * DEALINGS IN THE SOFTWARE.
23
 */
23
 */
24
 
24
 
25
#include <i86.h>
-
 
26
#include <dos.h>
25
#include <dos.h>
27
#include <stdio.h>
26
#include <stdio.h>
28
#include <stdlib.h>
-
 
29
#include <string.h>
27
#include <string.h>
30
 
28
 
31
#include "svarlang.lib/svarlang.h"
29
#include "svarlang.lib/svarlang.h"
32
 
30
 
33
#include "cmd.h"
31
#include "cmd.h"
Line 119... Line 117...
119
  outputnl(msg);
117
  outputnl(msg);
120
  return(1);
118
  return(1);
121
}
119
}
122
 
120
 
123
 
121
 
-
 
122
/* exit do DOS with exist code */
-
 
123
static void EXIT(char code);
-
 
124
#pragma aux EXIT = \
-
 
125
"mov ah, 0x4c" \
-
 
126
"int 0x21" \
-
 
127
parm [al]
-
 
128
 
-
 
129
 
124
/* DR-DOS specific boot processing: check for F5/F8 boot key presses and reset
130
/* DR-DOS specific boot processing: check for F5/F8 boot key presses and reset
125
 * the wild pointer to DR-DOS kernel (CONFIG.SYS) environment because it is not
131
 * the wild pointer to DR-DOS kernel (CONFIG.SYS) environment because it is not
126
 * allocated memory hence will be overwritten soon.
132
 * allocated memory hence will be overwritten soon.
127
 * details: https://github.com/SvarDOS/edrdos/issues/83
133
 * details: https://github.com/SvarDOS/edrdos/issues/83
128
 * this function returns 0, FLAG_SKIP_AUTOEXEC or FLAG_STEPBYSTEP */
134
 * this function returns 0, FLAG_SKIP_AUTOEXEC or FLAG_STEPBYSTEP */
Line 222... Line 228...
222
   *
228
   *
223
   * The cautious approach is therefore to read the tail up until the length
229
   * The cautious approach is therefore to read the tail up until the length
224
   * mentionned at [80h] or to first CR or nul, whichever comes first.
230
   * mentionned at [80h] or to first CR or nul, whichever comes first.
225
   */
231
   */
226
 
232
 
227
  memset(cfg, 0, sizeof(*cfg));
233
  bzero(cfg, sizeof(*cfg));
228
 
234
 
229
  /* Make sure that the advertised cmdline length is no more than 126 bytes
235
  /* Make sure that the advertised cmdline length is no more than 126 bytes
230
   * because the PSP ends at [0xff] and there ought to be at least 1 byte of
236
   * because the PSP ends at [0xff] and there ought to be at least 1 byte of
231
   * room for the CR-terminator.
237
   * room for the CR-terminator.
232
   * According to Matthias Paul cmdlines longer than 126 (and even longer than
238
   * According to Matthias Paul cmdlines longer than 126 (and even longer than
Line 301... Line 307...
301
        nls_outputnl(1,3); /* "/E:nnn  Sets the environment size to nnn bytes" */
307
        nls_outputnl(1,3); /* "/E:nnn  Sets the environment size to nnn bytes" */
302
        nls_outputnl(1,4); /* "/P      Makes the new command interpreter permanent and run AUTOEXEC.BAT" */
308
        nls_outputnl(1,4); /* "/P      Makes the new command interpreter permanent and run AUTOEXEC.BAT" */
303
        nls_outputnl(1,5); /* "/C      Executes the specified command and returns" */
309
        nls_outputnl(1,5); /* "/C      Executes the specified command and returns" */
304
        nls_outputnl(1,6); /* "/K      Executes the specified command and continues running" */
310
        nls_outputnl(1,6); /* "/K      Executes the specified command and continues running" */
305
        nls_outputnl(1,7); /* "/Y      Executes the batch program step by step" */
311
        nls_outputnl(1,7); /* "/Y      Executes the batch program step by step" */
306
        exit(1);
312
        EXIT(1);
307
        break;
313
        break;
308
 
314
 
309
      default:
315
      default:
310
        nls_output(0,2); /* invalid switch */
316
        nls_output(0,2); /* invalid switch */
311
        output(": /");
317
        output(": /");
Line 682... Line 688...
682
    cmdtail_to_fcb(farptr, farptr + 16, cmdtail);
688
    cmdtail_to_fcb(farptr, farptr + 16, cmdtail);
683
    /* set (far) pointers in the ExecParam block */
689
    /* set (far) pointers in the ExecParam block */
684
    ExecParam->fcb1 = (unsigned long)MK_FP(rmod->rmodseg, 0x5C);
690
    ExecParam->fcb1 = (unsigned long)MK_FP(rmod->rmodseg, 0x5C);
685
    ExecParam->fcb2 = (unsigned long)MK_FP(rmod->rmodseg, 0x6C);
691
    ExecParam->fcb2 = (unsigned long)MK_FP(rmod->rmodseg, 0x6C);
686
  }
692
  }
687
  exit(0); /* let rmod do the job now */
693
  EXIT(0); /* let rmod do the job now */
688
}
694
}
689
 
695
 
690
 
696
 
691
static void set_comspec_to_self(unsigned short envseg) {
697
static void set_comspec_to_self(unsigned short envseg) {
692
  unsigned short *psp_envseg = (void *)(0x2c); /* pointer to my env segment field in the PSP */
698
  unsigned short *psp_envseg = (void *)(0x2c); /* pointer to my env segment field in the PSP */