1
0
mirror of https://github.com/aap/pdp6.git synced 2026-02-15 20:36:47 +00:00

better pulse system; revisited key cycle

This commit is contained in:
aap
2016-04-05 00:50:38 +02:00
parent b0bfdf7400
commit ab96a0f785
4 changed files with 907 additions and 917 deletions

View File

@@ -1,6 +1,9 @@
SRC=main.c apr.c mem.c io.c
CFLAGS= -Wno-shift-op-parentheses -Wno-logical-op-parentheses\
-Wno-bitwise-op-parentheses\
# clang
#CFLAGS= -Wno-shift-op-parentheses -Wno-logical-op-parentheses \
# -Wno-bitwise-op-parentheses
CFLAGS= \
-fno-diagnostics-show-caret \
-L/usr/local/lib -I/usr/local/include -lSDL -lSDL_image -lpthread

1779
apr.c

File diff suppressed because it is too large Load Diff

10
main.c
View File

@@ -535,7 +535,7 @@ poweron(void)
{
pthread_t apr_thread;
apr.sw_power = 1;
pthread_create(&apr_thread, NULL, aprmain, NULL);
pthread_create(&apr_thread, NULL, aprmain, &apr);
}
void
@@ -753,7 +753,7 @@ error:
initmem();
memset(&apr, 0xff, sizeof apr);
apr.extpulse = 0;
apr.nextpulse = apr.mc_rst1_ret = apr.art3_ret = NULL;
apr.art3_ret = NULL;
for(;;){
while(SDL_PollEvent(&ev))
@@ -797,11 +797,11 @@ error:
apr.key_inst_stop = keys[2].state == 1;
apr.key_mem_stop = keys[2].state == 2;
apr.key_io_reset = keys[3].state == 1;
apr.key_execute = keys[3].state == 2;
apr.key_exec = keys[3].state == 2;
apr.key_dep = keys[4].state == 1;
apr.key_dep_next = keys[4].state == 2;
apr.key_dep_nxt = keys[4].state == 2;
apr.key_ex = keys[5].state == 1;
apr.key_ex_next = keys[5].state == 2;
apr.key_ex_nxt = keys[5].state == 2;
apr.key_rd_off = keys[6].state == 1;
apr.key_rd_on = keys[6].state == 2;
apr.key_pt_rd = keys[7].state == 1;

28
pdp6.h
View File

@@ -12,7 +12,7 @@ typedef uint16_t u16;
typedef uint8_t u8;
typedef char bool;
enum {
enum Mask {
FW = 0777777777777,
RT = 0000000777777,
LT = 0777777000000,
@@ -20,7 +20,7 @@ enum {
RSGN = 0000000400000,
};
enum {
enum Opcode {
FSC = 0132,
IBP = 0133,
EXCH = 0250,
@@ -40,10 +40,15 @@ enum {
JRA = 0267,
};
typedef void *Pulse(void);
#define pulse(p) void *p(void)
enum {
MAXPULSE = 5
};
typedef struct Apr Apr;
typedef void Pulse(Apr *apr);
#define pulse(p) void p(Apr *apr)
struct Apr {
hword ir;
word mi;
@@ -63,9 +68,9 @@ struct Apr {
bool key_start, key_readin;
bool key_mem_cont, key_inst_cont;
bool key_mem_stop, key_inst_stop;
bool key_io_reset, key_execute;
bool key_dep, key_dep_next;
bool key_ex, key_ex_next;
bool key_io_reset, key_exec;
bool key_dep, key_dep_nxt;
bool key_ex, key_ex_nxt;
bool key_rd_off, key_rd_on;
bool key_pt_rd, key_pt_wr;
@@ -131,10 +136,15 @@ struct Apr {
/* needed for the emulation */
int extpulse;
Pulse *nextpulse;
Pulse *mc_rst1_ret, *art3_ret, *sct2_ret;
// want to get rid of these
Pulse *art3_ret, *sct2_ret;
Pulse *pulses1[MAXPULSE], *pulses2[MAXPULSE];
Pulse **clist, **nlist;
int ncurpulses, nnextpulses;
};
extern Apr apr;
void nextpulse(Apr *apr, Pulse *p);
void *aprmain(void *p);
void initmem(void);