Date : Thu, 22 Jul 2010 16:54:23 +0000 (GMT)
From : tommowalker@... (Tom Walker)
Subject: Spitting expletives
> To give an example, the above in B-Em is:
> --8<--------
> tempw=a-(temp+(p.c?0:1));? ? \
> tempv=(short)a-(short)(temp+(p.c?0:1));? ? ?\
> p.v=((a^(temp+(p.c?0:1)))&(a^(unsigned char)tempv)&0x80); \
> p.c=tempv>=0;\
> a=tempw&0xFF;? ? ? ? ? ?\
> setzn(a);? ? ? ? ? ? ?\
> --8<--------
I'm amazed I haven't simplified that yet. Carry can be worked out as p.c=(a>=temp),
and overflow can be simplified a bit.
Did notice you haven't attacked the BCD version, presumably that's for sanity
reasons.
> Oh, and 'B' is returned as set. Is this a bug in BeebEm, or does BASIC
> do something pretty weird when returning? I was under the impression
> that the BRK flag only really existed in the value pushed to the stack.
B is always set, except when pushed to the stack on an interrupt.
Tom