From 0e319d987125c12baa3596b8b4ba193dd81cc088 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 29 Jan 2020 20:28:01 +0100 Subject: [PATCH] implemented NEGOP math routine --- STATUS.md | 2 +- c64/aliases/,aliases_ram_lowmem.s | 2 +- c64/basic/{,stubs_math => math}/bfb4.NEGOP.s | 12 +++++++++--- c64/basic/{,stubs_math => math}/bfb4.interop | 0 4 files changed, 11 insertions(+), 5 deletions(-) rename c64/basic/{,stubs_math => math}/bfb4.NEGOP.s (66%) rename c64/basic/{,stubs_math => math}/bfb4.interop (100%) diff --git a/STATUS.md b/STATUS.md index f21b68a8..932b3690 100644 --- a/STATUS.md +++ b/STATUS.md @@ -206,7 +206,7 @@ Floating point mathematical routines - not official, but well known and broadly | `$BF71` | `SQR` | NOT DONE | XXX - no stub added yet | | `$BF78` | `FPWR` | NOT DONE | set FAC1 as RAM raised to the power of FAC1 | | `$BF7B` | `FPWRT` | NOT DONE | set FAC1 as FAC2 raised to the power of FAC1 | -| `$BFB4` | `NEGOP` | NOT DONE | toggle FAC1 sign (if not 0) | +| `$BFB4` | `NEGOP` | DONE | | | `$BFED` | `EXP` | NOT DONE | XXX - no stub added yet | | `$E043` | `POLY1` | NOT DONE | evaluate polynomial with odd powers only | | `$E059` | `POLY2` | NOT DONE | evaluate polynomial with odd and even powers | diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index efb85ef8..828aef45 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -31,7 +31,7 @@ .label TEMPPT = $16 // -- NOT IMPLEMENTED -- .label LASTPT = $17 // $17-$18 -- NOT IMPLEMENTED -- .label TEMPST = $19 // $19-$21 -- NOT IMPLEMENTED -- - .label INDEX = $22 // $22-$25 -- NOT IMPLEMENTED -- temporary variables + .label INDEX = $22 // $22-$25 temporary variables, [!] our usage might be different .label RESHO = $26 // $26-$2A -- NOT IMPLEMENTED -- .label TXTTAB = $2B // $2B-$2C start of BASIC code .label VARTAB = $2D // $2D-$2E end of BASIC code, start of variables diff --git a/c64/basic/,stubs_math/bfb4.NEGOP.s b/c64/basic/math/bfb4.NEGOP.s similarity index 66% rename from c64/basic/,stubs_math/bfb4.NEGOP.s rename to c64/basic/math/bfb4.NEGOP.s index 838f92c5..c231407b 100644 --- a/c64/basic/,stubs_math/bfb4.NEGOP.s +++ b/c64/basic/math/bfb4.NEGOP.s @@ -10,7 +10,13 @@ // - https://www.c64-wiki.com/wiki/Floating_point_arithmetic // -// XXX provide implementation - NEGOP: - STUB_IMPLEMENTATION() + + lda FAC1_exponent + beq !+ // do not toggle the sign if value is 0 + + lda FAC1_sign + eor #$FF + sta FAC1_sign +!: + rts diff --git a/c64/basic/,stubs_math/bfb4.interop b/c64/basic/math/bfb4.interop similarity index 100% rename from c64/basic/,stubs_math/bfb4.interop rename to c64/basic/math/bfb4.interop