From 856fd58549e5bf50e800a665f9deb27d967df2fb Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 24 Oct 2025 12:58:52 +0200 Subject: checkpoint --- .../listing_0048_ip_register | Bin 0 -> 14 bytes .../listing_0048_ip_register.asm | 23 +++++++++++++ .../listing_0048_ip_register.txt | 13 +++++++ .../listing_0049_conditional_jumps | Bin 0 -> 14 bytes .../listing_0049_conditional_jumps.asm | 24 +++++++++++++ .../listing_0049_conditional_jumps.txt | 18 ++++++++++ .../listing_0050_challenge_jumps | Bin 0 -> 28 bytes .../listing_0050_challenge_jumps.asm | 38 +++++++++++++++++++++ .../listing_0050_challenge_jumps.txt | 38 +++++++++++++++++++++ 9 files changed, 154 insertions(+) create mode 100644 data/simulating_conditional_jumps/listing_0048_ip_register create mode 100644 data/simulating_conditional_jumps/listing_0048_ip_register.asm create mode 100644 data/simulating_conditional_jumps/listing_0048_ip_register.txt create mode 100644 data/simulating_conditional_jumps/listing_0049_conditional_jumps create mode 100644 data/simulating_conditional_jumps/listing_0049_conditional_jumps.asm create mode 100644 data/simulating_conditional_jumps/listing_0049_conditional_jumps.txt create mode 100644 data/simulating_conditional_jumps/listing_0050_challenge_jumps create mode 100644 data/simulating_conditional_jumps/listing_0050_challenge_jumps.asm create mode 100644 data/simulating_conditional_jumps/listing_0050_challenge_jumps.txt (limited to 'data/simulating_conditional_jumps') diff --git a/data/simulating_conditional_jumps/listing_0048_ip_register b/data/simulating_conditional_jumps/listing_0048_ip_register new file mode 100644 index 0000000..1aa90a5 Binary files /dev/null and b/data/simulating_conditional_jumps/listing_0048_ip_register differ diff --git a/data/simulating_conditional_jumps/listing_0048_ip_register.asm b/data/simulating_conditional_jumps/listing_0048_ip_register.asm new file mode 100644 index 0000000..f7fe1d7 --- /dev/null +++ b/data/simulating_conditional_jumps/listing_0048_ip_register.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/data/simulating_conditional_jumps/listing_0048_ip_register.txt b/data/simulating_conditional_jumps/listing_0048_ip_register.txt new file mode 100644 index 0000000..b5072f6 --- /dev/null +++ b/data/simulating_conditional_jumps/listing_0048_ip_register.txt @@ -0,0 +1,13 @@ +--- 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/data/simulating_conditional_jumps/listing_0049_conditional_jumps b/data/simulating_conditional_jumps/listing_0049_conditional_jumps new file mode 100644 index 0000000..0a27d41 Binary files /dev/null and b/data/simulating_conditional_jumps/listing_0049_conditional_jumps differ diff --git a/data/simulating_conditional_jumps/listing_0049_conditional_jumps.asm b/data/simulating_conditional_jumps/listing_0049_conditional_jumps.asm new file mode 100644 index 0000000..f80bce6 --- /dev/null +++ b/data/simulating_conditional_jumps/listing_0049_conditional_jumps.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/data/simulating_conditional_jumps/listing_0049_conditional_jumps.txt b/data/simulating_conditional_jumps/listing_0049_conditional_jumps.txt new file mode 100644 index 0000000..8005993 --- /dev/null +++ b/data/simulating_conditional_jumps/listing_0049_conditional_jumps.txt @@ -0,0 +1,18 @@ +--- 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 + diff --git a/data/simulating_conditional_jumps/listing_0050_challenge_jumps b/data/simulating_conditional_jumps/listing_0050_challenge_jumps new file mode 100644 index 0000000..7a95806 Binary files /dev/null and b/data/simulating_conditional_jumps/listing_0050_challenge_jumps differ diff --git a/data/simulating_conditional_jumps/listing_0050_challenge_jumps.asm b/data/simulating_conditional_jumps/listing_0050_challenge_jumps.asm new file mode 100644 index 0000000..8d2f484 --- /dev/null +++ b/data/simulating_conditional_jumps/listing_0050_challenge_jumps.asm @@ -0,0 +1,38 @@ +; ======================================================================== +; +; (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 50 +; ======================================================================== + +bits 16 + +mov ax, 10 +mov bx, 10 +mov cx, 10 + +label_0: +cmp bx, cx +je label_1 + +add ax, 1 +jp label_2 + +label_1: +sub bx, 5 +jb label_3 + +label_2: +sub cx, 2 + +label_3: +loopnz label_0 diff --git a/data/simulating_conditional_jumps/listing_0050_challenge_jumps.txt b/data/simulating_conditional_jumps/listing_0050_challenge_jumps.txt new file mode 100644 index 0000000..881a107 --- /dev/null +++ b/data/simulating_conditional_jumps/listing_0050_challenge_jumps.txt @@ -0,0 +1,38 @@ +--- test\listing_0050_challenge_jumps execution --- +mov ax, 10 ; ax:0x0->0xa ip:0x0->0x3 +mov bx, 10 ; bx:0x0->0xa ip:0x3->0x6 +mov cx, 10 ; cx:0x0->0xa ip:0x6->0x9 +cmp bx, cx ; ip:0x9->0xb flags:->PZ +je $+7 ; ip:0xb->0x12 +sub bx, 5 ; bx:0xa->0x5 ip:0x12->0x15 flags:PZ->P +jb $+5 ; ip:0x15->0x17 +sub cx, 2 ; cx:0xa->0x8 ip:0x17->0x1a flags:P-> +loopnz $-17 ; cx:0x8->0x7 ip:0x1a->0x9 +cmp bx, cx ; ip:0x9->0xb flags:->CAS +je $+7 ; ip:0xb->0xd +add ax, 1 ; ax:0xa->0xb ip:0xd->0x10 flags:CAS-> +jp $+7 ; ip:0x10->0x12 +sub bx, 5 ; bx:0x5->0x0 ip:0x12->0x15 flags:->PZ +jb $+5 ; ip:0x15->0x17 +sub cx, 2 ; cx:0x7->0x5 ip:0x17->0x1a flags:PZ->P +loopnz $-17 ; cx:0x5->0x4 ip:0x1a->0x9 +cmp bx, cx ; ip:0x9->0xb flags:P->CPAS +je $+7 ; ip:0xb->0xd +add ax, 1 ; ax:0xb->0xc ip:0xd->0x10 flags:CPAS->P +jp $+7 ; ip:0x10->0x17 +sub cx, 2 ; cx:0x4->0x2 ip:0x17->0x1a flags:P-> +loopnz $-17 ; cx:0x2->0x1 ip:0x1a->0x9 +cmp bx, cx ; ip:0x9->0xb flags:->CPAS +je $+7 ; ip:0xb->0xd +add ax, 1 ; ax:0xc->0xd ip:0xd->0x10 flags:CPAS-> +jp $+7 ; ip:0x10->0x12 +sub bx, 5 ; bx:0x0->0xfffb ip:0x12->0x15 flags:->CAS +jb $+5 ; ip:0x15->0x1a +loopnz $-17 ; cx:0x1->0x0 ip:0x1a->0x1c + +Final registers: + ax: 0x000d (13) + bx: 0xfffb (65531) + ip: 0x001c (28) + flags: CAS + -- cgit v1.2.3-70-g09d2