From d0f91f15f8ec17e1b039661f07ad69621f3eca35 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Fri, 21 Mar 2025 16:33:24 +0700 Subject: [PATCH] Listings 48 and 49 --- asm_files/list-0048.asm | 23 +++++++++++++++++++++++ asm_files/list-0048.txt | 12 ++++++++++++ asm_files/list-0049.asm | 24 ++++++++++++++++++++++++ asm_files/list-0049.txt | 17 +++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 asm_files/list-0048.asm create mode 100644 asm_files/list-0048.txt create mode 100644 asm_files/list-0049.asm create mode 100644 asm_files/list-0049.txt diff --git a/asm_files/list-0048.asm b/asm_files/list-0048.asm new file mode 100644 index 0000000..f7fe1d7 --- /dev/null +++ b/asm_files/list-0048.asm @@ -0,0 +1,23 @@ +; ======================================================================== +; +; (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 48 +; ======================================================================== + +bits 16 + +mov cx, 200 +mov bx, cx +add cx, 1000 +mov bx, 2000 +sub cx, bx diff --git a/asm_files/list-0048.txt b/asm_files/list-0048.txt new file mode 100644 index 0000000..58d9574 --- /dev/null +++ b/asm_files/list-0048.txt @@ -0,0 +1,12 @@ +--- test\listing_0048_ip_register execution --- +mov cx, 200 ; cx:0x0->0xc8 ip:0x0->0x3 +mov bx, cx ; bx:0x0->0xc8 ip:0x3->0x5 +add cx, 1000 ; cx:0xc8->0x4b0 ip:0x5->0x9 flags:->A +mov bx, 2000 ; bx:0xc8->0x7d0 ip:0x9->0xc +sub cx, bx ; cx:0x4b0->0xfce0 ip:0xc->0xe flags:A->CS + +Final registers: + bx: 0x07d0 (2000) + cx: 0xfce0 (64736) + ip: 0x000e (14) + flags: CS diff --git a/asm_files/list-0049.asm b/asm_files/list-0049.asm new file mode 100644 index 0000000..f80bce6 --- /dev/null +++ b/asm_files/list-0049.asm @@ -0,0 +1,24 @@ +; ======================================================================== +; +; (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 49 +; ======================================================================== + +bits 16 + +mov cx, 3 +mov bx, 1000 +loop_start: +add bx, 10 +sub cx, 1 +jnz loop_start diff --git a/asm_files/list-0049.txt b/asm_files/list-0049.txt new file mode 100644 index 0000000..091c0d6 --- /dev/null +++ b/asm_files/list-0049.txt @@ -0,0 +1,17 @@ +--- test\listing_0049_conditional_jumps execution --- +mov cx, 3 ; cx:0x0->0x3 ip:0x0->0x3 +mov bx, 1000 ; bx:0x0->0x3e8 ip:0x3->0x6 +add bx, 10 ; bx:0x3e8->0x3f2 ip:0x6->0x9 flags:->A +sub cx, 1 ; cx:0x3->0x2 ip:0x9->0xc flags:A-> +jne $-6 ; ip:0xc->0x6 +add bx, 10 ; bx:0x3f2->0x3fc ip:0x6->0x9 flags:->P +sub cx, 1 ; cx:0x2->0x1 ip:0x9->0xc flags:P-> +jne $-6 ; ip:0xc->0x6 +add bx, 10 ; bx:0x3fc->0x406 ip:0x6->0x9 flags:->PA +sub cx, 1 ; cx:0x1->0x0 ip:0x9->0xc flags:PA->PZ +jne $-6 ; ip:0xc->0xe + +Final registers: + bx: 0x0406 (1030) + ip: 0x000e (14) + flags: PZ