OSDN Git Service

コメント付加
[heavyosecpu/HeavyOSECPU.git] / osecpu.h
1 #ifndef _HDLOAD_OSECPU
2 #define _HDLOAD_OSECPU 1
3
4 // プロジェクトのすべてのファイルで読み込むヘッダ
5
6
7 /* Visual Studio で fopen()やsprintf() などの古い関数を使用する時に出る警告を抑止する*/
8 #define _CRT_SECURE_NO_WARNINGS 1
9
10 #include <stdio.h>
11 #include <string.h>
12 #include <limits.h>
13 #include <time.h>
14 #include <setjmp.h>
15 #include <stdlib.h>
16
17 struct PtrCtrl {
18         int liveSign;
19         int size, typ;
20         unsigned char *p0;
21 };
22
23 struct Ptr {    /* 32バイト(=256bit!) */
24         unsigned char *p;
25         int typ;
26         unsigned char *p0, *p1;
27         int liveSign;
28         struct PtrCtrl *pls;
29         int flags, dummy;       /* read/writeなど */
30 };
31
32 struct LabelTable {
33         unsigned char *p, *p1;
34         int opt;
35         
36         /*
37          * default = -1
38          * TYP_CODE = 0
39          * T_UINT8 = 3
40          */
41         int typ;
42 };
43
44 struct Regs {
45         int ireg[64]; /* 32bit整数レジスタ */
46         struct Ptr preg[64];    /* ポインタレジスタ */
47
48         int debugInfo0, debugInfo1, dmy[2]; /* 2304 */
49         struct PtrCtrl *ptrCtrl; /* 2320 */
50         char winClosed, autoSleep;
51         jmp_buf *setjmpEnv;
52
53         /* for-junkApi */
54         int argc;
55         const unsigned char **argv;
56         unsigned char *buf0, *buf1, *junkStack, lastConsoleChar, *junkStack1;
57
58         struct LabelTable *label;
59         int maxLabels;
60         unsigned char *jitbuf, *jitbuf1;
61         void(*errHndl)(struct Regs *);
62         char dbgr;
63         int mapDi1s[16][16];
64 };
65
66 #define KEY_ENTER               '¥n'
67 #define KEY_ESC                 27
68 #define KEY_BACKSPACE   8
69 #define KEY_TAB                 9
70 #define KEY_PAGEUP              0x1020
71 #define KEY_PAGEDWN             0x1021
72 #define KEY_END                 0x1022
73 #define KEY_HOME                0x1023
74 #define KEY_LEFT                0x1024
75 #define KEY_UP                  0x1025
76 #define KEY_RIGHT               0x1026
77 #define KEY_DOWN                0x1027
78 #define KEY_INS                 0x1028
79 #define KEY_DEL                 0x1029
80
81 static int *keybuf, keybuf_r, keybuf_w, keybuf_c;
82 static int *vram = NULL, v_xsiz, v_ysiz;
83
84 //デバッグ用。プログラム中の随所で加算される変数
85 static int di1_serial = 0;
86
87 // main.c
88 void putKeybuf(int i);
89
90 #include "switch.h"
91 #include "function.h"
92 #include "dependent.h"
93 #include "jitc.h"
94 #include "screen.h"
95 #include "comlib.h"
96
97 #if (USE_TEK5 != 0)
98
99 /* tek.cを移植するのは大変だと思ったので、断念 */
100 #error "tek is not supported. edit switch.h and set USE_TEK5=0"
101
102 //      #include "tek.c"
103 //      int tek5Decomp(unsigned char *buf, unsigned char *buf1, unsigned char *tmp);
104 #endif
105
106
107 #endif
108