summaryrefslogtreecommitdiffstats
path: root/patches/cbmbasic
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2008-11-27 16:02:45 +0000
committerWolfram Sang <w.sang@pengutronix.de>2008-11-27 16:02:45 +0000
commitd862b9bef7dd78db3881804db7cff678f553471e (patch)
treec888575407259e306214e7032a38852a533428fd /patches/cbmbasic
parent3eface707f5c42d95e578eae8639377f12e74eab (diff)
downloadptxdist-d862b9bef7dd78db3881804db7cff678f553471e.tar.gz
ptxdist-d862b9bef7dd78db3881804db7cff678f553471e.tar.xz
* cbmbasic: add RND functionality
git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-trunk@9168 33e552b5-05e3-0310-8538-816dae2090ed
Diffstat (limited to 'patches/cbmbasic')
-rw-r--r--patches/cbmbasic/generic/add_iobase45
-rw-r--r--patches/cbmbasic/generic/series1
2 files changed, 46 insertions, 0 deletions
diff --git a/patches/cbmbasic/generic/add_iobase b/patches/cbmbasic/generic/add_iobase
new file mode 100644
index 000000000..a1e1d4b45
--- /dev/null
+++ b/patches/cbmbasic/generic/add_iobase
@@ -0,0 +1,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
diff --git a/patches/cbmbasic/generic/series b/patches/cbmbasic/generic/series
new file mode 100644
index 000000000..3ce433cb4
--- /dev/null
+++ b/patches/cbmbasic/generic/series
@@ -0,0 +1 @@
+add_iobase