4 ms·
Rewrite it. Ok, easier said than done, but how difficult can it really be, today with the tools, namely debuggers, emulators and macro-assemblers, available to
by guenthert 3y ago
Rewrite it. Ok, easier said than done, but how difficult can it really be, today with the tools, namely debuggers, emulators and macro-assemblers, available to us? It's just 8 or 16KiB machine code, right?
- smokel 3y agoI'm way ahead of you :) Unfortunately, rewriting it without reverse engineering makes it almost impossible to reach the same performance characteristics. These are essential to reproduce proper timing in several games. Also, it may not be much code, but the floating point operations are quite a piece of art. See the GW-BASIC source code, which is somewhat similar [1]. I also rewrote most of the BASIC interpreter directly in Kotlin, omitting assembly, but obviously that runs into the same compatibility issues. As far as I understand it, reverse engineering is not allowed without permission, although some people suggest that it is ok to get other software to run. Not sure whether that case would hold up for my entertainment value. [1] https://github.com/microsoft/GW-BASIC/blob/master/MATH2.ASM https://github.com/microsoft/GW-BASIC/blob/master/MATH2.ASM
- guenthert 3y agoI see. I'm a bit surprised that the timing would be so critical. I recall BASIC only ever being too slow (time critical sections needed to be in machine code or required hardware support). Cycle counting was a thing then in machine code (and to some degree it still is, at least in embedded systems), but clearly not possible in BASIC. Well, if you decide to go ahead, don't forget to include Gates' easter egg in the sin data table: https://www.pagetable.com/?p=43 https://www.pagetable.com/?p=43 ;-)