diff --git a/src/basic/,basic_aliases.s b/src/basic/,basic_aliases.s index 5a03a2a4..948cbb0b 100644 --- a/src/basic/,basic_aliases.s +++ b/src/basic/,basic_aliases.s @@ -8,7 +8,11 @@ !addr memmove__size = RESHO+2 !addr memmove__tmp = RESHO+4 +; +; Error codes +; +err_overflow = $0F ; ; Helper aliases to make the code more readable diff --git a/src/basic/,stubs/a437.error.s b/src/basic/,stubs/a437.error.s new file mode 100644 index 00000000..9735d974 --- /dev/null +++ b/src/basic/,stubs/a437.error.s @@ -0,0 +1,12 @@ +;; #LAYOUT# STD * #TAKE +;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000 +;; #LAYOUT# * BASIC_0 #TAKE +;; #LAYOUT# * * #IGNORE + + + +; XXX provide documentation and implementation + +error: + + +STUB_IMPLEMENTATION diff --git a/src/basic/math/b97e.overflow_error.s b/src/basic/math/b97e.overflow_error.s new file mode 100644 index 00000000..e20ad61c --- /dev/null +++ b/src/basic/math/b97e.overflow_error.s @@ -0,0 +1,17 @@ +;; #LAYOUT# STD * #TAKE +;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000 +;; #LAYOUT# * BASIC_0 #TAKE +;; #LAYOUT# * * #IGNORE + +; This file is under the MIT license, it contains code released by Microsoft Corporation. +; See LICENSE for more information. + +; Math package - overflow error +; +; This is verified to be identical to the original Microsoft implementation where it was named OVERR. +; + +overflow_error: + + ldx #err_overflow + jmp error diff --git a/src/basic/math/mul10_FAC1_mul2.s b/src/basic/math/mul10_FAC1_mul2.s index 4498a60d..7864e1c1 100644 --- a/src/basic/math/mul10_FAC1_mul2.s +++ b/src/basic/math/mul10_FAC1_mul2.s @@ -11,6 +11,6 @@ mul10_FAC1_mul2: ; Increment the exponent inc FAC1_exponent - +beq set_FAC1_max + +beq overflow_error rts diff --git a/src/basic/math/mul_FAC2_FAC1.s b/src/basic/math/mul_FAC2_FAC1.s index 64112040..abbe57c6 100644 --- a/src/basic/math/mul_FAC2_FAC1.s +++ b/src/basic/math/mul_FAC2_FAC1.s @@ -64,7 +64,7 @@ mul_FAC2_FAC1: sta RESHO+1 @2: lda RESHO+1 - +bne set_FAC1_max ; overflow + +bne overflow_error ; overflow lda RESHO+0 sta FAC1_exponent @@ -124,7 +124,7 @@ mul_FAC2_FAC1: lda FAC1_exponent clc adc #$08 - +bcs set_FAC1_max ; branch if overflow + +bcs overflow_error ; branch if overflow sta FAC1_exponent jmp normal_FAC1