blob: ae612507acd91bc02a3686c8780f448264d8b334 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
Author: Fabian Greffrath <fabian+debian@greffrath.com>
Description: Reboot the machine when the ESC key is pressed,
reboot() taken from memtest86_3.5-2.
--- invaders-1.0.0.orig/game.c
+++ invaders-1.0.0/game.c
@@ -2,6 +2,7 @@
#include "keyboard.h"
#include "sound.h"
#include "delay.h"
+#include "io.h"
struct shot_t {
int8 x,y; // x==-1 -> inactive shot
@@ -19,6 +20,13 @@
static bool gameover, winner;
+static inline void reboot()
+{
+ /* tell the BIOS to do a warm start */
+ *((unsigned short *)0x472) = 0x1234;
+ outb(0xfe,0x64);
+};
+
void resetgame()
{
gameover=false;
@@ -120,6 +128,11 @@
break;
case 'x':
return;
+ case '@':
+ if (pressed) {
+ reboot();
+ }
+ break;
};
};
};
|