Closed sromeroi closed 10 months ago
The ex bc,hl
could be also push hl : ld l,c : ld h,b : pop bc
which is 1 byte longer but -11T faster and in case you have single spare register you can write it as 6x ld
to have 24T total instead of 29T (or yours 40T).
I feel a bit dubious about these, but I guess most of the fake instruction already are dubious, so that's not a good counter argument. I'm more like surprised you are even missing these, that was unexpected for me. :) (how comes, did you run into the need of this in some real project?)
But I guess there's little harm to add them, probably in the faster-but-longer variant doing ld
where possible? If anyone else has opinion/idea about these, please share, so it's not just me vs OP.
Thanks for you quick response.
I just came across those combinations while reading/watching Z80 ASM tutorials, and found out that they were not available among the existing Fake Instructions.
I agree about your -11T+1b combination, it's a better tradeof to save 11 t-states for a single byte. Thanks!
So I have been pondering about this for a while, also discussed it with other users and contributors, and these ex
feels not "attractive enough" for us to add them, we can't recall any good use cases from our experience of writing ZX SW, usually when you long for ex bc,hl
the answer is to write the code in different way to not need it.
The tricky part is that ex de,hl
is only one byte and only 4T (as it's technically just flipping single bit inside CPU, not doing much work, so for anyone not familiar with Z80 ISA having ex bc,hl
on hand would look similarly cheap, while it's lot more costly in the form of fake instruction. And it's using also stack which is another "not attractive" feature.
If you would go through current list of fake instructions, you could easily find few more questionable, which could be rejected by similar reasoning, so please understand this is rather subjective ruling, but I don't see a way how to make this process more objective. I hope you will understand it as it is. I'm definitely glad you did raise this, could be still helpful info for people who would look for it.
In the end, it's reasonable easy to add your own macro if you really need instruction like this, but I would be surprised if you would need this often, we were discussing it among people who delivered tens+ ZX projects over decades and nobody was able to recall good use case.
Thanks anyway for considering my request.
The following missing
fake instructions
are not described in sjasmplus documentation (so they're probably not implemented):Example:
Could be written as:
Could you please include them in sjasmplus?