Make 'pop' operation safe
This commit is contained in:
parent
5b5886a2f2
commit
804da393a8
3 changed files with 9 additions and 0 deletions
|
@ -131,4 +131,7 @@ return_call_stack_jump:
|
|||
.std_alu CORE_ALU_GT
|
||||
tlr CORE_REG_A
|
||||
.std_cond_jump loop_strings_1
|
||||
dbg
|
||||
pop
|
||||
dbg
|
||||
.std_stop
|
||||
|
|
|
@ -2,3 +2,5 @@
|
|||
|
||||
." test\n"
|
||||
." jdsafhjfnjfn\n"
|
||||
|
||||
debug drop debug
|
||||
|
|
|
@ -247,7 +247,11 @@ impl Emulator {
|
|||
self.reg_sp = self.reg_sp.wrapping_add(1);
|
||||
}
|
||||
0x02 => {
|
||||
let before = self.reg_sp;
|
||||
self.reg_sp = self.reg_sp.wrapping_sub(1);
|
||||
if before < self.reg_sp {
|
||||
self.reg_sp = 0;
|
||||
}
|
||||
}
|
||||
0x03 => {
|
||||
self.tmp = self.reg_arg;
|
||||
|
|
Loading…
Reference in a new issue