Fix error in adress-determination in find_data().

This commit is contained in:
lux 2017-08-17 17:49:48 +02:00
parent ac48d2c6b7
commit 99a8dc35a7
2 changed files with 6 additions and 7 deletions

View File

@ -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;

View File

@ -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);