static void write_v40(byte v, int count, byte*& d) { while (count) { if (v) { if (count < 0x100) { *d++ = 0x00; *d++ = count; *d++ = v; break; } int c_write = min(count, 0x3fff); *d++ = 0x80; write_w(0xc000 | c_write, d); count -= c_write; *d++ = v; } else if (count < 0x80) { *d++ = 0x80 | count; count = 0; } else { int c_write = count < 0x8000 ? count : 0x7fff; *d++ = 0x80; write_w(c_write, d); count -= c_write; } } }
void write_i(unsigned char ins) { i2cstart(); write_w(0x78); write_w(0x80); write_w(ins); i2cstop(); }
void melps4_cpu_device::device_reset() { m_sm = m_sms = false; m_ba_flag = false; m_skip = false; m_op = m_prev_op = 0; m_pc = m_prev_pc = 0; op_lcps(); // CPS=0 // clear interrupts m_inte = 0; m_intp = 1; write_v(0); write_w(0); m_irqflag[0] = m_irqflag[1] = m_irqflag[2] = false; m_prohibit_irq = false; m_possible_irq = false; // clear ports write_d_pin(MELPS4_PORTD_CLR, 0); write_gen_port(MELPS4_PORTS, 0); write_gen_port(MELPS4_PORTF, 0); write_gen_port(MELPS4_PORTG, 0); write_gen_port(MELPS4_PORTU, 0); m_write_t(0); m_port_t = 0; }
static void write40_c3(byte*& w, int count, const byte* r) { *w++ = 0x80; write_w(0x8000 | count, w); memcpy(w, r, count); w += count; }
int CBlockFile::flush() { if (m_blockSize > 0) { write_w((const byte*)m_block, m_blockSize); m_blockSize = 0; } return 0; }
void Display_Picture(unsigned char pic[]) { unsigned char i,j,num=0; for(i=0;i<0x04;i++) { Set_Page_Address(i); Set_Column_Address(0x00); i2cstart(); write_w(0x78); write_w(0x40); for(j=0;j<0x40;j++) { write_w(pic[i*0x40+j]); } i2cstop(); } return; }
void write_next(t_points *it, int fd) { write_str("path_1=", fd); write_nb(it->path_1[1].x, fd); write_str(",", fd); write_nb(it->path_1[1].y, fd); write_str("\n", fd); write_str("path_2=", fd); write_nb(it->path_2[1].x, fd); write_str(",", fd); write_nb(it->path_2[1].y, fd); write_str("\n", fd); write_str("path_3=", fd); write_nb(it->path_3[1].x, fd); write_str(",", fd); write_nb(it->path_3[1].y, fd); write_str("\n", fd); write_w(it, fd); }
int encode40_y(const byte* last_r, const byte* r, byte* d, int cb_s) { // run length encoding byte* w = d; int count = 0; byte last = ~(*last_r ^ *r); while (cb_s--) { byte v = *last_r++ ^ *r++; if (last == v) count++; else { write_v40(last, count, w); count = 1; last = v; } } write_v40(last, count, w); *w++ = 0x80; write_w(0, w); return w - d; }
static void write40_c2(byte*& w, int count) { *w++ = 0x80; write_w(count, w); }
static void write40_c4(byte*& w, int count, int v) { *w++ = 0x80; write_w(0xc000 | count, w); *w++ = v; }