User Tools

Site Tools


three_or_more_pass_assembly

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

three_or_more_pass_assembly [2021/09/19 15:53]
richardrussell created
three_or_more_pass_assembly [2021/09/19 15:57] (current)
richardrussell
Line 36: Line 36:
 </​code>​ </​code>​
  
-But wait, this is wrong! ​ The address ​of test% is **&​09A31DB9** but the value pushed in the previous instruction is **&​09A31DB6**. ​ BBC BASIC is broken! ​ I want my money back!+But wait, this is wrong! ​ The address test% is **&​09A31DB9** but the value pushed in the previous instruction is **&​09A31DB6**. ​ BBC BASIC is broken! ​ I want my money back!
  
 No, it's not broken. ​ On the first pass the value of test% is **zero**, because it's declared as LOCAL, so the assembler encodes the 'push 0' as 6A 00.  But on the second pass the value of test% is no longer in the range -128 to +127 and therefore the assembler uses the long encoding: 68 B6 1D A3 09.  The resulting phase error causes the code emitted by the assembler to be invalid. No, it's not broken. ​ On the first pass the value of test% is **zero**, because it's declared as LOCAL, so the assembler encodes the 'push 0' as 6A 00.  But on the second pass the value of test% is no longer in the range -128 to +127 and therefore the assembler uses the long encoding: 68 B6 1D A3 09.  The resulting phase error causes the code emitted by the assembler to be invalid.
three_or_more_pass_assembly.txt ยท Last modified: 2021/09/19 15:57 by richardrussell