From 5a8266e84aeac9f87c01cec41cf0f7cb6e950888 Mon Sep 17 00:00:00 2001 From: "Mark J. Reed" Date: Mon, 7 Jul 2025 11:26:10 -0400 Subject: [PATCH 1/6] fix: document difference in X16 FOUT behavior --- X16 Reference - 06 - Math Library.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/X16 Reference - 06 - Math Library.md b/X16 Reference - 06 - Math Library.md index 37129fb..bf50d43 100644 --- a/X16 Reference - 06 - Math Library.md +++ b/X16 Reference - 06 - Math Library.md @@ -13,11 +13,17 @@ The following functions are available from machine language code after setting t |---------|----------|----------------------------------------------------------------------------------------------| | $FE00 | `AYINT` | convert floating point to integer (signed word) | | $FE03 | `GIVAYF` | convert integer (signed word) to floating point | -| $FE06 | `FOUT` | convert floating point to ASCII string | +| $FE06 | `FOUT` | convert floating point to ASCII string. (See below) | | $FE09 | `VAL_1` | convert ASCII string in .X:.Y length in .A, to floating point in FACC. _Caveat! Read below!_ | | $FE0C | `GETADR` | convert floating point to an address (unsigned word) | | $FE0F | `FLOATC` | convert address (unsigned word) to floating point | +**Differences in X16 Behavior of FOUT** + +The version of FOUT described in the book leaves a pointer to the result string +in the AY register pair; the X16 version does not do that. Instead, rely on the +string always being placed in the FBUFFR location at $0100, + **Important caveat ragarding the `VAL_1` routine in its current implementation:** Unlike the other routines in the math library, this routine calls into the VAL implementation From 8d43ea8cfd13551c3d8cf50dab5fb592a040ffea Mon Sep 17 00:00:00 2001 From: "Mark J. Reed" Date: Mon, 7 Jul 2025 11:27:10 -0400 Subject: [PATCH 2/6] fix: correct typos --- X16 Reference - 06 - Math Library.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/X16 Reference - 06 - Math Library.md b/X16 Reference - 06 - Math Library.md index bf50d43..eb0504f 100644 --- a/X16 Reference - 06 - Math Library.md +++ b/X16 Reference - 06 - Math Library.md @@ -18,11 +18,11 @@ The following functions are available from machine language code after setting t | $FE0C | `GETADR` | convert floating point to an address (unsigned word) | | $FE0F | `FLOATC` | convert address (unsigned word) to floating point | -**Differences in X16 Behavior of FOUT** +**Difference in X16 Behavior of FOUT** The version of FOUT described in the book leaves a pointer to the result string in the AY register pair; the X16 version does not do that. Instead, rely on the -string always being placed in the FBUFFR location at $0100, +string always being placed in the FBUFFR location at $0100. **Important caveat ragarding the `VAL_1` routine in its current implementation:** From a213a72b393a8a3e1c920350562077add5fc209a Mon Sep 17 00:00:00 2001 From: "Mark J. Reed" Date: Wed, 19 Nov 2025 12:20:21 -0500 Subject: [PATCH 3/6] fix: result of QINT is signed (i32), not unsigned (u32) --- X16 Reference - 06 - Math Library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/X16 Reference - 06 - Math Library.md b/X16 Reference - 06 - Math Library.md index eb0504f..1ef9930 100644 --- a/X16 Reference - 06 - Math Library.md +++ b/X16 Reference - 06 - Math Library.md @@ -39,7 +39,7 @@ The following calls are new to the X16 and were not part of the C128 math librar |---------|----------|-------------------------------------------------| | $FE87 | `FLOAT` | FACC = (s8).A convert signed byte to float | | $FE8A | `FLOATS` | FACC = (s16)facho+1:facho | -| $FE8D | `QINT` | facho:facho+1:facho+2:facho+3 = u32(FACC) | +| $FE8D | `QINT` | facho:facho+1:facho+2:facho+3 = i32(FACC) | | $FE93 | `FOUTC` | Convert FACC to ASCIIZ string at fbuffr - 1 + .Y | ## Movement From c9b29baf8fd52486c73d9f20c28a268f50546ec4 Mon Sep 17 00:00:00 2001 From: "Mark J. Reed" Date: Wed, 19 Nov 2025 12:22:05 -0500 Subject: [PATCH 4/6] fix: QINT is there on c64, not an X16 addition --- X16 Reference - 06 - Math Library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/X16 Reference - 06 - Math Library.md b/X16 Reference - 06 - Math Library.md index 1ef9930..bc59cb3 100644 --- a/X16 Reference - 06 - Math Library.md +++ b/X16 Reference - 06 - Math Library.md @@ -17,6 +17,7 @@ The following functions are available from machine language code after setting t | $FE09 | `VAL_1` | convert ASCII string in .X:.Y length in .A, to floating point in FACC. _Caveat! Read below!_ | | $FE0C | `GETADR` | convert floating point to an address (unsigned word) | | $FE0F | `FLOATC` | convert address (unsigned word) to floating point | +| $FE8D | `QINT` | facho:facho+1:facho+2:facho+3 = i32(FACC) | **Difference in X16 Behavior of FOUT** @@ -39,7 +40,6 @@ The following calls are new to the X16 and were not part of the C128 math librar |---------|----------|-------------------------------------------------| | $FE87 | `FLOAT` | FACC = (s8).A convert signed byte to float | | $FE8A | `FLOATS` | FACC = (s16)facho+1:facho | -| $FE8D | `QINT` | facho:facho+1:facho+2:facho+3 = i32(FACC) | | $FE93 | `FOUTC` | Convert FACC to ASCIIZ string at fbuffr - 1 + .Y | ## Movement From c2587c6edfe29626558fa4120a90fa0a7d93c961 Mon Sep 17 00:00:00 2001 From: "Mark J. Reed" Date: Wed, 19 Nov 2025 12:28:07 -0500 Subject: [PATCH 5/6] fix: change format of description to match rest of format conversions table --- X16 Reference - 06 - Math Library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/X16 Reference - 06 - Math Library.md b/X16 Reference - 06 - Math Library.md index bc59cb3..45fff81 100644 --- a/X16 Reference - 06 - Math Library.md +++ b/X16 Reference - 06 - Math Library.md @@ -17,7 +17,7 @@ The following functions are available from machine language code after setting t | $FE09 | `VAL_1` | convert ASCII string in .X:.Y length in .A, to floating point in FACC. _Caveat! Read below!_ | | $FE0C | `GETADR` | convert floating point to an address (unsigned word) | | $FE0F | `FLOATC` | convert address (unsigned word) to floating point | -| $FE8D | `QINT` | facho:facho+1:facho+2:facho+3 = i32(FACC) | +| $FE8D | `QINT` | convert floating point to signed 32-bit integer (which is stored within the FAC mantissa bytes in big-endian order) | **Difference in X16 Behavior of FOUT** From 956c441af85666ecec419d14247902bb11d49da3 Mon Sep 17 00:00:00 2001 From: "Mark J. Reed" Date: Wed, 19 Nov 2025 12:29:14 -0500 Subject: [PATCH 6/6] fix: spell FACC correctly --- X16 Reference - 06 - Math Library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/X16 Reference - 06 - Math Library.md b/X16 Reference - 06 - Math Library.md index 45fff81..891d1f9 100644 --- a/X16 Reference - 06 - Math Library.md +++ b/X16 Reference - 06 - Math Library.md @@ -17,7 +17,7 @@ The following functions are available from machine language code after setting t | $FE09 | `VAL_1` | convert ASCII string in .X:.Y length in .A, to floating point in FACC. _Caveat! Read below!_ | | $FE0C | `GETADR` | convert floating point to an address (unsigned word) | | $FE0F | `FLOATC` | convert address (unsigned word) to floating point | -| $FE8D | `QINT` | convert floating point to signed 32-bit integer (which is stored within the FAC mantissa bytes in big-endian order) | +| $FE8D | `QINT` | convert floating point to signed 32-bit integer (which is stored in the FACC mantissa bytes in big-endian order) | **Difference in X16 Behavior of FOUT**