Finish rough ACCU implementation!

This commit is contained in:
lux
2017-08-10 23:08:50 +02:00
parent ad6f5a5854
commit caf2b81431
5 changed files with 33 additions and 24 deletions

View File

@ -15,24 +15,28 @@ int main(int argc, char *argv[])
uint8_t op_code;
uint16_t pc = 0;
int data_addr=0;
char quit;
bool run = true;
if(initialise_ram(ram,argc,argv)==-1) return 1;
// while(run && pc<(RAM_SIZE-1))
// {
while(run && pc<(RAM_SIZE-1))
{
ir = ram[pc];
op_code = get_opcode(ir);
data_addr=find_data(ir);
#ifdef DEBUG
printf("OP Code: %u\n",op_code);
printf("OP Code: %"PRIu8"\n",op_code);
printf("Adresse: %d\n",data_addr);
makeHexDump(true,ram);
#endif
if(execute(op_code,data_addr,*ram))
pc=data_addr(ram[pc]);
if(execute(op_code,data_addr,ram))
pc=find_data(ram[pc]); //jump if ACCU is ZERO
else pc++;
// }
printf("(n)ext step or (q)uit or (c)oredump ?\n");
scanf("%c",&quit);
if(quit == 'c') makeHexDump(true,ram);
else if(quit == 'q') run = false;
}