From 3e86db960016bb3ad934b3bc5984d4bbc62cd57a Mon Sep 17 00:00:00 2001 From: "(Tim) Efthimis Kritikos" Date: Sat, 4 May 2024 07:29:45 +0100 Subject: [PATCH] CPU: Fixed a bug with memory access on the RET instruction --- cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu.c b/cpu.c index 1a3140e..aea391b 100644 --- a/cpu.c +++ b/cpu.c @@ -384,7 +384,7 @@ int exec(struct simdata_t *simdata){ case RET: simdata->exec_data->cycles_left=delay_values[CALL_RET_INDX]; simdata->registers->SP-=4; - simdata->registers->PC=simdata->RAM[simdata->registers->SP]; + simdata->registers->PC=*(uint32_t*)(simdata->RAM+simdata->registers->SP); break; case EXEC_ALU: if( simdata->exec_data->in_op1->OP_ADDR==REGISTER &&