Recent versions of SDCC very nicely avoid using
the temporary registers R2/R3 and instead directly
use dpl (or dph) with the function argument:)
(see byte_out_c())
Unfortunately the handling of bits (as in
byte_out_a() and byte_out_b()) seems to
spoil this optimization.
Would it be safe to assume that bit operations
can be ignored here?
-------8<-------------------------------------
#include <8052.h>
#define CLK_HI P1_1=1
#define CLK_LO P1_1=0
void byte_out_a(unsigned char b)
{
CLK_HI;
P3 = b;
CLK_LO;
}
void byte_out_b(unsigned char b)
{
EA = 0;
P3 = b;
CLK_HI;
CLK_LO;
EA = 1;
}
void byte_out_c(unsigned char b)
{
P3 = b;
CLK_HI;
CLK_LO;
}