projects
/
screensavers
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added missing newline in NEDsim error message.
[screensavers]
/
hacks
/
NEDsim
/
simulator.h
diff --git
a/hacks/NEDsim/simulator.h
b/hacks/NEDsim/simulator.h
index
927f73b
..
51c461e
100644
(file)
--- a/
hacks/NEDsim/simulator.h
+++ b/
hacks/NEDsim/simulator.h
@@
-1,45
+1,22
@@
/* (c) 2021 Aaron Taylor <ataylor at subgeniuskitty dot com> */
/* See LICENSE.txt file for copyright and license details. */
/* (c) 2021 Aaron Taylor <ataylor at subgeniuskitty dot com> */
/* See LICENSE.txt file for copyright and license details. */
-// TODO: Prune includes in both this header and the corresponding source file.
-#include <stdio.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <time.h>
-#include <termios.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-
-#include "./a.out.h"
+#ifndef NEDSIM_SIMULATOR_H
+#define NEDSIM_SIMULATOR_H
-// TODO: Can get rid of this since I don't do a show_usage() anymore?
-#define VERSION 5
+#include <stdbool.h>
/* Bytes per word. */
#define BPW 4
/* Bytes per word. */
#define BPW 4
-/* Number of stack words. */
-#define STACK_LENGTH 1048576
-
-/* Number of bytes of RAM. */
-#define RAM_LENGTH 1073741824
-
-/* Number of hardware threads. */
-#define THREAD_COUNT 8
-
-/* Number of syllables per word. */
+/* Syllables per word. */
#define SPW 5
#define SPW 5
+/* Storage definitions. */
+#define STACK_LENGTH 65536
+#define RAM_LENGTH 67108864
+#define RAM_BASE_ADDRESS 0x20000000
+
struct NEDpsw {
bool zero;
bool negative;
struct NEDpsw {
bool zero;
bool negative;
@@
-58,11
+35,11
@@
struct NEDhack {
bool resume_word;
};
bool resume_word;
};
-// TODO: Make this a single thread before committing. Multi-thread is broken with my current main loop.
struct NEDstate {
bool halted;
uint8_t ram[RAM_LENGTH];
struct NEDstate {
bool halted;
uint8_t ram[RAM_LENGTH];
- struct NEDthread * thread[THREAD_COUNT];
+ /* Although NED is multi-threaded, this screensaver is restricted to a single thread. */
+ struct NEDthread * thread[1];
struct NEDthread * active_thread;
struct NEDhack * hack;
};
struct NEDthread * active_thread;
struct NEDhack * hack;
};
@@
-86,7
+63,8
@@
enum syllables {
HALT = 0b00000000
};
HALT = 0b00000000
};
-struct NEDstate * init_simulator(
void
);
+struct NEDstate * init_simulator(
char * input_file, const uint8_t * blob, const size_t * blob_size
);
struct NEDstate * run_simulator(struct NEDstate * state);
uint32_t ram_r_word(struct NEDstate * state, uint32_t address);
struct NEDstate * run_simulator(struct NEDstate * state);
uint32_t ram_r_word(struct NEDstate * state, uint32_t address);
+#endif