X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=include%2Fassemble.h;h=f6e081add610e658bbb4b436f0c90088ba4367c0;hp=139cea758b56051efb2a70852a29b9df6e83fbe6;hb=712486afe58b10ef37c5fa915de889ab8d1dd6cd;hpb=534506a757688db300328b7141bab4d6d0bd4e29 diff --git a/include/assemble.h b/include/assemble.h index 139cea7..f6e081a 100644 --- a/include/assemble.h +++ b/include/assemble.h @@ -1,3 +1,6 @@ +#ifndef YACASL2_ASSEMBLE_INCLUDED +#define YACASL2_ASSEMBLE_INCLUDED + /* CASL IIの制限 */ enum { LINESIZE = 1024, /* 行の最大文字数 */ @@ -7,6 +10,16 @@ enum { OPDSIZE = 40, /* オペラントの最大数 */ }; +/* アセンブルモード */ +typedef struct { + bool srcmode; /* ソースを表示する場合はtrue */ + bool labelmode; /* ラベル表を表示する場合はtrue */ + bool onlylabelmode; /* ラベル表を表示して終了する場合はtrue */ + bool asdetailmode; /* アセンブラ詳細結果を表示する場合はtrue */ + bool onlyassemblemode; /* アセンブルだけを行う場合はtrue */ +} ASMODE; +extern ASMODE asmode; + /* 値を格納するポインタ */ extern WORD ptr; @@ -50,7 +63,10 @@ typedef enum { SECOND = 1, } PASS; -/* ラベル表からアドレスを検索する */ +/* プログラム名とラベルに対応するハッシュ値を返す */ +unsigned labelhash(const char *prog, const char *label); + +/* プログラム名とラベルに対応するアドレスをラベル表から検索する */ WORD getlabel(const char *prog, const char *label); /* ラベルを表に追加する */ @@ -98,7 +114,7 @@ WORD gethex(const char *str); /* アドレスを返す */ /* アドレスには、リテラル/10進定数/16進定数/アドレス定数が含まれる */ -WORD getadr(const char *str, PASS pass); +WORD getadr(const char *prog, const char *str, PASS pass); /* 定数の前に等号(=)をつけて記述される、リテラルを返す */ /* リテラルには、10進定数/16進定数/文字定数が含まれる */ @@ -145,3 +161,5 @@ bool writeRPUSH(PASS pass); /* マクロ命令「RPOP」をメモリに書込 */ bool writeRPOP(PASS pass); + +#endif