X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=include%2Fcasl2.h;h=49f4c8c6e14552417660d1918e95bc00b8467c1c;hp=93d3d1f92e65d0b5cae054358aa66806cfc6e9e8;hb=373540e9b114c01712121c36b40f47a98e12d263;hpb=4ee27a568fb9222907a566e59aaefe248f08a8e4 diff --git a/include/casl2.h b/include/casl2.h index 93d3d1f..49f4c8c 100644 --- a/include/casl2.h +++ b/include/casl2.h @@ -11,12 +11,9 @@ #include "word.h" #include "hash.h" +#include "cmem.h" #include "cerr.h" -#ifndef ARRAYSIZE -#define ARRAYSIZE(array) (sizeof(array)/sizeof(array[0])) -#endif - /* COMET IIの規格 */ enum { CMDSIZE = 4, /* 命令の最大文字数 */ @@ -25,12 +22,6 @@ enum { DEFAULT_CLOCKS = 5000000, /* デフォルトのクロック周波数。COMET II規格では、未定義 */ }; -/* COMET IIのメモリ */ -extern WORD *memory; - -/* メモリサイズ */ -extern int memsize; - /* COMET II フラグのマスク値 */ enum { OF = 0x4, /* Overflow Flag */ @@ -46,11 +37,15 @@ typedef struct { WORD fr; /* フラグレジスタ */ } CPU; -/* COMET IIのCPU */ -extern CPU *cpu; +/* COMET IIの仮装実行マシンシステム */ +typedef struct { + CPU *cpu; /* CPU */ + WORD *memory; /* メモリ */ + int memsize; /* メモリサイズ */ + int clocks; /* クロック周波数 */ +} SYSTEM; -/* クロック周波数 */ -extern int clocks; +extern SYSTEM *sys; /* COMET II 命令 */ /* 命令タイプは、オペランドにより6種類に分類 */ @@ -106,10 +101,10 @@ typedef struct { WORD end; /* プログラムの終了番地 */ } PROGPROP; -extern PROGPROP *progprop; +extern PROGPROP *prog; /* COMET II仮想マシンのリセット */ -void reset(); +void reset(int memsize, int clocks); /* COMET II仮想マシンのシャットダウン */ void shutdown();