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