int consio_init(int device) { if (device < 0) { /* undetemined yet */ if (KEYCTRL & 8) device = ITE; else { IOCS_B_PRINT ("No keyboard; " "switching to serial console..."); device = SERIAL; } } switch (device) { case ITE: x68k_console_device = ITE; /* set palette here */ IOCS_OS_CURON (); break; case SERIAL: x68k_console_device = SERIAL; IOCS_OS_CUROF (); IOCS_SET232C (SERPARAM); } return x68k_console_device; }
void print_title(const char *fmt, ...) { va_list ap; if (x68k_console_device == ITE) { int y, y1; char *buf = alloca(240); /* about 3 lines */ char *p; y = y1 = (IOCS_B_LOCATE(-1, -1) & 0xffff) + 1; put_image (8, y*16-6); IOCS_B_LOCATE(0, y+3); IOCS_B_PRINT("\360D\360a\360e\360m\360o\360n " "\360l\360o\360g\360o " "\360(\360C\360)\3601\3609\3609\3608\360 " "\360b\360y\360 " "\360M\360a\360r\360s\360h\360a\360l\360l\360 " "\360K\360i\360r\360k\360 " "\360M\360c\360K\360u\360s\360i\360c\360k\360."); va_start(ap, fmt); vsnprintf(buf, 240, fmt, ap); va_end(ap); while ((p = strchr(buf, '\n')) != 0) { *p = 0; IOCS_B_LOCATE(9, ++y); IOCS_B_PRINT(buf); buf = p+1; } IOCS_B_LOCATE(9, ++y); IOCS_B_PRINT(buf); IOCS_B_LOCATE(0, y1+5); } else { va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); printf("\n"); } }
void bootmain(void) { int bootdev, ha, fd; char bootdevstr[16]; u_long marks[MARK_MAX]; IOCS_B_PRINT(bootprog_name); IOCS_B_PRINT(" rev."); IOCS_B_PRINT(bootprog_rev); IOCS_B_PRINT("\r\n"); ha = get_scsi_host_adapter(bootdevstr); #ifdef XXBOOT_DEBUG bootdevstr[10] = '0' + (ID & 7); bootdevstr[14] = 'a'; #endif #if defined(CDBOOT) bootdev = X68K_MAKESCSIBOOTDEV(X68K_MAJOR_CD, ha >> 4, ha & 15, ID & 7, 0, 0); #elif defined(FDBOOT) || defined(SDBOOT) if (BINF_ISFD(&BOOT_INFO)) { /* floppy */ #ifdef XXBOOT_DEBUG *(uint32_t *)bootdevstr = ('f' << 24 | 'd' << 16 | '@' << 8 | '0' + (BOOT_INFO & 3)); bootdevstr[4] = '\0'; #endif /* fdNa for 1024 bytes/sector, fdNc for 512 bytes/sector */ bootdev = X68K_MAKEBOOTDEV(X68K_MAJOR_FD, BOOT_INFO & 3, (FDSECMINMAX.minsec.N == 3) ? 0 : 2); } else { /* SCSI */ bootdev = X68K_MAKESCSIBOOTDEV(X68K_MAJOR_SD, ha >> 4, ha & 15, ID & 7, 0, 0 /* XXX: assume partition a */); } #else bootdev = 0; #endif #ifdef XXBOOT_DEBUG IOCS_B_PRINT("boot device: "); IOCS_B_PRINT(bootdevstr); #endif IOCS_B_PRINT("\r\n"); marks[MARK_START] = BOOT_TEXTADDR; fd = loadfile("x68k/boot", marks, LOAD_TEXT|LOAD_DATA|LOAD_BSS); if (fd < 0) fd = loadfile("boot", marks, LOAD_TEXT|LOAD_DATA|LOAD_BSS); if (fd >= 0) { close(fd); exec_image(BOOT_TEXTADDR, /* image loaded at */ BOOT_TEXTADDR, /* image executed at */ BOOT_TEXTADDR, /* XXX: entry point */ 0, /* XXX: image size */ bootdev, 0); /* arguments */ } IOCS_B_PRINT("can't load the secondary bootstrap."); exit(0); }