I've been working on an emulator for the MOS 6502, and I nearly have it fully completed at this point. It has one small problem though. It seems to pass all of the tests that I put it through, but for some reason it causes Enhanced Basic to output everything, including characters, in scientific notation.
Enhanced Basic is only supposed to put numbers into scientific notation if they are > 999999.4375.
Where should I start to look? What emulation issues could cause a response like this from EhBasic? I have no idea where to even start with such a large program, and considering my emulator passes all of the tests I have fed it, I can't exactly find problems with the tests.
Here is a sample output from enhanced basic.
6502 EhBASIC [C]old/[W]arm ?
Memory size ? $C000
4.8383E+04 Bytes free
Enhanced BASIC 2.22
Ready
The 4.8383 should actually be 48383.
I took the liberty to re-write the code and comment out anything that was not required to see this issue. It should be much more readable to anyone now.
To reproduce this, run EhBASIC Cold by pressing C, and for the memory size, enter $C000.
EDIT: To clarify
The Accumulator is memory[memory_size]
Some variables have [0] after them because I took advantage of javaScript Uint8 arrays to have unsigned 8 bit integers, and unsigned 16 bit integers.