From 2a3db7876fcfa8c6659c34592d833b68fccf71d4 Mon Sep 17 00:00:00 2001 From: hugova Date: Fri, 1 Aug 2025 00:32:53 +0200 Subject: [PATCH] make divition return to A, because compiler. --- host/src/routines/arithmatic/div.s | 1 + host/src/routines/arithmatic/div_test.s | 4 +--- host/src/routines/arithmatic/div_test_zero.s | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/host/src/routines/arithmatic/div.s b/host/src/routines/arithmatic/div.s index 64d5c02..447fd61 100644 --- a/host/src/routines/arithmatic/div.s +++ b/host/src/routines/arithmatic/div.s @@ -39,5 +39,6 @@ R_neg: ; R < 0 LSR count BNE for_i for_i_end: + TXA RTS .endproc diff --git a/host/src/routines/arithmatic/div_test.s b/host/src/routines/arithmatic/div_test.s index 2cd0a32..d904295 100644 --- a/host/src/routines/arithmatic/div_test.s +++ b/host/src/routines/arithmatic/div_test.s @@ -15,16 +15,14 @@ LDY #(j+1) STY VAL_B JSR div ; A = VAL_A / VAL_B, clobers X. - CPX #i/(j+1) + CMP #i/(j+1) BEQ :+ jmp error : .endrepeat .endrepeat - TXA jmp end error: - TXA ;; Error make screen read ;; X * Y has the result in A that is wrong. LDX #$02 diff --git a/host/src/routines/arithmatic/div_test_zero.s b/host/src/routines/arithmatic/div_test_zero.s index 6e2509a..870a5d8 100644 --- a/host/src/routines/arithmatic/div_test_zero.s +++ b/host/src/routines/arithmatic/div_test_zero.s @@ -12,7 +12,7 @@ JSR div ; A = VAL_A / VAL_B, clobers X. .endrepeat paint: - ;; Donw make screen green - LDA #$13 + ;; Done, make screen green + LDA #$05 STA $D020 .endscope