`jmp` instruction is limited between 0-2047, so any programs longer than that fail
sam-astro opened this issue · comments
Describe the bug
jmp instruction is limited between 0-2047, so any programs longer than that fail
A new jmpl instruction should be added for jumping to large addresses (larger than 2047). This will use the following word as an address, rather than the 11-bit instruction area.
Currently J is always using the lowest 12 bits of the instruction:
Astro8-Computer/Astro8-Emulator/main.cpp
Lines 594 to 599 in 37aeb32
Even though all jump instructions (JMP, JMPZ, JMPC) are also executing micro instruction IR (setting the lowest 12 bits of the instruction to the bus):
Astro8-Computer/Astro8-Emulator/main.cpp
Lines 140 to 142 in 37aeb32
This seems like a bug in the emulator, since the README states that the bus should is used:
Line 104 in 37aeb32
If we fix the micro instruction J to use the bus instead, we can make a new instruction JMPL that does the following:
- NOOP
CRread value from counter to bus
AWwrite lowest 12 bits from bus to mem. addr. registerRMread from memory to bus at the address in mem addr. register
AWwrite lowest 12 bits from bus to mem. addr. registerRMread from memory to bus at the address in mem addr. register
Jwrite from bus to counter current value
CEenable incrementing of counterEIend instruction, resets step counter to move to next instruction
This is just like the LDLGE instruction, but instead of WA we do J.
Fixed in v0.2.0, thanks!