05-31-2010, 12:29 PM
boriel Wrote:So this function, adapted for a configurable screen address is 8 T-states faster than the original in ZX Basic (only 5 if the commented optimization is done) :?:Code:ld de, (SCREEN_ADDRESS)
add hl, de ;; Total T-States = 84 T-States
;; (implicit RET) + 10 T-States = 94 T-States
end asm
END FUNCTION
I haven't looked yet, but I will. Could the assembler/compiler optimize this by KNOWING if the screen address is changed ever? I would consider it unusual code to move it on the spectrum?
(I know, multi-platform). One optimization would be spectrum specific. If screen address=16384, then go short on the code :-)
Incidentally, I was looking at some asm:
Code:
poke Uinteger @ptDatapoint+3,value becomes:
ld hl, __LABEL__ptDataPoint
inc hl
inc hl
inc hl
Can't the assembler deal with
Code:
ld hl, __LABEL__ptDataPoint+3
Being able to do that would reduce the code quite a lot, I would think - if the assembler could code the actual value there, instead of the base and then inc three times.