diff --git a/src/toy.c b/src/toy.c index d1b91a6..4be0f70 100644 --- a/src/toy.c +++ b/src/toy.c @@ -58,12 +58,11 @@ uint8_t get_opcode(uint16_t instruction) return opcode; } -int find_data(uint16_t instruction) +uint16_t find_data(uint16_t instruction) { - int instr; - if(instruction > 32767) instr = -1; - else instr=instruction & 4095; - return instr; + uint16_t operand; + operand = instruction & 4095; + return operand; } int get2compl(uint16_t value) @@ -78,7 +77,7 @@ int get2compl(uint16_t value) } -bool execute(uint8_t op_code, int data_addr, uint16_t *ram) // jump when 1 +bool execute(uint8_t op_code, int data_addr, uint16_t *ram) // jump if true { //Vorsicht: bool ops bei sigend int typs sind nach c99 undefiniert ! static uint16_t accu; diff --git a/src/toy.h b/src/toy.h index f7ef55a..600c5b1 100644 --- a/src/toy.h +++ b/src/toy.h @@ -13,7 +13,7 @@ int initialise_ram(uint16_t *ram, int argc, char **argv ); uint8_t get_opcode(uint16_t instruction); -int find_data(uint16_t instruction); +uint16_t find_data(uint16_t instruction); int get2compl(uint16_t value); //not good place for something! bool execute(uint8_t op_code, int data_addr,uint16_t *ram);