Tuesday, August 8, 2017

Into the great divide

I thought of another optimization to try in a couple places for the MC-10 ROM.
It *might* save 90 or more clock cycles per divide which would be a very good thing.
That's what?  20+ instructions worth?  It won't help with Ahl's benchmark, but it will speed up some other things a little.  It's not huge like the hardware multiply but every little bit helps.

Monday, August 7, 2017

VZ200 ROM Disassembly

Last time I worked on a commented disassembly of the VZ200 ROM, I used a disassembler called dZ80.  If it has a trace file output from an emulator, it can do a pretty good job of identifying blocks of code or data, but it doesn't really generate code that can be reassembled without considerable work.

After a quick search I ran across YAZD - Yet Another Z80 Disassembler 
It does an excellent job of turning a program back into source code with labels.
It can even do things like include where a label was accessed from in a comment in the disassembly.
Sadly, it detected ZERO data in the VZ ROM file, so that's a problem unless I can figure out how to resolve that in the settings.

By passing the disassembler output through sed (unix) with a list of substitutions for known commands or ROM routines, we get something that actually looks a little like real source code for the ROM.  And by using sed, I can try as many options with YAZD, or other disassemblers, as I like and still recreate a labeled ROM file in seconds.  SWEET!   Now I need to find the book on Level II BASIC I was using for some of the comments.  If I can create a sed file to append comments automatically, this won't be so bad.




The Mandelbrot generator I posted before runs significantly faster with the new ROM.  It uses a lot of multiplication.  It also depends on SQR, if there were a way I could squeeze a faster version in, the program would probably run twice as fast on the new ROM as on the old one.

I stated porting the Fedora 3D plot program last night to see how much faster it is.  Converting the parameters for different screen heights is a pain, and the oblong pixels on the normal display don't help.

Factorial Generator

This provides a pretty good comparison of different machines.
It's not a perfect benchmark since different machines have different screen width and some scroll faster, but then the MC-10 is using higher precision math than many other machines.

The MC-10 is quite competitive here.  It won't keep up with a CoCo in high speed mode, but it beats most 1 MHz systems .

5 REM FACTORIAL GENERATOR
10 FOR Z=1 TO 100
20 FOR X=0 TO 33
30 GOSUB 80
40 PRINT Z;X;A
50 NEXT X
60 NEXT Z
70 END
80 A=1
90 IF X=0 THEN RETURN
100 FOR C=1 TO X
110 A=A*C
120 NEXT C
130 RETURN

Beta 2.1c online

Here's the new Beta version of my MC-10 ROM.  It's not quite as fast as some of the test versions but it doesn't seem to have any issues, the BREAK key is still fairly responsive, and math results should be identical to the original ROM..

The break key check interval is set to 32.  Even 40 felt too long.  Let me know if it seems responsive enough.


MC10_ROM_21c.bin Beta

Raid!!!!

I had a little time to fix the last issues in the floating point code.

The random number seed is based on the sub precision byte of the multiply (basically the 5th byte of a 4 byte floating point number).  It was never random even though the number it is based on should be changing with every multiply.
After changing the code so it works, and the accuracy reported by Ahl's Benchmark matches the original ROM.  But the change shouldn't have done anything different.
EDIT: The sub precision byte got moved to the wrong floating point accumulator at some point when I was dealing with another issue.

The other issue is actually finding 6 memory locations that are safe to use as temporary storage in the multiply.  Some trial and error may be involved because tracking the execution of an interpreter is a nightmare.

I think it's time for a Beta release.

Sunday, August 6, 2017

Around and round we go

This is the circles program after the modification to the MC-10 ROM BREAK key test.
The counter is set to 64 here, which is a bit long, but the new version is clearly faster than the old one on the left. I tried 32 and that seemed okay.  I'll probably have to keep it at 40 or less.