Subversion Repositories SvarDOS

Rev

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

Rev 2169 Rev 2181
Line 75... Line 75...
75
  unsigned short keybid;
75
  unsigned short keybid;
76
  unsigned short countryid; /* 1=USA, 33=FR, 48=PL, etc */
76
  unsigned short countryid; /* 1=USA, 33=FR, 48=PL, etc */
77
};
77
};
78
 
78
 
79
 
79
 
-
 
80
/* a special routine to display a message trough the video BIOS. this is much
-
 
81
 * slower than direct writes to video memory, but it is the only way to make
-
 
82
 * provox read such info message */
-
 
83
static void infomsg(unsigned char row, unsigned char col, const char *msg, unsigned char attr, unsigned short maxlen);
-
 
84
#pragma aux infomsg = \
-
 
85
"mov cx, 1" \
-
 
86
"xor bh, bh" \
-
 
87
"NEXT:" \
-
 
88
/* put cursor at position [dl,dh] */ \
-
 
89
"mov ah, 0x02" \
-
 
90
"int 0x10" \
-
 
91
/* am I allowed to print more? */ \
-
 
92
"test di, di" \
-
 
93
"jz DONE" \
-
 
94
/* write char (unless nul terminator) */ \
-
 
95
"mov ah, 0x09" \
-
 
96
"lodsb" \
-
 
97
"test al, al" \
-
 
98
"jz DONE" \
-
 
99
"int 0x10" \
-
 
100
"inc dl" \
-
 
101
"dec di" \
-
 
102
"jmp short NEXT" \
-
 
103
"DONE:" \
-
 
104
modify [ax bx cx dx si di] \
-
 
105
parm [dh] [dl] [si] [bl] [di]
-
 
106
 
-
 
107
 
80
/* install a dummy int24h handler that always fails. this is to avoid the
108
/* install a dummy int24h handler that always fails. this is to avoid the
81
 * annoying "abort, retry, fail... DOS messages. */
109
 * annoying "abort, retry, fail... DOS messages. */
82
static void install_int24(void) {
110
static void install_int24(void) {
83
  static unsigned char handler[] = { /* contains machine code instructions */
111
  static unsigned char handler[] = { /* contains machine code instructions */
84
    0xB0, 0x03,  /* mov al, 3   ; tell DOS the action has to FAIL   */
112
    0xB0, 0x03,  /* mov al, 3   ; tell DOS the action has to FAIL   */
Line 148... Line 176...
148
      if (s[i] == 0) {
176
      if (s[i] == 0) {
149
        len = i;
177
        len = i;
150
        break;
178
        break;
151
      }
179
      }
152
    }
180
    }
153
    mdr_cout_str(y++, x, s, attr, len);
181
    infomsg(y++, x, s, attr, len);
154
    s += len;
182
    s += len;
155
    if (*s == 0) break;
183
    if (*s == 0) break;
156
    s += 1; /* skip the whitespace char */
184
    s += 1; /* skip the whitespace char */
157
  }
185
  }
158
  return(lincount);
186
  return(lincount);
Line 240... Line 268...
240
    }
268
    }
241
 
269
 
242
    for (y = ypos; y < (ypos + height); y++) {
270
    for (y = ypos; y < (ypos + height); y++) {
243
      mdr_cout_char(y, xpos-1, 0xB3, COLOR_SELECT); /* left side */
271
      mdr_cout_char(y, xpos-1, 0xB3, COLOR_SELECT); /* left side */
244
      if (y - ypos == i) {
272
      if (y - ypos == i) {
245
        mdr_cout_char(y, xpos+width+2, '=', COLOR_SELECT); /* cursor */
273
        mdr_cout_char(y, xpos+width+2, ' ', 0); /* cursor */
246
      } else {
274
      } else {
247
        mdr_cout_char(y, xpos+width+2, 0xB3, COLOR_SELECT); /* right side */
275
        mdr_cout_char(y, xpos+width+2, 0xB3, COLOR_SELECT); /* right side */
248
      }
276
      }
249
    }
277
    }
250
 
278
 
Line 360... Line 388...
360
  };
