From 4c38ba57de15222f0bc27e684c972a37ebcb975b Mon Sep 17 00:00:00 2001 From: Russell-S-Harper Date: Fri, 17 Aug 2018 22:57:44 -0400 Subject: [PATCH] Setting result to largest value for true overflow. --- common/common.asm | 8 +++++--- common/common.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/common.asm b/common/common.asm index e01413b..1a5b50c 100644 --- a/common/common.asm +++ b/common/common.asm @@ -599,10 +599,12 @@ _3 JSR _CMPDC ; is D < C? ROL _RB+3 BCC _3 ; carry is set, means a real overflow condition - LDA _R0+3,X - ORA #_F_O + LDA #$FF ; set to the maximum + STA _R0,X + STA _R0+1,X + STA _R0+2,X + LDA #_MAX_V|_F_O STA _R0+3,X - BEQ _4 JMP _9 _4 LDA _RB ; is RB > 0? ORA _RB+1 diff --git a/common/common.h b/common/common.h index 76e37c2..f314054 100644 --- a/common/common.h +++ b/common/common.h @@ -131,6 +131,7 @@ _MOD_C = $e0 _EXT_C = $f0 ; common constants +_MAX_V = $3f ; i.e. the $3f part of $3fffffff ; plus and minus 1 for increment and decrement _PLS_1 = %00000100 ; i.e. the $04 part of $00000400