From 7ae98d8353550ac79a0048a74ca11a6869497b8b Mon Sep 17 00:00:00 2001 From: "(Tim) Efthimis Kritikos" Date: Fri, 16 Feb 2024 21:54:17 +0000 Subject: [PATCH] CPU: Fixed a bug with the PUSH/POP instructions where only the lower 24bits were saved --- cpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpu.c b/cpu.c index 55a6b55..b4911d7 100644 --- a/cpu.c +++ b/cpu.c @@ -393,6 +393,7 @@ int exec(struct simdata_t *simdata){ simdata->RAM[simdata->registers->SP ]=simdata->registers->GPR[simdata->exec_data->in_op1->data]&0x000000FF; simdata->RAM[simdata->registers->SP+1]=(simdata->registers->GPR[simdata->exec_data->in_op1->data]&0x0000FF00)>>8; simdata->RAM[simdata->registers->SP+2]=(simdata->registers->GPR[simdata->exec_data->in_op1->data]&0x00FF0000)>>16; + simdata->RAM[simdata->registers->SP+3]=(simdata->registers->GPR[simdata->exec_data->in_op1->data]&0xFF000000)>>24; simdata->registers->SP+=4; break; case POP: @@ -400,6 +401,7 @@ int exec(struct simdata_t *simdata){ simdata->registers->GPR[simdata->exec_data->in_op1->data]=simdata->RAM[simdata->registers->SP]; simdata->registers->GPR[simdata->exec_data->in_op1->data]|=simdata->RAM[simdata->registers->SP+1]<<8; simdata->registers->GPR[simdata->exec_data->in_op1->data]|=simdata->RAM[simdata->registers->SP+2]<<16; + simdata->registers->GPR[simdata->exec_data->in_op1->data]|=simdata->RAM[simdata->registers->SP+3]<<24; break; } add_to_instr_list(&simdata->cpu_gui_hints->executing_list,simdata->exec_data->address);