xref: /haiku/src/system/boot/platform/atari_m68k/debug.cpp (revision 1345706a9ff6ad0dc041339a02d4259998b0765d)
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 "toscalls.h"
9 
10 #include <boot/platform.h>
11 #include <boot/stdio.h>
12 #include <stdarg.h>
13 
14 #include <Errors.h>
15 
16 /*!	This works only after console_init() was called.
17 */
18 void
19 panic(const char *format, ...)
20 {
21 	const char greetings[] = "\n*** PANIC ***";
22 	char buffer[512];
23 	va_list list;
24 
25 	//platform_switch_to_text_mode();
26 
27 	Bconputs(DEV_CONSOLE, greetings);
28 	// send to the emulator's stdout if available
29 	nat_feat_debugprintf(greetings);
30 	nat_feat_debugprintf("\n");
31 
32 	va_start(list, format);
33 	vsnprintf(buffer, sizeof(buffer), format, list);
34 	va_end(list);
35 
36 	Bconputs(DEV_CONSOLE, buffer);
37 	// send to the emulator's stdout if available
38 	nat_feat_debugprintf(buffer);
39 	nat_feat_debugprintf("\n");
40 
41 	Bconputs(DEV_CONSOLE, "\nPress key to reboot.");
42 
43 	clear_key_buffer();
44 	wait_for_key();
45 	platform_exit();
46 }
47 
48 
49 void
50 dprintf(const char *format, ...)
51 {
52 	char buffer[512];
53 	va_list list;
54 
55 	va_start(list, format);
56 	vsnprintf(buffer, sizeof(buffer), format, list);
57 	va_end(list);
58 
59 	Bconput(DEV_AUX, buffer);
60 
61 	// send to the emulator's stdout if available
62 	nat_feat_debugprintf(buffer);
63 
64 	//if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT)
65 		Bconput(DEV_CONSOLE, buffer);
66 }
67 
68 
69