388
  };
361
 
389
 
362
  newscreen(1);
390
  newscreen(1);
363
  msg = svarlang_strid(0x0100); /* "Welcome to SvarDOS" */
391
  msg = svarlang_strid(0x0100); /* "Welcome to SvarDOS" */
364
  x = 40 - (strlen(msg) >> 1);
392
  x = 40 - (strlen(msg) >> 1);
365
  mdr_cout_str(4, x, msg, COLOR_BODY, 80);
393
  infomsg(4, x, msg, COLOR_BODY, 80);
366
  mdr_cout_char_rep(5, x, '=', COLOR_BODY, strlen(msg));
394
  mdr_cout_char_rep(5, x, '=', COLOR_BODY, strlen(msg));
367
 
395
 
368
  /* center out the string "Please select your language..." */
396
  /* center out the string "Please select your language..." */
369
  msg = svarlang_str(1, 1); /* "Please select your language from the list below:" */
397
  msg = svarlang_str(1, 1); /* "Please select your language from the list below:" */
370
  if (strlen(msg) > 74) {
398
  if (strlen(msg) > 74) {
371
    putstringwrap(8, 1, COLOR_BODY, msg);
399
    putstringwrap(8, 1, COLOR_BODY, msg);
372
  } else {
400
  } else {
373
    mdr_cout_str(8, 40 - (strlen(msg) / 2), msg, COLOR_BODY, 80);
401
    infomsg(8, 40 - (strlen(msg) / 2), msg, COLOR_BODY, 80);
374
  }
402
  }
375
 
403
 
376
  choice = menuselect(11, 9, langlist, -1);
404
  choice = menuselect(11, 9, langlist, -1);
377
  if (choice < 0) return(MENUPREV);
405
  if (choice < 0) return(MENUPREV);
378
 
406
 
Line 823... Line 851...
823
  /* if not formatted, propose to format it right away (try to create a directory) */
851
  /* if not formatted, propose to format it right away (try to create a directory) */
