CPU: Fixed a bug with memory access on the RET instruction

This commit is contained in:
(Tim) Efthimis Kritikos 2024-05-04 07:29:45 +01:00
parent 39af6ec292
commit 3e86db9600

2
cpu.c
View File

@ -384,7 +384,7 @@ int exec(struct simdata_t *simdata){
case RET: case RET:
simdata->exec_data->cycles_left=delay_values[CALL_RET_INDX]; simdata->exec_data->cycles_left=delay_values[CALL_RET_INDX];
simdata->registers->SP-=4; simdata->registers->SP-=4;
simdata->registers->PC=simdata->RAM[simdata->registers->SP]; simdata->registers->PC=*(uint32_t*)(simdata->RAM+simdata->registers->SP);
break; break;
case EXEC_ALU: case EXEC_ALU:
if( simdata->exec_data->in_op1->OP_ADDR==REGISTER && if( simdata->exec_data->in_op1->OP_ADDR==REGISTER &&