-
Notifications
You must be signed in to change notification settings - Fork 0
/
foo.h
56 lines (50 loc) · 1.35 KB
/
foo.h
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
46
47
48
49
50
51
52
53
54
55
56
#ifndef FOOH
#define FOOH
#include <stdarg.h>
#include <assert.h> // ñðåäñòâî äëÿ ñîõðàíåíèÿ çðåíèÿ è âðåìåíè
typedef unsigned char byte;
typedef unsigned short int word;
typedef word adr;
#define MEMSIZE (64*1024) //ðàçìåð îïåðàòèâíîé ïàìÿòè
#define pc reg[7] //òî áèøü ïîñëåäíèé ðåãèñòð R7
// ðåæèìû àäðåñàöèè:
#define Rn0 0 // ðåãèñòðîâûé
#define Rn1 1 // êîñâåííî-ðåãèñòðîâûé
#define Rn2 2 // àâòîèíêðåìåíòíûé
/*
#define Rn3 3 // êîñâåííî àâòîèíêðåìåíòíûé
#define Rn4 4 // àâòîäåêðåìåíòíûé
#define Rn5 5 // êîñâåííî àâòîäåêðåìåíòíûé
#define Rn6 6 // èíäåêñíûé
#define Rn7 7 // êîñâåííî èíäåêñíûé
*/
extern byte mem[MEMSIZE];
extern char tracechecker;
void b_write(adr a, byte b);
byte b_read(adr a);
word w_read(adr a);
word reg[8];
void w_write(adr a, word w);
void run();
void do_mov();
void do_halt();
void do_add();
void do_nothing();
void run();
void test_mem();
void do_mul();
typedef struct {
word mask;
word opcode;
char * name;
void (*do_func)(void);
} Command;
extern const Command cmd[];
void trace(const char * format, ...);
struct Argument {
word val; // íîìåð ðåãèñòðà (íå ïóòàòü ñî çíà÷åíèåì èç ÎÇÓ w_read((struct Argument).adress)!)
word adress;
}; //îáúÿâèì ïåðåìåííûå ss è dd òèïà struct Argument
extern struct Argument ss, dd;
struct Argument sixbittodata(word w);
#endif