Hi, I'm kind new on the use of SDCC, just started trying it out. I tried to compile a small snippet of code, but I get an error from the assembler, claiming that "s0x7F" is not defined. I guess it can be a bug, but due to my lack of experience on sdcc, cannot discard the possibility of user-side-bug :).

The code I'm trying to compile is:
include <p16f84.h>

typedef enum { LEFT_MOTOR = 0, RIGHT_MOTOR = 2 } t_motor;
typedef enum { FORWARD = 0x01, BACKWARD = 0x02 } t_direction;

static unsigned char porta_motor_mask(t_motor motor);

void turn_motor_on(t_motor motor, t_direction direction) {
    PORTA = (PORTA & porta_motor_mask(motor)) | (direction << motor);
}

void turn_motor_off(t_motor motor) {
    PORTA &= porta_motor_mask(motor);
}

unsigned char porta_motor_mask(t_motor motor) {
    switch (motor) {
        case LEFT_MOTOR:
            return 0xFC;
            break;
        case RIGHT_MOTOR:
            return 0xF3;
            break;
    };
    return 0xFF;
}

int
main(void) {
    while (1) {
        if (PORTA & 0x10) {
            turn_motor_on(LEFT_MOTOR,FORWARD);
        } else {
            turn_motor_off(LEFT_MOTOR);
        }
    }
}

Some info about the compilation:
$ sdcc -v
SDCC : pic16/pic14 2.4.0 (Apr 29 2005) (UNIX)
$ sdcc -mpic14 -p16f84 -o test -Iinclude/ src/control.c
Processor: 16f84
test.asm:105:Error [113] Symbol not previously defined (s0x7F).
test.asm:206:Error [113] Symbol not previously defined (s0x7F).

When I get to look at the test.asm file, on the "header" of some functions there is a comment about "N compiler assigned register", most of them are "r0xXX", and are actually defined on the top of the asm file, but this "s" register is being left behind. Is it really a bug? Sorry for the size of the mail.
Thanks,
Otavio

--
Otavio Pereira
otaviofp@gmail.com
---------------------------
Programmer (def): An organism that converts caffeine into software.