asm
@test:
mov eax, eax
jnz short @test
end;
Compiler / linker is confused by relative short jumps with an immediate value. Thinks they are a label or something..Any reason you want to hard code the jump distance, rather than using a label so that the linker can calculate the appropriate distance?
dec cl
jnz -15
<snip>
TASM has "short" label type for this purpose, but FPC doesn't seem to support it.The exact syntax depends on the selected assembler mode, for Intel syntax (https://www.freepascal.org/docs-html/prog/progsu129.html#x146-1470003.2.1) the following code:
<snip>
<snip>I fully agree with this point of view.
Yes, I use external assemblers and assembly tools, but I am an into INTEGRATED development environments...
In my experience 'ASM syndrome' is yet another high level excuse for not doing low-level work when it's easy, as in the case I demonstrated. Easy to program whilst guaranteeing equal or better performance than the compiled version. Easy to roll-out similar methods (ie. small lines and arcs rotated 8 or 4 ways).Ok, at the end it's your choice. I can't dictate anything to you.
--
The FPC 'bitpacked' types produce pretty efficient code, but I can beat it with assembly and it's easier when it comes to nitty-gritty bit manipulation with a bit of practice. Macros reduce procedure calls... These are all tight little loops and tight, rapidly repeated procedures. Inlined code and assembler macros enable higher code engineering standards... and more speed.
--
This tiny engine could run on a 68000 or even Z80 using 16kb of tiny arc, line, circle and interpolation + a few fast math lookup tables.. It also happens to work well on modern systems. FPC and Lazarus is a fine effort, and Delphi 7 32bit for compiled Win32 apps was a masterpiece for its time. FPC does a very good job at optimisation with plenty of control - but also lack of it at times...
--
Yes, I use external assemblers and assembly tools, but I am an into INTEGRATED development environments and assessing many.
Compiler / linker is confused by relative short jumps with an immediate value. Thinks they are a label or something..