X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=include%2Fassemble.h;h=7c6b347a0739cf496a6756f11f5187b91fd19727;hp=594157c1d3299e33f285f1ea7a62d24e76e798ba;hb=2b0ff8e75f11c5fb58e16e95d8195d6f1252c97c;hpb=e07b6371cc8a59c6793a895e968ff2c6cf28181b diff --git a/include/assemble.h b/include/assemble.h index 594157c..7c6b347 100644 --- a/include/assemble.h +++ b/include/assemble.h @@ -1,15 +1,28 @@ #ifndef YACASL2_ASSEMBLE_INCLUDED #define YACASL2_ASSEMBLE_INCLUDED -/* CASL IIの制限 */ +/* CASL IIの仕様 */ +enum { + LABELSIZE = 8, /* ラベルの最大文字数 */ + OPDSIZE = 40, /* オペラントの最大数。CASL IIシミュレータの制限 */ +}; + +/* YACASL2の制限 */ enum { LINESIZE = 1024, /* 行の最大文字数 */ TOKENSIZE = 256, /* トークンの最大文字数 */ - LABELSIZE = 8, /* ラベルの最大文字数 */ - LABELTABSIZE = 256, /* ラベルの最大数 */ - OPDSIZE = 40, /* オペラントの最大数 */ }; +/* アセンブルモード */ +typedef struct { + bool src; /* ソースを表示する場合はtrue */ + bool label; /* ラベル表を表示する場合はtrue */ + bool onlylabel; /* ラベル表を表示して終了する場合はtrue */ + bool asdetail; /* アセンブラ詳細結果を表示する場合はtrue */ + bool onlyassemble; /* アセンブルだけを行う場合はtrue */ +} ASMODE; +extern ASMODE asmode; + /* 値を格納するポインタ */ extern WORD ptr; @@ -39,6 +52,13 @@ typedef struct { char *cmd; } CMDARRAY; +/* ラベル配列 */ +typedef struct { + char *prog; + char *label; + WORD adr; +} LABELARRAY; + /* ラベル表 */ typedef struct _LABELTAB { struct _LABELTAB *next; @@ -47,6 +67,10 @@ typedef struct _LABELTAB { WORD adr; } LABELTAB; +enum { + LABELTABSIZE = 251, /* ラベル表のサイズ */ +}; + /* アセンブラが、1回目か、2回目か、を表す */ typedef enum { FIRST = 0, @@ -91,9 +115,9 @@ OPD *opdtok(const char *str); /* 1行を解析する */ CMDLINE *linetok(const char *line); -/* 汎用レジスタを表す文字列「GR[0-7]」をWORD値に変換 - is_xがTRUEの場合は、指標レジスタとして用いる汎用レジスタ - 文字列が汎用レジスタを表さない場合は、0xFFFFを返す */ +/* 汎用レジスタを表す文字列「GR[0-7]」から、レジスタ番号[0-7]をWORD値で返す */ +/* 文字列が汎用レジスタを表さない場合は、0xFFFFを返す */ +/* is_xがtrueの場合は指標レジスタ。GR0は、COMET IIの仕様により、エラー発生 */ WORD getgr(const char *str, bool is_x); /* 10進定数をWORDに変換 */ @@ -152,4 +176,4 @@ bool writeRPUSH(PASS pass); /* マクロ命令「RPOP」をメモリに書込 */ bool writeRPOP(PASS pass); -#endif +#endif /* YACASL2_ASSEMBLE_INCLUDEDの終端 */