YACASL2
Loading...
Searching...
No Matches
struct.h
Go to the documentation of this file.
1#ifndef YACASL2_STRUCT_H_INCLUDED
2#define YACASL2_STRUCT_H_INCLUDED
3
4#include <stdio.h>
5#include <assert.h>
6#include <string.h>
7#include <time.h>
8#include "word.h"
9#include "cmem.h"
10#include "hash.h"
11
12typedef unsigned int CLOCK;
13
17enum {
18 CMDSIZE = 4,
19 GRSIZE = 8,
20 MAX_MEMSIZE = 65536,
22 MAX_CLOCKS = 1000000,
24};
25
29enum {
30 OF = 0x4,
31 SF = 0x2,
32 ZF = 0x1,
33};
34
38typedef struct {
43} CPU;
44
54
58extern SYSTEM *sys;
59
68
73typedef enum {
80 R_ADR_X = 01,
86 R1_R2 = 02,
92 ADR_X = 03,
97 R_ = 04,
101 NONE = 0,
102} CMDTYPE;
103
107typedef struct {
108 char *name;
109 void (*ptr);
110} CMD;
111
115typedef struct {
116 char *name;
119 void (*ptr);
121} COMET2CMD;
122
126typedef struct _CMDTAB {
127 struct _CMDTAB *next;
128 const COMET2CMD *cmd;
130
134typedef struct {
137 bool stop;
138 bool started;
139} EXECPTR;
140
141extern EXECPTR *execptr;
142
146typedef struct {
147 bool trace;
148 bool logical;
149 bool dump;
152 bool reverse;
153 bool monitor;
154 bool step;
155} EXECMODE;
156
160extern EXECMODE execmode;
161
169char *grstr(WORD word);
170
178WORD memsize_str2word(const char *str);
179
186void comet2_init(WORD memsize, CLOCK clocks);
187
191void comet2_reset();
192
196void comet2_resetall();
197
201void comet2_shutdown();
202
209
214
219WORD getcmdcode(const char *cmd, CMDTYPE type);
220
224bool code_gr_valid(WORD code);
225
230WORD getcmdwordlen(const char *cmd, CMDTYPE type);
231
235void (*getcmdptr(WORD code));
236
241
245char *getcmdname(WORD code);
246
247#endif
248
unsigned hash(int keyc, HKEY *keyv[], int tabsize)
ハッシュ値を取得する
Definition hash.c:3
WORD code2cmdwordlen(WORD code)
Definition struct.c:294
WORD memsize_str2word(const char *str)
メモリーサイズを表す数値文字列をWORD値に変換して返す。WORD値に変換できない場合は、エラーを表示して0を返す
Definition struct.c:322
CMDTAB_HASH
Definition struct.h:63
@ HASH_CMDTYPE
Definition struct.h:64
@ HASH_MAX
Definition struct.h:66
@ HASH_CODE
Definition struct.h:65
@ MAX_MEMSIZE
Definition struct.h:20
@ DEFAULT_MEMSIZE
Definition struct.h:21
@ DEFAULT_CLOCKS
Definition struct.h:23
@ CMDSIZE
Definition struct.h:18
@ GRSIZE
Definition struct.h:19
@ MAX_CLOCKS
Definition struct.h:22
void comet2_shutdown()
COMET II仮想マシンのシャットダウン
Definition struct.c:399
CMDTYPE getcmdtype(WORD code)
Definition struct.c:235
EXECPTR * execptr
Definition struct.c:13
bool create_cmdtable(CMDTAB_HASH hash)
命令ハッシュ表を作成する
Definition struct.c:124
@ OF
Definition struct.h:30
@ ZF
Definition struct.h:32
@ SF
Definition struct.h:31
void * getcmdptr(WORD code)
Definition struct.c:218
char * grstr(WORD word)
汎用レジスタの番号からレジスタを表す文字列を返す
Definition struct.c:312
unsigned int CLOCK
Definition struct.h:12
CMDTYPE
Definition struct.h:73
@ R_
Definition struct.h:97
@ R_ADR_X
Definition struct.h:80
@ ADR_X
Definition struct.h:92
@ NONE
Definition struct.h:101
@ R1_R2
Definition struct.h:86
void free_cmdtable(CMDTAB_HASH hash)
Definition struct.c:146
SYSTEM * sys
COMET IIの仮想実行マシンシステム
Definition struct.c:8
bool code_gr_valid(WORD code)
Definition struct.c:269
struct _CMDTAB CMDTAB
WORD getcmdwordlen(const char *cmd, CMDTYPE type)
Definition struct.c:183
void comet2_resetall()
Definition struct.c:384
void comet2_reset()
COMET II仮想マシンのCPUをリセット
Definition struct.c:371
char * getcmdname(WORD code)
Definition struct.c:252
WORD getcmdcode(const char *cmd, CMDTYPE type)
Definition struct.c:164
void comet2_init(WORD memsize, CLOCK clocks)
COMET II仮想マシンの初期化
Definition struct.c:329
EXECMODE execmode
実行モード: trace, logical, dump, reverse, monitor, step
Definition exec.c:90
const COMET2CMD * cmd
Definition struct.h:128
struct _CMDTAB * next
Definition struct.h:127
Definition struct.h:107
void * ptr
Definition struct.h:109
char * name
Definition struct.h:108
CMDTYPE type
Definition struct.h:117
void * ptr
Definition struct.h:119
int wordlen
Definition struct.h:120
char * name
Definition struct.h:116
WORD code
Definition struct.h:118
COMET IIのCPUを表すデータ型
Definition struct.h:38
WORD gr[GRSIZE]
Definition struct.h:39
WORD sp
Definition struct.h:40
WORD fr
Definition struct.h:42
WORD pr
Definition struct.h:41
実行モードを表すデータ型
Definition struct.h:146
WORD dump_end
Definition struct.h:151
bool step
Definition struct.h:154
bool dump
Definition struct.h:149
bool trace
Definition struct.h:147
bool logical
Definition struct.h:148
WORD dump_start
Definition struct.h:150
bool reverse
Definition struct.h:152
bool monitor
Definition struct.h:153
bool started
Definition struct.h:138
WORD start
Definition struct.h:135
WORD end
Definition struct.h:136
bool stop
Definition struct.h:137
COMET IIの仮想実行マシンシステムを表すデータ型
Definition struct.h:48
CLOCK clocks
Definition struct.h:52
WORD memsize
Definition struct.h:51
WORD * memory
Definition struct.h:50
CPU * cpu
Definition struct.h:49
unsigned short WORD
16ビットの数値を表すデータ型
Definition word.h:9