casl2
comet2
dumpword
-test.log
+TEST.log
*~
TAGS
CMDSIZE = 4, /* 命令の最大文字数 */
REGSIZE = 8, /* 汎用レジスタの数 */
DEFAULT_MEMSIZE = 512, /* デフォルトのメモリ容量。COMET II規格では、65536語 */
- DEFAULT_CLOCKS = 5000000 /* デフォルトのクロック周波数。COMET II規格では、未定義 */
+ DEFAULT_CLOCKS = 5000000, /* デフォルトのクロック周波数。COMET II規格では、未定義 */
};
/* ハッシュ値を取得する */
enum {
OF = 0x4, /* Overflow Flag */
SF = 0x2, /* Sign Flag */
- ZF = 0x1 /* Zero Flag */
+ ZF = 0x1, /* Zero Flag */
};
/* エラー番号 */
R1_R2 = 020,
ADR_X = 030,
R_ = 040,
- NONE = 0
+ NONE = 0,
} CMDTYPE;
typedef struct {
INCLUDE = ../include
CC = gcc
CFLAGS = -Wall -I $(INCLUDE)
-COMMONSRC = struct.o cmd.o cerr.o dump.o
+COMMONSRC = struct.o hash.o cmd.o cerr.o dump.o
ASSRC = assemble.o token.o label.o macro.o
EXECSRC = exec.o
.PHPNY: all clean
CMDCODETAB *np;
unsigned hashval;
int i;
-
+
for(i = 0; i < cmdcodesize; i++) {
np = (CMDCODETAB *) malloc(sizeof(*np));
if(np == NULL) {
CMDCODETAB *np;
unsigned hashval;
int i;
-
+
for(i = 0; i < cmdcodesize; i++) {
- np = (CMDCODETAB *) malloc(sizeof(*np));
- if(np == NULL) {
+ if((np = (CMDCODETAB *) malloc(sizeof(*np))) == NULL) {
setcerr(122, NULL); /* cannot create hash table */
return false;
}
char *bit, *p;
bit = malloc(16 + 1);
p = bit;
- while(mask > 0){
- if((word & mask) == 0) {
- *p++ = '0';
- } else {
- *p++ = '1';
- }
- mask = (mask >> 1);
- }
+ do {
+ *p++ = (word & mask) ? '1' : '0';
+ } while((mask >>= 1) > 0);
*p = '\0';
return bit;
}
--- /dev/null
+/* ハッシュ値を取得する */
+unsigned hash(const char *key, int size){
+ unsigned hashval;
+
+ for(hashval = 0; *key != '\0'; key++){
+ hashval = *key + 31 * hashval;
+ }
+ return hashval % size;
+}
/* 実行終了番地 */
WORD endptr = 0x0;
-
-/* ハッシュ値を取得する */
-unsigned hash(const char *key, int size){
- unsigned hashval;
-
- for(hashval = 0; *key != '\0'; key++){
- hashval = *key + 31 * hashval;
- }
- return hashval % size;
-}
+++ /dev/null
-abs_call: Test Success 2010-01-21 02:33:30
-adda0: Test Success 2010-01-21 02:33:30
-adda1: Test Success 2010-01-21 02:33:30
-adda_overflow: Test Success 2010-01-21 02:33:30
-addl: Test Success 2010-01-21 02:33:30
-addl_overflow: Test Success 2010-01-21 02:33:30
-and0: Test Success 2010-01-21 02:33:30
-and1: Test Success 2010-01-21 02:33:30
-and2: Test Success 2010-01-21 02:33:30
-and3: Test Success 2010-01-21 02:33:30
-binout: Test Success 2010-01-21 02:33:30
-call0: Test Success 2010-01-21 02:33:30
-call1: Test Success 2010-01-21 02:33:30
-call2: Test Success 2010-01-21 02:33:30
-cmd_err0: Test Success 2010-01-21 02:33:31
-cmd_err1: Test Success 2010-01-21 02:33:31
-count_call: Test Success 2010-01-21 02:33:31
-cpa1: Test Success 2010-01-21 02:33:31
-dc_overflow: Test Success 2010-01-21 02:33:31
-dc_spc: Test Success 2010-01-21 02:33:31
-divl0_call: Test Success 2010-01-21 02:33:32
-divl1_call: Test Success 2010-01-21 02:33:34
-ds_0: Test Success 2010-01-21 02:33:34
-ds_err: Test Success 2010-01-21 02:33:34
-fib_outl: Test Success 2010-01-21 02:33:34
-floatedit: Test Success 2010-01-21 02:33:34
-hanoi: Test Success 2010-01-21 02:33:34
-hello: Test Success 2010-01-21 02:33:34
-iotest: Test Success 2010-01-21 02:33:34
-labeldup_err: Test Success 2010-01-21 02:33:34
-lad0: Test Success 2010-01-21 02:33:34
-lad1: Test Success 2010-01-21 02:33:34
-lad2: Test Success 2010-01-21 02:33:34
-lad3: Test Success 2010-01-21 02:33:34
-ld0: Test Success 2010-01-21 02:33:34
-ld1: Test Success 2010-01-21 02:33:34
-ld2: Test Success 2010-01-21 02:33:34
-ld3: Test Success 2010-01-21 02:33:35
-ld4: Test Success 2010-01-21 02:33:35
-ld5: Test Success 2010-01-21 02:33:35
-ld_loop: Test Success 2010-01-21 02:33:35
-literal_spc: Test Success 2010-01-21 02:33:35
-literalstr: Test Success 2010-01-21 02:33:35
-minim_call: Test Success 2010-01-21 02:33:35
-mula0_call: Test Success 2010-01-21 02:33:40
-mula1_call: Test Success 2010-01-21 02:33:41
-mull0_call: Test Success 2010-01-21 02:33:46
-mull1_call: Test Success 2010-01-21 02:33:46
-opdspc_err: Test Success 2010-01-21 02:33:46
-out0: Test Success 2010-01-21 02:33:46
-out1: Test Success 2010-01-21 02:33:46
-outa_call: Test Success 2010-01-21 02:33:46
-outb_call: Test Success 2010-01-21 02:33:47
-outd_q15_call: Test Success 2010-01-21 02:33:47
-outl_call: Test Success 2010-01-21 02:33:47
-ptn1: Test Success 2010-01-21 02:33:47
-ptn2: Test Success 2010-01-21 02:33:47
-ptn3: Test Success 2010-01-21 02:33:47
-ptn4: Test Success 2010-01-21 02:33:47
-pushpop: Test Success 2010-01-21 02:33:47
-rev_call: Test Success 2010-01-21 02:33:47
-sla2: Test Success 2010-01-21 02:33:47
-sra2: Test Success 2010-01-21 02:33:47
-sra3: Test Success 2010-01-21 02:33:48
-sra4: Test Success 2010-01-21 02:33:48
-st0: Test Success 2010-01-21 02:33:48
-st1: Test Success 2010-01-21 02:33:48
-sum_call: Test Success 2010-01-21 02:33:48
-summary: Test Success 2010-01-21 02:33:48
-svc2: Test Success 2010-01-21 02:33:48
-svc2_out: Test Success 2010-01-21 02:33:48
-xor0: Test Success 2010-01-21 02:33:48
-xor1: Test Success 2010-01-21 02:33:48
-xor3: Test Success 2010-01-21 02:33:48
-xor4: Test Success 2010-01-21 02:33:48
-xor5: Test Success 2010-01-21 02:33:48
+++ /dev/null
-abs_call: Test Success 2010-01-21 02:33:49
-adda0: Test Success 2010-01-21 02:33:49
-adda1: Test Success 2010-01-21 02:33:49
-adda_overflow: Test Success 2010-01-21 02:33:49
-addl: Test Success 2010-01-21 02:33:50
-addl_overflow: Test Success 2010-01-21 02:33:50
-and0: Test Success 2010-01-21 02:33:50
-and1: Test Success 2010-01-21 02:33:50
-and2: Test Success 2010-01-21 02:33:50
-and3: Test Success 2010-01-21 02:33:50
-binout: Test Success 2010-01-21 02:33:50
-call0: Test Success 2010-01-21 02:33:50
-call1: Test Success 2010-01-21 02:33:51
-call2: Test Success 2010-01-21 02:33:51
-count_call: Test Success 2010-01-21 02:33:51
-cpa1: Test Success 2010-01-21 02:33:51
-dc_overflow: Test Success 2010-01-21 02:33:51
-dc_spc: Test Success 2010-01-21 02:33:51
-divl0_call: Test Success 2010-01-21 02:33:53
-divl1_call: Test Success 2010-01-21 02:33:54
-ds_0: Test Success 2010-01-21 02:33:54
-fib_outl: Test Success 2010-01-21 02:33:54
-floatedit: Test Success 2010-01-21 02:33:55
-hanoi: Test Success 2010-01-21 02:33:55
-hello: Test Success 2010-01-21 02:33:55
-iotest: Test Success 2010-01-21 02:33:55
-lad0: Test Success 2010-01-21 02:33:55
-lad1: Test Success 2010-01-21 02:33:55
-lad2: Test Success 2010-01-21 02:33:55
-lad3: Test Success 2010-01-21 02:33:56
-ld0: Test Success 2010-01-21 02:33:56
-ld1: Test Success 2010-01-21 02:33:56
-ld2: Test Success 2010-01-21 02:33:56
-ld3: Test Success 2010-01-21 02:33:56
-ld4: Test Success 2010-01-21 02:33:57
-ld5: Test Success 2010-01-21 02:33:57
-ld_loop: Test Success 2010-01-21 02:33:57
-literal_spc: Test Success 2010-01-21 02:33:57
-literalstr: Test Success 2010-01-21 02:33:57
-minim_call: Test Success 2010-01-21 02:33:57
-mula0_call: Test Success 2010-01-21 02:34:02
-mula1_call: Test Success 2010-01-21 02:34:03
-mull0_call: Test Success 2010-01-21 02:34:08
-mull1_call: Test Success 2010-01-21 02:34:09
-out0: Test Success 2010-01-21 02:34:09
-out1: Test Success 2010-01-21 02:34:09
-outa_call: Test Success 2010-01-21 02:34:09
-outb_call: Test Success 2010-01-21 02:34:09
-outd_q15_call: Test Success 2010-01-21 02:34:10
-outl_call: Test Success 2010-01-21 02:34:10
-ptn1: Test Success 2010-01-21 02:34:10
-ptn2: Test Success 2010-01-21 02:34:10
-ptn3: Test Success 2010-01-21 02:34:10
-ptn4: Test Success 2010-01-21 02:34:10
-pushpop: Test Success 2010-01-21 02:34:11
-rev_call: Test Success 2010-01-21 02:34:11
-sla2: Test Success 2010-01-21 02:34:11
-sra2: Test Success 2010-01-21 02:34:11
-sra3: Test Success 2010-01-21 02:34:11
-sra4: Test Success 2010-01-21 02:34:11
-st0: Test Success 2010-01-21 02:34:11
-st1: Test Success 2010-01-21 02:34:12
-sum_call: Test Success 2010-01-21 02:34:12
-summary: Test Success 2010-01-21 02:34:12
-svc2: Test Success 2010-01-21 02:34:12
-svc2_out: Test Success 2010-01-21 02:34:12
-xor0: Test Success 2010-01-21 02:34:12
-xor1: Test Success 2010-01-21 02:34:12
-xor3: Test Success 2010-01-21 02:34:13
-xor4: Test Success 2010-01-21 02:34:13
-xor5: Test Success 2010-01-21 02:34:13
+++ /dev/null
-a: Test Success 2010-01-21 02:34:13
-l: Test Success 2010-01-21 02:34:14
-noopt: Test Success 2010-01-21 02:34:14