From db5aeb333c859d0d2e658f82d519e7a8b50bef9f Mon Sep 17 00:00:00 2001 From: Dominic Grimm Date: Sat, 9 Jul 2022 21:08:27 +0200 Subject: [PATCH] Add carry flag "threading" --- src/hence/emulator.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hence/emulator.cr b/src/hence/emulator.cr index 003797c..5fa5a4e 100644 --- a/src/hence/emulator.cr +++ b/src/hence/emulator.cr @@ -184,13 +184,13 @@ module Hence when 0x08 # shr @reg_tmp = @reg_a >> @reg_b when 0x09 # add - @reg_tmp = @reg_a &+ @reg_b + @reg_tmp = @reg_a &+ @reg_b &+ (@reg_s & 0b00000001_u8) @reg_s &= 0b11111110_u8 if @reg_tmp < @reg_a @reg_s |= 0b00000001_u8 end when 0x0a # sub - @reg_tmp = @reg_a &- @reg_b + @reg_tmp = @reg_a &- @reg_b &- (@reg_s & 0b00000001_u8) @reg_s &= 0b11111110_u8 if @reg_tmp > @reg_a @reg_s |= 0b00000001_u8