Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New bug-fix release 1.2.5-r1513c
#7
Ok, I will try: in function calls, local variables and parameters are mostly managed using (ix+n) indirections. So, when doing var = var + 1, the compiler will emmit this code (if var is declared as Ubyte/Byte):
Code:
ld a, (ix + n)
add a, 1
ld (ix + n), a
The compiler does successive optimizations. The first one is obvious. ADD A, 1 ==> INC A
Code:
ld a, (ix + n)
inc a
ld (ix + n), a
The 2nd one is less obvious: This block can be replaced by
Code:
inc (ix + n)
... but only if A register is not used later; this is the hard part for the compiler, because "later" is something we must define.
The problem is the latter condition was not being checked, so A register was not being preserved when it was required.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)