824
  if (test_drive_write(cselecteddrive) != 0) {
852
  if (test_drive_write(cselecteddrive) != 0) {
825
    const char *list[3];
853
    const char *list[3];
826
    newscreen(0);
854
    newscreen(0);
827
    snprintf(buff, sizeof(buff), svarlang_str(3, 3), cselecteddrive); /* "ERROR: Drive %c: seems to be unformated. Do you wish to format it?") */
855
    snprintf(buff, sizeof(buff), svarlang_str(3, 3), cselecteddrive); /* "ERROR: Drive %c: seems to be unformated. Do you wish to format it?") */
828
    mdr_cout_str(7, 1, buff, COLOR_BODY, 80);
856
    infomsg(7, 1, buff, COLOR_BODY, 80);
829
 
857
 
830
    snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
858
    snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
831
    list[0] = buff;
859
    list[0] = buff;
832
    list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
860
    list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
833
    list[2] = NULL;
861
    list[2] = NULL;
Line 879... Line 907...
879
    const char *list[3];
907
    const char *list[3];
880
    list[0] = svarlang_strid(0x0001); /* Install SvarDOS */
908
    list[0] = svarlang_strid(0x0001); /* Install SvarDOS */
881
    list[1] = svarlang_strid(0x0002); /* Quit to DOS */
909
    list[1] = svarlang_strid(0x0002); /* Quit to DOS */
882
    list[2] = NULL;
910
    list[2] = NULL;
883
    snprintf(buff, sizeof(buff), svarlang_strid(0x0306), cselecteddrive); /* "The installation of SvarDOS to %c: is about to begin." */
911
    snprintf(buff, sizeof(buff), svarlang_strid(0x0306), cselecteddrive); /* "The installation of SvarDOS to %c: is about to begin." */
884
    mdr_cout_str(7, 40 - (strlen(buff) / 2), buff, COLOR_BODY, 80);
912
    infomsg(7, 40 - (strlen(buff) / 2), buff, COLOR_BODY, 80);
885
    choice = menuselect(10, 2, list, -1);
913
    choice = menuselect(10, 2, list, -1);
886
    if (choice < 0) return(MENUPREV);
914
    if (choice < 0) return(MENUPREV);
887
    if (choice == 1) return(MENUQUIT);
915
    if (choice == 1) return(MENUQUIT);
888
 
916
 
889
    /* update the disk's MBR, transfer the boot system, make sure the partition
917
    /* update the disk's MBR, transfer the boot system, make sure the partition
Line 1154... Line 1182...
1154
  newscreen(3);
1182
  newscreen(3);
1155
 
1183
 
1156
  /* load pkg list */
1184
  /* load pkg list */
1157
  fd = fopen("install.lst", "rb");
1185
  fd = fopen("install.lst", "rb");
1158
  if (fd == NULL) {
1186
  if (fd == NULL) {
1159
    mdr_cout_str(10, 30, "ERROR: INSTALL.LST NOT FOUND", COLOR_BODY, 80);
1187
    infomsg(10, 30, "ERROR: INSTALL.LST NOT FOUND", COLOR_BODY, 80);
1160
    mdr_dos_getkey();
1188
    mdr_dos_getkey();
1161
    return(-1);
1189
    return(-1);
1162
  }
1190
  }
1163
  pkglistflen = fread(pkglist, 1, sizeof(pkglist) - 2, fd);
1191
  pkglistflen = fread(pkglist, 1, sizeof(pkglist) - 2, fd);
1164
  fclose(fd);
1192
  fclose(fd);
1165
  if (pkglistflen == sizeof(pkglist) - 2) {
1193
  if (pkglistflen == sizeof(pkglist) - 2) {
1166
    mdr_cout_str(10, 30, "ERROR: INSTALL.LST TOO LARGE", COLOR_BODY, 80);
1194
    infomsg(10, 30, "ERROR: INSTALL.LST TOO LARGE", COLOR_BODY, 80);
1167
    mdr_dos_getkey();
1195
    mdr_dos_getkey();
1168
    return(-1);
1196
    return(-1);
1169
  }
1197
  }
1170
  /* mark the end of list */
1198
  /* mark the end of list */
1171
  pkglist[pkglistflen] = 0;
1199
  pkglist[pkglistflen] = 0;
Line 1224... Line 1252...
1224
    }
1252
    }
1225
 
1253
 
1226
    /* copy the package */
1254
    /* copy the package */
1227
    snprintf(buff, sizeof(buff), svarlang_strid(0x0400), i+1, pkglistlen, pkgptr); /* "Copying package %d/%d: %s" */
1255
    snprintf(buff, sizeof(buff), svarlang_strid(0x0400), i+1, pkglistlen, pkgptr); /* "Copying package %d/%d: %s" */
1228
    strcat(buff, "       ");
1256
    strcat(buff, "       ");
1229
    mdr_cout_str(10, 1, buff, COLOR_BODY, 40);
1257
    infomsg(10, 1, buff, COLOR_BODY, 80);
1230
 
1258
 
1231
    /* proceed with package copy */
1259
    /* proceed with package copy */
1232
    sprintf(buff, "%c:\\TEMP\\%s.svp", drvletter, pkgptr);
1260
    sprintf(buff, "%c:\\TEMP\\%s.svp", drvletter, pkgptr);
1233
    if (fcopy(buff, buff + 8, buff, sizeof(buff)) != 0) {
1261
    if (fcopy(buff, buff + 8, buff, sizeof(buff)) != 0) {
1234
      mdr_cout_str(10, 30, "READ ERROR", COLOR_BODY, 80);
1262
      infomsg(10, 30, "READ ERROR", COLOR_BODY, 80);
1235
      mdr_dos_getkey();
1263
      mdr_dos_getkey();
1236
      return(-1);
1264
      return(-1);
1237
    }
1265
    }
1238
    /* jump to next entry or end of list and zero out the pkg name in the process */
1266
    /* jump to next entry or end of list and zero out the pkg name in the process */
1239
    while ((*pkgptr != 0) && (*pkgptr != 0xff)) {
1267
    while ((*pkgptr != 0) && (*pkgptr != 0xff)) {