blob: a1e1d4b45f688f218512110283c2d95520e78beb (
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
41
42
43
44
45
|
Add IOBASE and pseudo-timer (will give RND-functionality)
Signed-off-by: Wolfram Sang <ninja@the-dreams.de>
# Already sent mainline and accepted.
Index: basic/runtime.c
===================================================================
--- basic.orig/runtime.c 2008-11-17 05:16:31.000000000 +0100
+++ basic/runtime.c 2008-11-17 05:43:31.000000000 +0100
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <time.h>
unsigned char RAM[65536];
@@ -155,6 +156,7 @@
interactive = 1;
f = NULL;
}
+ srand(time(NULL));
}
static void
@@ -565,8 +567,16 @@
/* IOBASE */
static void
IOBASE() {
- printf("UNIMPL: IOBASE\n");
- exit(1);
+ /*
+ * IOBASE is just used inside RND to get a timer value.
+ * So, let's fake this here, too.
+ */
+ int pseudo_timer = rand();
+ RAM[0xDC04] = pseudo_timer&0xff;
+ RAM[0xDC05] = pseudo_timer>>8;
+
+ X = 0x00;
+ Y = 0xDC;
}
int
|