Subversion Repositories SvarDOS

Rev

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

Rev 2157 Rev 2158
Line 628... Line 628...
628
};
628
};
629
#pragma pack (pop)
629
#pragma pack (pop)
630
 
630
 
631
 
631
 
632
/* get the DOS drive data table list */
632
/* get the DOS drive data table list */
633
static struct dos_udsc far *get_dos_udsc(void)  {
633
static struct dos_udsc far *get_dos_udsc(void);
634
  unsigned short udsc_seg = 0, udsc_off = 0;
634
#pragma aux get_dos_udsc = \
635
  _asm {
635
"push ds" \
636
    push ds
636
"mov ax, 0x0803" \
-
 
637
"int 0x2f" /* drive data table list is in DS:DI, error if DI is 0xffff */ \
637
    push di
638
"push ds" \
638
 
-
 
639
    mov ax, 0x0803
639
"pop es" \
640
    int 0x2f
640
"pop ds" \
641
    /* drive data table list is in DS:DI now */
-
 
642
    mov udsc_seg, ds
641
"cmp di, 0xffff" \
643
    mov udsc_off, di
642
"jne DONE" \
644
 
-
 
645
    pop di
643
"xor di, di" \
646
    pop ds
644
"mov es, di" \
647
  }
645
"DONE:" \
648
  if (udsc_off == 0xffff) return(NULL);
646
modify [ax] \
649
  return(MK_FP(udsc_seg, udsc_off));
647
value [es di]
650
}
-
 
651
 
648
 
652
 
649
 
653
/* returns 0 if fsid is a valid (recognized) filesystem for SvarDOS install  */
650
/* returns 0 if fsid is a valid (recognized) filesystem for SvarDOS install  */
654
static int is_fstype_valid(unsigned char fsid) {
651
static int is_fstype_valid(unsigned char fsid) {
655
  switch (fsid) {
652
  switch (fsid) {
Line 696... Line 693...
696
      drives[listlen].hd = drv & 3;
693
      drives[listlen].hd = drv & 3;
697
      drives[listlen].partid = i;
694
      drives[listlen].partid = i;
698
      drives[listlen].start_lba = ((unsigned long *)entry)[2];
695
      drives[listlen].start_lba = ((unsigned long *)entry)[2];
699
      drives[listlen].tot_sect = ((unsigned long *)entry)[3];
696
      drives[listlen].tot_sect = ((unsigned long *)entry)[3];
700
 
697
 
701
      /* now iterate over DOS drives and try to match ont to this MBR entry */
698
      /* now iterate over DOS drives and try to match one to this MBR entry */
702
      udsc_node = udsc_root;
699
      udsc_node = udsc_root;
703
      while (udsc_node != NULL) {
700
      while (udsc_node != NULL) {
704
        if (udsc_node->hd != drv) goto NEXT;
701
        if (udsc_node->hd != drv) goto NEXT;
705
        if (udsc_node->start_lba != drives[listlen].start_lba) goto NEXT;
702
        if (udsc_node->start_lba != drives[listlen].start_lba) goto NEXT;
706
 
703
 
Line 1262... Line 1259...
1262
  mdr_dos_getkey();
1259
  mdr_dos_getkey();
1263
  reboot();
1260
  reboot();
1264
}
1261
}
1265
 
1262
 
1266
 
1263
 
-
 
1264
static void reinit_ega(void);
-
 
1265
#pragma aux reinit_ega = \
-
 
1266
"mov ah, 0x0f" /* get current video mode */ \
-
 
1267
"int 0x10"     /* al contains the current video mode now */ \
-
 
1268
"or al, 128"   /* set AL's high bit so BIOS does not flush VRAM (EGA+) */ \
-
 
1269
"xor ah, ah"   /* re-set video mode (to whatever is set in AL) */ \
-
 
1270
"int 0x10" \
-
 
1271
modify [ax bx]
-
 
1272
 
-
 
1273
 
1267
static void loadcp(const struct slocales *locales) {
1274
static void loadcp(const struct slocales *locales) {
1268
  char buff[64];
1275
  char buff[64];
1269
  if (locales->codepage == 437) return;
1276
  if (locales->codepage == 437) return;
1270
  mdr_cout_locate(1, 0);
1277
  mdr_cout_locate(1, 0);
1271
  if (locales->egafile == 1) {
1278
  if (locales->egafile == 1) {
Line 1277... Line 1284...
1277
  snprintf(buff, sizeof(buff), "MODE CON CP SEL=%u > NUL", locales->codepage);
1284
  snprintf(buff, sizeof(buff), "MODE CON CP SEL=%u > NUL", locales->codepage);
1278
  exec(buff);
1285
  exec(buff);
1279
  /* below I re-init the video controller - apparently this is required if
1286
  /* below I re-init the video controller - apparently this is required if
1280
   * I want the new glyph symbols to be actually applied, at least some
1287
   * I want the new glyph symbols to be actually applied, at least some
1281
   * (broken?) BIOSes, like VBox, apply glyphs only at next video mode change */
1288
   * (broken?) BIOSes, like VBox, apply glyphs only at next video mode change */
1282
  _asm {
-
 
1283
    push bx
-
 
1284
    mov ah, 0x0F  /* get current video mode */
-
 
1285
    int 0x10      /* al contains the current video mode now */
-
 
1286
    or al, 128    /* set high bit of AL to instruct BIOS not to flush VRAM's content (EGA+) */
-
 
1287
    xor ah, ah    /* re-set video mode (to whatever is set in AL) */
-
 
1288
    int 0x10
1289
  reinit_ega();
1289
    pop bx
-
 
1290
  }
-
 
1291
}
1290
}
1292
 
1291
 
1293
 
1292
 
1294
int main(void) {
1293
int main(void) {
1295
  struct slocales locales;
1294
  struct slocales locales;