Example #1
0
static void
do_add(enum size_tag size,
       gp_boolean is_const,
       int value,
       char *name,
       char *bank_addr)
{

  switch (size) {
  case size_bit:
    assert(0);
    break;
  case size_uint8:
  case size_int8:
    if (is_const) {
      codegen_write_asm("addlw %#x", value & 0xff);
    } else {
      BANKSEL;
      codegen_write_asm("addwf %s, w", name);
    }
    break;
  case size_uint16:
  case size_int16:
    BANKSEL_LOCAL;
    add_setup(is_const, (value & 0xff), name, bank_addr);
    add_next(is_const, (value >> 8) && 0xff, name, bank_addr, 1);
    break;
  case size_uint24:
  case size_int24:
    BANKSEL_LOCAL;
    add_setup(is_const, (value & 0xff), name, bank_addr);
    add_next(is_const, (value >> 8) && 0xff, name, bank_addr, 1);
    add_next(is_const, (value >> 16) && 0xff, name, bank_addr, 2);
    break;
  case size_uint32:
  case size_int32:
    BANKSEL_LOCAL;
    add_setup(is_const, (value & 0xff), name, bank_addr);
    add_next(is_const, (value >> 8) && 0xff, name, bank_addr, 1);
    add_next(is_const, (value >> 16) && 0xff, name, bank_addr, 2);
    add_next(is_const, (value >> 24) && 0xff, name, bank_addr, 3);
    break;
  case size_float:
  default:
    assert(0);
  }

}
Example #2
0
void test_list(void) {
  test_init();

  add_setup();
  test_add();
  add_teardown();

  del_setup();
  test_del();
  del_teardown();
}