Subversion Repositories SvarDOS

Rev

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

Rev 475 Rev 478
Line 26... Line 26...
26
#include <string.h>
26
#include <string.h>
27
 
27
 
28
#include "env.h"
28
#include "env.h"
29
#include "helpers.h"
29
#include "helpers.h"
30
 
30
 
31
#include "rmod.h"
31
#include "rmodcore.h"
32
 
32
 
33
#include "rmodinit.h"
33
#include "rmodinit.h"
34
 
34
 
35
 
35
 
36
/* returns far pointer to rmod's settings block on success */
36
/* returns far pointer to rmod's settings block on success */
37
struct rmod_props far *rmod_install(unsigned short envsize) {
37
struct rmod_props far *rmod_install(unsigned short envsize) {
38
  char far *myptr, far *mcb;
38
  char far *myptr, far *mcb;
39
  unsigned short far *owner;
39
  unsigned short far *owner;
40
  const unsigned short sizeof_rmodandprops_paras = (0x100 + rmod_len + sizeof(struct rmod_props) + 15) / 16;
40
  const unsigned short sizeof_rmodandprops_paras = (0x100 + rmodcore_len + sizeof(struct rmod_props) + 15) / 16;
41
  unsigned short rmodseg = 0xffff;
41
  unsigned short rmodseg = 0xffff;
42
  unsigned short envseg, origenvseg;
42
  unsigned short envseg, origenvseg;
43
  struct rmod_props far *res;
43
  struct rmod_props far *res;
44
 
44
 
45
  /* read my current env segment from PSP and save it */
45
  /* read my current env segment from PSP and save it */
Line 112... Line 112...
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
  }
115
  }
116
  myptr = MK_FP(rmodseg, 0x100);
116
  myptr = MK_FP(rmodseg, 0x100);
117
  _fmemcpy(myptr, rmod, rmod_len);
117
  _fmemcpy(myptr, rmodcore, rmodcore_len);
118
 
118
 
119
  /* mark rmod memory as "self owned" */
119
  /* mark rmod memory as "self owned" */
120
  mcb = MK_FP(rmodseg - 1, 0);
120
  mcb = MK_FP(rmodseg - 1, 0);
121
  owner = (void far *)(mcb + 1);
121
  owner = (void far *)(mcb + 1);
122
  *owner = rmodseg;
122
  *owner = rmodseg;
Line 134... Line 134...
134
    owner[0] = 0;
134
    owner[0] = 0;
135
    owner[1] = 0;
135
    owner[1] = 0;
136
  }
136
  }
137
 
137
 
138
  /* prepare result (rmod props) */
138
  /* prepare result (rmod props) */
139
  res = MK_FP(rmodseg, 0x100 + rmod_len);
139
  res = MK_FP(rmodseg, 0x100 + rmodcore_len);
140
  _fmemset(res, 0, sizeof(*res));  /* zero out */
140
  _fmemset(res, 0, sizeof(*res));  /* zero out */
141
  res->rmodseg = rmodseg;          /* rmod segment */
141
  res->rmodseg = rmodseg;          /* rmod segment */
142
  res->inputbuf[0] = 128;          /* input buffer for INT 0x21, AH=0Ah*/
142
  res->inputbuf[0] = 128;          /* input buffer for INT 0x21, AH=0Ah*/
143
  res->origenvseg = origenvseg;    /* original environment segment */
143
  res->origenvseg = origenvseg;    /* original environment segment */
144
 
144
 
Line 197... Line 197...
197
   * command-line tail should contain a single character '\r' */
197
   * command-line tail should contain a single character '\r' */
198
  if ((cmdtail[0] != 1) || (cmdtail[1] != '\n')) return(NULL);
198
  if ((cmdtail[0] != 1) || (cmdtail[1] != '\n')) return(NULL);
199
  cmdtail[0] = 0;
199
  cmdtail[0] = 0;
200
  cmdtail[1] = '\r';
200
  cmdtail[1] = '\r';
201
  /* */
201
  /* */
202
  return(MK_FP(*parent, 0x100 + rmod_len));
202
  return(MK_FP(*parent, 0x100 + rmodcore_len));
203
}
203
}
204
 
204
 
205
 
205
 
206
/* update rmod's pointer to comspec */
206
/* update rmod's pointer to comspec */
207
void rmod_updatecomspecptr(unsigned short rmod_seg, unsigned short env_seg) {
207
void rmod_updatecomspecptr(unsigned short rmod_seg, unsigned short env_seg) {