diff --git a/emul_inst_exec.c b/emul_inst_exec.c index c4e9a84..83b6385 100644 --- a/emul_inst_exec.c +++ b/emul_inst_exec.c @@ -289,7 +289,7 @@ /* :OUTPUT * レジスタの値をASCII文字として画面に出力する,改行はない*/ void emul_inst_exec_pseudo_output(int reg) { - emul_out_std("%d", (char)emul_reg_get(reg)); + emul_out_std("%c", (char)emul_reg_get(reg)); } /* :CRLF diff --git a/emul_mem.c b/emul_mem.c index 8ec7cf5..e3145dc 100644 --- a/emul_mem.c +++ b/emul_mem.c @@ -15,16 +15,16 @@ int emul_mem_get_word(int address) { int word = 0; - word |= (0x000F&mem[address+0]) << 0; - word |= (0x000F&mem[address+1]) << 8; - word |= (0x000F&mem[address+2]) << 16; - word |= (0x000F&mem[address+3]) << 24; + word |= (0x00FF&mem[address+0]) << 0; + word |= (0x00FF&mem[address+1]) << 8; + word |= (0x00FF&mem[address+2]) << 16; + word |= (0x00FF&mem[address+3]) << 24; return word; } void emul_mem_set_word(int address, int word) { - mem[address+0] = (char)((word >> 0 ) & 0x000F); - mem[address+1] = (char)((word >> 8 ) & 0x000F); - mem[address+2] = (char)((word >> 16) & 0x000F); - mem[address+3] = (char)((word >> 24) & 0x000F); + mem[address+0] = (char)((word >> 0 ) & 0x00FF); + mem[address+1] = (char)((word >> 8 ) & 0x00FF); + mem[address+2] = (char)((word >> 16) & 0x00FF); + mem[address+3] = (char)((word >> 24) & 0x00FF); }