Blob Blame History Raw
From 2bec637637df08ffa5a43c0e75fa04015934e0e3 Mon Sep 17 00:00:00 2001
From: Piotr Fusik <fox@scene.pl>
Date: Tue, 5 Nov 2019 20:15:34 +0100
Subject: [PATCH 087/170] Optimize a negation in signed division.

---
 libsrc/runtime/idiv32by16r16.s | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libsrc/runtime/idiv32by16r16.s b/libsrc/runtime/idiv32by16r16.s
index 12e7feb5..098e3dbf 100644
--- a/libsrc/runtime/idiv32by16r16.s
+++ b/libsrc/runtime/idiv32by16r16.s
@@ -29,19 +29,18 @@ idiv32by16r16:
         stx     ptr3+1
 
         lda     ptr2+1
+        cmp     #$80
         eor     tmp1
         sta     tmp1
-        bit     ptr2+1
-        bpl     @L3
+        bcc     @L3
 
 ; Negate the value in ptr1:ptr2
 
         ldx     #0
         ldy     #4
-        sec
-@L2:    lda     ptr1,x
-        eor     #$FF
-        adc     #$00
+;       sec
+@L2:    lda     #$00
+        sbc     ptr1,x
         sta     ptr1,x
         inx
         dey
-- 
2.26.0