ex af,af'

Other misc things
Post Reply
cborn
Well known member
Posts: 267
Joined: Tue Oct 06, 2020 7:45 pm

ex af,af'

Post by cborn »

Hi

i was staring blind very much why my code wasnt accepted
the line pointed out my simplistic and very usefull EX AF,AF'
which includes the ' sign as i am used to that for about say 35 years.
But zcc does not like it. it does NOT want that alternative register set sign '
i did find it and now my code works, remains the question, why is that needed? to avoid the '
?
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: ex af,af'

Post by stefano »

I was disappointed as you are when I noticed it, but it is not so uncommon to find z80 assemblers not accepting AF'.
If you feel it as a terrible loss, then an issue can be opened on github.
DarkSchneider
Member
Posts: 71
Joined: Sun Apr 01, 2018 4:02 pm

Re: ex af,af'

Post by DarkSchneider »

Have tried with?

Code: Select all

ex af, af
cborn
Well known member
Posts: 267
Joined: Tue Oct 06, 2020 7:45 pm

Re: ex af,af'

Post by cborn »

stefano wrote: Thu Apr 20, 2023 9:14 pm I was disappointed as you are when I noticed it, but it is not so uncommon to find z80 assemblers not accepting AF'.
If you feel it as a terrible loss, then an issue can be opened on github.
i know it now but foresure i will bump my head on it again. technicly there is no way off controling what register set you work with, from that point off view there are two AF registers and not AF and AF '
But i have plenty asm that will have to be addepted on that 1 small ' sign meaning that adding it to the compiler to accept both cases would be much easier, i hope ?

for the parser it migth be complex if the code is totaly mixed with asm and common C codings...
Last edited by cborn on Fri Apr 21, 2023 2:32 pm, edited 1 time in total.
cborn
Well known member
Posts: 267
Joined: Tue Oct 06, 2020 7:45 pm

Re: ex af,af'

Post by cborn »

DarkSchneider wrote: Fri Apr 21, 2023 7:30 am Have tried with?

Code: Select all

ex af, af
yes i did ommit the '
but if i copy/past old file i will bump into it again.
cborn
Well known member
Posts: 267
Joined: Tue Oct 06, 2020 7:45 pm

Re: ex af,af'

Post by cborn »

I guess the ' works like brackets in pairs and af' uses only a single one giving a uneven count missmatch with needs extra code to keep it appart
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: ex af,af'

Post by dom »

So, af,af' works in .asm file, but as you deduced, when embedded in a C file, the preprocessor expects to see a '[char]' sequence and will report an error if it comes across a "stray" '
cborn
Well known member
Posts: 267
Joined: Tue Oct 06, 2020 7:45 pm

Re: ex af,af'

Post by cborn »

knowing the problem is half off the solution, they say
Perhaps the compiler can mention the error by what it is?
and its a little releave that if i use my ol' code as file it will work without changes.
cheers
DarkSchneider
Member
Posts: 71
Joined: Sun Apr 01, 2018 4:02 pm

Re: ex af,af'

Post by DarkSchneider »

Maybe could change those lines to:

Code: Select all

ex af, af’;’
So is valid asm code and also should be valid for the C compiler.
Any text processor should allow you to replace one text by this new one very easily.
cborn
Well known member
Posts: 267
Joined: Tue Oct 06, 2020 7:45 pm

Re: ex af,af'

Post by cborn »

DarkSchneider wrote: Tue Apr 25, 2023 5:48 pm Maybe could change those lines to:

Code: Select all

ex af, af’;’
So is valid asm code and also should be valid for the C compiler.
Any text processor should allow you to replace one text by this new one very easily.
that works indeed !! then one file can be used by both systems
cborn
Well known member
Posts: 267
Joined: Tue Oct 06, 2020 7:45 pm

Re: ex af,af'

Post by cborn »

BUT
...
now it migth inject an DEB 59 !!
mind that z80 instuction 0x3b dec 59 is DEC SP
which is very bad if executed randomly
its a good trick but migth have an edge on it
DarkSchneider
Member
Posts: 71
Joined: Sun Apr 01, 2018 4:02 pm

Re: ex af,af'

Post by DarkSchneider »

Try it, maybe the C compiler interpret it as string. If it injects a DEC SP the program should freeze soon after execution. Can also generate the assembled (-a option of zcc) and watch the code.
Post Reply