From 0982906027721c71307e234d6f14f886bdca47c5 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 15 Oct 2025 11:51:03 +0200 Subject: checkpoint --- src/build/sim86 | Bin 58120 -> 58480 bytes src/code/sim86.cpp | 55 +++++++++++++++++++++ src/code/sim86.h | 6 +++ src/data/listing_0043_immediate_movs | Bin 24 -> 0 bytes src/data/listing_0043_immediate_movs.asm | 27 ---------- src/data/listing_0043_immediate_movs.txt | 20 -------- src/data/listing_0044_register_movs | Bin 28 -> 0 bytes src/data/listing_0044_register_movs.asm | 32 ------------ src/data/listing_0044_register_movs.txt | 24 --------- src/data/listing_0045_challenge_register_movs | 1 - src/data/listing_0045_challenge_register_movs.asm | 43 ---------------- src/data/listing_0045_challenge_register_movs.txt | 35 ------------- src/data/listing_0046_add_sub_cmp | 1 + src/data/listing_0046_add_sub_cmp.asm | 29 +++++++++++ src/data/listing_0046_add_sub_cmp.txt | 16 ++++++ src/data/listing_0047_challenge_flags | Bin 0 -> 44 bytes src/data/listing_0047_challenge_flags.asm | 36 ++++++++++++++ src/data/listing_0047_challenge_flags.txt | 23 +++++++++ .../listing_0043_immediate_movs | Bin 0 -> 24 bytes .../listing_0043_immediate_movs.asm | 27 ++++++++++ .../listing_0043_immediate_movs.txt | 20 ++++++++ .../listing_0044_register_movs | Bin 0 -> 28 bytes .../listing_0044_register_movs.asm | 32 ++++++++++++ .../listing_0044_register_movs.txt | 24 +++++++++ .../listing_0045_challenge_register_movs | 1 + .../listing_0045_challenge_register_movs.asm | 43 ++++++++++++++++ .../listing_0045_challenge_register_movs.txt | 35 +++++++++++++ 27 files changed, 348 insertions(+), 182 deletions(-) delete mode 100644 src/data/listing_0043_immediate_movs delete mode 100644 src/data/listing_0043_immediate_movs.asm delete mode 100644 src/data/listing_0043_immediate_movs.txt delete mode 100644 src/data/listing_0044_register_movs delete mode 100644 src/data/listing_0044_register_movs.asm delete mode 100644 src/data/listing_0044_register_movs.txt delete mode 100644 src/data/listing_0045_challenge_register_movs delete mode 100644 src/data/listing_0045_challenge_register_movs.asm delete mode 100644 src/data/listing_0045_challenge_register_movs.txt create mode 100644 src/data/listing_0046_add_sub_cmp create mode 100644 src/data/listing_0046_add_sub_cmp.asm create mode 100644 src/data/listing_0046_add_sub_cmp.txt create mode 100644 src/data/listing_0047_challenge_flags create mode 100644 src/data/listing_0047_challenge_flags.asm create mode 100644 src/data/listing_0047_challenge_flags.txt create mode 100644 src/data/simulating_non_memory_movs/listing_0043_immediate_movs create mode 100644 src/data/simulating_non_memory_movs/listing_0043_immediate_movs.asm create mode 100644 src/data/simulating_non_memory_movs/listing_0043_immediate_movs.txt create mode 100644 src/data/simulating_non_memory_movs/listing_0044_register_movs create mode 100644 src/data/simulating_non_memory_movs/listing_0044_register_movs.asm create mode 100644 src/data/simulating_non_memory_movs/listing_0044_register_movs.txt create mode 100644 src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs create mode 100644 src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs.asm create mode 100644 src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs.txt (limited to 'src') diff --git a/src/build/sim86 b/src/build/sim86 index 16e2bdd..d8ce0a1 100755 Binary files a/src/build/sim86 and b/src/build/sim86 differ diff --git a/src/code/sim86.cpp b/src/code/sim86.cpp index 8ea8453..75e1e93 100644 --- a/src/code/sim86.cpp +++ b/src/code/sim86.cpp @@ -20,6 +20,7 @@ internal void Run8086(psize DisassemblySize, u8 *Disassembly) { s32 Registers[Register_count] = {}; + u32 Flags = 0; u32 Offset = 0; while(Offset < DisassemblySize) @@ -96,7 +97,61 @@ Run8086(psize DisassemblySize, u8 *Disassembly) printf(" ; %s:0x%x->0x%x", Sim86_RegisterNameFromOperand(&Decoded.Operands[0].Register), Old, *Destination); #endif + } + else if(Decoded.Op == Op_cmp) + { + Assert(0 && "cmp has not been implemented yet"); + } + else if(Decoded.Op == Op_sub) + { + s32 *Destination = 0; + s32 *Source = 0; + + if(0) {} + else if(Decoded.Operands[0].Type == Operand_Register) + { + Destination = Registers + Decoded.Operands[0].Register.Index; + } + else + { + Assert(0 && "Destination must be a register"); + } + + if(0) {} + else if(Decoded.Operands[1].Type == Operand_Register) + { + Source = Registers + Decoded.Operands[1].Register.Index; + } + else if(Decoded.Operands[1].Type == Operand_Immediate) + { + Source = &Decoded.Operands[1].Immediate.Value; + } + else + { + Assert(1 && "Substraction from memory address is not implemented yet."); + } + + Assert(0 && "sub has not been implemented yet"); + *Destination = (u16)((u16)(*Destination) - ((u16)(*Source))); + if(*Destination & (1 << 15)) + { + Flags |= Flag_Sign; + } + + if(*Destination == 0) + { + Flags |= Flag_Zero; + } + else + { + Flags &= (~Flag_Zero); + } + + } + else if(Decoded.Op == Op_add) + { + Assert(0 && "add has not been implemented yet"); } else { diff --git a/src/code/sim86.h b/src/code/sim86.h index 2a3427e..5beef0b 100644 --- a/src/code/sim86.h +++ b/src/code/sim86.h @@ -35,5 +35,11 @@ enum register_mapping_8086 Register_count, }; +enum flags_8086 +{ + Flag_Zero = 0x1, + Flag_Sign = 0x2, +}; + #endif //SIM86_H diff --git a/src/data/listing_0043_immediate_movs b/src/data/listing_0043_immediate_movs deleted file mode 100644 index a965538..0000000 Binary files a/src/data/listing_0043_immediate_movs and /dev/null differ diff --git a/src/data/listing_0043_immediate_movs.asm b/src/data/listing_0043_immediate_movs.asm deleted file mode 100644 index 475afaf..0000000 --- a/src/data/listing_0043_immediate_movs.asm +++ /dev/null @@ -1,27 +0,0 @@ -; ======================================================================== -; -; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved. -; -; This software is provided 'as-is', without any express or implied -; warranty. In no event will the authors be held liable for any damages -; arising from the use of this software. -; -; Please see https://computerenhance.com for further information -; -; ======================================================================== - -; ======================================================================== -; LISTING 43 -; ======================================================================== - -bits 16 - -mov ax, 1 -mov bx, 2 -mov cx, 3 -mov dx, 4 - -mov sp, 5 -mov bp, 6 -mov si, 7 -mov di, 8 diff --git a/src/data/listing_0043_immediate_movs.txt b/src/data/listing_0043_immediate_movs.txt deleted file mode 100644 index fb36287..0000000 --- a/src/data/listing_0043_immediate_movs.txt +++ /dev/null @@ -1,20 +0,0 @@ ---- test\listing_0043_immediate_movs execution --- -mov ax, 1 ; ax:0x0->0x1 -mov bx, 2 ; bx:0x0->0x2 -mov cx, 3 ; cx:0x0->0x3 -mov dx, 4 ; dx:0x0->0x4 -mov sp, 5 ; sp:0x0->0x5 -mov bp, 6 ; bp:0x0->0x6 -mov si, 7 ; si:0x0->0x7 -mov di, 8 ; di:0x0->0x8 - -Final registers: - ax: 0x0001 (1) - bx: 0x0002 (2) - cx: 0x0003 (3) - dx: 0x0004 (4) - sp: 0x0005 (5) - bp: 0x0006 (6) - si: 0x0007 (7) - di: 0x0008 (8) - diff --git a/src/data/listing_0044_register_movs b/src/data/listing_0044_register_movs deleted file mode 100644 index 346ff45..0000000 Binary files a/src/data/listing_0044_register_movs and /dev/null differ diff --git a/src/data/listing_0044_register_movs.asm b/src/data/listing_0044_register_movs.asm deleted file mode 100644 index 58988fe..0000000 --- a/src/data/listing_0044_register_movs.asm +++ /dev/null @@ -1,32 +0,0 @@ -; ======================================================================== -; -; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved. -; -; This software is provided 'as-is', without any express or implied -; warranty. In no event will the authors be held liable for any damages -; arising from the use of this software. -; -; Please see https://computerenhance.com for further information -; -; ======================================================================== - -; ======================================================================== -; LISTING 44 -; ======================================================================== - -bits 16 - -mov ax, 1 -mov bx, 2 -mov cx, 3 -mov dx, 4 - -mov sp, ax -mov bp, bx -mov si, cx -mov di, dx - -mov dx, sp -mov cx, bp -mov bx, si -mov ax, di diff --git a/src/data/listing_0044_register_movs.txt b/src/data/listing_0044_register_movs.txt deleted file mode 100644 index e46c56c..0000000 --- a/src/data/listing_0044_register_movs.txt +++ /dev/null @@ -1,24 +0,0 @@ ---- test\listing_0044_register_movs execution --- -mov ax, 1 ; ax:0x0->0x1 -mov bx, 2 ; bx:0x0->0x2 -mov cx, 3 ; cx:0x0->0x3 -mov dx, 4 ; dx:0x0->0x4 -mov sp, ax ; sp:0x0->0x1 -mov bp, bx ; bp:0x0->0x2 -mov si, cx ; si:0x0->0x3 -mov di, dx ; di:0x0->0x4 -mov dx, sp ; dx:0x4->0x1 -mov cx, bp ; cx:0x3->0x2 -mov bx, si ; bx:0x2->0x3 -mov ax, di ; ax:0x1->0x4 - -Final registers: - ax: 0x0004 (4) - bx: 0x0003 (3) - cx: 0x0002 (2) - dx: 0x0001 (1) - sp: 0x0001 (1) - bp: 0x0002 (2) - si: 0x0003 (3) - di: 0x0004 (4) - diff --git a/src/data/listing_0045_challenge_register_movs b/src/data/listing_0045_challenge_register_movs deleted file mode 100644 index dd781b2..0000000 --- a/src/data/listing_0045_challenge_register_movs +++ /dev/null @@ -1 +0,0 @@ -""DDffЎێ3Uw܈ЎێԌ݌Ɖ \ No newline at end of file diff --git a/src/data/listing_0045_challenge_register_movs.asm b/src/data/listing_0045_challenge_register_movs.asm deleted file mode 100644 index 9e25fda..0000000 --- a/src/data/listing_0045_challenge_register_movs.asm +++ /dev/null @@ -1,43 +0,0 @@ -; ======================================================================== -; -; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved. -; -; This software is provided 'as-is', without any express or implied -; warranty. In no event will the authors be held liable for any damages -; arising from the use of this software. -; -; Please see https://computerenhance.com for further information -; -; ======================================================================== - -; ======================================================================== -; LISTING 45 -; ======================================================================== - -bits 16 - -mov ax, 0x2222 -mov bx, 0x4444 -mov cx, 0x6666 -mov dx, 0x8888 - -mov ss, ax -mov ds, bx -mov es, cx - -mov al, 0x11 -mov bh, 0x33 -mov cl, 0x55 -mov dh, 0x77 - -mov ah, bl -mov cl, dh - -mov ss, ax -mov ds, bx -mov es, cx - -mov sp, ss -mov bp, ds -mov si, es -mov di, dx diff --git a/src/data/listing_0045_challenge_register_movs.txt b/src/data/listing_0045_challenge_register_movs.txt deleted file mode 100644 index 66c8c7b..0000000 --- a/src/data/listing_0045_challenge_register_movs.txt +++ /dev/null @@ -1,35 +0,0 @@ ---- test\listing_0045_challenge_register_movs execution --- -mov ax, 8738 ; ax:0x0->0x2222 -mov bx, 17476 ; bx:0x0->0x4444 -mov cx, 26214 ; cx:0x0->0x6666 -mov dx, 34952 ; dx:0x0->0x8888 -mov ss, ax ; ss:0x0->0x2222 -mov ds, bx ; ds:0x0->0x4444 -mov es, cx ; es:0x0->0x6666 -mov al, 17 ; ax:0x2222->0x2211 -mov bh, 51 ; bx:0x4444->0x3344 -mov cl, 85 ; cx:0x6666->0x6655 -mov dh, 119 ; dx:0x8888->0x7788 -mov ah, bl ; ax:0x2211->0x4411 -mov cl, dh ; cx:0x6655->0x6677 -mov ss, ax ; ss:0x2222->0x4411 -mov ds, bx ; ds:0x4444->0x3344 -mov es, cx ; es:0x6666->0x6677 -mov sp, ss ; sp:0x0->0x4411 -mov bp, ds ; bp:0x0->0x3344 -mov si, es ; si:0x0->0x6677 -mov di, dx ; di:0x0->0x7788 - -Final registers: - ax: 0x4411 (17425) - bx: 0x3344 (13124) - cx: 0x6677 (26231) - dx: 0x7788 (30600) - sp: 0x4411 (17425) - bp: 0x3344 (13124) - si: 0x6677 (26231) - di: 0x7788 (30600) - es: 0x6677 (26231) - ss: 0x4411 (17425) - ds: 0x3344 (13124) - diff --git a/src/data/listing_0046_add_sub_cmp b/src/data/listing_0046_add_sub_cmp new file mode 100644 index 0000000..ba7e73d --- /dev/null +++ b/src/data/listing_0046_add_sub_cmp @@ -0,0 +1 @@ +)˼9 \ No newline at end of file diff --git a/src/data/listing_0046_add_sub_cmp.asm b/src/data/listing_0046_add_sub_cmp.asm new file mode 100644 index 0000000..287e958 --- /dev/null +++ b/src/data/listing_0046_add_sub_cmp.asm @@ -0,0 +1,29 @@ +; ======================================================================== +; +; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved. +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Please see https://computerenhance.com for further information +; +; ======================================================================== + +; ======================================================================== +; LISTING 46 +; ======================================================================== + +bits 16 + +mov bx, -4093 +mov cx, 3841 +sub bx, cx + +mov sp, 998 +mov bp, 999 +cmp bp, sp + +add bp, 1027 +sub bp, 2026 + diff --git a/src/data/listing_0046_add_sub_cmp.txt b/src/data/listing_0046_add_sub_cmp.txt new file mode 100644 index 0000000..4b27dba --- /dev/null +++ b/src/data/listing_0046_add_sub_cmp.txt @@ -0,0 +1,16 @@ +--- test\listing_0046_add_sub_cmp execution --- +mov bx, 61443 ; bx:0x0->0xf003 +mov cx, 3841 ; cx:0x0->0xf01 +sub bx, cx ; bx:0xf003->0xe102 flags:->S +mov sp, 998 ; sp:0x0->0x3e6 +mov bp, 999 ; bp:0x0->0x3e7 +cmp bp, sp ; flags:S-> +add bp, 1027 ; bp:0x3e7->0x7ea +sub bp, 2026 ; bp:0x7ea->0x0 flags:->PZ + +Final registers: + bx: 0xe102 (57602) + cx: 0x0f01 (3841) + sp: 0x03e6 (998) + flags: PZ + diff --git a/src/data/listing_0047_challenge_flags b/src/data/listing_0047_challenge_flags new file mode 100644 index 0000000..58edaa0 Binary files /dev/null and b/src/data/listing_0047_challenge_flags differ diff --git a/src/data/listing_0047_challenge_flags.asm b/src/data/listing_0047_challenge_flags.asm new file mode 100644 index 0000000..0a4cd1f --- /dev/null +++ b/src/data/listing_0047_challenge_flags.asm @@ -0,0 +1,36 @@ +; ======================================================================== +; +; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved. +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Please see https://computerenhance.com for further information +; +; ======================================================================== + +; ======================================================================== +; LISTING 47 +; ======================================================================== + +bits 16 + +add bx, 30000 +add bx, 10000 +sub bx, 5000 +sub bx, 5000 + +mov bx, 1 +mov cx, 100 +add bx, cx + +mov dx, 10 +sub cx, dx + +add bx, 40000 +add cx, -90 + +mov sp, 99 +mov bp, 98 +cmp bp, sp diff --git a/src/data/listing_0047_challenge_flags.txt b/src/data/listing_0047_challenge_flags.txt new file mode 100644 index 0000000..d33a1ca --- /dev/null +++ b/src/data/listing_0047_challenge_flags.txt @@ -0,0 +1,23 @@ +--- test\listing_0047_challenge_flags execution --- +add bx, 30000 ; bx:0x0->0x7530 flags:->P +add bx, 10000 ; bx:0x7530->0x9c40 flags:P->SO +sub bx, 5000 ; bx:0x9c40->0x88b8 flags:SO->PAS +sub bx, 5000 ; bx:0x88b8->0x7530 flags:PAS->PO +mov bx, 1 ; bx:0x7530->0x1 +mov cx, 100 ; cx:0x0->0x64 +add bx, cx ; bx:0x1->0x65 flags:PO->P +mov dx, 10 ; dx:0x0->0xa +sub cx, dx ; cx:0x64->0x5a flags:P->PA +add bx, 40000 ; bx:0x65->0x9ca5 flags:PA->PS +add cx, -90 ; cx:0x5a->0x0 flags:PS->CPAZ +mov sp, 99 ; sp:0x0->0x63 +mov bp, 98 ; bp:0x0->0x62 +cmp bp, sp ; flags:CPAZ->CPAS + +Final registers: + bx: 0x9ca5 (40101) + dx: 0x000a (10) + sp: 0x0063 (99) + bp: 0x0062 (98) + flags: CPAS + diff --git a/src/data/simulating_non_memory_movs/listing_0043_immediate_movs b/src/data/simulating_non_memory_movs/listing_0043_immediate_movs new file mode 100644 index 0000000..a965538 Binary files /dev/null and b/src/data/simulating_non_memory_movs/listing_0043_immediate_movs differ diff --git a/src/data/simulating_non_memory_movs/listing_0043_immediate_movs.asm b/src/data/simulating_non_memory_movs/listing_0043_immediate_movs.asm new file mode 100644 index 0000000..475afaf --- /dev/null +++ b/src/data/simulating_non_memory_movs/listing_0043_immediate_movs.asm @@ -0,0 +1,27 @@ +; ======================================================================== +; +; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved. +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Please see https://computerenhance.com for further information +; +; ======================================================================== + +; ======================================================================== +; LISTING 43 +; ======================================================================== + +bits 16 + +mov ax, 1 +mov bx, 2 +mov cx, 3 +mov dx, 4 + +mov sp, 5 +mov bp, 6 +mov si, 7 +mov di, 8 diff --git a/src/data/simulating_non_memory_movs/listing_0043_immediate_movs.txt b/src/data/simulating_non_memory_movs/listing_0043_immediate_movs.txt new file mode 100644 index 0000000..fb36287 --- /dev/null +++ b/src/data/simulating_non_memory_movs/listing_0043_immediate_movs.txt @@ -0,0 +1,20 @@ +--- test\listing_0043_immediate_movs execution --- +mov ax, 1 ; ax:0x0->0x1 +mov bx, 2 ; bx:0x0->0x2 +mov cx, 3 ; cx:0x0->0x3 +mov dx, 4 ; dx:0x0->0x4 +mov sp, 5 ; sp:0x0->0x5 +mov bp, 6 ; bp:0x0->0x6 +mov si, 7 ; si:0x0->0x7 +mov di, 8 ; di:0x0->0x8 + +Final registers: + ax: 0x0001 (1) + bx: 0x0002 (2) + cx: 0x0003 (3) + dx: 0x0004 (4) + sp: 0x0005 (5) + bp: 0x0006 (6) + si: 0x0007 (7) + di: 0x0008 (8) + diff --git a/src/data/simulating_non_memory_movs/listing_0044_register_movs b/src/data/simulating_non_memory_movs/listing_0044_register_movs new file mode 100644 index 0000000..346ff45 Binary files /dev/null and b/src/data/simulating_non_memory_movs/listing_0044_register_movs differ diff --git a/src/data/simulating_non_memory_movs/listing_0044_register_movs.asm b/src/data/simulating_non_memory_movs/listing_0044_register_movs.asm new file mode 100644 index 0000000..58988fe --- /dev/null +++ b/src/data/simulating_non_memory_movs/listing_0044_register_movs.asm @@ -0,0 +1,32 @@ +; ======================================================================== +; +; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved. +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Please see https://computerenhance.com for further information +; +; ======================================================================== + +; ======================================================================== +; LISTING 44 +; ======================================================================== + +bits 16 + +mov ax, 1 +mov bx, 2 +mov cx, 3 +mov dx, 4 + +mov sp, ax +mov bp, bx +mov si, cx +mov di, dx + +mov dx, sp +mov cx, bp +mov bx, si +mov ax, di diff --git a/src/data/simulating_non_memory_movs/listing_0044_register_movs.txt b/src/data/simulating_non_memory_movs/listing_0044_register_movs.txt new file mode 100644 index 0000000..e46c56c --- /dev/null +++ b/src/data/simulating_non_memory_movs/listing_0044_register_movs.txt @@ -0,0 +1,24 @@ +--- test\listing_0044_register_movs execution --- +mov ax, 1 ; ax:0x0->0x1 +mov bx, 2 ; bx:0x0->0x2 +mov cx, 3 ; cx:0x0->0x3 +mov dx, 4 ; dx:0x0->0x4 +mov sp, ax ; sp:0x0->0x1 +mov bp, bx ; bp:0x0->0x2 +mov si, cx ; si:0x0->0x3 +mov di, dx ; di:0x0->0x4 +mov dx, sp ; dx:0x4->0x1 +mov cx, bp ; cx:0x3->0x2 +mov bx, si ; bx:0x2->0x3 +mov ax, di ; ax:0x1->0x4 + +Final registers: + ax: 0x0004 (4) + bx: 0x0003 (3) + cx: 0x0002 (2) + dx: 0x0001 (1) + sp: 0x0001 (1) + bp: 0x0002 (2) + si: 0x0003 (3) + di: 0x0004 (4) + diff --git a/src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs b/src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs new file mode 100644 index 0000000..dd781b2 --- /dev/null +++ b/src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs @@ -0,0 +1 @@ +""DDffЎێ3Uw܈ЎێԌ݌Ɖ \ No newline at end of file diff --git a/src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs.asm b/src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs.asm new file mode 100644 index 0000000..9e25fda --- /dev/null +++ b/src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs.asm @@ -0,0 +1,43 @@ +; ======================================================================== +; +; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved. +; +; This software is provided 'as-is', without any express or implied +; warranty. In no event will the authors be held liable for any damages +; arising from the use of this software. +; +; Please see https://computerenhance.com for further information +; +; ======================================================================== + +; ======================================================================== +; LISTING 45 +; ======================================================================== + +bits 16 + +mov ax, 0x2222 +mov bx, 0x4444 +mov cx, 0x6666 +mov dx, 0x8888 + +mov ss, ax +mov ds, bx +mov es, cx + +mov al, 0x11 +mov bh, 0x33 +mov cl, 0x55 +mov dh, 0x77 + +mov ah, bl +mov cl, dh + +mov ss, ax +mov ds, bx +mov es, cx + +mov sp, ss +mov bp, ds +mov si, es +mov di, dx diff --git a/src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs.txt b/src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs.txt new file mode 100644 index 0000000..66c8c7b --- /dev/null +++ b/src/data/simulating_non_memory_movs/listing_0045_challenge_register_movs.txt @@ -0,0 +1,35 @@ +--- test\listing_0045_challenge_register_movs execution --- +mov ax, 8738 ; ax:0x0->0x2222 +mov bx, 17476 ; bx:0x0->0x4444 +mov cx, 26214 ; cx:0x0->0x6666 +mov dx, 34952 ; dx:0x0->0x8888 +mov ss, ax ; ss:0x0->0x2222 +mov ds, bx ; ds:0x0->0x4444 +mov es, cx ; es:0x0->0x6666 +mov al, 17 ; ax:0x2222->0x2211 +mov bh, 51 ; bx:0x4444->0x3344 +mov cl, 85 ; cx:0x6666->0x6655 +mov dh, 119 ; dx:0x8888->0x7788 +mov ah, bl ; ax:0x2211->0x4411 +mov cl, dh ; cx:0x6655->0x6677 +mov ss, ax ; ss:0x2222->0x4411 +mov ds, bx ; ds:0x4444->0x3344 +mov es, cx ; es:0x6666->0x6677 +mov sp, ss ; sp:0x0->0x4411 +mov bp, ds ; bp:0x0->0x3344 +mov si, es ; si:0x0->0x6677 +mov di, dx ; di:0x0->0x7788 + +Final registers: + ax: 0x4411 (17425) + bx: 0x3344 (13124) + cx: 0x6677 (26231) + dx: 0x7788 (30600) + sp: 0x4411 (17425) + bp: 0x3344 (13124) + si: 0x6677 (26231) + di: 0x7788 (30600) + es: 0x6677 (26231) + ss: 0x4411 (17425) + ds: 0x3344 (13124) + -- cgit v1.2.3-70-g09d2