From 27e485a4205924cc8b4760dec4f0335a909e5d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas?= Date: Tue, 9 Jun 2020 11:21:09 +0200 Subject: [PATCH] Fixed bug calculating the numbers in minefield --- mine.asm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mine.asm b/mine.asm index 91ff439..321f14e 100644 --- a/mine.asm +++ b/mine.asm @@ -273,14 +273,17 @@ calcend: pop ax ret +; We don't check Y bounds as we have surrounded the field array +; with padding zeroes, rendering this calculation correct if CX +; is below or beyond the limits checksurroundings: mov byte [tempnumber], 0 push ax push cx + sub cx, 1 test ax, ax jz axiszerofirstrow sub ax, 1 - sub cx, 1 call calcnumber add ax, 1 axiszerofirstrow: @@ -314,8 +317,8 @@ axoutboundssecondrow: jz axiszerothirdrow sub ax, 1 call calcnumber -axiszerothirdrow: add ax, 1 +axiszerothirdrow: call calcnumber add ax, 1 cmp ax, COLUMNS