diff --git a/gidubba.asm b/gidubba.asm index 47a3e55..4a0244e 100644 --- a/gidubba.asm +++ b/gidubba.asm @@ -616,7 +616,7 @@ cpend: breq r0, r0, copy ;Delete a line - ;Check the counter + ;Check for an empty counter delete: xor r0, r0 load r1, count breq r0, r1, cmdp @@ -652,28 +652,18 @@ dchend: load r0, 0 load r1, #1a breq r0, r1, cmdp - ;Increment the line number - ;Load the number - load r0, target - load r1, target + 1 - ;Increment - cleq r0, r0, incdw - ;Store the number - store target, r0 - store target + 1, r1 - - ;Reset the line number - xor r0, r0 - store lnnum, r0 - store lnnum + 1, r0 - - ;Get the save start address - ;High byte - load r0, svstrt - store eoflod + 1, r0 + ;Increment the buffer address ;Low byte - load r0, svstrt + 1 - store eoflod + 2, r0 + load r0, target + 1 + load r2, count + cleq r0, r0, sum + store target + 1, r0 + ;Add the overflow to the high byte + load r0, target + xor r2, r2 + xor r2, r1 + cleq r0, r0, sum + store target, r0 ;Find the next line in the save and store its number cleq r0, r0, fend @@ -717,20 +707,8 @@ stomov: store 0, r0 ;Move the next character breq r0, r0, lodmov - ;Loop - ;Decrement the counter -delend: load r0, count - load r2, #ff - cleq r0, r0, sum - store count, r0 - ;Decrement the line number - load r0, target - load r1, target + 1 - cleq r0, r0, decdw - store target, r0 - store target + 1, r1 - ;Loop - breq r0, r0, delete + ;Return to the command prompt +delend: breq r0, r0, cmdp ;***