Login
Back to forumSee the full topicGo to last reply

Posted By

JamesD
on 2017-12-08
19:54:11
 Re: Does the Plus/4 support some form of VARPTR() command?

I honestly didn't do any cycle counting.
Most of the speedup was due to dumping the paging and handling the most likely case first so I left it at that.
The first version was more of a proof of concept to get it working and see if it was worth further effort.

As for the .36% improvement, I think the ultimate goal is providing the most speed possible, but that's not going to make much difference on the benchmarks. Dropping a second or two when setting the prime limit to 20000 isn't going to impress anyone. Especially when the Plus/4 is still turning in dismal numbers compared to several machines.

There is definitely room for further optimization. There is a function that immediately follows this in RAM that gets bytes under ROM. If we patch the memory pointers BASIC uses to keep track of where free memory is, we can patch the the function that gets bytes under ROM. It should provide a similar speedup, though I'm hoping it's more.

The math library uses floating point registers in low memory already, but the code that copies values to and from those registers is probably where the greatest inefficiency is. Since writes to addresses in the ROM range automatically go to RAM already, it's the reads that are the issue.
If BASIC reads 1 byte at a time, it's no wonder the interpreter is so slow. If it has a function that moves a full floating point value at a time, then we won't see as much of a speedup. Topping a combined 10% while still running BASIC out of ROM would definitely be worth the effort Especially if all we have to do is copy some bytes. But I'm not sure if the patch would still fit in a single REM.

The limiting factor here is ultimately the ROM. Rewrite that so it directly accesses RAM instead of through the intermediate RAM functions and you dump JSR, SEI, STA, LDA, CLI RTS for RAM accesses.


*edit*
The faster version of the patch was good for 1 second on Ahl's Benchmark. Just defining variables at the top was good for for more.
But that spends a lot of time performing floating point operations.



Back to top


Copyright © Plus/4 World Team, 2001-2024