X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fstruct.c;h=4e38f2e0d15e0339c1ccc5bb975d803892625bb5;hb=be496380efb4018b38076cfadb4b790fa388a1e3;hp=f0f705b8bbf601ff91591391b4cea8deb4d5cc1e;hpb=4d98d132e119aa98dd7abcb76b6a96ae4723f274;p=YACASL2.git diff --git a/src/struct.c b/src/struct.c index f0f705b..4e38f2e 100644 --- a/src/struct.c +++ b/src/struct.c @@ -1,9 +1,4 @@ -#include -#include -#include -#include "hash.h" #include "struct.h" -#include "cmem.h" #include "exec.h" /** @@ -19,7 +14,7 @@ EXECPTR *execptr; /** * システムCOMET IIの命令表 */ -static COMET2CMD comet2cmd[] = { +static const COMET2CMD comet2cmd[] = { { "NOP", NONE, 0x0, nop }, { "LD", R_ADR_X, 0x1000, ld_r_adr_x }, { "ST", R_ADR_X, 0x1100, st }, @@ -215,7 +210,7 @@ const void (*getcmdptr(WORD code)) CMDTYPE getcmdtype(WORD code) { CMDTAB *t; - CMDTYPE type = 0; + CMDTYPE type = NONE; for(t = code_cmdtype[hash_code(code)]; t != NULL; t = t->next) { if(code == t->cmd->code) { @@ -243,6 +238,18 @@ char *getcmdname(WORD code) return cmd; } +/** + * 汎用レジスタの番号からレジスタを表す文字列を返す + */ + +char *grstr(WORD word) +{ + assert(word <= 7); + char *str = malloc_chk(3 + 1, "grstr.str"); + sprintf(str, "GR%d", word); + return str; +} + /** * コードがキーの命令ハッシュ表を解放する */