diff --git a/Makefile b/Makefile index da8927c1..eecfb259 100644 --- a/Makefile +++ b/Makefile @@ -372,7 +372,7 @@ $(TARGET_X16_x): $(SEG_LIST_X16) build/chargen.rom dd if=/dev/zero bs=8192 count=8 of=build/x16_padding_64_KB cat $(DIR_X16)/basic.seg_0 > $(TARGET_X16_x) cat $(DIR_X16)/kernal.seg_0 >> $(TARGET_X16_x) - cat build/chargen.rom >> $(TARGET_X16_x) + cat build/chargen.rom >> $(TARGET_X16_x) cat $(DIR_X16)/basic.seg_1 >> $(TARGET_X16_x) cat $(DIR_X16)/kernal.seg_1 >> $(TARGET_X16_x) rm -f build/x16_padding_* diff --git a/STATUS.md b/STATUS.md index 5ee5f251..10c217d9 100644 --- a/STATUS.md +++ b/STATUS.md @@ -237,6 +237,7 @@ Floating point mathematical routines - not official, but well known and broadly | `$BFED` | `exp_FAC1` | NOT DONE | | | `$E043` | `poly1_FAC1` | NOT DONE | | | `$E059` | `poly2_FAC1` | NOT DONE | | +| `$E097` | `rnd_FAC1` | PARTIAL | requires `sgn_FAC1_A` | | `$E09A` | `rnd_A` | DONE | | | `$E0BE` | `rnd_generate` | DONE | | | `$E264` | `cos_FAC1` | NOT DONE | | diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 7db8844e..f0f5b1e3 100644 Binary files a/bin/basic_generic.rom and b/bin/basic_generic.rom differ diff --git a/bin/basic_testing.rom b/bin/basic_testing.rom index 04529177..86d713bd 100644 Binary files a/bin/basic_testing.rom and b/bin/basic_testing.rom differ diff --git a/bin/basic_ultimate64.rom b/bin/basic_ultimate64.rom index 98571e4e..74b9697b 100644 Binary files a/bin/basic_ultimate64.rom and b/bin/basic_ultimate64.rom differ diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 6be4cf2b..20ed1ace 100644 Binary files a/bin/kernal_generic.rom and b/bin/kernal_generic.rom differ diff --git a/bin/kernal_testing.rom b/bin/kernal_testing.rom index cee5e14c..6628e7a2 100644 Binary files a/bin/kernal_testing.rom and b/bin/kernal_testing.rom differ diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index fc119cd3..d000620b 100644 Binary files a/bin/kernal_ultimate64.rom and b/bin/kernal_ultimate64.rom differ diff --git a/bin/mega65.rom b/bin/mega65.rom index d5cb3978..c637aa65 100644 Binary files a/bin/mega65.rom and b/bin/mega65.rom differ diff --git a/c64/basic/math/e097.interop b/c64/basic/math/e097.interop new file mode 100644 index 00000000..6b2f206f --- /dev/null +++ b/c64/basic/math/e097.interop @@ -0,0 +1,3 @@ +This is an important floating point math routine, referenced by ACME SDK, see here: + +- https://sourceforge.net/p/acme-crossass/code-0/38/tree/trunk/ACME_Lib/cbm/c64/float.a?force=True diff --git a/c64/basic/math/e097.rnd_FAC1.s b/c64/basic/math/e097.rnd_FAC1.s new file mode 100644 index 00000000..0091fe7f --- /dev/null +++ b/c64/basic/math/e097.rnd_FAC1.s @@ -0,0 +1,20 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# * BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Random number generator routine +// +// Input: +// - FAC1 (0 - reinitialize the seed with random value, negative - create seed from FAC1) +// +// Output: +// - FAC1 +// + +rnd_FAC1: + + jsr sgn_FAC1_A + + // FALLTROUGH to rnd_A + diff --git a/c64/basic/math/e0be.rnd_generate.s b/c64/basic/math/e0be.rnd_generate.s index d315cc1a..f33e2921 100644 --- a/c64/basic/math/e0be.rnd_generate.s +++ b/c64/basic/math/e0be.rnd_generate.s @@ -38,6 +38,8 @@ rnd_generate: eor #$04 sta RNDX+4 + sec // make sure Carry is always set, for adc + // FALLTROUGH rnd_generate_copy: @@ -45,7 +47,7 @@ rnd_generate_copy: // Copy the generated number to FAC1, mangle it a little lda RNDX+3 - eor #$62 + adc #$C6 sta FAC1_mantissa+0 lda RNDX+1 @@ -53,10 +55,12 @@ rnd_generate_copy: sta FAC1_mantissa+1 lda RNDX+4 - eor #$97 + eor #$62 sta FAC1_mantissa+2 lda RNDX+2 + bit RNDX+2 + rol sta FAC1_mantissa+3 // FALLTROUGH