3 Copyright 2001-2005 John Coffman.
6 Licensed under the terms contained in the file 'COPYING' in the LILO
11 #include "../src/bdata.h"
13 #define DISK_VERSION "2.4"
16 #define putch bios_putc
17 #define getch bios_getc
18 #define printf cprintf
22 #define putch(c) fputc((c),stdout)
39 #define SECTOR_SIZE 512
41 #define nelem(a) (sizeof(a)/sizeof((a)[0]))
43 typedef unsigned char byte;
44 typedef unsigned short word;
45 typedef unsigned long dword;
47 extern union REGS __argr;
48 extern struct SREGS __argseg;
55 int num_hd = BD_MAX_HARD;
57 dword hma; /* highest memory address */
63 #define E820_MAGIC 0x534D4150
67 unsigned short base01;
69 unsigned char dtype; /* 0x93 for data */
70 unsigned char limit2; /* limit in low nibble, granularity & 32-bit in high nibble */
74 struct gdt_entry gdt[6];
103 if (get_fs() != FS_REG) {
105 printf("\nThe FS register has been modified.\n");
112 int hicopy (unsigned long to, unsigned long from, int wcount)
117 memset(gdt, 0, sizeof(gdt));
118 gdt[2].limit = gdt[3].limit = 0xFFFF;
119 gdt[2].dtype = gdt[3].dtype = 0x93;
121 gdt[2].base01 = from;
122 gdt[2].base2 = from>>16;
123 gdt[2].base3 = from>>24;
126 gdt[3].base2 = to>>16;
127 save = gdt[3].base3 = to>>24;
134 /*** gdt[3].base3 &= 0; / crosstalk */
135 int86x(0x15, ®, &oreg, &sreg);
138 if (oreg.x.cflag) status |= 0x100;
139 if (save!=gdt[3].base3) status |= 0x200;
144 unsigned long linear(void *ptr)
147 return ((unsigned long)sreg.ds<<4) + (unsigned int)ptr;
150 word hipeekw(long address)
153 hicopy(linear(&temp), address, 1);
157 int hipokew(long address, word value)
159 return hicopy(address, linear(&value), 1);
170 int86(0x10, ®, ®);
172 int86(0x10, ®, ®);
174 static word upper = 0;
176 __set_es(0x40); /* address BIOS data area */
177 upper = __peek_es(0x84);
178 if (upper < 24 || upper > 50) upper = 24;
180 reg.h.ah = 0x0F; /* get video mode */
181 int86(0x10, ®, ®);
182 upper |= (reg.h.ah-1);
184 reg.x.ax = 0x0600; /* blank screen area */
188 int86(0x10, ®, ®);
189 reg.h.ah = 2; /* set cursor position */
192 int86(0x10, ®, ®);
198 int86(0x10, ®, ®);
202 void bios_putc(char c)
208 do bios_putc(' '); while(col&7);
210 case '\n': bios_putc0('\r');
216 if (c>=' ' && c<0177) col++;
222 int a20(void) /* Return 1 if a20 is enabled, 0 if disabled */
256 void sizeit(unsigned long sectors)
258 static char suf[] = "KMGT";
262 /* print disk size in K,M,G,T */
265 if (sectors <= 999) {
266 printf("%ld%c", sectors, *cp);
270 while (sectors > 999999) {
274 if (sectors > 2999) {
278 sectors += 5; /* round decimal part */
280 fract = sectors % 100;
282 printf("%ld.%02d%c", sectors, fract, *cp);
286 void banner(char *version)
289 ">>>> Disk Detection and Parameter Display <<<<\n\n\n"
290 "Version %s, Copyright (C) 1999-2005 John Coffman <johninsd@san.rr.com>\n"
291 "Portions Copyright (C) 1996-2001 Robert de Bath, used with permission\n"
292 "Re-use and redistribution rights set forth in the file \"COPYING\".\n\n",
300 printf("Boot reported from DX = 0x%04x (boot device is 0x%02x in DL)\n", __argr.x.dx, __argr.h.dl);
301 if (__argr.h.dl == 0 || __argr.h.dl == 1) {
302 printf("If you booted from the %s floppy drive, then this is correct.",
303 __argr.h.dl ? "second" : "first");
304 } else if (__argr.h.dl >= 0x80 && __argr.h.dl <= 0x8f) {
305 printf("If you booted from %s hard drive, then this is correct.",
306 __argr.h.dl==0x80 ? "the first" :
307 __argr.h.dl==0x81 ? "the second" : "a" );
309 printf("It looks like the BIOS failed to report the boot device in DL.\n");
371 int outb(int port, int data)
384 static char s1[] = "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
388 printf( "!!! *** Warning: DOS is not running in REAL mode *** !!!\n"
389 "!!! *** Reported results may not be accurate *** !!!\n" );
397 printf("%s\n", i?"yes":"no");
401 void decimal(unsigned long value)
405 for (i=0; i<4; i++) {
409 if (v[3]) printf("%d,%03d,%03d,%03d", v[3], v[2], v[1], v[0]);
410 else if (v[2]) printf("%d,%03d,%03d", v[2], v[1], v[0]);
411 else if (v[1]) printf("%d,%03d", v[1], v[0]);
412 else printf("%d", v[0]);
416 void print_regs(union REGS *reg) {
417 printf("AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x\n",
418 reg->x.ax, reg->x.bx, reg->x.cx, reg->x.dx, reg->x.si, reg->x.di);
422 void print_sregs(struct SREGS *sreg) {
423 printf("DS=%04x ES=%04x CS=%04x SS=%04x\n",
424 sreg->ds, sreg->es, sreg->cs, sreg->ss);
433 return (__argseg.es+0x10 == __argseg.cs);
441 /* Must be standalone */
443 printf("\n\n\nHit <Enter> to continue, <^C> to quit ...");
446 if (ch==CTRL_C) exit(0);
448 if (ch != CR) printf(" %o", ch);
458 video_1 = inb(SEQ+1);
459 /* dirty hack for DELL Dimension 4300 computers */
463 static void print_carry(int flag)
465 printf(" Carry = %d\n", flag);
469 void get_equip_cfg(void)
471 static char *vmode[4] = { "reserved", "40x25 color",
472 "80x25 color", "80x25 monochrome" };
478 "Int 11h\t\t\t\t[PC][AT][PS/2]\n"
479 "Get Equipment Configuration\n\n"
481 flag = int86(0x11, ®, ®);
484 printf("\nHas floppy drive(s): "); yesno(flag&1);
485 printf("Has math coprocessor: "); yesno(flag&2);
486 printf("Has pointing device: "); yesno(flag&4);
487 printf("Initial video mode: %s\n", vmode[(flag>>4)&3]);
488 n = flag&1 ? ((flag>>6)&3)+1 : 0;
489 if (n) printf("Floppy drives installed: %d\n", ((flag>>6)&3)+1 );
491 printf("Serial interfaces: %d\n", n);
492 printf("Has game adapter: "); yesno(flag&4096);
494 printf("Parallel interfaces: %d\n", n);
498 void get_conv_mem(void)
504 "Int 12h\t\t\t\t[PC][AT][PS/2]\n"
505 "Get Conventional Memory Size\n\n"
507 mem = int86(0x12, ®, ®);
509 printf("\nThere is %dK of low memory. EBDA size = %dK EBDA starts at 0x%lx\n",
510 mem, 640-mem, (long)mem<<10 );
511 printf("\n(The A20 line is %sabled.)\n", a20() ? "en" : "dis");
515 void mov_ext_mem(void)
517 word status, temp, vtemp;
518 dword high, veryhigh;
524 "Int 15h Function 87h\t\t[AT][PS/2]\n"
525 "Move Extended Memory Block\n\n"
534 high = 1024L*(1024L+128)-2; /* 1Mb + 128K */
535 veryhigh = high+16L*1024L*1024L;
536 if (veryhigh >= hma) veryhigh=0;
541 temp = hipeekw(high);
542 status = hipokew(high, WORDA^temp);
543 printf("\nReturns:\n ");
547 print_carry((status>>8) & 1);
549 printf("\nR/W test at address %08lx ", high);
550 if (hipeekw(high) != (WORDA^temp)) errno |= 0x400;
552 if (hipeekw(high) != temp) errno |= 0x800;
553 printf("%ssuccessful\n", errno ? "un" : "");
554 if (errno) printf("Error code = 0x%04x\n", errno);
557 printf("R/W test at address %08lx ", veryhigh);
558 vtemp = hipeekw(veryhigh);
559 hipokew(veryhigh, WORDB^vtemp);
560 if (hipeekw(high) != temp) errno |= 0x200;
561 if (hipeekw(veryhigh) != (WORDB^vtemp)) errno |= 0x400;
562 hipokew(veryhigh, vtemp);
563 if (hipeekw(high) != temp) errno |= 0x200;
564 if (hipeekw(veryhigh) != vtemp) errno |= 0x800;
565 printf("%ssuccessful\n", errno ? "un" : "");
566 if (errno) printf("Error code = 0x%04x\n", errno);
569 printf("\nThere is crosstalk between the two addresses\n"
570 "The function does not support full 386 32-bit addressing.\n");
576 void get_ext_mem(void)
584 "Int 15h Function E820h\t\t[EXT]\n"
587 " EAX=0000E820 EBX=00000000 ECX=00000014 EDX=%lx\n\n",
592 dword start[NAREA], length[NAREA];
595 /* 00 000000000000 000000000000 (1) avail */
596 printf("EBX Start Length Type\n\n");
598 printf(" %02lx %04hx%08lx %04hx%08lx (%d) %s\n", b1,
599 (short)mem_map.start_hi, mem_map.start,
600 (short)mem_map.length_hi, mem_map.length, (int)mem_map.mtype,
601 mem_map.mtype == 1 ? "available" :
602 mem_map.mtype == 2 ? "reserved" :
603 mem_map.mtype == 3 ? "ACPI" :
604 mem_map.mtype == 4 ? "NVS" : "unknown-reserved");
605 if (mem_map.mtype==1 && mem_map.start_hi==0 && mem_map.start<=1024L*1024L) {
606 if (mem_map.length_hi==0) hma = mem_map.start+mem_map.length;
607 else hma = 0xFFF00000L;
610 start[i] = *(dword*)(((char*)&mem_map.start)+1);
611 length[i] = *(dword*)(((char*)&mem_map.length)+1);
621 for (k=0; k<i-1; k++) {
625 for (j=k+1; j<i; j++) {
629 if (!(ss < s && ee <= s || ss >= e && ee > e)) {
630 printf("*** Memory areas %d and %d overlap ***\n", k, j);
635 if (!ovlap) printf("No memory areas overlap\n");
637 printf("Returns:\n");
638 if (b==-1) print_carry(1);
639 else if (b==-2) printf(" EAX=<trash>\n");
640 else if (b==-3) printf(" EAX=%lx EBX=******** ECX=<trash>\n", E820_MAGIC);
641 else printf(" EAX=%lx EBX=00000000\n", E820_MAGIC);
642 printf("\nFunction is not supported.\n");
648 "Int 15h Function E801h\t\t[EXT]\n"
649 "Get Extended Memory Blocks\n\n"
653 int86(0x15, ®, &oreg);
654 printf("\nReturns:\n ");
656 print_carry(oreg.x.cflag);
659 printf("\nNumber of 1K blocks between 1M and 16M: %u\n", oreg.x.ax);
660 printf( "Number of 64K blocks above 16M: %u\n", oreg.x.bx);
661 t = 1024L*(oreg.x.ax+1024);
662 t += 64L*1024L*oreg.x.bx;
664 else if (hma!=t) printf("A different amount of memory is reported by this function\n");
666 else printf("\nFunction is not supported.\n");
670 "Int 15h Function 88h\t\t[AT][PS/2]\n"
671 "Get Extended Memory Size\n\n"
675 int86(0x15, ®, ®);
676 printf("\nReturns:\n ");
678 printf("\nThere is ");
679 decimal( (unsigned long)reg.x.ax );
680 printf("K of extended memory.\n");
682 t = (reg.x.ax + 1024L) * 1024L;
687 int get_video_mode(void)
693 "Int 10h Function 0Fh\t\t[MDA][CGA][PCjr]\n"
694 "Get Video Mode\t\t\t[EGA][MCGA][VGA]\n\n"
699 int86(0x10, ®, ®);
700 printf("\nReturns:\n ");
703 __set_es(0x40); /* address BIOS data area */
704 reg.h.bl = row = __peek_es(0x84);
705 printf("Fetch 0040:0084 (rows-1) to BL\n"
709 printf("\nVideo mode = 0x%02x (%dx%d %s)\n", m, col, row+1,
710 m==7 ? "monochrome" : m==3 ? "color" : "unknown");
711 printf("Active display page = %d\n", (int)reg.h.bh);
713 return !(m==7 || col<80);
717 int get_cfg_info(void)
721 "Int 10h Function 12h\t\t[EGA][VGA]\n"
723 "Get Configuration Information\n\n"
728 int86(0x10, ®, ®);
729 printf("\nReturns:\n ");
731 if (reg.h.bh > 1) return 0;
733 printf("\n%s display\n", reg.h.bh==0 ? "Color" : reg.h.bh==1 ? "Monochrome" : "Unknown");
734 printf("EGA memory = %dK\n", reg.h.bl <= 3 ? (reg.h.bl+1)*64 : 0);
735 printf("Feature bits = 0x%02x\n", (int)reg.h.ch);
736 printf("Configuration switch = 0x%02x\n", (int)reg.h.cl);
742 int enable_refresh(void)
746 "Int 10h Function 12h\t\t[VGA]\n"
748 "Enable Screen Refresh\n\n"
755 int86(0x10, ®, &oreg);
756 printf("\nReturns:\n ");
760 printf("Function is %ssupported.\n", oreg.h.al==0x12 ? "" : "NOT ");
761 if (oreg.x.dx != reg.x.dx || oreg.x.cx != reg.x.cx || oreg.x.si != reg.x.si
762 || oreg.x.di != reg.x.di)
763 printf("Error: Register(s) are not preserved.\n");
770 int get_comb_code(void)
772 static char *dcode[] = { "none", "Monochrome", "CGA", "reserved",
773 "EGA (color)", "EGA (mono)", "PGA", "VGA (monochrome)", "VGA (color)",
774 "reserved", "MCGA (digital color)", "MCGA (monochrome)", "MCGA (color)",
780 "Int 10h Function 1Ah\t\t[PS/2]\n"
782 "Get Display Combination Code\n\n"
785 reg.x.bx = reg.x.cx = 0;
787 int86(0x10, ®, ®);
788 printf("\nReturns:\n ");
790 if (reg.h.al != 0x1A) return 0;
792 code = reg.h.bl <= 12 ? reg.h.bl : 13;
793 printf("\nActive display: %s\n", dcode[code]);
794 code = reg.h.bh <= 12 ? reg.h.bh : 13;
795 printf("Inactive display: %s\n", dcode[code]);
797 return (reg.h.bl>=4);
800 static void print_io_status(int status)
802 static char *errmsg[] = {"no error", "invalid command", /* 0-1 */
803 "address mark not found", "disk write-protected", /* 2-3 */
804 "sector not found", "reset failed", "floppy disk removed", /* 4-6 */
805 "bad parameter table", "DMA overrun", /* 7-8 */
806 "DMA crossed 64k boundary", "bad sector flag", /* 9-A */
807 "bad track flag", "media type not found", /* B-C */
808 "invalid number of sectors on format", /* D */
809 "control data address mark detected", /* E */
810 "DMA arbitration level out of range", /* F */
811 "uncorrectable CRC or ECC data error", /* 10 */
812 "ECC corrected data error" /* 11 */
816 if (status <= 0x11) err = errmsg[status];
817 else switch(status) {
818 case 0x20: err = "controller failure"; break;
819 case 0x40: err = "seek failed"; break;
820 case 0x80: err = "disk timeout (failed to respond)"; break;
821 case 0xAA: err = "drive not ready"; break;
822 case 0xBB: err = "undefined error"; break;
823 case 0xCC: err = "write fault"; break;
824 case 0xE0: err = "status register error"; break;
825 case 0xFF: err = "sense operation failed"; break;
826 default: err = "???";
828 printf(" BIOS error code = 0x%02x (%s)\n", status, err);
838 "Int 13h Function 41h\t\t[EDD]\n"
839 "Check EDD Extensions Present (device %02xh)\n\n"
840 "Call With:\n ", dev);
845 int86(0x13, ®, &oreg);
846 printf("\nReturns:\n ");
848 print_carry(oreg.x.cflag);
850 if (oreg.x.cflag) print_io_status(oreg.h.ah);
851 else if (oreg.x.bx == 0xAA55 && (oreg.x.cx&EDD_SUBSET+EDD_LOCK+EDD_PACKET)) {
853 printf("\nEnhanced Disk Drive support: "); yesno(subset=oreg.x.cx&EDD_SUBSET);
854 printf("Drive locking and ejecting: "); yesno(oreg.x.cx&EDD_LOCK);
855 printf("Device access using packet calls: "); yesno(oreg.x.cx&EDD_PACKET);
856 printf("EDD extensions version%s (hex code %02xh)\n",
857 oreg.h.ah==0x30 ? " 3.0" : oreg.h.ah==0x21 ? " 1.1" : "" ,oreg.h.ah);
862 short size; /* size of this structure */
863 short flags; /* information flags */
864 long pcyls; /* number of physical cylinders */
865 long pheads; /* number of physical heads/cylinder */
866 long psects; /* number of physical sectors/track */
867 unsigned /* number of physical sectors on volume */
868 long sectors_lo, sectors_hi; /* this is 8 bytes long */
869 short sec_size; /* number of bytes per sector */
871 long params; /* EDD config params (valid only if EDD_SUBSET) */
875 m = !!(oreg.x.cx&EDD_SUBSET) && oreg.h.ah>=0x21;
877 "Int 13h Function 48h\t\t[EDD]\n"
878 "EDD Get Drive Parameters (device %02xh)\n\n"
879 "Call With:\n ", dev);
880 eddparam.size = sizeof(eddparam);
881 reg.x.si = &eddparam; /* DS:SI points to buffer */
887 int86x(0x13, ®, ®, &sreg);
888 printf("\nReturns:\n ");
892 print_carry(reg.x.cflag);
893 #define fl eddparam.flags
894 printf("\nDMA boundary errors handled transparently: "); yesno(fl&1);
895 printf("Geometry supplied: "); yesno(fl&2);
896 printf("Device is removable: "); yesno(fl&4);
897 printf("Device supports write with verify: "); yesno(fl&8);
899 printf("Device has change-line support: "); yesno(fl&16);
900 printf("Device is lockable: "); yesno(fl&32);
901 printf("No media present; geometry is set to maximum: "); yesno(fl&64);
903 printf("Disk geometry (");
905 printf("C:H:S) = %ld:%ld:%ld (", eddparam.pcyls, eddparam.pheads,
908 if (eddparam.sectors_hi == 0)
909 decimal(eddparam.sectors_lo);
910 else printf("0x%x%08x", eddparam.sectors_hi, eddparam.sectors_lo);
911 printf(" sectors)\n");
915 static char *cfunc[] = {
918 "Set Maximum PIO Mode",
920 "Set Default PIO Mode",
921 "Enable DMA Maximum Mode",
924 m = 0; /* start with subfn 0 */
927 "Int 13h Function 4Eh\t\t[EDD]\n"
929 "EDD Set Hardware Configuration (device %02xh)\n\n"
930 "Call With:\n ", dev);
934 int86(0x13, ®, ®);
935 printf("\nReturns:\n ");
937 print_carry(reg.x.cflag);
940 for (m=0; m<nelem(cfunc); m++) {
941 reg.x.ax = 0x4E00 + m;
943 int86(0x13, ®, ®);
944 printf("Subfn(%d): %s <-- ", m, cfunc[m]);
945 if (reg.x.cflag || reg.h.ah) {
946 printf("is not supported.\n");
949 printf("%s other drives on controller.\n",
950 reg.h.al ? "affects" : "does not affect");
962 static char *drvtyp[] = {"No drive present", "Floppy w/o change-line support",
963 "Floppy with change-line support"};
964 static char *dt[] = { "5.25\", 40 track, 360K",
965 "5.25\", 80 track, 1.2M",
966 "3.5\", 80 track, 720K",
967 "3.5\", 80 track, 1.44M" };
974 "Int 13h Function 15h\t\t[AT][PS/2]\n"
975 "Get Disk Type (device %02xh)\n\n"
976 "Call With:\n ", dev);
981 int86(0x13, ®, &oreg);
982 printf("\nReturns:\n ");
984 print_carry(oreg.x.cflag);
985 mm = (oreg.x.cflag==0 && oreg.h.ah!=0);
986 m = mm || (dev&0x80)==0;
987 if (oreg.x.cflag) print_io_status((int)oreg.h.ah);
990 oreg.h.ah < 3 ? drvtyp[oreg.h.ah] :
991 oreg.h.ah != 3 ? "unknown drive type" : "");
992 if (oreg.h.ah == 3) {
993 printf("Fixed disk with ");
994 sect = (long)oreg.x.cx<<16 | oreg.x.dx;
996 printf(" sectors = ");
1005 "Int 13h Function 08h\t\t[PC][AT][PS/2]\n"
1006 "Get Drive Parameters (device %02xh)\n\n"
1007 "Call With:\n ", dev);
1017 int86x(0x13, ®, &oreg, &sreg);
1018 printf("\nReturns:\n ");
1022 print_carry(oreg.x.cflag);
1023 if (oreg.x.cflag) print_io_status((int)oreg.h.ah);
1025 last_good_disk = dev;
1029 printf("Disk type %d = %s\n", (int)oreg.h.bl,
1030 dt[(oreg.h.bl-1)&3] );
1031 printf("Parameter table at %04x:%04x\n",
1032 sreg.es, oreg.x.di);
1035 if (oreg.x.bx != reg.x.bx)
1036 printf("Error: Hard disk BIOS should not touch BX\n");
1037 if (sreg.es != 0 || oreg.x.di != reg.x.di)
1038 printf("Error: Hard disk BIOS should not touch ES:DI\n");
1040 s = (oreg.h.cl & 0x3F); /* sectors 1..63 */
1042 h = (int)oreg.h.dh + 1; /* heads 0..254 */
1043 c = (((oreg.h.cl & 0xC0)<<2) | oreg.h.ch) + 1;
1044 printf("Disk geometry (C:H:S) = %d:%d:%d (", c, h, s);
1045 decimal( sect=(long)c*h*s );
1046 printf(" sectors) = ");
1048 printf("\n%s disks on system = %d\n",
1049 dev&0x80 ? "Fixed" : "Floppy", oreg.h.dl);
1050 if (s > 63) printf("BIOS BUG!!! sectors returned as zero; 64 assumed\n");
1051 if (h > 255) printf("BIOS BUG!!! heads > 255; BIOS is not IBM compatible\n");
1053 if (dev == 0x80) num_hd = oreg.h.dl;
1064 int do_rw(int tries)
1069 int86x(0x13, ®, &oreg, &sreg);
1070 if (oreg.x.cflag == 0 && oreg.x.ax == 0x0001) return 0;
1073 int86(0x13, &oreg, &oreg);
1079 void do_get_pt(int dev)
1082 char buf[SECTOR_SIZE];
1084 printf("Get partition table (device = 0x%x): ", dev);
1090 reg.x.dx = dev & 0xFF;
1092 if (m) print_io_status(m);
1093 else printf(" okay");
1106 "Int 10h Function 4Fh\t\t[VESA]\n"
1108 "Check VESA Extensions Present\n\n"
1114 reg.x.di = &vesa[0];
1118 int86x(0x10, ®, &oreg, &sreg);
1119 printf("\nReturns:\n ");
1123 if (oreg.x.ax != 0x004F) {
1124 printf("\nVESA BIOS extensions not present\n");
1127 if (strncmp(vesa, "VESA", 4)) {
1128 printf("\nVESA signature not found\n");
1132 printf("\n\"%s\" BIOS extensions present\n", vesa);
1136 "Int 10h Function 4Fh\t\t[VESA]\n"
1138 "Get VESA Mode Information 1\n\n"
1144 reg.x.di = &vesa[0];
1148 int86x(0x10, ®, &oreg, &sreg);
1149 printf("\nReturns:\n ");
1153 i = *(int*)vesa; /* get mode bits */
1154 printf("\nMode bits: 0x%04x\n", i);
1155 printf("640x480x256 mode supported: ");
1156 yesno(!(0x19 & ~i));
1160 "Int 10h Function 4Fh\t\t[VESA]\n"
1162 "Get VESA Mode Information 3\n\n"
1168 reg.x.di = &vesa[0];
1172 int86x(0x10, ®, &oreg, &sreg);
1173 printf("\nReturns:\n ");
1177 i = *(int*)vesa; /* get mode bits */
1178 printf("\nMode bits: 0x%04x\n", i);
1179 printf("800x600x256 mode supported: ");
1180 yesno(!(0x19 & ~i));
1189 printf("FS=%04x\n", get_fs());
1194 /** atexit(pause); **/
1195 video_fix(); /* for Dumb DELL computers */
1197 #if DEBUG>=1 && __MSDOS__==0
1198 printf("Beginning of '___cstartup'\n");
1199 print_regs(&__argr);
1200 printf("DS=%04x ES=%04x CS=%04x SS=%04x SP=%04x BP=%04x\n",
1201 __argseg.ds, __argseg.es, __argseg.cs, __argseg.ss,
1202 __argr.x.flags, __argr.x.cflag);
1205 printf("\nBeginning of '_main'\n");
1210 banner(DISK_VERSION);
1215 sizeit((long)40*2*9); putch('\n');
1216 sizeit((long)80*2*15); putch('\n');
1217 sizeit((long)80*2*18); putch('\n');
1218 sizeit((long)80*2*36); putch('\n');
1219 sizeit((long)1024*255*63); putch('\n');
1220 sizeit((long)24000*512); putch('\n');
1226 if (hma>1024L*1024L) mov_ext_mem();
1227 m = get_video_mode();
1228 if (m) m = get_cfg_info();
1229 if (m) m = enable_refresh();
1230 if (m) m = get_comb_code();
1233 printf("\n\nm=%x\n", m);
1236 for (i=BD_MAX_FLOPPY; i && m;) {
1239 if (--i == 0 && (dev & 0x80)==0) {
1243 if ((dev & 0x7F) >= num_hd) m = 0;
1247 for (dev = 0x80; dev <= last_good_disk; dev++) do_get_pt(dev);
1250 printf("\n\nInitial SEQ reg 1: 0x%02x\n", video_1);
1252 printf("The FS register was %smodified during the tests.\n",
1253 fs_mod ? "" : "NOT ");