Finish rough ACCU implementation!
This commit is contained in:
18
src/main.c
18
src/main.c
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user