Subversion Repositories SvarDOS

Rev

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

Rev 1589 Rev 1590
Line 110... Line 110...
110
  myptr = MK_FP(rmodseg, 0);
110
  myptr = MK_FP(rmodseg, 0);
111
  {
111
  {
112
    unsigned short i;
112
    unsigned short i;
113
    char *mypsp = (void *)0;
113
    char *mypsp = (void *)0;
114
    for (i = 0; i < 0x100; i++) myptr[i] = mypsp[i];
114
    for (i = 0; i < 0x100; i++) myptr[i] = mypsp[i];
115
    for (i = 0x18; i < 0x18+20; i++) myptr[i] = 0xff;
115
    /* for (i = 0x18; i < 0x18+20; i++) myptr[i] = 0xff; */ /* do NOT close file handlers, RMOD's children might need stdin/stdout/etc */
116
  }
116
  }
117
 
117
 
118
  /* patch up RMOD's PSP: Parent's PSP segment @ 0x16-0x17 */
118
  /* patch up RMOD's PSP: Parent's PSP segment @ 0x16-0x17 */
119
  myptr[0x16] = rmodseg & 0xff; /* RMOD is his own parent */
119
  myptr[0x16] = rmodseg & 0xff; /* RMOD is his own parent */
120
  myptr[0x17] = rmodseg >> 8;
120
  myptr[0x17] = rmodseg >> 8;
121
 
121
 
122
  /* patch up RMOD's PSP: SS:SP pointer @ 0x2E-0x31  --  I abuse the PSP's
122
  /* patch up RMOD's PSP: SS:SP pointer @ 0x2E-0x31  --  I abuse the PSP's
123
   * command line tail as stack, but I do NOT set the stacat the end of the
123
   * command line tail as stack, but I do NOT set the stack at the end of the
124
   * tail. E. C. Masloch kindly explained why this would be a bad idea:
124
   * tail. E. C. Masloch kindly explained why this would be a bad idea:
125
   *
125
   *
126
   * "This is wrong and will potentially overwrite part of your buffers that
126
   * "This is wrong and will potentially overwrite part of your buffers that
127
   * start past the PSP. This is because the dword [PSP:2Eh] is not used merely
127
   * start past the PSP. This is because the dword [PSP:2Eh] is not used merely
128
   * to set SS:SP but rather to find the stack frame created by the int 21h
128
   * to set SS:SP but rather to find the stack frame created by the int 21h