CPCWiki forum

General Category => Programming => Topic started by: johnlobo on 18:10, 22 February 22

Title: Silly question, inc(ix+3) in sdasz80 (SDCC assembler)??
Post by: johnlobo on 18:10, 22 February 22
Hi all,
One silly question for the experts in CPCTelera assembler.

In sdasz80, the assembler of SDCC, the syntax for using ix and iy registers is something like...

ld a, 3(ix)
and can be also used with constants

ld a, e_life(ix)

...but does anybody know what's the syntax for the increment of the referenced value ??

inc (e_life(ix)) produces a "missing or improper operators, terminators, or delimiters error" 

But, in plain assembler something like this...

inc (ix +3)
proceduces the code 34 ff 03.. so it's a valid opcode, and I guess that must be implemented somehow in sdasz80, even though I've been trying different sytax alternatives with no success.

Any help??

Thanks in advance.
Title: Re: Silly question, inc(ix+3) in sdasz80 (SDCC assembler)??
Post by: reidrac on 19:32, 22 February 22
I just tried "inc 3 (ix)" and it works, and "inc CONSTANT (ix)" works too. This is SDCC 4.0.

EDIT: of course, I encourage you to avoid using ix and iy. That's slow!  :laugh:
Title: Re: Silly question, inc(ix+3) in sdasz80 (SDCC assembler)??
Post by: johnlobo on 00:20, 23 February 22
Great!!  it works.
Thank you very much.

Must be the only combination I didn't try myself...  :D
In any case, you're right, I'll try not tu abuse of index registries, even though in my current game speed is not a key factor.
Regards.



Quote from: reidrac on 19:32, 22 February 22I just tried "inc 3 (ix)" and it works, and "inc CONSTANT (ix)" works too. This is SDCC 4.0.

EDIT: of course, I encourage you to avoid using ix and iy. That's slow!  :laugh:
Powered by SMFPacks Menu Editor Mod