comet2monitorの追加と、モニター機能作成
[YACASL2.git] / include / struct.h
index 05ff5f9..e36c13f 100644 (file)
@@ -1,11 +1,16 @@
 #ifndef YACASL2_CASL2_INCLUDED
 #define YACASL2_CASL2_INCLUDED
 
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
 #include <time.h>
 #include "word.h"
+#include "cmem.h"
+#include "hash.h"
 
 /**
- * COMET IIの規格
+ * @brief COMET IIの規格値
  */
 enum {
     CMDSIZE = 4,              /**<命令の最大文字数 */
@@ -15,7 +20,7 @@ enum {
 };
 
 /**
- * COMET II フラグのマスク値
+ * @brief COMET II フラグのマスク値
  */
 enum {
     OF = 0x4,    /**<Overflow Flag */
@@ -24,7 +29,7 @@ enum {
 };
 
 /**
- * COMET IIのCPU
+ * @brief COMET IIのCPUを表すデータ型
  */
 typedef struct {
     WORD gr[GRSIZE]; /**<汎用レジスタ */
@@ -34,7 +39,7 @@ typedef struct {
 } CPU;
 
 /**
- * COMET IIの仮想実行マシンシステム
+ * @brief COMET IIの仮想実行マシンシステムを表すデータ型
  */
 typedef struct {
     CPU *cpu;        /**<CPU */
@@ -43,6 +48,9 @@ typedef struct {
     clock_t clocks;  /**<クロック周波数 */
 } SYSTEM;
 
+/**
+ * @brief COMET IIの仮想実行マシンシステム
+ */
 extern SYSTEM *sys;
 
 /**
@@ -77,7 +85,7 @@ typedef enum {
     /**
      * オペランドなし
      */
-    NONE = 00,
+    NONE = 0,
 } CMDTYPE;
 
 /**
@@ -117,6 +125,15 @@ typedef struct {
 
 extern EXECPTR *execptr;
 
+/**
+ * @brief 汎用レジスタの番号からレジスタを表す文字列を返す
+ *
+ * @return 汎用レジスタを表す文字列。「GR0」「GR1」・・・「GR7」のいずれか
+ *
+ * @param word レジスタ番号[0-7]を表すWORD値
+ */
+char *grstr(WORD word);
+
 /**
  * COMET II仮想マシンのリセット
  */
@@ -146,16 +163,26 @@ void free_cmdtype_code();
 /**
  * コードがキーの命令ハッシュ表を作成する
  */
-bool create_code_type();
+bool create_code_cmdtype();
 
 /**
  * 命令コードから命令の関数ポインタを返す
  */
 const void (*getcmdptr(WORD code));
 
+/**
+ * 命令コードから命令のタイプを返す
+ */
+CMDTYPE getcmdtype(WORD code);
+
+/**
+ * 命令コードから命令の名前を返す
+ */
+char *getcmdname(WORD code);
+
 /**
  * コードがキーの命令ハッシュ表を解放する
  */
-void free_code_type();
+void free_code_cmdtype();
 
 #endif            /* YACASL2_CASL2_INCLUDEDの終端 */