+ char *a;
+ int i;
+
+ // allow changing default mode from command line
+ for (i=1;i < argc;) {
+ a = argvar[i++];
+
+ if (*a == '-') {
+ do { a++; } while (*a == '-');
+
+ if (!strcmp(a,"mx")) {
+ // (based on src/lib/modex16.c)
+ // 1 = 320x240
+ // 2 = 160x120
+ // 3 = 320x200
+ // 4 = 192x144
+ // 5 = 256x192
+ vgamodex_mode = (sword)strtoul(argvar[i++],NULL,0);
+ }
+ else {
+ fprintf(stderr,"Unknown switch %s\n",a);
+ return;
+ }
+ }
+ else {
+ fprintf(stderr,"Unknown command arg %s\n",a);
+ return;
+ }
+ }
+
+ // DOSLIB: check our environment
+ probe_dos();
+
+ // DOSLIB: what CPU are we using?
+ // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.
+ // So this code by itself shouldn't care too much what CPU it's running on. Except that other
+ // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for
+ // the CPU to carry out tasks. --J.C.
+ cpu_probe();
+
+ // DOSLIB: check for VGA
+ if (!probe_vga()) {
+ printf("VGA probe failed\n");
+ return;
+ }
+ // hardware must be VGA or higher!
+ if (!(vga_state.vga_flags & VGA_IS_VGA)) {
+ printf("This program requires VGA or higher graphics hardware\n");
+ return;
+ }
+