From 0237ff105f56fac3dae552496de44a26ed7ea5fd Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 21 Jul 2019 19:43:45 -0400 Subject: [PATCH] ed: fix 'd' going crazy when deleting last lines of buf --- apps/ed/buf.asm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/ed/buf.asm b/apps/ed/buf.asm index d907611..988f191 100644 --- a/apps/ed/buf.asm +++ b/apps/ed/buf.asm @@ -111,6 +111,13 @@ bufDelLines: pop de ; <-- lvl 2 pop hl ; <-- lvl 1 ; Line count updated! + ; One other thing... is BC zero? Because if it is, then we shouldn't + ; call ldir (otherwise we're on for a veeeery long loop), BC=0 means + ; that only last lines were deleted. nothing to do. + ld a, b + or c + ret z ; BC==0, return + ; let's have invert HL and DE to match LDIR's signature ex de, hl ; At this point we have higher index in HL, lower index in DE and number