X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fbsod.c;h=680475d5b8cd2233ecf5b5dbe52cc052473a827f;hb=3f438031d610c7e15fd33876a879b97e290e05fb;hp=008b60fdb52047c5a7a5846d6a5ae6f7146f4f4a;hpb=6a1da724858673ac40aa13a9612340d8bed8c7b9;p=xscreensaver diff --git a/hacks/bsod.c b/hacks/bsod.c index 008b60fd..680475d5 100644 --- a/hacks/bsod.c +++ b/hacks/bsod.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1998-2003 Jamie Zawinski +/* xscreensaver, Copyright (c) 1998-2005 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -16,6 +16,7 @@ #include #include "screenhack.h" #include "xpm-pixmap.h" +#include "apple2.h" #include #include #include @@ -293,12 +294,84 @@ windows (Display *dpy, Window window, int delay, int which) const char *wmeb = (" System halted."); +# ifdef __GNUC__ + __extension__ /* don't warn about "string length is greater than the + length ISO C89 compilers are required to support" + in the following string constant... */ +# endif + + const char *wxpa = /* From Wm. Rhodes */ + ("A problem has been detected and windows has been shut down to prevent " + "damage\n" + "to your computer.\n" + "\n" + "If this is the first time you've seen this Stop error screen,\n" + "restart your computer. If this screen appears again, follow\n" + "these steps:\n" + "\n" + "Check to be sure you have adequate disk space. If a driver is\n" + "identified in the Stop message, disable the driver or check\n" + "with the manufacturer for driver updates. Try changing video\n" + "adapters.\n" + "\n" + "Check with your hardware vendor for any BIOS updates. Disable\n" + "BIOS memory options such as caching or shadowing. If you need\n" + "to use Safe Mode to remove or disable components, restart your\n" + "computer, press F8 to select Advanced Startup Options, and then\n" + "select Safe Mode.\n" + "\n" + "Technical information:\n" + "\n" + "*** STOP: 0x0000007E (0xC0000005,0xF88FF190,0x0xF8975BA0,0xF89758A0)\n" + "\n" + "\n" + "*** EPUSBDSK.sys - Address F88FF190 base at FF88FE000, datestamp " + "3b9f3248\n" + "\n" + "Beginning dump of physical memory\n"); + const char *wxpb = + ("Physical memory dump complete.\n" + "Contact your system administrator or technical support group for " + "further\n" + "assitance.\n" + ); + + /* The "RSOD" that appeared with "Windows Longhorn 5048.050401-0536_x86fre" + As reported by http://joi.ito.com/RedScreen.jpg + */ + const char *wlha = + ("_Windows Boot Error\n"); + const char *wlhb = + ("\n" + "Windows Boot Manager has experienced a problem.\n" + "\n" + "\n" + " Status: 0xc000000f\n" + "\n" + "\n" + "\n" + " Info: An error occurred transferring exectuion." /* (sic) */ + "\n" + "\n" + "\n" + "You can try to recover the system with the Microsoft Windows " + "System Recovery\n" + "Tools. (You might need to restart the system manually.)\n" + "\n" + "If the problem continues, please contact your system administrator " + "or computer\n" + "manufacturer.\n" + ); + const char *wlhc = + (" SPACE=Continue\n" + ); + if (which < 0 || which > 2) abort(); - /* kludge to lump Win2K and WinME together; seems silly to add another - preference/command line option just for this little one. */ + /* kludge to lump Win2K, WinME, and WinXP together; seems silly to add + another preference/command line option just for these little ones. */ if (which == 2 && (random() % 2)) - which = 3; + which = 3 + (random() % 3); XGetWindowAttributes (dpy, window, &xgwa); @@ -323,12 +396,14 @@ windows (Display *dpy, Window window, int delay, int which) gcv.foreground = get_pixel_resource((which == 0 ? "windows95.foreground" : which == 1 ? "windowsNT.foreground" : which == 2 ? "windows2K.foreground" : + which == 5 ? "windowsLH.foreground" : "windowsME.foreground"), "Windows.Foreground", dpy, xgwa.colormap); gcv.background = get_pixel_resource((which == 0 ? "windows95.background" : which == 1 ? "windowsNT.background" : which == 2 ? "windows2K.background" : + which == 5 ? "windowsLH.background" : "windowsME.background"), "Windows.Background", dpy, xgwa.colormap); @@ -354,6 +429,16 @@ windows (Display *dpy, Window window, int delay, int which) draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, w2kb, 750); } else if (which == 3) + { + int line_height = font->ascent + font->descent + 1; + int x = 4; + int y = 4; + draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, wxpa, 750); + y += line_height * 26; + bsod_sleep(dpy, 4); + draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, wxpb, 750); + } + else if (which == 4) { int line_height = font->ascent + font->descent; int x = 0; @@ -376,6 +461,33 @@ windows (Display *dpy, Window window, int delay, int which) delay--; } } + else if (which == 5) + { + int line_height = font->ascent + font->descent; + int x = 0; + int y = 0; + unsigned long p0 = gcv.background; + unsigned long p1 = gcv.foreground; + unsigned long p2 = get_pixel_resource("windowsLH.background2", + "Windows.Background", + dpy, xgwa.colormap); + XSetBackground (dpy, gc, p2); + XSetForeground (dpy, gc, p2); + XFillRectangle (dpy, window, gc, 0, 0, xgwa.width, line_height+2); + XSetForeground (dpy, gc, p0); + draw_string (dpy, window, gc, &gcv, font, x, y, xgwa.width, 10, wlha, 0); + y += line_height; + XSetForeground (dpy, gc, p1); + XSetBackground (dpy, gc, p0); + draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wlhb, 0); + + y = xgwa.height - (line_height+2); + XSetBackground (dpy, gc, p2); + XSetForeground (dpy, gc, p2); + XFillRectangle (dpy, window, gc, 0, y, xgwa.width, line_height+2); + XSetForeground (dpy, gc, p0); + draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wlhc, 0); + } else abort(); @@ -1453,7 +1565,7 @@ blitdamage (Display *dpy, Window window, int delay) XGetWindowAttributes(dpy, window, &xwa); - load_random_image (xwa.screen, window, window); + load_random_image (xwa.screen, window, window, NULL, NULL); w = xwa.width; h = xwa.height; @@ -1503,6 +1615,177 @@ blitdamage (Display *dpy, Window window, int delay) XFreeGC(dpy, gc0); } + +/* nvidia, by jwz. + * + * This is what happens if an Nvidia card goes into some crazy text mode. + * Most often seen on the second screen of a dual-head system when the + * proper driver isn't loaded. + */ +typedef struct { int fg; int bg; int bit; Bool blink; } nvcell; + +static void +nvspatter (nvcell *grid, int rows, int cols, int ncolors, int nbits, + Bool fill_p) +{ + int max = rows * cols; + int from = fill_p ? 0 : random() % (max - 1); + int len = fill_p ? max : random() % (cols * 4); + int to = from + len; + int i; + Bool noisy = ((random() % 4) == 0); + Bool diag = (noisy || fill_p) ? 0 : ((random() % 4) == 0); + + int fg = random() % ncolors; + int bg = random() % ncolors; + int blink = ((random() % 4) == 0); + int bit = (random() % nbits); + + if (to > max) to = max; + + if (diag) + { + int src = random() % (rows * cols); + int len2 = (cols / 2) - (random() % 5); + int j = src; + for (i = from; i < to; i++, j++) + { + if (j > src + len2 || j >= max) + j = src; + if (i >= max) abort(); + if (j >= max) abort(); + grid[j] = grid[i]; + } + } + else + for (i = from; i < to; i++) + { + nvcell *cell = &grid[i]; + cell->fg = fg; + cell->bg = bg; + cell->bit = bit; + cell->blink = blink; + + if (noisy) + { + fg = random() % ncolors; + bg = random() % ncolors; + blink = ((random() % 8) == 0); + } + } +} + + +static void +nvidia (Display *dpy, Window window, int delay) +{ + XGCValues gcv; + XWindowAttributes xgwa; + int cols, rows; + int cellw, cellh; + unsigned long colors[256]; + int ncolors; + GC gc, gc1 = 0; + int x, y, i; + int tick = 0; + nvcell *grid; + Pixmap bits[5]; + + XGetWindowAttributes (dpy, window, &xgwa); + + cols = 80; + rows = 25; + cellw = xgwa.width / cols; + cellh = xgwa.height / rows; + if (cellw < 8 || cellh < 18) + cellw = 8, cellh = 18; + cols = (xgwa.width / cellw) + 1; + rows = (xgwa.height / cellh) + 1; + + grid = (nvcell *) calloc (sizeof(*grid), rows * cols); + gc = XCreateGC (dpy, window, 0, &gcv); + + /* Allocate colors + */ + ncolors = 16; + for (i = 0; i < ncolors; i++) + { + XColor c; + c.red = random() & 0xFFFF; + c.green = random() & 0xFFFF; + c.blue = random() & 0xFFFF; + c.flags = DoRed|DoGreen|DoBlue; + XAllocColor (dpy, xgwa.colormap, &c); + colors[i] = c.pixel; + } + + /* Construct corrupted character bitmaps + */ + for (i = 0; i < countof(bits); i++) + { + int j; + + bits[i] = XCreatePixmap (dpy, window, cellw, cellh, 1); + if (!gc1) gc1 = XCreateGC (dpy, bits[i], 0, &gcv); + + XSetForeground (dpy, gc1, 0); + XFillRectangle (dpy, bits[i], gc1, 0, 0, cellw, cellh); + XSetForeground (dpy, gc1, ~0L); + + if ((random() % 40) != 0) + for (j = 0; j < ((cellw * cellh) / 16); j++) + XFillRectangle (dpy, bits[i], gc1, + (random() % (cellw-2)) & ~1, + (random() % (cellh-2)) & ~1, + 2, 2); + } + + /* Randomize the grid + */ + nvspatter (grid, rows, cols, ncolors, countof(bits), True); + for (i = 0; i < 20; i++) + nvspatter (grid, rows, cols, ncolors, countof(bits), False); + + + /* Redisplay loop: blink 4x/second + */ + while (1) + { + for (y = 0; y < rows; y++) + for (x = 0; x < cols; x++) + { + nvcell *cell = &grid[y * cols + x]; + unsigned long fg = colors[cell->fg]; + unsigned long bg = colors[cell->bg]; + Bool flip = cell->blink && (tick & 1); + XSetForeground (dpy, gc, flip ? fg : bg); + XSetBackground (dpy, gc, flip ? bg : fg); + XCopyPlane (dpy, bits[cell->bit], window, gc, + 0, 0, cellw, cellh, + x * cellw, y * cellh, 1L); + } + + if ((random() % 5) == 0) /* change the display */ + nvspatter (grid, rows, cols, ncolors, countof(bits), False); + + XSync (dpy, False); + usleep (250000); + if (bsod_sleep(dpy, 0)) + goto DONE; + if (tick / 4 >= delay) + goto DONE; + tick++; + } + + DONE: + XFreeColors (dpy, xgwa.colormap, colors, ncolors, 0); + for (i = 0; i < countof(bits); i++) + XFreePixmap (dpy, bits[i]); + XFreeGC (dpy, gc); + XFreeGC (dpy, gc1); + free (grid); +} + /* * SPARC Solaris panic. Should look pretty authentic on Solaris boxes. @@ -1587,7 +1870,7 @@ make_scrolling_window (Display *dpy, Window window, if (!grab_screen_p) ts->sub_height += ts->sub_y, ts->sub_y = 0; if (grab_screen_p) - load_random_image (xgwa.screen, window, window); + load_random_image (xgwa.screen, window, window, NULL, NULL); sprintf (buf1, "%.50s.background", name); sprintf (buf2, "%.50s.Background", name); @@ -1682,7 +1965,7 @@ sparc_solaris (Display* dpy, Window window, int delay) const char *msg1 = "BAD TRAP: cpu=0 type=0x31 rp=0x2a10043b5e0 addr=0xf3880 mmu_fsr=0x0\n" - "BAD TRAP occured in module \"unix\" due to an illegal access to a" + "BAD TRAP occurred in module \"unix\" due to an illegal access to a" " user address.\n" "adb: trap type = 0x31\n" "addr=0xf3880\n" @@ -2136,6 +2419,208 @@ linux_fsck (Display *dpy, Window window, int delay) XClearWindow(dpy, window); } + + +/* + * Linux (hppa) panic, by Stuart Brady + * Output courtesy of M. Grabert + */ +static void +hppa_linux (Display *dpy, Window window, int delay) +{ + XWindowAttributes xgwa; + scrolling_window *ts; + int i=0; + const char *sysname; + long int linedelay=0; + +# ifdef __GNUC__ + __extension__ /* don't warn about "string length is greater than the + length ISO C89 compilers are required to support" + in the following string constant... */ +# endif + + struct { long int delay; const char *string; } linux_panic[] = + {{ 0, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + "\n\n\n\n\n\n\n\n\n\n\n\n\n" }, + { 0, "Linux version 2.6.0-test11-pa2 (root@%s) " + "(gcc version 3.3.2 (Debian)) #2 Mon Dec 8 06:09:27 GMT 2003\n" }, + { 4000, "FP[0] enabled: Rev 1 Model 16\n" }, + { 10, "The 32-bit Kernel has started...\n" }, + { -1, "Determining PDC firmware type: System Map.\n" }, + { -1, "model 00005bb0 00000481 00000000 00000002 7778df9f 100000f0 " + "00000008 000000b2 000000b2\n" }, + { -1, "vers 00000203\n" }, + { -1, "CPUID vers 17 rev 7 (0x00000227)\n" }, + { -1, "capabilities 0x3\n" }, + { -1, "model 9000/785/C3000\n" }, + { -1, "Total Memory: 1024 Mb\n" }, + { -1, "On node 0 totalpages: 262144\n" }, + { -1, " DMA zone: 262144 pages, LIFO batch:16\n" }, + { -1, " Normal zone: 0 pages, LIFO batch:1\n" }, + { -1, " HighMem zone: 0 pages, LIFO batch:1\n" }, + { -1, "LCD display at f05d0008,f05d0000 registered\n" }, + { -1, "Building zonelist for node : 0\n" }, + { -1, "Kernel command line: ide=nodma root=/dev/sda3 HOME=/ ip=off " + "console=ttyS0 TERM=vt102 palo_kernel=2/vmlinux-2.6\n" }, + { -1, "ide_setup: ide=nodmaIDE: Prevented DMA\n" }, + { -1, "PID hash table entries: 16 (order 4: 128 bytes)\n" }, + {500, "Console: colour dummy device 160x64\n" }, + { 10, "Memory: 1034036k available\n" }, + { -1, "Calibrating delay loop... 796.67 BogoMIPS\n" }, + { -1, "Dentry cache hash table entries: 131072 (order: 7, 524288 " + "bytes)\n" }, + { -1, "Inode-cache hash table entries: 65536 (order: 6, 262144 " + "bytes)\n" }, + { -1, "Mount-cache hash table entries: 512 (order: 0, 4096 bytes)\n" }, + { -1, "POSIX conformance testing by UNIFIX\n" }, + { -1, "NET: Registered protocol family 16\n" }, + { 100, "Searching for devices...\n" }, + { 25, "Found devices:\n" }, + { 10, "1. Astro BC Runway Port at 0xfed00000 [10] " + "{ 12, 0x0, 0x582, 0x0000b }\n" }, + { -1, "2. Elroy PCI Bridge at 0xfed30000 [10/0] " + "{ 13, 0x0, 0x782, 0x0000a }\n" }, + { -1, "3. Elroy PCI Bridge at 0xfed32000 [10/1] " + "{ 13, 0x0, 0x782, 0x0000a }\n" }, + { -1, "4. Elroy PCI Bridge at 0xfed38000 [10/4] " + "{ 13, 0x0, 0x782, 0x0000a }\n" }, + { -1, "5. Elroy PCI Bridge at 0xfed3c000 [10/6] " + "{ 13, 0x0, 0x782, 0x0000a }\n" }, + { -1, "6. AllegroHigh W at 0xfffa0000 [32] " + "{ 0, 0x0, 0x5bb, 0x00004 }\n" }, + { -1, "7. Memory at 0xfed10200 [49] { 1, 0x0, 0x086, 0x00009 }\n" }, + { -1, "CPU(s): 1 x PA8500 (PCX-W) at 400.000000 MHz\n" }, + { -1, "SBA found Astro 2.1 at 0xfed00000\n" }, + { -1, "lba version TR2.1 (0x2) found at 0xfed30000\n" }, + { -1, "lba version TR2.1 (0x2) found at 0xfed32000\n" }, + { -1, "lba version TR2.1 (0x2) found at 0xfed38000\n" }, + { -1, "lba version TR2.1 (0x2) found at 0xfed3c000\n" }, + { 100, "SCSI subsystem initialized\n" }, + { 10, "drivers/usb/core/usb.c: registered new driver usbfs\n" }, + { -1, "drivers/usb/core/usb.c: registered new driver hub\n" }, + { -1, "ikconfig 0.7 with /proc/config*\n" }, + { -1, "Initializing Cryptographic API\n" }, + { 250, "SuperIO: probe of 0000:00:0e.0 failed with error -1\n" }, + { 20, "SuperIO: Found NS87560 Legacy I/O device at 0000:00:0e.1 " + "(IRQ 64)\n" }, + { -1, "SuperIO: Serial port 1 at 0x3f8\n" }, + { -1, "SuperIO: Serial port 2 at 0x2f8\n" }, + { -1, "SuperIO: Parallel port at 0x378\n" }, + { -1, "SuperIO: Floppy controller at 0x3f0\n" }, + { -1, "SuperIO: ACPI at 0x7e0\n" }, + { -1, "SuperIO: USB regulator enabled\n" }, + { -1, "SuperIO: probe of 0000:00:0e.2 failed with error -1\n" }, + { -1, "Soft power switch enabled, polling @ 0xf0400804.\n" }, + { -1, "pty: 256 Unix98 ptys configured\n" }, + { -1, "Generic RTC Driver v1.07\n" }, + { -1, "Serial: 8250/16550 driver $Revision: 1.66 $ 13 ports, " + "IRQ sharing disabled\n" }, + { -1, "ttyS0 at I/O 0x3f8 (irq = 0) is a 16550A\n" }, + { -1, "ttyS1 at I/O 0x2f8 (irq = 0) is a 16550A\n" }, + { -1, "Linux Tulip driver version 1.1.13 (May 11, 2002)\n" }, + { 150, "tulip0: no phy info, aborting mtable build\n" }, + { 10, "tulip0: MII transceiver #1 config 1000 status 782d " + "advertising 01e1.\n" }, + { -1, "eth0: Digital DS21143 Tulip rev 65 at 0xf4008000, " + "00:10:83:F9:B4:34, IRQ 66.\n" }, + { -1, "Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2\n" }, + { -1, "ide: Assuming 33MHz system bus speed for PIO modes; " + "override with idebus=xx\n" }, + { 100, "SiI680: IDE controller at PCI slot 0000:01:06.0\n" }, + { 10, "SiI680: chipset revision 2\n" }, + { -1, "SiI680: BASE CLOCK == 133\n" }, + { -1, "SiI680: 100% native mode on irq 128\n" }, + { -1, " ide0: MMIO-DMA at 0xf4800000-0xf4800007 -- " + "Error, MMIO ports already in use.\n" }, + { -1, " ide1: MMIO-DMA at 0xf4800008-0xf480000f -- " + "Error, MMIO ports already in use.\n" }, + { 5, "hda: TS130220A2, ATA DISK drive\n" }, + { -1, " _______________________________\n" }, + { -1, " < Your System ate a SPARC! Gah! >\n" }, + { -1, " -------------------------------\n" }, + { -1, " \\ ^__^\n" }, + { -1, " \\ (xx)\\_______\n" }, + { -1, " (__)\\ )\\/\\\n" }, + { -1, " U ||----w |\n" }, + { -1, " || ||\n" }, + { -1, "swapper (pid 1): Breakpoint (code 0)\n" }, + { -1, "\n" }, + { -1, " YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI\n" }, + { -1, "PSW: 00000000000001001111111100001111 Not tainted\n" }, + { -1, "r00-03 4d6f6f21 1032f010 10208f34 103fc2e0\n" }, + { -1, "r04-07 103fc230 00000001 00000001 0000000f\n" }, + { -1, "r08-11 103454f8 000f41fa 372d3980 103ee404\n" }, + { -1, "r12-15 3ccbf700 10344810 103ee010 f0400004\n" }, + { -1, "r16-19 f00008c4 f000017c f0000174 00000000\n" }, + { -1, "r20-23 fed32840 fed32800 00000000 0000000a\n" }, + { -1, "r24-27 0000ffa0 000000ff 103fc2e0 10326010\n" }, + { -1, "r28-31 00000000 00061a80 4ff98340 10208f34\n" }, + { -1, "sr0-3 00000000 00000000 00000000 00000000\n" }, + { -1, "sr4-7 00000000 00000000 00000000 00000000\n" }, + { -1, "\n" }, + { -1, "IASQ: 00000000 00000000 IAOQ: 00000000 00000004\n" }, + { -1, " IIR: 00000000 ISR: 00000000 IOR: 00000000\n" }, + { -1, " CPU: 0 CR30: 4ff98000 CR31: 1037c000\n" }, + { -1, " ORIG_R28: 55555555\n" }, + { -1, " IAOQ[0]: 0x0\n" }, + { -1, " IAOQ[1]: 0x4\n" }, + { -1, " RP(r2): probe_hwif+0x218/0x44c\n" }, + { -1, "Kernel panic: Attempted to kill init!\n" }, + { 0, NULL }}; + + XGetWindowAttributes (dpy, window, &xgwa); + XSetWindowBackground (dpy, window, + get_pixel_resource("HPPALinux.background", + "HPPALinux.Background", + dpy, xgwa.colormap)); + XClearWindow(dpy, window); + + sysname = "hppa"; +# ifdef HAVE_UNAME + { + struct utsname uts; + char *s; + if (uname (&uts) >= 0) + sysname = uts.nodename; + s = strchr (sysname, '.'); + if (s) *s = 0; + } +# endif /* !HAVE_UNAME */ + + /* Insert current host name into banner on line 2 */ + { + static char ss[1024]; + sprintf (ss, linux_panic[1].string, sysname); + linux_panic[1].string = ss; + } + + ts = make_scrolling_window (dpy, window, "HPPALinux", False); + + usleep (100000); + while (linux_panic[i].string) + { + if (linux_panic[i].delay != -1) + linedelay = linux_panic[i].delay * 1000; + usleep (linedelay); + scrolling_puts (ts, linux_panic[i].string, 0); + XSync(dpy, False); + if (bsod_sleep (dpy, 0)) + goto DONE; + i++; + } + + if (bsod_sleep (dpy, 4)) + goto DONE; + + XSync(dpy, False); + bsod_sleep(dpy, delay); + + DONE: + free_scrolling_window (ts); + XClearWindow(dpy, window); +} + /* VMS by jwz (text sent by Roland Barmettler ) */ static void @@ -2216,6 +2701,7 @@ vms (Display *dpy, Window window, int delay) "\n" }; char *args[8]; + int ids[3]; XGetWindowAttributes (dpy, window, &xgwa); ts = make_scrolling_window (dpy, window, "VMS", False); @@ -2240,17 +2726,22 @@ vms (Display *dpy, Window window, int delay) strcpy (args[0], sysname); args[0][5] = 0; + /* Pick three numbers, 1-9, no overlaps. */ + ids[0] = 1 + (random() % 9); + do { ids[1] = 1 + (random() % 9); } while (ids[1]==ids[0]); + do { ids[2] = 1 + (random() % 9); } while (ids[2]==ids[0] || ids[2]==ids[1]); + i = strlen(args[0])-1; if (i < 6) i++; - args[0][i] = '1' + (random() % 9); + args[0][i] = '0' + ids[0]; args[0][i+1] = 0; for (s = args[0]; *s; s++) if (isalpha(*s)) *s = toupper (*s); args[1] = strdup (args[0]); - args[2] = strdup (args[0]); args[2][i] = '1' + (random() % 9); - args[3] = strdup (args[0]); args[3][i] = '1' + (random() % 9); + args[2] = strdup (args[0]); args[2][i] = '0' + ids[1]; + args[3] = strdup (args[0]); args[3][i] = '0' + ids[2]; args[4] = strdup (args[1]); args[5] = strdup (args[2]); @@ -2313,6 +2804,71 @@ vms (Display *dpy, Window window, int delay) } +/* HVX (formerly GCOS6) and TPS6 crash + by Brian Garratt + + GCOS6 is a Unix-like operating system developed by Honeywell in the + 1970s in collaboration with MIT and AT&T (who called their version + UNIX). Both are very much like MULTICS which Honeywell got from GE. + + HVX ("High-performance Virtual System on Unix") is an AIX application + which emulates GCOS6 hardware on RS6000-like machines. + */ +static void +hvx (Display *dpy, Window window, int delay) +{ + XWindowAttributes xgwa; + scrolling_window *ts; + + int delay1 = 10000; + int delay2 = 100000; + const char *hvx_panic_1 = + ("(TP) Trap no E Effective address 00000000 Instruction D7DE\n" + "(TP) Registers :\n" + "(TP) B1 -> B7 03801B02 00000000 03880D45 038BABDB 0388AFFD" + " 0389B3F8 03972317\n" + "(TP) R1 -> R7 0001 0007 F10F 090F 0020 0106 0272\n" + "(TP) P I Z M1 0388A18B 3232 0000 FF00\n" + "(TP) Program counter is at offset 0028 from string YTPAD\n" + "(TP) User id of task which trapped is LT 626\n" + "(TP)?\n" + ); + const char *hvx_panic_2 = + ("\n" + "(TP)?\n" + "Core dumps initiated for selected HVX processes ...\n" + "Core dumps complete.\n" + "Fri Jul 19 15:53:09 2002\n" + "Live registers for cp 0:\n" + " P = 7de3 IW=0000 I=32 CI=30000000 S=80006013" + " IV=aa0 Level=13\n" + " R1-7 = 1f 913 13 4 8 0 0\n" + " B1-7 = 64e71b a93 50e 64e73c 6c2c 7000 b54\n" + "Memory dump starting to file /var/hvx/dp01/diag/Level2 ...\n" + "Memory dump complete.\n" + ); + + XGetWindowAttributes (dpy, window, &xgwa); + ts = make_scrolling_window (dpy, window, "HVX", False); + XClearWindow(dpy, window); + + scrolling_puts (ts, hvx_panic_1, delay1); + if (bsod_sleep(dpy, 1)) goto DONE; + scrolling_puts (ts, " TP CLOSE ALL", delay2); + scrolling_puts (ts, "\n(TP)?\n", delay1); + if (bsod_sleep(dpy, 1)) goto DONE; + scrolling_puts (ts, " TP ABORT -LT ALL", delay2); + scrolling_puts (ts, "\n(TP)?\n", delay1); + if (bsod_sleep(dpy, 1)) goto DONE; + scrolling_puts (ts, " TP STOP KILL", delay2); + scrolling_puts (ts, hvx_panic_2, delay1); + + bsod_sleep(dpy, delay); + DONE: + XClearWindow(dpy, window); +} + + /* HPUX panic, by Tobias Klausmann @@ -2555,1503 +3111,669 @@ DONE: -/* - * Simulate various Apple II crashes. The memory map encouraged many - * programs to use the primary hi-res video page for various storage, - * and the secondary hi-res page for active display. When it crashed - * into Applesoft or the monitor, it would revert to the primary page - * and you'd see memory garbage on the screen. Also, it was common for - * copy-protected games to use the primary text page for important - * code, because that made it really hard to reverse-engineer them. The - * result often looked like what this generates. - * - * Sometimes an imaginary user types some of the standard commands to - * recover from crashes. You can turn off BSOD*apple2SimulateUser to - * prevent this. - * - * It simulates the following characteristics of standard television - * monitors: - * - * - Realistic rendering of a composite video signal - * - Compression & brightening on the right, as the scan gets truncated - * because of saturation in the flyback transformer - * - Blooming of the picture dependent on brightness - * - Overscan, cutting off a few pixels on the left side. - * - Colored text in mixed graphics/text modes - * - * It's amazing how much it makes your high-end monitor look like at - * large late-70s TV. All you need is to put a big "Solid State" logo - * in curly script on it and you'd be set. - * - * Trevor Blackwell - */ -/* - * Implementation notes: - * - * There are roughly 3 parts to this hack: - * - * - emulation of A2 Basic and Monitor. Not much more than printing random - * plausible messages. Here we work in the A2 memory space. - * - * - emulation of the A2's video output section, which shifted bits out of main - * memory at a 14 MHz dot clock rate, sort of. You could only read one byte - * per MHz, so there were various schemes for turning 8 bits into 14 screen - * pixels. - * - * - simulation of an NTSC television, which turned the bits into colored - * graphics and text. - * - * The A2 had 3 display modes: text, lores, and hires. Text was 40x24, and it - * disabled color in the TV. Lores gave you 40x48 graphics blocks, using the - * same memory as the text screen. Each could be one of 16 colors. Hires gave - * you 280x192 pixels. Odd pixels were blue or purple, and even pixels were - * orange or green depending on the setting of the high bit in each byte. - * - * The graphics modes could also have 4 lines of text at the bottom. This was - * fairly unreadable if you had a color monitor. - * - * Each mode had 2 different screens using different memory space. In hires - * mode this was sometimes used for double buffering, but more often the lower - * screen was full of code/data and the upper screen was used for display, so - * you got random garbage on the screen. - * - * In DirectColor or TrueColor modes, it generates pixel values directly from - * RGB values it calculates across each scan line. In PseudoColor mode, it - * consider each possible pattern of 5 preceding bit values in each possible - * position modulo 4 and allocates a color for each. A few things, like the - * brightening on the right side as the horizontal trace slows down, aren't - * done in PseudoColor. - * - * The text font is based on X's standard 6x10 font, with a few tweaks like - * putting a slash across the zero. - * - * I'd like to add a bit of visible retrace, but it conflicts with being able - * to bitcopy the image when fast scrolling. After another couple of CPU - * generations, we could probably regenerate the whole image from scratch every - * time. On a P4 2 GHz it can manage this fine for blinking text, but scrolling - * looks too slow. +/* Compaq Tru64 Unix panic, by jwz as described by + Tobias Klausmann */ -static char * apple2_basic_errors[]={ - "BREAK", - "NEXT WITHOUT FOR", - "SYNTAX ERROR", - "RETURN WITHOUT GOSUB", - "ILLEGAL QUANTITY", - "OVERFLOW", - "OUT OF MEMORY", - "BAD SUBSCRIPT ERROR", - "DIVISION BY ZERO", - "STRING TOO LONG", - "FORMULA TOO COMPLEX", - "UNDEF'D FUNCTION", - "OUT OF DATA" -}; -static char * apple2_dos_errors[]={ - "VOLUME MISMATCH", - "I/O ERROR", - "DISK FULL", - "NO BUFFERS AVAILABLE", - "PROGRAM TOO LARGE", -}; - -struct apple2_state { - char hireslines[192][40]; - char textlines[24][40]; - int gr_text; - enum { - A2_GR_FULL=1, - A2_GR_LORES=2, - A2_GR_HIRES=4 - } gr_mode; - int cursx; - int cursy; - int blink; - int rowimage[24]; -}; - -enum { - A2_SP_ROWMASK=1023, - A2_SP_PUT=1024, - A2_SP_COPY=2048 -}; - -static void -a2_scroll(struct apple2_state *st) -{ - int i; - int top=(st->gr_mode&(A2_GR_LORES|A2_GR_HIRES)) ? 20 : 0; - if ((st->gr_mode&A2_GR_FULL) && (st->gr_mode&A2_GR_HIRES)) return; - if (st->gr_mode&A2_GR_FULL) top=0; - for (i=top; i<23; i++) { - if (memcmp(st->textlines[i],st->textlines[i+1],40)) { - memcpy(st->textlines[i],st->textlines[i+1],40); - st->rowimage[i]=st->rowimage[i+1]; - } - } - memset(st->textlines[23],0xe0,40); - st->rowimage[23]=-1; -} - static void -a2_printc(struct apple2_state *st, char c) +tru64 (Display* dpy, Window window, int delay) { - st->textlines[st->cursy][st->cursx] |= 0xc0; /* turn off blink */ - if (c=='\n') { - if (st->cursy==23) { - a2_scroll(st); - } else { - st->rowimage[st->cursy]=-1; - st->cursy++; - st->rowimage[st->cursy]=-1; - } - st->cursx=0; - } else { - st->textlines[st->cursy][st->cursx]=c ^ 0xc0; - st->rowimage[st->cursy]=-1; - st->cursx++; - if (st->cursx==40) { - if (st->cursy==23) { - a2_scroll(st); - } else { - st->rowimage[st->cursy]=-1; - st->cursy++; - st->rowimage[st->cursy]=-1; - } - st->cursx=0; - } - } - st->textlines[st->cursy][st->cursx] &= 0x7f; /* turn on blink */ -} + XWindowAttributes xgwa; + scrolling_window *ts; + const char *sysname; + char buf[2048]; -static void -a2_goto(struct apple2_state *st, int r, int c) -{ - st->textlines[st->cursy][st->cursx] |= 0xc0; /* turn off blink */ - st->cursy=r; - st->cursx=c; - st->textlines[st->cursy][st->cursx] &= 0x7f; /* turn on blink */ -} +# ifdef __GNUC__ + __extension__ /* don't warn about "string length is greater than the + length ISO C89 compilers are required to support" + in the following string constant... */ +# endif -static void -a2_cls(struct apple2_state *st) -{ - int i; - for (i=0; i<24; i++) { - memset(st->textlines[i],0xe0,40); - st->rowimage[i]=-1; - } -} + const char *msg1 = + ("panic (cpu 0): trap: illegal instruction\n" + "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n" + "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n" + " \n" + "DUMP: blocks available: 1571600\n" + "DUMP: blocks wanted: 100802 (partial compressed dump) [OKAY]\n" + "DUMP: Device Disk Blocks Available\n" + "DUMP: ------ ---------------------\n" + "DUMP: 0x1300023 1182795 - 1571597 (of 1571598) [primary swap]\n" + "DUMP.prom: Open: dev 0x5100041, block 2102016: SCSI 0 11 0 2 200 0 0\n" + "DUMP: Writing header... [1024 bytes at dev 0x1300023, block 1571598]\n" + "DUMP: Writing data"); + const char *msg2 = + ("DUMP: Writing header... [1024 bytes at dev 0x1300023, block 1571598]\n" + "DUMP: crash dump complete.\n" + "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n" + " \n" + "DUMP: second crash dump skipped: 'dump_savecnt' enforced.\n"); + const char *msg3 = + ("\n" + "halted CPU 0\n" + "\n" + "halt code = 5\n" + "HALT instruction executed\n" + "PC = fffffc00005863b0\n"); + const char *msg4 = + ("\n" + "CPU 0 booting\n" + "\n" + "\n" + "\n"); -static void -a2_invalidate(struct apple2_state *st) -{ - int i; - for (i=0; i<24; i++) { - st->rowimage[i]=-1; + XGetWindowAttributes (dpy, window, &xgwa); + ts = make_scrolling_window (dpy, window, "Tru64", False); + XClearWindow(dpy,window); + ts->columns = 10000; /* never wrap */ + ts->sub_x = 0; + ts->sub_y = 0; + ts->sub_width = xgwa.width; + ts->sub_height = xgwa.height; + + sysname = "127.0.0.1"; +# ifdef HAVE_UNAME + { + struct utsname uts; + if (uname (&uts) >= 0) + sysname = uts.nodename; } -} +# endif /* !HAVE_UNAME */ -static void -a2_poke(struct apple2_state *st, int addr, int val) -{ + if (bsod_sleep (dpy, 1)) + goto DONE; - if (addr>=0x400 && addr<0x800) { - /* text memory */ - int row=((addr&0x380)/0x80) + ((addr&0x7f)/0x28)*8; - int col=(addr&0x7f)%0x28; - if (row<24 && col<40) { - st->textlines[row][col]=val; - if (!(st->gr_mode&(A2_GR_HIRES)) || - (!(st->gr_mode&(A2_GR_FULL)) && row>=20)) { - st->rowimage[row]=-1; - } - } - } - else if (addr>=0x2000 && addr<0x4000) { - int row=(((addr&0x1c00) / 0x400) * 1 + - ((addr&0x0380) / 0x80) * 8 + - ((addr&0x0078) / 0x28) * 64); - int col=((addr&0x07f)%0x28); - if (row<192 && col<40) { - st->hireslines[row][col]=val; - if (st->gr_mode&A2_GR_HIRES) { - st->rowimage[row/8]=-1; + + + sprintf (buf, + "Compaq Tru64 UNIX V5.1B (Rev. 2650) (%.100s) console\n" + "\n" + "login: ", + sysname); + scrolling_puts (ts, buf, 0); + if (bsod_sleep (dpy, 6)) + goto DONE; + + scrolling_puts (ts, msg1, 0); + { + int i; + int steps = 4 + (random() % 8); + for (i = 0; i < steps; i++) + { + scrolling_puts (ts, ".", 0); + XSync (dpy, False); + if (bsod_sleep (dpy, 1)) + goto DONE; } - } + sprintf (buf, "[%dMB]\n", steps); + scrolling_puts (ts, buf, 0); } -} -/* This table lists fixes for characters that differ from the standard 6x10 - font. Each encodes a pixel, as (charindex*7 + x) + (y<<10) + (value<<15) - where value is 0 for white and 1 for black. */ -static unsigned short a2_fixfont[] = { - /* Fix $ */ 0x8421, 0x941d, - /* Fix % */ 0x8024, 0x0028, 0x8425, 0x0426, 0x0825, 0x1027, 0x1426, 0x9427, - 0x1824, 0x9828, - /* Fix * */ 0x8049, 0x8449, 0x8849, 0x0c47, 0x0c48, 0x0c4a, 0x0c4b, 0x9049, - 0x9449, 0x9849, - /* Fix , */ 0x9057, 0x1458, 0x9856, 0x1857, 0x1c56, - /* Fix . */ 0x1465, 0x1864, 0x1866, 0x1c65, - /* Fix / */ 0x006e, 0x186a, - /* Fix 0 */ 0x8874, 0x8c73, 0x9072, - /* Fix 1 */ 0x0878, 0x1878, 0x187c, - /* Fix 5 */ 0x8895, 0x0c94, 0x0c95, - /* Fix 6 */ 0x809f, 0x8c9c, 0x109c, - /* Fix 7 */ 0x8ca4, 0x0ca5, 0x90a3, 0x10a4, - /* Fix 9 */ 0x08b3, 0x8cb3, 0x98b0, - /* Fix : */ 0x04b9, 0x08b8, 0x08ba, 0x0cb9, 0x90b9, 0x14b9, 0x18b8, 0x18b9, - 0x18ba, 0x1cb9, - /* Fix ; */ 0x04c0, 0x08bf, 0x08c1, 0x0cc0, 0x90c0, 0x14c1, 0x98bf, 0x18c0, - 0x1cbf, - /* Fix < */ 0x80c8, 0x00c9, 0x84c7, 0x04c8, 0x88c6, 0x08c7, 0x8cc5, 0x0cc6, - 0x90c6, 0x10c7, - 0x94c7, 0x14c8, 0x98c8, 0x18c9, - /* Fix > */ 0x80d3, 0x00d4, 0x84d4, 0x04d5, 0x88d5, 0x08d6, 0x8cd6, 0x0cd7, - 0x90d5, 0x10d6, - 0x94d4, 0x14d5, 0x98d3, 0x18d4, - /* Fix @ */ 0x88e3, 0x08e4, 0x8ce4, 0x98e5, - /* Fix B */ 0x84ef, 0x04f0, 0x88ef, 0x08f0, 0x8cef, 0x90ef, 0x10f0, 0x94ef, - 0x14f0, - /* Fix D */ 0x84fd, 0x04fe, 0x88fd, 0x08fe, 0x8cfd, 0x0cfe, 0x90fd, 0x10fe, - 0x94fd, 0x14fe, - /* Fix G */ 0x8116, 0x0516, 0x9916, - /* Fix J */ 0x0129, 0x012a, 0x052a, 0x852b, 0x092a, 0x892b, 0x0d2a, 0x8d2b, - 0x112a, 0x912b, - 0x152a, 0x952b, 0x992a, - /* Fix M */ 0x853d, 0x853f, 0x093d, 0x893e, 0x093f, - /* Fix Q */ 0x915a, 0x155a, 0x955b, 0x155c, 0x195b, 0x995c, 0x1d5c, - /* Fix V */ 0x8d7b, 0x0d7c, 0x0d7e, 0x8d7f, 0x917b, 0x117c, 0x117e, 0x917f, - /* Fix [ */ 0x819e, 0x81a2, 0x859e, 0x899e, 0x8d9e, 0x919e, 0x959e, 0x999e, - 0x99a2, - /* Fix \ */ 0x01a5, 0x19a9, - /* Fix ] */ 0x81ac, 0x81b0, 0x85b0, 0x89b0, 0x8db0, 0x91b0, 0x95b0, 0x99ac, - 0x99b0, - /* Fix ^ */ 0x01b5, 0x05b4, 0x05b6, 0x09b3, 0x89b5, 0x09b7, 0x8db4, 0x8db6, - 0x91b3, 0x91b7, - /* Fix _ */ 0x9db9, 0x9dbf, - 0, -}; - -struct ntsc_dec { - char pattern[600]; - int ntscy[600]; - int ntsci[600]; - int ntscq[600]; - int multi[600]; - int multq[600]; - int brightness_control; -}; + scrolling_puts (ts, msg2, 0); + XSync(dpy, False); + if (bsod_sleep (dpy, 4)) + goto DONE; -/* - First generate the I and Q reference signals, which we'll multiply by the - input signal to accomplish the demodulation. Normally they are shifted 33 - degrees from the colorburst. I think this was convenient for - inductor-capacitor-vacuum tube implementation. - - The tint control, FWIW, just adds a phase shift to the chroma signal, and - the color control controls the amplitude. - - In text modes (colormode==0) the system disabled the color burst, and no - color was detected by the monitor. - - freq_error gives a mismatch between the built-in oscillator and the TV's - colorbust. Older II Plus machines seemed to occasionally get instability - problems -- the crystal oscillator was a single transistor if I remember - correctly -- and the frequency would vary enough that the tint would change - across the width of the screen. The left side would be in correct tint - because it had just gotten resynchronized with the color burst. -*/ -static void -ntsc_set_demod(struct ntsc_dec *it, double tint_control, - double color_control, double brightness_control, - double freq_error, - int colormode) -{ - int i; + scrolling_puts (ts, msg3, 0); + XSync(dpy, False); + if (bsod_sleep (dpy, 3)) + goto DONE; - it->brightness_control=(int)(1024.0*brightness_control); + scrolling_puts (ts, msg4, 0); + XSync(dpy, False); + bsod_sleep(dpy, delay); - for (i=0; i<600; i++) { - double phase=90.0-90.0*i + freq_error*i/600.0 + tint_control; - it->multi[i]=(int)(-cos(3.1415926/180.0*(phase-303)) * 65536.0 * - color_control * colormode * 4); - it->multq[i]=(int)(cos(3.1415926/180.0*(phase-33)) * 65536.0 * - color_control * colormode * 4); - } + DONE: + free_scrolling_window (ts); } -/* Here we model the analog circuitry of an NTSC television. Basically, it - splits the signal into 3 signals: Y, I and Q. Y corresponds to luminance, - and you get it by low-pass filtering the input signal to below 3.57 MHz. - I and Q are the in-phase and quadrature components of the 3.57 MHz - subcarrier. We get them by multiplying by cos(3.57 MHz*t) and sin(3.57 - MHz*t), and low-pass filtering. Because the eye has less resolution in some - colors than others, the I component gets low-pass filtered at 1.5 MHz and - the Q at 0.5 MHz. The I component is approximately orange-blue, and Q is - roughly purple-green. See http://www.ntsc-tv.com for details. + +/* + * Simulate various Apple ][ crashes. The memory map encouraged many programs + * to use the primary hi-res video page for various storage, and the secondary + * hi-res page for active display. When it crashed into Applesoft or the + * monitor, it would revert to the primary page and you'd see memory garbage on + * the screen. Also, it was common for copy-protected games to use the primary + * text page for important code, because that made it really hard to + * reverse-engineer them. The result often looked like what this generates. + * + * The Apple ][ logic and video hardware is in apple2.c. The TV is emulated by + * analogtv.c for maximum realism + * + * Trevor Blackwell */ -static void -ntsc_to_yiq(struct ntsc_dec *it) -{ - int i; - int fyx[10],fyy[10]; - int fix[10],fiy[10]; - int fqx[10],fqy[10]; - int pixghost; - int iny,ini,inq,pix,blank; - - for (i=0; i<10; i++) fyx[i]=fyy[i]=fix[i]=fiy[i]=fqx[i]=fqy[i]=0.0; - pixghost=0; - for (i=0; i<600; i++) { - /* Get the video out signal, and add a teeny bit of ghosting, typical of RF - monitor cables. This corresponds to a pretty long cable, but looks right - to me. */ - pix=it->pattern[i]*1024; - if (i>=20) pixghost += it->pattern[i-20]*15; - if (i>=30) pixghost -= it->pattern[i-30]*15; - pix += pixghost; - - /* Get Y, I, Q before filtering */ - iny=pix; - ini=(pix*it->multi[i])>>16; - inq=(pix*it->multq[i])>>16; - - blank = (i>=7 && i<596 ? it->brightness_control : -200); - - /* Now filter them. These are infinite impulse response filters calculated - by the script at http://www-users.cs.york.ac.uk/~fisher/mkfilter. This - is fixed-point integer DSP, son. No place for wimps. We do it in integer - because you can count on integer being faster on most CPUs. We care - about speed because we need to recalculate every time we blink text, and - when we spew random bytes into screen memory. This is roughly 16.16 - fixed point arithmetic, but we scale some filter values up by a few bits - to avoid some nasty precision errors. */ - - /* Filter y at with a 4-pole low-pass Butterworth filter at 3.5 MHz - with an extra zero at 3.5 MHz, from - mkfilter -Bu -Lp -o 4 -a 2.1428571429e-01 0 -Z 2.5e-01 -l - Delay about 2 */ - - fyx[0] = fyx[1]; fyx[1] = fyx[2]; fyx[2] = fyx[3]; - fyx[3] = fyx[4]; fyx[4] = fyx[5]; fyx[5] = fyx[6]; - fyx[6] = (iny * 1897) >> 13; - fyy[0] = fyy[1]; fyy[1] = fyy[2]; fyy[2] = fyy[3]; - fyy[3] = fyy[4]; fyy[4] = fyy[5]; fyy[5] = fyy[6]; - fyy[6] = (fyx[0]+fyx[6]) + 4*(fyx[1]+fyx[5]) + 7*(fyx[2]+fyx[4]) + 8*fyx[3] - + ((-151*fyy[2] + 8115*fyy[3] - 38312*fyy[4] + 36586*fyy[5]) >> 16); - if (i>=2) it->ntscy[i-2] = blank + (fyy[6]>>3); - - /* Filter I and Q at 1.5 MHz. 3 pole Butterworth from - mkfilter -Bu -Lp -o 3 -a 1.0714285714e-01 0 - Delay about 3. - - The NTSC spec says the Q value should be filtered at 0.5 MHz at the - transmit end, But the Apple's video circuitry doesn't any such thing. - AFAIK, oldish televisions (before comb filters) simply applied a 1.5 MHz - filter to both after the demodulator. - */ - - fix[0] = fix[1]; fix[1] = fix[2]; fix[2] = fix[3]; - fix[3] = (ini * 1413) >> 14; - fiy[0] = fiy[1]; fiy[1] = fiy[2]; fiy[2] = fiy[3]; - fiy[3] = (fix[0]+fix[3]) + 3*(fix[1]+fix[2]) - + ((16559*fiy[0] - 72008*fiy[1] + 109682*fiy[2]) >> 16); - if (i>=3) it->ntsci[i-3] = fiy[3]>>2; - - fqx[0] = fqx[1]; fqx[1] = fqx[2]; fqx[2] = fqx[3]; - fqx[3] = (inq * 1413) >> 14; - fqy[0] = fqy[1]; fqy[1] = fqy[2]; fqy[2] = fqy[3]; - fqy[3] = (fqx[0]+fqx[3]) + 3*(fqx[1]+fqx[2]) - + ((16559*fqy[0] - 72008*fqy[1] + 109682*fqy[2]) >> 16); - if (i>=3) it->ntscq[i-3] = fqy[3]>>2; - } - for (; i<610; i++) { - if (i-2<600) it->ntscy[i-2]=0; - if (i-3<600) it->ntsci[i-3]=0; - if (i-9<600) it->ntscq[i-9]=0; - } -} +static char * apple2_basic_errors[]={ + "BREAK", + "NEXT WITHOUT FOR", + "SYNTAX ERROR", + "RETURN WITHOUT GOSUB", + "ILLEGAL QUANTITY", + "OVERFLOW", + "OUT OF MEMORY", + "BAD SUBSCRIPT ERROR", + "DIVISION BY ZERO", + "STRING TOO LONG", + "FORMULA TOO COMPLEX", + "UNDEF'D FUNCTION", + "OUT OF DATA" +#if 0 + , + "DEFAULT ARGUMENTS ARE NOT ALLOWED IN DECLARATION OF FRIEND " + "TEMPLATE SPECIALIZATION" +#endif -enum { - A2_CMAP_HISTBITS=5, - A2_CMAP_LEVELS=2, - A2_CMAP_OFFSETS=4 +}; +static char * apple2_dos_errors[]={ + "VOLUME MISMATCH", + "I/O ERROR", + "DISK FULL", + "NO BUFFERS AVAILABLE", + "PROGRAM TOO LARGE", }; -#define A2_CMAP_INDEX(COLORMODE, LEVEL, HIST, OFFSET) \ -((((COLORMODE)*A2_CMAP_LEVELS+(LEVEL))<st; + char *s; + int i; - XGetWindowAttributes (dpy, window, &xgwa); - visclass=xgwa.visual->class; - red_shift=red_invprec=green_shift=green_invprec=blue_shift=blue_invprec=-1; - if (visclass == TrueColor || xgwa.visual->class == DirectColor) { - use_cmap=0; - use_color=!mono_p; - } - else if (visclass == PseudoColor || visclass == StaticColor) { - use_cmap=1; - use_color=!mono_p; - } - else { - use_cmap=1; - use_color=0; - } + struct mydata { + int fillptr; + int fillbyte; + } *mine; - /* The Apple II screen was 280x192, sort of. We expand the width to 300 - pixels to allow for overscan. We then pick a size within the window - that's an integer multiple of 300x192. The small case happens when - we're displaying in a subwindow. Then it ends up showing the center - of the screen, which is OK. */ - w=xgwa.width; - h = (xgwa.height/192)*192; - if (w<300) w=300; - if (h==0) h=192; - - dec=(struct ntsc_dec *)malloc(sizeof(struct ntsc_dec)); + if (!sim->controller_data) + sim->controller_data = calloc(sizeof(struct mydata),1); + mine=(struct mydata *) sim->controller_data; - if (use_cmap) { - int hist,offset,level; - int colorprec=8; - - cmap_again: - n_colors=0; - /* Typically allocates 214 distinct colors, but will scale back its - ambitions pretty far if it can't get them */ - for (colormode=0; colormode<=use_color; colormode++) { - ntsc_set_demod(dec, tint_control, color_control, brightness_control, - 0.0, colormode); - for (level=0; level<2; level++) { - for (hist=0; hist<(1<dec->powerup = 1000.0; - for (i=0; i<600; i++) dec->pattern[i]=0; - for (i=0; ipattern[64+offset-i]=(hist>>i)&1; - } - - ntsc_to_yiq(dec); - interpy=dec->ntscy[63+offset]; - interpi=dec->ntsci[63+offset]; - interpq=dec->ntscq[63+offset]; - - r=(interpy + ((+68128*interpi+40894*interpq)>>16))*levelmult; - g=(interpy + ((-18087*interpi-41877*interpq)>>16))*levelmult; - b=(interpy + ((-72417*interpi+113312*interpq)>>16))*levelmult; - if (r<0) r=0; - if (r>65535) r=65535; - if (g<0) g=0; - if (g>65535) g=65535; - if (b<0) b=0; - if (b>65535) b=65535; - - col.red=r & precmask; - col.green=g & precmask; - col.blue=b & precmask; - col.pixel=0; - if (!XAllocColor(dpy, xgwa.colormap, &col)) { - XFreeColors(dpy, xgwa.colormap, colors, n_colors, 0L); - n_colors=0; - colorprec--; - if (colorprec<3) { - goto bailout; - } - goto cmap_again; - } - colors[n_colors++]=col.pixel; - } - } - } - } - } else { - /* Is there a standard way to do this? Does this handle all cases? */ - int shift, prec; - for (shift=0; shift<32; shift++) { - for (prec=1; prec<16 && prec<32-shift; prec++) { - unsigned long mask=(0xffffUL>>(16-prec)) << shift; - if (red_shift<0 && mask==xgwa.visual->red_mask) - red_shift=shift, red_invprec=16-prec; - if (green_shift<0 && mask==xgwa.visual->green_mask) - green_shift=shift, green_invprec=16-prec; - if (blue_shift<0 && mask==xgwa.visual->blue_mask) - blue_shift=shift, blue_invprec=16-prec; - } + if (random()%3==0) { + st->gr_mode=0; + *next_actiontime+=0.4; + *stepno=100; } - if (red_shift<0 || green_shift<0 || blue_shift<0) { - if (0) fprintf(stderr,"Can't figure out color space\n"); - goto bailout; + else if (random()%4==0) { + st->gr_mode=A2_GR_LORES; + if (random()%3==0) st->gr_mode |= A2_GR_FULL; + *next_actiontime+=0.4; + *stepno=100; } - raw_rgb=(short *)calloc(w*3, sizeof(short)); - } - - gcv.background=0; - gc = XCreateGC(dpy, window, GCBackground, &gcv); - XSetWindowBackground(dpy, window, gcv.background); - XClearWindow(dpy,window); - - screen_xo=(xgwa.width-w)/2; - screen_yo=(xgwa.height-h)/2; - - if (use_shm) { -#ifdef HAVE_XSHM_EXTENSION - image = create_xshm_image (dpy, xgwa.visual, xgwa.depth, ZPixmap, 0, - &shm_info, w, h); -#endif - if (!image) { - fprintf(stderr, "create_xshm_image failed\n"); - use_shm=0; + else if (random()%2==0) { + st->gr_mode=A2_GR_HIRES; + *stepno=300; } - } - if (!image) { - image = XCreateImage(dpy, xgwa.visual, xgwa.depth, ZPixmap, 0, 0, - w, h, 8, 0); - image->data = (char *)calloc(image->height, image->bytes_per_line); - } - - st=(struct apple2_state *)calloc(1,sizeof(struct apple2_state)); - - /* - Generate the font. It used a 5x7 font which looks a lot like the standard X - 6x10 font, with a few differences. So we render up all the uppercase - letters of 6x10, and make a few tweaks (like putting a slash across the - zero) according to fixfont. - */ - { - const char *def_font="6x10"; - XFontStruct *font; - Pixmap text_pm; - GC gc; - - font = XLoadQueryFont (dpy, def_font); - if (!font) { - fprintf(stderr,"Can't load font %s\n",def_font); - goto bailout; + else { + st->gr_mode=A2_GR_HIRES; + *next_actiontime+=0.4; + *stepno=100; } - - text_pm=XCreatePixmap(dpy, window, 64*7, 8, xgwa.depth); - - gcv.foreground=1; - gcv.background=0; - gcv.font=font->fid; - gc=XCreateGC(dpy, text_pm, GCFont|GCBackground|GCForeground, &gcv); - - XSetForeground(dpy, gc, 0); - XFillRectangle(dpy, text_pm, gc, 0, 0, 64*7, 8); - XSetForeground(dpy, gc, 1); - for (i=0; i<64; i++) { - char c=32+i; - int x=7*i+1; - int y=7; - if (c=='0') { - c='O'; - XDrawString(dpy, text_pm, gc, x, y, &c, 1); + break; + + case 100: + /* An illegal instruction or a reset caused it to drop into the + assembly language monitor, where you could disassemble code & view + data in hex. */ + if (random()%3==0) { + char ibytes[128]; + char itext[128]; + int addr=0xd000+random()%0x3000; + sprintf(ibytes, + "%02X",random()%0xff); + sprintf(itext, + "???"); + sprintf(sim->printing_buf, + "\n\n" + "%04X: %-15s %s\n" + " A=%02X X=%02X Y=%02X S=%02X F=%02X\n" + "*", + addr,ibytes,itext, + random()%0xff, random()%0xff, + random()%0xff, random()%0xff, + random()%0xff); + sim->printing=sim->printing_buf; + a2_goto(st,23,1); + if (st->gr_mode) { + *stepno=180; } else { - XDrawString(dpy, text_pm, gc, x, y, &c, 1); + *stepno=200; } + sim->prompt='*'; + *next_actiontime += 2.0 + (random()%1000)*0.0002; } - text_im = XGetImage(dpy, text_pm, 0, 0, 64*7, 8, ~0L, ZPixmap); - XFreeGC(dpy, gc); - XFreePixmap(dpy, text_pm); - - for (i=0; a2_fixfont[i]; i++) { - XPutPixel(text_im, a2_fixfont[i]&0x3ff, - (a2_fixfont[i]>>10)&0xf, - (a2_fixfont[i]>>15)&1); + else { + /* Lots of programs had at least their main functionality in + Applesoft Basic, which had a lot of limits (memory, string + length, etc) and would sometimes crash unexpectedly. */ + sprintf(sim->printing_buf, + "\n" + "\n" + "\n" + "?%s IN %d\n" + "\001]", + apple2_basic_errors[random() % + (sizeof(apple2_basic_errors) + /sizeof(char *))], + (1000*(random()%(random()%59+1)) + + 100*(random()%(random()%9+1)) + + 5*(random()%(random()%199+1)) + + 1*(random()%(random()%(random()%2+1)+1)))); + sim->printing=sim->printing_buf; + a2_goto(st,23,1); + *stepno=110; + sim->prompt=']'; + *next_actiontime += 2.0 + (random()%1000)*0.0002; } - } + break; + + case 110: + if (random()%3==0) { + /* This was how you reset the Basic interpreter. The sort of + incantation you'd have on a little piece of paper taped to the + side of your machine */ + sim->typing="CALL -1370"; + *stepno=120; + } + else if (random()%2==0) { + sim->typing="CATALOG\n"; + *stepno=170; + } + else { + *next_actiontime+=1.0; + *stepno=999; + } + break; + + case 120: + *stepno=130; + *next_actiontime += 0.5; + break; + + case 130: + st->gr_mode=0; + a2_cls(st); + a2_goto(st,0,16); + for (s="APPLE ]["; *s; s++) a2_printc(st,*s); + a2_goto(st,23,0); + a2_printc(st,']'); + *next_actiontime+=1.0; + *stepno=999; + break; + + case 170: + if (random()%50==0) { + sprintf(sim->printing_buf, + "\nDISK VOLUME 254\n\n" + " A 002 HELLO\n" + "\n" + "]"); + sim->printing=sim->printing_buf; + } + else { + sprintf(sim->printing_buf,"\n?%s\n]", + apple2_dos_errors[random()% + (sizeof(apple2_dos_errors) / + sizeof(char *))]); + sim->printing=sim->printing_buf; + } + *stepno=999; + *next_actiontime+=1.0; + break; + + case 180: + if (random()%2==0) { + /* This was how you went back to text mode in the monitor */ + sim->typing="FB4BG"; + *stepno=190; + } else { + *next_actiontime+=1.0; + *stepno=999; + } + break; + + case 190: + st->gr_mode=0; + a2_invalidate(st); + a2_printc(st,'\n'); + a2_printc(st,'*'); + *stepno=200; + *next_actiontime+=2.0; + break; + + case 200: + /* This reset things into Basic */ + if (random()%2==0) { + sim->typing="FAA6G"; + *stepno=120; + } + else { + *stepno=999; + *next_actiontime+=sim->delay; + } + break; - /* - Simulate plausible initial memory contents. - */ - { - int addr=0; - while (addr<0x4000) { - int n; - - switch (random()%4) { - case 0: - case 1: - n=random()%500; - for (i=0; iwidth); - for (i=0; i<100; i++) { - for (y=0; y<8; y++) { - c=0; - for (j=0; j<8; j++) { - c |= XGetPixel(text_im, (x+j)%text_im->width, y)<width); - } - break; + case 300: + for (i=0; i<1500; i++) { + a2_poke(st, mine->fillptr, mine->fillbyte); + mine->fillptr++; + mine->fillbyte = (mine->fillbyte+1)&0xff; + } + *next_actiontime += 0.08; + /* When you hit c000, it changed video settings */ + if (mine->fillptr>=0xc000) { + a2_invalidate(st); + st->gr_mode=0; + } + /* And it seemed to reset around here, I dunno why */ + if (mine->fillptr>=0xcf00) *stepno=130; + break; - case 3: - if (addr>0x2000) { - n=random()%200; - for (i=0; ibits_per_rgb>=8) { - flutter_tint=1; - } - else if (random()%3==0) { - flutter_horiz_desync=1; + case A2CONTROLLER_FREE: + free(mine); + break; } +} - crtload[0]=0.0; - stepno=0; - a2_goto(st,23,0); - gettimeofday(&basetime_tv, NULL); - if (random()%2==0) basetime_tv.tv_sec -= 1; /* random blink phase */ - next_actiontime=0.0; - fillptr=fillbyte=0; - while (1) { - double curtime,blinkphase; - int startdisplayrow=0; - int cheapdisplay=0; - int nodelay=0; - { - struct timeval curtime_tv; - gettimeofday(&curtime_tv, NULL); - curtime=(curtime_tv.tv_sec - basetime_tv.tv_sec) + - 0.000001*(curtime_tv.tv_usec - basetime_tv.tv_usec); - } - if (curtime>delay) goto finished; +static void +apple2crash (Display* dpy, Window window, int delay) +{ + apple2 (dpy, window, delay, a2controller_crash); +} - if (bsod_sleep(dpy,0)) goto finished; +/* MS-DOS, by jwz + */ +static void +msdos (Display *dpy, Window window, int delay) +{ + XWindowAttributes xgwa; + scrolling_window *ts; - if (flutter_tint && st->gr_mode && !printing) { - /* Oscillator instability. Look for freq_error below. We should only do - this with color depth>=8, since otherwise you see pixels changing. */ - freq_error_inc += (-0.10*freq_error_inc - + ((int)(random()&0xff)-0x80) * 0.01); - freq_error += freq_error_inc; - a2_invalidate(st); - nodelay=1; - } - else if (flutter_horiz_desync) { - /* Horizontal sync during vertical sync instability. */ - horiz_desync += (-0.10*(horiz_desync-3.0) + - ((int)(random()&0xff)-0x80) * - ((int)(random()&0xff)-0x80) * - ((int)(random()&0xff)-0x80) * 0.0000003); - for (i=0; i<3; i++) st->rowimage[i]=-1; - nodelay=1; - } - - /* It's super-important to get the cursor/text flash out at exactly the - right time, or it looks wrong. So if we're almost due for a blink, wait - for it so we don't miss it in the middle of a screen update. */ - blinkphase=curtime/0.8; - if (blinkphase-floor(blinkphase)>0.7 && !printing && !nodelay) { - /* We're about to blink */ - int delay = ((1.0-(blinkphase-floor(blinkphase)))*0.8) * 1000000; - if (delay<1000) delay=1000; - usleep(delay); - continue; - } + int delay1 = 10000; + int delay2 = 200000; - /* The blinking rate was controlled by 555 timer with a resistor/capacitor - time constant. Because the capacitor was electrolytic, the flash rate - varied somewhat between machines. I'm guessing 1.6 seconds/cycle was - reasonable. (I soldered a resistor in mine to make it blink faster.) */ - i=st->blink; - st->blink=((int)blinkphase)&1; - if (st->blink!=i && !(st->gr_mode&A2_GR_FULL)) { - int downcounter=0; - /* For every row with blinking text, set the changed flag. This basically - works great except with random screen garbage in text mode, when we - end up redrawing the whole screen every second */ - for (row=(st->gr_mode ? 20 : 0); row<24; row++) { - for (col=0; col<40; col++) { - c=st->textlines[row][col]; - if ((c & 0xc0) == 0x40) { - downcounter=4; - break; - } - } - if (downcounter>0) { - st->rowimage[row]=-1; - downcounter--; - } - } - st->rowimage[st->cursy]=-1; - startdisplayrow=random()%24; - } - else if (next_actiontime > curtime && !printing && !nodelay) { - int delay = (next_actiontime-curtime)*1000000; - - if (delay>100000) delay=100000; - if (delay<1000) delay=1000; - usleep(delay); - continue; - } +# define CURSOR "_\b \b" +# define CURSOR2 CURSOR CURSOR CURSOR - if (printing) { - cheapdisplay=1; - while (*printing) { - if (*printing=='\001') { /* pause */ - printing++; - for (i=20; i<24; i++) st->rowimage[i]=-1; - break; - } - else if (*printing=='\n') { - a2_printc(st,*printing); - printing++; - break; - } - else { - a2_printc(st,*printing); - printing++; - } - } - if (!*printing) printing=NULL; - } - else if (curtime >= next_actiontime) { - if (typing) { - /* If we're in the midst of typing a string, emit a character with - random timing. */ - a2_printc(st, *typing); - if (*typing=='\n') { - next_actiontime = curtime; - } else { - next_actiontime = curtime + (random()%1000)*0.0003 + 0.3; - } - typing++; - - if (!*typing) typing=NULL; - - } - else { - next_actiontime=curtime; - - switch(stepno) { - case 0: - a2_invalidate(st); - if (0) { - /* - For testing color rendering. The spec is: - red grn blu - 0 black 0 0 0 - 1 red 227 30 96 - 2 dk blue 96 78 189 - 3 purple 255 68 253 - 4 dk green 0 163 96 - 5 gray 156 156 156 - 6 med blue 20 207 253 - 7 lt blue 208 195 255 - 8 brown 96 114 3 - 9 orange 255 106 60 - 10 grey 156 156 156 - 11 pink 255 160 208 - 12 lt green 20 245 60 - 13 yellow 208 221 141 - 14 aqua 114 255 208 - 15 white 255 255 255 - */ - st->gr_mode=A2_GR_LORES; - for (row=0; row<24; row++) { - for (col=0; col<40; col++) { - st->textlines[row][col]=(row&15)*17; - } - } - next_actiontime+=0.4; - stepno=88; - } - else if (random()%3==0) { - st->gr_mode=0; - next_actiontime+=0.4; - stepno=88; - } - else if (random()%4==0) { - st->gr_mode=A2_GR_LORES; - if (random()%3==0) st->gr_mode |= A2_GR_FULL; - next_actiontime+=0.4; - stepno=88; - } - else if (random()%2==0) { - st->gr_mode=A2_GR_HIRES; - stepno=73; - } - else { - st->gr_mode=A2_GR_HIRES; - next_actiontime+=0.4; - stepno=88; - } - break; - - case 88: - /* An illegal instruction or a reset caused it to drop into the - assembly language monitor, where you could disassemble code & view - data in hex. */ - if (random()%3==0) { - char ibytes[128]; - char itext[128]; - int addr=0xd000+random()%0x3000; - sprintf(ibytes, - "%02X",random()%0xff); - sprintf(itext, - "???"); - sprintf(printbuf, - "\n\n" - "%04X: %-15s %s\n" - " A=%02X X=%02X Y=%02X S=%02X F=%02X\n" - "*", - addr,ibytes,itext, - random()%0xff, random()%0xff, - random()%0xff, random()%0xff, - random()%0xff); - printing=printbuf; - a2_goto(st,23,1); - if (st->gr_mode) { - stepno=11; - } else { - stepno=13; - } - prompt='*'; - next_actiontime += 2.0 + (random()%1000)*0.0002; - } - else { - /* Lots of programs had at least their main functionality in - Applesoft Basic, which had a lot of limits (memory, string - length, etc) and would sometimes crash unexpectedly. */ - sprintf(printbuf, - "\n" - "\n" - "\n" - "?%s IN %d\n" - "\001]", - apple2_basic_errors[random() % - (sizeof(apple2_basic_errors) - /sizeof(char *))], - (1000*(random()%(random()%59+1)) + - 100*(random()%(random()%9+1)) + - 5*(random()%(random()%199+1)) + - 1*(random()%(random()%(random()%2+1)+1)))); - printing=printbuf; - a2_goto(st,23,1); - stepno=1; - prompt=']'; - next_actiontime += 2.0 + (random()%1000)*0.0002; - } - break; - - case 1: - if (simulate_user && random()%3==0) { - /* This was how you reset the Basic interpreter. The sort of - incantation you'd have on a little piece of paper taped to the - side of your machine */ - typing="CALL -1370"; - stepno=2; - } - else if (simulate_user && random()%2==0) { - typing="CATALOG\n"; - stepno=22; - } - else { - next_actiontime+=1.0; - stepno=6; - } - break; + XGetWindowAttributes (dpy, window, &xgwa); + ts = make_scrolling_window (dpy, window, "MSDOS", False); - case 2: - stepno=3; - next_actiontime += 0.5; - break; - - case 3: - st->gr_mode=0; - a2_cls(st); - a2_goto(st,0,16); - for (s="APPLE ]["; *s; s++) a2_printc(st,*s); - a2_goto(st,23,0); - a2_printc(st,']'); - next_actiontime+=1.0; - stepno=6; - break; - - case 6: - if (simulate_user && random()%50==0 && 0) { /* disabled, too goofy */ - typing="10 PRINT \"TRS-80S SUCK!!!\"\n" - "]20 GOTO 10\n" - "]RUN"; - stepno=7; - } - else { - stepno=8; - next_actiontime += delay; - } - break; + XClearWindow(dpy, window); - case 7: - for (i=0; i<30; i++) { - for (s="\nTRS-80S SUCK"; *s; s++) a2_printc(st,*s); - } - stepno=8; - next_actiontime+=delay; - - case 8: - break; - - case 22: - if (random()%50==0) { - sprintf(printbuf,"\nDISK VOLUME 254\n\n" - " A 002 HELLO\n" - "\n" - "]"); - printing=printbuf; - } - else { - sprintf(printbuf,"\n?%s\n]", - apple2_dos_errors[random()% - (sizeof(apple2_dos_errors) / - sizeof(char *))]); - printing=printbuf; - } - stepno=6; - next_actiontime+=1.0; - break; - - case 11: - if (simulate_user && random()%2==0) { - /* This was how you went back to text mode in the monitor */ - typing="FB4BG"; - stepno=12; - } else { - next_actiontime+=1.0; - stepno=6; - } - break; - - case 12: - st->gr_mode=0; - a2_invalidate(st); - a2_printc(st,'\n'); - a2_printc(st,'*'); - stepno=13; - next_actiontime+=2.0; - break; - - case 13: - /* This reset things into Basic */ - if (simulate_user && random()%2==0) { - typing="FAA6G"; - stepno=2; - } - else { - stepno=8; - next_actiontime+=delay; - } - break; + scrolling_puts (ts, "C:\\WINDOWS>", delay1); + if (bsod_sleep(dpy, 1)) goto DONE; - case 73: - for (i=0; i<1500; i++) { - a2_poke(st, fillptr, fillbyte); - fillptr++; - fillbyte = (fillbyte+1)&0xff; - } - next_actiontime += 0.08; - /* When you hit c000, it changed video settings */ - if (fillptr>=0xc000) { - a2_invalidate(st); - st->gr_mode=0; - } - /* And it seemed to reset around here, I dunno why */ - if (fillptr>=0xcf00) stepno=3; - break; - } - } - } + scrolling_puts (ts, CURSOR2 "dir a:", delay2); + if (bsod_sleep(dpy, 1)) goto DONE; - /* Now, we turn the data in the Apple II video into a screen display. This - is interesting because of the interaction with the NTSC color decoding - in a color television. */ + scrolling_puts (ts, "\nNot ready reading drive A\nAbort, Retry, Fail?", + delay1); + if (bsod_sleep(dpy, 1)) goto DONE; - colormode=use_color && st->gr_mode!=0; - if (!use_cmap) { - ntsc_set_demod(dec, tint_control, color_control, brightness_control, - freq_error, colormode); - } - imgrow=0; - for (textrow=0; textrow<24; textrow++) { - if (st->rowimage[textrow] == textrow) { - screen_plan[textrow]=0; - } - else if (cheapdisplay && st->rowimage[textrow]>=0 && - textrow<21 && st->rowimage[textrow]<21 && - st->rowimage[textrow]>=2 && textrow>=2 && - (st->rowimage[textrow]+1)*h/24 + screen_xo <= xgwa.height) { - screen_plan[textrow]= A2_SP_COPY | st->rowimage[textrow]; - for (i=0; i<8; i++) { - crtload[textrow*8+i]=crtload[st->rowimage[textrow]*8+i]; - } - startdisplayrow=0; - } - else { - st->rowimage[textrow]=imgrow; - screen_plan[textrow]=imgrow | A2_SP_PUT; - - for (row=textrow*8; rowpattern,0,sizeof(dec->pattern)); - pp=dec->pattern+20; - - if ((st->gr_mode&A2_GR_HIRES) && (row<160 || - (st->gr_mode&A2_GR_FULL))) { - - /* Emulate the mysterious pink line, due to a bit getting - stuck in a shift register between the end of the last - row and the beginning of this one. */ - if ((st->hireslines[row][0] & 0x80) && - (st->hireslines[row][39]&0x40)) { - pp[-1]=1; - } + scrolling_puts (ts, CURSOR2 "f", delay2); + if (bsod_sleep(dpy, 1)) goto DONE; - for (col=0; col<40; col++) { - u_char b=st->hireslines[row][col]; - int shift=(b&0x80)?0:1; + scrolling_puts (ts, "\n\n\nNot ready reading drive A\nAbort, Retry, Fail?", + delay1); + if (bsod_sleep(dpy, 1)) goto DONE; - /* Each of the low 7 bits in hires mode corresponded to 2 dot - clocks, shifted by one if the high bit was set. */ - for (i=0; i<7; i++) { - pp[shift+1] = pp[shift] =(b>>i)&1; - pp+=2; - } - } - } - else if ((st->gr_mode&A2_GR_LORES) && (row<160 || - (st->gr_mode&A2_GR_FULL))) { - for (col=0; col<40; col++) { - u_char nib=(st->textlines[textrow][col] >> (((row/4)&1)*4))&0xf; - /* The low or high nybble was shifted out one bit at a time. */ - for (i=0; i<14; i++) { - *pp = (nib>>((col*14+i)&3))&1; - pp++; - } - } - } - else { - for (col=0; col<40; col++) { - int rev; - c=st->textlines[textrow][col]; - /* hi bits control inverse/blink as follows: - 0x00: inverse - 0x40: blink - 0x80: normal - 0xc0: normal */ - rev=!(c&0x80) && (!(c&0x40) || st->blink); - - for (i=0; i<7; i++) { - for (i=0; i<7; i++) { - unsigned long pix=XGetPixel(text_im, - ((c&0x3f)^0x20)*7+i, row%8); - pp[1] = pp[2] = pix^rev; - pp+=2; - } - } - } - } + scrolling_puts (ts, CURSOR2 "f", delay2); + if (bsod_sleep(dpy, 1)) goto DONE; - /* - Interpolate the 600-dotclock line into however many horizontal - screen pixels we're using, and convert to RGB. - - We add some 'bloom', variations in the horizontal scan width with - the amount of brightness, extremely common on period TV sets. They - had a single oscillator which generated both the horizontal scan - and (during the horizontal retrace interval) the high voltage for - the electron beam. More brightness meant more load on the - oscillator, which caused an decrease in horizontal deflection. Look - for (bloomthisrow). - - Also, the A2 did a bad job of generating horizontal sync pulses - during the vertical blanking interval. This, and the fact that the - horizontal frequency was a bit off meant that TVs usually went a - bit out of sync during the vertical retrace, and the top of the - screen would be bent a bit to the left or right. Look for - (shiftthisrow). - - We also add a teeny bit of left overscan, just enough to be - annoying, but you can still read the left column of text. - - We also simulate compression & brightening on the right side of the - screen. Most TVs do this, but you don't notice because they - overscan so it's off the right edge of the CRT. But the A2 video - system used so much of the horizontal scan line that you had to - crank the horizontal width down in order to not lose the right few - characters, and you'd see the compression on the right - edge. Associated with compression is brightening; since the - electron beam was scanning slower, the same drive signal hit the - phosphor harder. Look for (squishright_i) and (squishdiv). - */ - - for (i=j=0; i<600; i++) { - j += dec->pattern[i]; - } - crtload[row] = (crtload[row>1 ? row-1 : 0]) * 0.98 + 0.02*(j/600.0) + - (row>180 ? (row-180)*(row-180)*0.0005 : 0.0); - bloomthisrow = -10.0 * crtload[row]; - shiftthisrow=((row<18) ? ((18-row)*(18-row)* 0.002 + (18-row)*0.05) - * horiz_desync : 0.0); - - scanstart_i=(int)((bloomthisrow+shiftthisrow+18.0)*65536.0); - if (scanstart_i<0) scanstart_i=0; - if (scanstart_i>30*65536) scanstart_i=30*65536; - scanend_i=599*65536; - squishright_i=scanstart_i + 530*65536; - squishdiv=w/15; - pixrate=(int)((560.0-2.0*bloomthisrow)*65536.0/w); - - if (use_cmap) { - for (y=ytop; y=3) && - !(y==ybot-1 && ybot-ytop>=5)); - int hist=0; - int histi=0; - - pixmultinc=pixrate; - for (x=0, i=scanstart_i; - x>16); - int offset=pati&3; - while (pati>=histi) { - hist=(((hist<<1) & ((1<pattern[histi]); - histi++; - } - XPutPixel(image, x, y, - colors[A2_CMAP_INDEX(colormode,level,hist,offset)]); - if (i >= squishright_i) { - pixmultinc += pixmultinc/squishdiv; - } - } - for ( ; x>16; - int r,g,b; - - int interpy=((dec->ntscy[pati]*invpixfrac + - dec->ntscy[pati+1]*pixfrac)>>16); - int interpi=((dec->ntsci[pati]*invpixfrac + - dec->ntsci[pati+1]*pixfrac)>>16); - int interpq=((dec->ntscq[pati]*invpixfrac + - dec->ntscq[pati+1]*pixfrac)>>16); - - /* - According to the NTSC spec, Y,I,Q are generated as: - - y=0.30 r + 0.59 g + 0.11 b - i=0.60 r - 0.28 g - 0.32 b - q=0.21 r - 0.52 g + 0.31 b - - So if you invert the implied 3x3 matrix you get what standard - televisions implement with a bunch of resistors (or directly in - the CRT -- don't ask): - - r = y + 0.948 i + 0.624 q - g = y - 0.276 i - 0.639 q - b = y - 1.105 i + 1.729 q - - These coefficients are below in 16.16 format. - */ - - r=((interpy + ((+68128*interpi+40894*interpq)>>16))*pixbright) - >>16; - g=((interpy + ((-18087*interpi-41877*interpq)>>16))*pixbright) - >>16; - b=((interpy + ((-72417*interpi+113312*interpq)>>16))*pixbright) - >>16; - if (r<0) r=0; - if (g<0) g=0; - if (b<0) b=0; - rrp[0]=r; - rrp[1]=g; - rrp[2]=b; - - if (i>=squishright_i) { - pixmultinc += pixmultinc/squishdiv; - pixbright += pixbright/squishdiv; - } - } - for ( ; xformat==ZPixmap && image->bits_per_pixel==32 && - sizeof(unsigned long)==4 && - image->byte_order==localbyteorder) { - unsigned long *pixelptr = - (unsigned long *) (image->data + y * image->bytes_per_line); - for (x=0, rrp=raw_rgb; x65535) ntscri=65535; - if (ntscgi>65535) ntscgi=65535; - if (ntscbi>65535) ntscbi=65535; - *pixelptr++ = ((ntscri>>red_invprec)<>green_invprec)<>blue_invprec)<format==ZPixmap && image->bits_per_pixel==16 && - sizeof(unsigned short)==2 && - image->byte_order==localbyteorder) { - unsigned short *pixelptr = - (unsigned short *)(image->data + y*image->bytes_per_line); - for (x=0, rrp=raw_rgb; x65535) ntscri=65535; - if (ntscgi>65535) ntscgi=65535; - if (ntscbi>65535) ntscbi=65535; - *pixelptr++ = ((ntscri>>red_invprec)<>green_invprec)<>blue_invprec)<65535) ntscri=65535; - if (ntscgi>65535) ntscgi=65535; - if (ntscbi>65535) ntscbi=65535; - pixel = ((ntscri>>red_invprec)<>green_invprec)<>blue_invprec)<", delay1); - for (textrow=0; textrow<24; textrow++) { - st->rowimage[textrow]=textrow; - } + { + time_t start = time((time_t *) 0); + while (start + delay > time((time_t *) 0)) + if (scrolling_puts (ts, CURSOR, delay2)) + break; } - finished: - XSync(dpy,False); + DONE: XClearWindow(dpy, window); - goto cleanup; - bailout: - ; +# undef CURSOR +# undef CURSOR2 +} + - cleanup: - if (image) { - if (use_shm) { -#ifdef HAVE_XSHM_EXTENSION - destroy_xshm_image(dpy, image, &shm_info); -#endif - } else { - XDestroyImage(image); +/* + * OS/2 panics, by Knut St. Osmundsen + * + * All but one messages are real ones, some are from my test machines + * and system dumps, others are reconstructed from google results. + * Please, don't be to hard if the formatting of the earlier systems + * aren't 100% correct. + */ +static void +os2 (Display *dpy, Window window, int delay) +{ + XGCValues gcv; + XWindowAttributes xgwa; + XFontStruct *font; + GC gc; + char *fontname; + const char *def_font = "fixed"; + const char *str; + const char *panic_msg; + time_t start; + int line_height; + int i; + int y; + +# ifdef __GNUC__ + __extension__ /* don't warn about "string length is greater than the + length ISO C89 compilers are required to support" + in the following string constant... */ +# endif + + static const char *os2_panics[] = + { /* OS/2 2.0 trap - details are bogus (CR0++). */ + "TRAP 0002 ERRCD=0000 ERACC=**** ERLIM=********\n" + "EAX=7d240a58 EBX=ff202fdc ECX=00064423 EDX=00003624\n" + "ESI=fff3272c EDI=7d240004 EBP=00004a44 FLG=00003202\n" + "CS:EIP=0160:fff702a6 CSACC=c09d CSLIM=ffffffff\n" + "SS:ESP=0030:00004a38 SSACC=1097 SSLIM=00003fff\n" + "DS=0158 DSACC=c0f3 DSLIM=ffffffff CR0=fffffffb\n" + "ES=0158 ESACC=c0f3 ESLIM=ffffffff CR2=1a060014\n" + "FS=0000 FSACC=**** FSLIM=********\n" + "GS=0000 GSACC=**** GSLIM=********\n" + "\n" + "The system detected an internal processing error\n" + "at location ##0160:fff6453f - 000d:a53f\n" + "60000, 9084\n" + "\n" + "038600d1\n" + "Internal revision 6.307, 92/03/01\n" + "\n", + + /* warp 3 (early) */ + "TRAP 000e ERRCD=0000 ERACC=**** ERLIM=********\n" + "EAX=ff050c20 EBX=000000bb ECX=ffff00c1 EDx=fff379b8\n" + "ESI=ffe55a3c EDI=00000000 EBP=00004eb8 FLG=00013282\n" + "CS:EIP=0160:fff8dbb8 CSACC=c09b CSLIM=ffffffff\n" + "SS:EIP=0030:00004eb4 SSACC=1097 SSLIM=00003fff\n" + "DS=0158 DSACC=c0f3 DSLIM=ffffffff CR0=8001001b\n" + "ES=0158 DSACC=c0f3 DSLIM=ffffffff CR2=000000c7\n" + "FS=0000 FSACC=**** FSLIM=********\n" + "GS=0000 GSACC=**** GSLIM=********\n" + "\n" + "The system detected an internal processing error\n" + "at location ##0160:fff66bf0 - 000d:9bf0.\n" + "60000, 9084\n" + "\n" + "048600b4\n" + "Internal revision 8.125, 94/02/16\n" + "\n" + "The system is stopped. Record the location number of the error\n" + "and contact your service representative.\n", + + /* warp 3 */ + "TRAP 000e ERRCD=0002 ERACC=**** ERLIM=********\n" + "EAX=00000000 EBX=fdef1e0c ECX=00003824 EDX=0000edf9\n" + "ESI=fdf30e80 EDI=fc8b0000 EBP=00005658 FLG=00012246\n" + "CS:EIP=0160:fff8ada3 CSACC=c09b CSLIM=ffffffff\n" + "SS:ESP=0030:000055d4 SSACC=1097 SSLIM=0000480f\n" + "DS=0158 DSACC=c093 DSLIM=ffffffff CR0=8001001b\n" + "ES=0158 ESACC=c093 ESLIM=ffffffff CR2=fc8b0000\n" + "FS=03b8 FSACC=0093 FSLIM=00000023\n" + "GS=0000 GSACC=**** GSLIM=********\n" + "\n" + "The system detected an internal processing error\n" + "at location ##0160:fff5c364 - 000d:a364.\n" + "60000, 9084\n" + "\n" + "05860526\n" + "Internal revision 8200,94/11/07\n" + "\n" + "The system is stopped. Record all of the above information and\n" + "contact your service representative.\n", + + /* warp 3 (late) */ + "TRAP 000d ERRCD=2200 ERACC=1092 ERLIM=00010fff\n" + "EAX=0000802e EBX=fff001c8 ECX=9bd80000 EDX=00000000\n" + "ESI=fff09bd8 EDI=fdeb001b EBP=00000000 FLG=00012012\n" + "CS:EIP=0168:fff480a2 CSACC=c09b CSLIM=ffffffff\n" + "SS:ESP=00e8:00001f32 SSACC=0093 SSLIM=00001fff\n" + "DS=0940 DSACC=0093 DSLIM=00000397 CR0=8001001b\n" + "ES=00e8 ESACC=0093 ESLIM=00001fff CR2=15760008\n" + "FS=0000 FSACC=**** FSLIM=****\n" + "GS=0000 GSACC=**** GSLIM=****\n" + "\n" + "The system detected an internal processing error\n" + "at location ##0168:fff4b06e - 000e:c06e\n" + "60000, 9084\n" + "\n" + "06860652\n" + "Internal revision 8.259_uni,98/01/07\n" + "\n" + "The system is stopped. Record all of the above information and\n" + "contact your service representative.\n", + + /* Warp 4.52+ - the official r0trap.exe from the debugging classes */ + "Exception in module: OS2KRNL\n" + "TRAP 000e ERRCD=0002 ERACC=**** ERLIM=********\n" + "EAX=00000001 EBX=80010002 ECX=ffed4638 EDX=0003f17b\n" + "ESI=00000001 EDI=00000002 EBP=00005408 FLG=00012202\n" + "CS:EIP=0168:fff3cd2e CSACC=c09b CSLIM=ffffffff\n" + "SS:ESP=0030:000053ec SSACC=1097 SSLIM=000044ff\n" + "DS=0160 DSACC=c093 DSLIM=ffffffff CR0=8001001b\n" + "ES=0160 ESACC=c093 ESLIM=ffffffff CR2=00000001\n" + "FS=0000 FSACC=**** FSLIM=********\n" + "GS=0000 GSACC=**** GSLIM=********\n" + "\n" + "The system detected an internal processing error at\n" + "location ##0168:fff1e3f3 - 000e:c3f3.\n" + "60000, 9084\n" + "\n" + "068606a0\n" + "Internal revision 14.097_UNI\n" + "\n" + "The system is stopped. Record all of the above information and\n" + "contact your service representative.\n", + + /* Warp 4.52+, typical JFS problem. */ + "Exeption in module: JFS\n" + "TRAP 0003 ERRCD=0000 ERACC=**** ERLIM=********\n" + "EAX=00000000 EBX=ffffff05 ECX=00000001 EDX=f5cd8010\n" + "ESI=000000e6 EDI=000000e7 EBP=f9c7378e FLG=00002296\n" + "CS:EIP=0168:f8df3250 CSACC=c09b CSLIM=ffffffff\n" + "SS:ESP=1550:fdc73778 SSACC=c093 SSLIM=ffffffff\n" + "DS=0160 DSACC=c093 DSLIM=ffffffff CR0=80010016\n" + "ES=0160 ESACC=c093 DSLIM=ffffffff CR2=05318000\n" + "FS=03c0 FSACC=0093 DSLIM=00000023\n" + "GS=0160 GSACC=c093 DSLIM=ffffffff\n" + "\n" + "The system detected an internal processing error\n" + "at location ##0168:fff1e2ab - 000e:c2ab.\n" + "60000, 9084\n" + "\n" + "07860695\n" + "\n" + "Internal revision 14.100c_UNI\n" + "\n" + "The system is stopped. Record all of the above information and\n" + "contact your service representative.\n" + }; + + i = random() % countof(os2_panics); + panic_msg = os2_panics[i]; + + XGetWindowAttributes(dpy, window, &xgwa); + fontname = get_string_resource((xgwa.height > 1000 + ? "OS2.font3" : xgwa.height > 600 + ? "OS2.font2" : "OS2.font"), + "OS2.Font"); + if (!fontname || !*fontname) + fontname = (char *)def_font; + font = XLoadQueryFont(dpy, fontname); + if (!font) + font = XLoadQueryFont(dpy, def_font); + if (!font) + exit(-1); + if (fontname && fontname != def_font) + free(fontname); + + gcv.font = font->fid; + gcv.foreground = get_pixel_resource("OS2.foreground", + "OS2.Foreground", + dpy, xgwa.colormap); + gcv.background = get_pixel_resource("OS2.background", + "OS2.Background", + dpy, xgwa.colormap); + XSetWindowBackground(dpy, window, gcv.background); + XClearWindow(dpy, window); + + gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv); + + /* draw the text, calc the cursor location and make it blink. */ + line_height = font->ascent + font->descent; + draw_string(dpy, window, gc, &gcv, font, 0, 0, 10, 10, panic_msg, 0); + + y = line_height * 2; + str = panic_msg - 1; + while ((str = strchr(str + 1, '\n')) != NULL) + y += line_height; + + start = time((time_t *) 0); + while (start + delay > time((time_t *) 0)) + { + XDrawImageString(dpy, window, gc, 0, y, "_", 1); + XSync(dpy, False); + usleep(200000L); + XDrawImageString(dpy, window, gc, 0, y, " ", 2); + XSync(dpy, False); + usleep(200000L); + if (bsod_sleep(dpy, 0)) + break; } - image=NULL; - } - if (text_im) XDestroyImage(text_im); - if (gc) XFreeGC(dpy, gc); - if (st) free(st); - if (raw_rgb) free(raw_rgb); - if (dec) free(dec); - if (n_colors) XFreeColors(dpy, xgwa.colormap, colors, n_colors, 0L); + + XFreeGC(dpy, gc); + XSync(dpy, False); + XClearWindow(dpy, window); + XFreeFont(dpy, font); } + char *progclass = "BSOD"; @@ -4072,17 +3794,24 @@ char *defaults [] = { "*doBSD: False", /* boring */ "*doLinux: True", "*doSparcLinux: False", /* boring */ + "*doHPPALinux: True", "*doBlitDamage: True", "*doSolaris: True", "*doHPUX: True", + "*doTru64: True", "*doApple2: True", "*doOS390: True", "*doVMS: True", + "*doHVX: True", + "*doMSDOS: True", + "*doOS2: True", ".Windows.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", ".Windows.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", ".Windows.foreground: White", ".Windows.background: #0000AA", /* EGA color 0x01. */ + ".windowsLH.background: #AA0000", /* EGA color 0x04. */ + ".windowsLH.background2: #AAAAAA", /* EGA color 0x07. */ ".Amiga.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", ".Amiga.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", @@ -4118,11 +3847,21 @@ char *defaults [] = { ".SCO.foreground: White", ".SCO.background: Black", + ".HVX.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", + ".HVX.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".HVX.foreground: White", + ".HVX.background: Black", + ".Linux.font: 9x15bold", ".Linux.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".Linux.foreground: White", ".Linux.background: Black", + ".HPPALinux.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", + ".HPPALinux.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".HPPALinux.foreground: White", + ".HPPALinux.background: Black", + ".SparcLinux.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", ".SparcLinux.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", ".SparcLinux.foreground: White", @@ -4151,6 +3890,11 @@ char *defaults [] = { ".OS390.background: Black", ".OS390.foreground: Red", + ".Tru64.font: 9x15bold", + ".Tru64.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".Tru64.foreground: White", + ".Tru64.background: #0000AA", /* EGA color 0x01. */ + "*apple2TVColor: 50", "*apple2TVTint: 5", "*apple2TVBrightness: 10", @@ -4162,6 +3906,19 @@ char *defaults [] = { ".VMS.foreground: White", ".VMS.background: Black", + ".MSDOS.font: 9x15bold", + ".MSDOS.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*", + ".MSDOS.foreground: White", + ".MSDOS.background: Black", + + ".OS2.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*", + ".OS2.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*", + ".OS2.font3: -*-courier-bold-r-*-*-*-240-*-*-m-*-*-*", + ".OS2.foreground: White", + ".OS2.background: Black", + + ANALOGTV_DEFAULTS + #ifdef HAVE_XSHM_EXTENSION "*useSHM: True", #endif @@ -4193,22 +3950,35 @@ XrmOptionDescRec options [] = { { "-no-apple2", ".doApple2", XrmoptionNoArg, "False" }, { "-sco", ".doSCO", XrmoptionNoArg, "True" }, { "-no-sco", ".doSCO", XrmoptionNoArg, "False" }, + { "-hvx", ".doHVX", XrmoptionNoArg, "True" }, + { "-no-hvx", ".doHVX", XrmoptionNoArg, "False" }, { "-bsd", ".doBSD", XrmoptionNoArg, "True" }, { "-no-bsd", ".doBSD", XrmoptionNoArg, "False" }, { "-linux", ".doLinux", XrmoptionNoArg, "True" }, { "-no-linux", ".doLinux", XrmoptionNoArg, "False" }, + { "-hppalinux", ".doHPPALinux", XrmoptionNoArg, "True" }, + { "-no-hppalinux", ".doHPPALinux", XrmoptionNoArg, "False" }, { "-sparclinux", ".doSparcLinux", XrmoptionNoArg, "True" }, { "-no-sparclinux", ".doSparcLinux", XrmoptionNoArg, "False" }, { "-blitdamage", ".doBlitDamage", XrmoptionNoArg, "True" }, { "-no-blitdamage", ".doBlitDamage", XrmoptionNoArg, "False" }, + { "-nvidia", ".doNvidia", XrmoptionNoArg, "True" }, + { "-no-nvidia", ".doNvidia", XrmoptionNoArg, "False" }, { "-solaris", ".doSolaris", XrmoptionNoArg, "True" }, { "-no-solaris", ".doSolaris", XrmoptionNoArg, "False" }, { "-hpux", ".doHPUX", XrmoptionNoArg, "True" }, { "-no-hpux", ".doHPUX", XrmoptionNoArg, "False" }, { "-os390", ".doOS390", XrmoptionNoArg, "True" }, { "-no-os390", ".doOS390", XrmoptionNoArg, "False" }, + { "-tru64", ".doHPUX", XrmoptionNoArg, "True" }, + { "-no-tru64", ".doTru64", XrmoptionNoArg, "False" }, { "-vms", ".doVMS", XrmoptionNoArg, "True" }, { "-no-vms", ".doVMS", XrmoptionNoArg, "False" }, + { "-msdos", ".doMSDOS", XrmoptionNoArg, "True" }, + { "-no-msdos", ".doMSDOS", XrmoptionNoArg, "False" }, + { "-os2", ".doOS2", XrmoptionNoArg, "True" }, + { "-no-os2", ".doOS2", XrmoptionNoArg, "False" }, + ANALOGTV_OPTIONS { 0, 0, 0, 0 } }; @@ -4218,24 +3988,30 @@ static struct { void (*fn) (Display *, Window, int delay); } all_modes[] = { { "Windows", windows_31 }, - { "Nt", windows_nt }, - { "2k", windows_2k }, + { "NT", windows_nt }, + { "Win2K", windows_2k }, { "Amiga", amiga }, { "Mac", mac }, { "MacsBug", macsbug }, { "Mac1", mac1 }, { "MacX", macx }, { "SCO", sco }, + { "HVX", hvx }, + { "HPPALinux", hppa_linux }, { "SparcLinux", sparc_linux }, { "BSD", bsd }, { "Atari", atari }, { "BlitDamage", blitdamage }, + { "Nvidia", nvidia }, { "Solaris", sparc_solaris }, { "Linux", linux_fsck }, { "HPUX", hpux }, { "OS390", os390 }, - { "Apple2", apple2 }, + { "Tru64", tru64 }, + { "Apple2", apple2crash }, { "VMS", vms }, + { "OS2", os2 }, + { "MSDOS", msdos }, }; @@ -4271,7 +4047,8 @@ screenhack (Display *dpy, Window window) XWindowAttributes xgwa; XGetWindowAttributes (dpy, window, &xgwa); XSelectInput (dpy, window, - xgwa.your_event_mask | KeyPressMask | ButtonPressMask); + xgwa.your_event_mask | + KeyPressMask | ButtonPressMask | ExposureMask); } while (1) @@ -4280,7 +4057,7 @@ screenhack (Display *dpy, Window window) int count = countof(all_modes); char name[100], class[100]; - if (only > 0) + if (only >= 0) i = only; else do { i = (random() & 0xFF) % count; } while (i == j);