1 /* 2 * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "keyboard.h" 8 #include "rom_calls.h" 9 10 #include <boot/platform.h> 11 #include <boot/stdio.h> 12 #include <stdarg.h> 13 #include <string.h> 14 15 #include <Errors.h> 16 17 /*! This works only after console_init() was called. 18 */ 19 void 20 panic(const char *format, ...) 21 { 22 static struct AlertMessage { 23 uint16 column1; 24 uint8 line1; 25 char message[14]; 26 uint8 cont; 27 uint16 column2; 28 uint8 line2; 29 char buffer[512]; 30 uint8 end; 31 32 } _PACKED alert = { 33 10, 12, 34 "*** PANIC ***", 35 1, 36 10, 22, 37 "", 38 0 39 }; 40 41 char *buffer = alert.buffer; 42 va_list list; 43 44 //platform_switch_to_text_mode(); 45 46 memset(buffer, 0, 512); 47 48 va_start(list, format); 49 vsnprintf(buffer, 512, format, list); 50 va_end(list); 51 52 DisplayAlert(DEADEND_ALERT, &alert, 40); 53 54 clear_key_buffer(); 55 wait_for_key(); 56 platform_exit(); 57 } 58 59 60 void 61 dprintf(const char *format, ...) 62 { 63 char buffer[512]; 64 va_list list; 65 66 va_start(list, format); 67 vsnprintf(buffer, sizeof(buffer), format, list); 68 va_end(list); 69 70 // Bconput(DEV_AUX, buffer); 71 72 //if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) 73 // Bconput(DEV_CONSOLE, buffer); 74 } 75 76 77