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
15enum {
16 CMDSIZE = 4,
17 GRSIZE = 8,
19 DEFAULT_CLOCKS = 5000000,
20};
21
25enum {
26 OF = 0x4,
27 SF = 0x2,
28 ZF = 0x1,
29};
30
34typedef struct {
39} CPU;
40
44typedef struct {
47 int memsize;
48 clock_t clocks;
49} SYSTEM;
50
54extern SYSTEM *sys;
55
64
69typedef enum {
76 R_ADR_X = 01,
82 R1_R2 = 02,
88 ADR_X = 03,
93 R_ = 04,
97 NONE = 0,
98} CMDTYPE;
99
103typedef struct {
104 char *name;
105 const void (*ptr);
106} CMD;
107
111typedef struct {
112 char *name;
115 const void (*ptr);
116} COMET2CMD;
117
121typedef struct _CMDTAB {
122 struct _CMDTAB *next;
123 const COMET2CMD *cmd;
125
129typedef struct {
132 bool stop;
133} EXECPTR;
134
135extern EXECPTR *execptr;
136
140typedef struct {
141 bool trace;
142 bool logical;
143 bool dump;
146 bool monitor;
147 bool step;
148} EXECMODE;
149
153extern EXECMODE execmode;
154
162char *grstr(WORD word);
163
167void comet2_init(int memsize, int clocks);
168
172void comet2_reset();
173
177void comet2_resetall();
178
182void comet2_shutdown();
183
190
195
200WORD getcmdcode(const char *cmd, CMDTYPE type);
201
205const void (*getcmdptr(WORD code));
206
211
215char *getcmdname(WORD code);
216
217#endif
unsigned hash(int keyc, HKEY *keyv[], int tabsize)
ハッシュ値を取得する
Definition hash.c:3
CMDTAB_HASH
Definition struct.h:59
@ HASH_CMDTYPE
Definition struct.h:60
@ HASH_MAX
Definition struct.h:62
@ HASH_CODE
Definition struct.h:61
@ DEFAULT_MEMSIZE
Definition struct.h:18
@ DEFAULT_CLOCKS
Definition struct.h:19
@ CMDSIZE
Definition struct.h:16
@ GRSIZE
Definition struct.h:17
void comet2_shutdown()
Definition struct.c:306
CMDTYPE getcmdtype(WORD code)
Definition struct.c:205
EXECPTR * execptr
Definition struct.c:12
bool create_cmdtable(CMDTAB_HASH hash)
命令ハッシュ表を作成する
Definition struct.c:113
@ OF
Definition struct.h:26
@ ZF
Definition struct.h:28
@ SF
Definition struct.h:27
const void * getcmdptr(WORD code)
Definition struct.c:188
char * grstr(WORD word)
汎用レジスタの番号からレジスタを表す文字列を返す
Definition struct.c:240
void comet2_init(int memsize, int clocks)
Definition struct.c:267
CMDTYPE
Definition struct.h:69
@ R_
Definition struct.h:93
@ R_ADR_X
Definition struct.h:76
@ ADR_X
Definition struct.h:88
@ NONE
Definition struct.h:97
@ R1_R2
Definition struct.h:82
void free_cmdtable(CMDTAB_HASH hash)
Definition struct.c:135
SYSTEM * sys
COMET IIの仮想実行マシンシステム
Definition struct.c:7
struct _CMDTAB CMDTAB
void comet2_resetall()
Definition struct.c:295
void comet2_reset()
Definition struct.c:286
char * getcmdname(WORD code)
Definition struct.c:222
WORD getcmdcode(const char *cmd, CMDTYPE type)
Definition struct.c:153
EXECMODE execmode
実行モード: trace, logical, dump, monitor, step
Definition exec.c:88
const COMET2CMD * cmd
Definition struct.h:123
struct _CMDTAB * next
Definition struct.h:122
Definition struct.h:103
const void * ptr
Definition struct.h:105
char * name
Definition struct.h:104
const void * ptr
Definition struct.h:115
CMDTYPE type
Definition struct.h:113
char * name
Definition struct.h:112
WORD code
Definition struct.h:114
COMET IIのCPUを表すデータ型
Definition struct.h:34
WORD gr[GRSIZE]
Definition struct.h:35
WORD sp
Definition struct.h:36
WORD fr
Definition struct.h:38
WORD pr
Definition struct.h:37
実行モードを表すデータ型
Definition struct.h:140
bool step
Definition struct.h:147
bool dump
Definition struct.h:143
bool trace
Definition struct.h:141
bool logical
Definition struct.h:142
int dump_start
Definition struct.h:144
int dump_end
Definition struct.h:145
bool monitor
Definition struct.h:146
WORD start
Definition struct.h:130
WORD end
Definition struct.h:131
bool stop
Definition struct.h:132
COMET IIの仮想実行マシンシステムを表すデータ型
Definition struct.h:44
int memsize
Definition struct.h:47
clock_t clocks
Definition struct.h:48
WORD * memory
Definition struct.h:46
CPU * cpu
Definition struct.h:45
unsigned short WORD
16ビットの数値を表すデータ型
Definition word.h:9