OSDN Git Service

added some comments
[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          * 将来的には UInt8, SInt32, Flt64, UInt8, VPtr が使えるようになる http://osecpu.osask.jp/wiki/?page0053
42          */
43         int typ;
44 };
45
46 struct Regs {
47         int ireg[64]; /* 32bit整数レジスタ */
48         struct Ptr preg[64];    /* ポインタレジスタ */
49
50         int debugInfo0, debugInfo1, dmy[2]; /* 2304 */
51         struct PtrCtrl *ptrCtrl; /* 2320 */
52         char winClosed, autoSleep;
53         jmp_buf *setjmpEnv;
54
55         /* for-junkApi */
56         int argc;
57         const unsigned char **argv;
58         unsigned char *buf0, *buf1, *junkStack, lastConsoleChar, *junkStack1;
59
60         struct LabelTable *label;
61         int maxLabels;
62         unsigned char *jitbuf, *jitbuf1;
63         void(*errHndl)(struct Regs *);
64         char dbgr;
65         int mapDi1s[16][16];
66 };
67
68 #define KEY_ENTER               '¥n'
69 #define KEY_ESC                 27
70 #define KEY_BACKSPACE   8
71 #define KEY_TAB                 9
72 #define KEY_PAGEUP              0x1020
73 #define KEY_PAGEDWN             0x1021
74 #define KEY_END                 0x1022
75 #define KEY_HOME                0x1023
76 #define KEY_LEFT                0x1024
77 #define KEY_UP                  0x1025
78 #define KEY_RIGHT               0x1026
79 #define KEY_DOWN                0x1027
80 #define KEY_INS                 0x1028
81 #define KEY_DEL                 0x1029
82
83 static int *keybuf, keybuf_r, keybuf_w, keybuf_c;
84 static int *vram = NULL, v_xsiz, v_ysiz;
85
86 //デバッグ用。プログラム中の随所で加算される変数
87 static int di1_serial = 0;
88
89 // main.c
90 void putKeybuf(int i);
91
92 #include "switch.h"
93 #include "function.h"
94 #include "dependent.h"
95 #include "jitc.h"
96 #include "screen.h"
97 #include "comlib.h"
98
99 #if (USE_TEK5 != 0)
100
101 /* tek.cを移植するのは大変だと思ったので、断念 */
102 #error "tek is not supported. edit switch.h and set USE_TEK5=0"
103
104 //      #include "tek.c"
105 //      int tek5Decomp(unsigned char *buf, unsigned char *buf1, unsigned char *tmp);
106 #endif
107
108
109 #endif
110