Subversion Repositories SvarDOS

Rev

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

Rev 1590 Rev 1591
Line 102... Line 102...
102
  if (rmodseg == 0xffff) {
102
  if (rmodseg == 0xffff) {
103
    outputnl("malloc error");
103
    outputnl("malloc error");
104
    return(NULL);
104
    return(NULL);
105
  }
105
  }
106
 
106
 
107
  /* copy my own PSP where RMOD is about to land, so it has a proper PSP as well */
107
  /* generate a new PSP where RMOD is about to land */
-
 
108
  _asm {
108
  /* take care to init the JFT (20 bytes starting at offset 0x18) to 0xff, which
109
    push dx
109
   * essentially means "empty JFT slot" */
110
    mov ah, 0x26 /* CREATE NEW PROGRAM SEGMENT PREFIX (DOS 1+) */
110
  myptr = MK_FP(rmodseg, 0);
111
    mov dx, rmodseg
111
  {
-
 
112
    unsigned short i;
112
    int 0x21
113
    char *mypsp = (void *)0;
113
    pop dx
114
    for (i = 0; i < 0x100; i++) myptr[i] = mypsp[i];
-
 
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
  }
114
  }
117
 
115
 
-
 
116
  myptr = MK_FP(rmodseg, 0);
-
 
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