Actions
Bug #411
openAOZ sometimes scrambles code order.
Start date:
07/13/2020
Due date:
% Done:
0%
Estimated time:
4:00 h
Affected version:
Description
Example: Given the following code:
End
//----------------------------|
// Initialize Apple 2 Emulator |
//------------------------------|
A2M_Init:
Print "Loading ROM!!!"
Gosub Load_ROM ' Load ROM image from file.
Print "Loading Memory"
Gosub Load_Memory ' Eventually, will load RAM image from file. Right now, just allocates the memory.
Print "Relocating ROM<<<"
Gosub Relocate_ROM ' later on won't want to do this, since extended memory 16K memory card will be bank-switched
' with ROM. We'll want to re-code for this eventuality.
Print "Resetting registers."
Gosub Reset_Registers ' Initialize 6502 registers
Print "Setting Reset Vector"
PC = $FA62 ' Reset Vector address.
Return
The following instruction is executed:
Gosub A2M_Init
The result is very weird:
Relocating ROM<<<
Loading ROM!!!
Resetting Registers.
$E8D4A51000
What we should see:
Loading ROM!!!
Load_ROM:
(...because there was an End in Load_ROM)
Even if we ignore this, we should then see the following:
Loading Memory
Relocating ROM<<<
Resetting Registers.
Setting Reset Vector
...but they're all scrambled.
First of all, the code inside Load_ROM is being ignored.
It's also apparent that the statements are being executed out of order... seemingly at random.
I put the symbols <<< and !!! at the end of the statements to ensure that was the actual code being called.
The last item (a hexidecimal number) isn't even in this block of code!!!
Actions