void code_pool::resolve_label(const char* name) { RW_INIT(); for (int i = 0; i < TARGET_COUNT; i ++) { if (labels[i].name != name) { continue; } for (int j = 0; j < TARGET_COUNT; j ++) { if (branches[j].name != name) { continue; } const uint32_t source = branches[j].position; const uint32_t target = labels[i].position; instructions[source] |= ((target - source) - 2) & 0xFFFFFF; branches[j].name = 0; } labels[i].name = 0; break; } RW_END(); }
void code_pool::insert_raw_instruction(uint32_t op) { if (next_instruction >= instruction_count) { fprintf(stderr, "code_pool overflow\n"); abort(); } RW_INIT(); instructions[next_instruction ++] = op; RW_END(); }
void code_pool::insert_constants(){ for(int i = 0; i < literal_count; i++){ uint32_t ins = literals[i][0]; RW_INIT(); instructions[ins] |= (next_instruction - ins - 2) * 4; // The PC points to an instruction 8 bytes ahead RW_END(); insert_raw_instruction( literals[i][1] ); } literal_count = 0; }
// ----------------------------------------------------------------------------- int8_t iLcdIoInit (void) { /* E, RS, RW en sorties */ LCD_PIO_E_DDR |= _BV(LCD_PIO_E_BIT); LCD_PIO_RS_DDR |= _BV(LCD_PIO_RS_BIT); RW_INIT (); RD_INIT (); /* Data en sorties */ LCD_PIO_DATA_DDR |= 0xFF; /* E, RS, WR à l'état bas */ LCD_PIO_E_PORT &= ~_BV(LCD_PIO_E_BIT); LCD_PIO_RS_PORT &= ~_BV(LCD_PIO_RS_BIT); RW_CLR (); RD_SET (); prvvReset(); return 0; }
void code_pool::resolve_jmp(uint32_t instruction, uint32_t offset) { RW_INIT(); instructions[instruction] |= (offset - instruction - 2) * 4; RW_END(); }