Hi everyone!
Just a minor update. As I was manually checking the floating point code I kept finding subtleties I needed to sort out. Now that's done I've managed to set up a simulation test environment and linked it all into one binary & I'm ready to start testing.
So what kind of subtleties arise? Well here's a delicious sample:
1. FP negation just involves inverting the sign bit, but inverting 0xffffffff (the special "overflow" value) would result in a valid number - I had to add code to check overflow first!
2. Dividing by denormalized numbers could lead to mantissas containing nonsense.
3. Exponents can go out of range in the middle of a calculation so I ended up needing 16-bit exponents temporarily.
4. mantissas during need to be shifted right twice , because a carry from its most significant bit mustn't be allowed to affect the sign.
Etc etc Stuff like that :-)
-cheers julz
4. Should have said "mantissas during Addition...."
-cheers julz
4. Should have said "mantissas during Addition...."
-cheers julz
Hi folks,
As of this evening, the floating point code all works :-) my recent efforts to read and display floating point numbers have been completed which means I can type things like
1.09e-10 99.6e4 f* f.
And it will all be processed correctly :-)
Audio data transfer next :-)
Dragon 32: 14.72s, or 11.72? without loops. FIGnition is around 43x faster.Oric-1: 15.75s, or 9.75 without the loop overhead, FIGnition is 36x faster.VIC-20: 10.91s, about 7.91s without the loop overhead (loops are 3s). FIGnition is 29.3x faster.Acorn Electron: 8.06s, about 6.56s without the loop overhead (assumed to be 1.5s). FIGnition is 24.3x faster.Hi folks,
I've also been comparing floating point calculations with other 8-bit computers (and a Mac Plus). On the 8-bit machines I do 1000 loops and the program is written in BASIC. Even for BASIC, floating point calculations will dominate the timings:
FIGnition: 3.3s, or 2.7s for the calculations themselves.Jupiter-Ace: 14.18, -0.6s = for calculations themselves, 13.58. FIGnition is 50.2x faster.ZX Spectrum: 14.94s, really 10.14s without the loop overhead. FIGnition is 37.6x faster.
...
--
You received this message because you are subscribed to the Google Groups "FIGnition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fignition+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<FIG - black on whiteMini.jpg><NmLogoMini.jpg>
Hi Si,
Good to hear from you! Do you mean are we near the theoretical limit for capability of the firmware or floating point performance?
-cheers julz
Hi folks,
Yet more on FIGgyFP! So why did I pick sqrt as the alternate function? Because sqrt is almost as fast as division in binary, and has a similar algorithm. Consider x=25, sqrt(x) in integer arithmetic. In each step we have a 'root' which starts at 1 . we shift the next two most significant even digits of x into m and then calculate root=2r-1. If m>=root, then m-=root and root+=2.
M=01 x=[01]1001 r=2*1-1 => m=01-01, r+=2 => 11.
M=10 x=[0110]01 r=2r-1=101 ( no subtraction, since m<101)
M=1001 x=0 r=2r-1=1001 => m=m-(2r-1), r+=2, so m=0 and r=11.
Final result is (r-1)/2 = 5. This is really just an optimised way of adding a sequence of odd numbers (which gives you the sequence of square numbers). Perhaps surprisingly, this method works for floating point values as well as whole numbers (surprising, because (a) square roots of values <1.0 get larger; i.e. towards 1.0 and (b) the evaluation leads to irrational results for non-square numbers).
-cheers from Julz
: fsqrt
dup 0< if
2drop 1d ;s ( overflow if <0)
then
dup 1 >> $7F80 and >r ( x : exp(x)/2)
$FF and fneg 2swap ( -m m : exp(x)/2)
0d ( -m m dx : exp(x)/2)
begin
f- ( -m m’-dx=>m’ : exp(x)/2)
2over 2over ( -m m’ -m m’: exp(x)/2)
2dup f* f+ ( -m m’ m’^2-m: exp(x)/2)
2over $80 + f/ ( -m m’ (m’^2-m)/(2x)=>dx : exp(x)/2)
dup until
2drop 2swap 2drop ( m : exp(x)/2)
r> +
; ( 59b+header = 68b)
There should be a graph in the post above!
--
You received this message because you are subscribed to the Google Groups "FIGnition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fignition+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
√ I/O Register setup for the upgrader code.
√ I/O Register setup in forth for ear and load”
√ Visual feedback. At the moment we don’t have any, but I want a simple output routine on the LED to say if loading is OK. How? Originally I wanted to feedback at 1Hz or 2Hz etc. Loading rate LED is OK. Works for upgrade mode and in Forth as it’s part of TapeIn.
√ Capture lead is poor, it only expects one lead bit. Capture lead now expects >= 16 bits, and will be reset anytime there’s a bit that’s out of range or a 1 bit and capture lead<16bits. LED flickers at 15Hz during capture lead.
√ Scatter loading support. Using a bitmap of load packets in internal RAM we can set each bit when its block has been loaded correctly and when all the blocks have been loaded OK, loading is complete. Works in upgrader, not yet in Forth.
√ Need to report via LED a loading failure, it just goes back to the beginning, waiting for a header, this will cause the LEDs to flicker. Works in upgrader, and Forth (in text) √ .
√ Upgrader returns to FIGnition, resetting vectors when done.
√ Being able to change the loading/saving bit rate from Forth.
√ Reclaim back to block in Forth.
As you can see from the ticks, it's now all done :-)
I think I'm now ready to start the next stage, first - getting all the code compiled (which mostly means getting the forth code compiled since the 'C' bootloader code compiled fairly recently and there haven't been many changes since); then starting the testing and debugging process itself. Judging by the rest of the size of the code I'm not sure if both Flash and RAM loading can be supported, though there may be ways around that (e.g. flash loading could be supported in terms of a RAM load, whose first block is the code needed to support Flash loading or by supporting only Flash loading/saving and RAM audio I/O would be additional code you'd load in from Flash). Anyway, we'll see!
-cheers from Julz
Woo!!!> √ Visual feedback. At the moment we don’t have any, but I want a simple output routine on the LED to say if loading is OK. How? Originally I wanted to feedback at 1Hz or 2Hz etc. Loading rate LED is OK. Works for upgrade mode and in Forth as it’s part of TapeIn.For my 2c, a slow and discrete patterns of LED flash is easily documented, and importantly communicate back by the user to the mailling list. Imagine a simple cut sheet listing the half-dozen different states, with "what to do next".A rapidly flickering LED (imagine the LED representation of the Spectrum loading "noise" (which I like btw)), might tell an engineer more about what's happening, but a non-engineer may be unable to communicate the important points.Just an idea, to exercise the point,quick double pulse for loading (or flicker)slow blink for errorsolid for done, or ok
Hi guys,
My audio firmware compiles so I'm on to testing :-)
To do this, I've started writing a desktop java app to convert forth and hex files into audio. This is also my testing app, but it'll have a tape-deck based GUI. Stay tuned for progress :-)
-cheers julz
--
Addendum: one of the really interesting things about loading into external ram is that it should be possible to stick up to about 8kb of source text into the data and by overwriting the TIB get the computer to auto-compile it (and auto-run it ;-) ). To an extent this gets around the problem of binary RAM programs being specific to a firmware version (because the firmware compilation addresses change with new firmware).
-cheers julz
--
You received this message because you are subscribed to the Google Groups "FIGnition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fignition+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi,
Correct me if I'm wrong, but don't apple laptops etc allow you to plug in the apple iPhone headset, which you can use for Skype etc. If I'm right, then that audio out, isn't an audio out, its a little bit more.
Stuart
Could be :-) !
Hi Julz,
Can you expand on that a little?
44.1khz is your sampling frequency?
32 is your two (for stereo)16 bit channels?
What is the 4? 4bit word?
I don't know which tones you are using, or which modulation technique you are using, but reducing the sampling frequency would reduce the file size.
Stuart
<FIG - black on whiteMini.jpg><NmLogoMini.jpg>
You're properly coding down-on-the-metal now ;-)
Cups of strong coffee (try it ice cold with milk/cream - it's good) and your favourite music in the background helps! I'm quite partial to some Dire Straits personally. I can recommend the Love Over Gold and Brothers In Arms albums :-)
Good luck. Let us know if you need us to send in supplies. I have baked beans and toilet rolls a plenty ;-)
Mark
Wanna see mine, baby? :-)
IN FORTH!
Check out the code-poetry herewith:
: >HASH ( c-addr len -- u)
\ hashes a string using the CRC-16 algorithm
$FFFF \ intial CRC16
-ROT \ move it out of the way
OVER + SWAP DO \ for each byte in the string
I C@ XOR \ xor with CRC16
8 0 DO \ for 8 bits in the byte
DUP 1 AND \ note the LSB prior to shift
SWAP 1 >> \ shift the CRC16
SWAP IF
$A001 XOR \ if LSB was 1 then apply polynomial
THEN
LOOP
LOOP ;
Oh yeah baby! That's what I'm talking 'bout!
That's actually the Modicon MODBUS CRC-16 algorithm. Used for serial communications with PLC's and lots of other industrial type controllers. It's quite possible your algorithm is the same one!
Ace!
Mark
This is a mega achievement Julz ' congratulations!
Mark
You're officially allowed the evening off to watch Uruguay V England ;-)
Mark
Hi Carl,
The big appeared to be restricted to my Mac mini. If I plugged a 3.5mm mono jack into it, then there would be glitches on the audio out. This didn't happen with my G5 iMac and it didn't happen if I plugged a stereo jack in.
So I don't know if that kind of issue is likely on other platforms. The most likely issue is with the java program in that java isn't brilliant at real-time audio. I have tried to minimize it by precalculating all the samples (sort-of) so that no memory allocation of any kind happens while it's playing, but I won't be able to take into account anything else people have running in the background nor their java implementations. So I expect a bit of community debugging there on release.
Hope this helps, exciting time ahead :-)
Cheers Julz
Yeah Yeah.... What everyone wants to know is: have you tried it on a cassette deck yet? ;-)
Mark
Hi Mark,
I'm not sure I even have a cassette deck in the house, but I'll have a look ;-)
It'd be exciting & authentic though :-)
The ear and mic commands take a 'div' parameter, which is normally 6. It governs the prescalar (bits 2..4) and '1' period shift ( bits 0..1), so by changing it we can slow the bit rate enough to make it work with tape (though in current builds mic just drops it and uses 6 anyway :-S ). I may fix that by release.
I haven't checked any speed apart from 6.
Cheers Julz
Of course we need to see a YouTube video, otherwise it never happened! :-)
Of course we need to see a YouTube video, otherwise it never happened! :-)
--
You received this message because you are subscribed to the Google Groups "FIGnition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fignition+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.