static void aten_read_block( PIA *pi, char * buf, int count ) { int k, a, b, c, d; switch (pi->mode) { case 0: w0(0x48); w2(0xe); w2(6); for (k=0;k<count/2;k++) { w2(7); w2(6); w2(2); a = r1(); w0(0x58); b = r1(); w2(0); d = r1(); w0(0x48); c = r1(); buf[2*k] = j44(c,d); buf[2*k+1] = j44(a,b); } w2(0xc); break; case 1: w0(0x58); w2(0xe); w2(6); for (k=0;k<count/2;k++) { w2(0x27); w2(0x26); w2(0x22); a = r0(); w2(0x20); b = r0(); buf[2*k] = b; buf[2*k+1] = a; } w2(0x26); w2(0xc); break; } }
static void fit2_read_block( PIA *pi, char * buf, int count ) { int k, a, b, c, d; w2(0xc); w0(0x10); for (k=0;k<count/4;k++) { w2(4); w2(5); w0(0); a = r1(); w0(1); b = r1(); w0(3); c = r1(); w0(2); d = r1(); buf[4*k+0] = j44(a,b); buf[4*k+1] = j44(d,c); w2(4); w2(5); a = r1(); w0(3); b = r1(); w0(1); c = r1(); w0(0); d = r1(); buf[4*k+2] = j44(d,c); buf[4*k+3] = j44(a,b); } w2(4); }
static void kbic_read_block( PIA *pi, char * buf, int count ) { int k, a, b; switch (pi->mode) { case 0: w0(0x98); w2(4); w2(6); w2(4); for (k=0;k<count/2;k++) { w2(1); w0(8); a = r1(); w0(0x28); b = r1(); buf[2*k] = j44(a,b); w2(5); b = r1(); w0(8); a = r1(); buf[2*k+1] = j44(a,b); w2(4); } break; case 1: w0(0xb8); w2(4); w2(6); w2(4); for (k=0;k<count/4;k++) { w0(0xb8); w2(4); w2(5); w0(8); buf[4*k] = j53(r12w()); w0(0xb8); buf[4*k+1] = j53(r12w()); w2(4); w2(5); buf[4*k+3] = j53(r12w()); w0(8); buf[4*k+2] = j53(r12w()); } w2(4); break; case 2: w0(0x88); w2(4); w2(6); w2(4); for (k=0;k<count/2;k++) { w2(0xa0); w2(0xa1); buf[2*k] = r0(); w2(0xa5); buf[2*k+1] = r0(); } w2(4); break; case 3: w0(0xa0); w2(4); w2(6); w2(4); w3(0); for (k=0;k<count;k++) buf[k] = r4(); w2(4); w2(0); w2(4); break; case 4: w0(0xa0); w2(4); w2(6); w2(4); w3(0); for (k=0;k<count/2;k++) ((u16 *)buf)[k] = r4w(); w2(4); w2(0); w2(4); break; case 5: w0(0xa0); w2(4); w2(6); w2(4); w3(0); for (k=0;k<count/4;k++) ((u32 *)buf)[k] = r4l(); w2(4); w2(0); w2(4); break; } }
static void ktti_read_block( PIA *pi, char * buf, int count ) { int k, a, b; for (k=0;k<count/2;k++) { w0(0x10); w2(0xb); w2(0xa); w2(9); w2(0xc); w2(9); a = r1(); w2(0xc); b = r1(); w2(9); buf[2*k] = j44(a,b); a = r1(); w2(0xc); b = r1(); w2(9); buf[2*k+1] = j44(a,b); } }
static int comm_read_regr( PIA *pi, int cont, int regr ) { int l, h, r; r = regr + cont_map[cont]; switch (pi->mode) { case 0: w0(r); P1; w0(0); w2(6); l = r1(); w0(0x80); h = r1(); w2(4); return j44(l,h); case 1: w0(r+0x20); P1; w0(0); w2(0x26); h = r0(); w2(4); return h; case 2: case 3: case 4: w3(r+0x20); (void)r1(); w2(0x24); h = r4(); w2(4); return h; } return -1; }
static int dstr_read_regr( PIA *pi, int cont, int regr ) { int a, b, r; r = regr + cont_map[cont]; w0(0x81); P1; if (pi->mode) { w0(0x11); } else { w0(1); } P2; w0(r); P1; switch (pi->mode) { case 0: w2(6); a = r1(); w2(4); w2(6); b = r1(); w2(4); return j44(a,b); case 1: w0(0); w2(0x26); a = r0(); w2(4); return a; case 2: case 3: case 4: w2(0x24); a = r4(); w2(4); return a; } return -1; }
static int on26_read_regr( PIA *pi, int cont, int regr ) { int a, b, r; r = (regr<<2) + 1 + cont; switch (pi->mode) { case 0: w0(1); P1; w0(r); P2; w0(0); P1; w2(6); a = r1(); w2(4); w2(6); b = r1(); w2(4); w2(6); w2(4); w2(6); w2(4); return j44(a,b); case 1: w0(1); P1; w0(r); P2; w0(0); P1; w2(0x26); a = r0(); w2(4); w2(0x26); w2(4); return a; case 2: case 3: case 4: w3(1); w3(1); w2(5); w4(r); w2(4); w3(0); w3(0); w2(0x24); a = r4(); w2(4); w2(0x24); r4(); w2(4); return a; } return -1; }
static int kbic_read_regr( PIA *pi, int cont, int regr ) { int a, b, s; s = cont_map[cont]; switch (pi->mode) { case 0: w0(regr|0x18|s); w2(4); w2(6); w2(4); w2(1); w0(8); a = r1(); w0(0x28); b = r1(); w2(4); return j44(a,b); case 1: w0(regr|0x38|s); w2(4); w2(6); w2(4); w2(5); w0(8); a = r12w(); w2(4); return j53(a); case 2: w0(regr|0x08|s); w2(4); w2(6); w2(4); w2(0xa5); w2(0xa1); a = r0(); w2(4); return a; case 3: case 4: case 5: w0(0x20|s); w2(4); w2(6); w2(4); w3(regr); a = r4(); b = r4(); w2(4); w2(0); w2(4); return a; } return -1; }
static int epia_read_regr( PIA *pi, int cont, int regr ) { int a, b, r; regr += cont_map[cont]; switch (pi->mode) { case 0: r = regr^0x39; w0(r); w2(1); w2(3); w0(r); a = r1(); w2(1); b = r1(); w2(4); return j44(a,b); case 1: r = regr^0x31; w0(r); w2(1); w0(r&0x37); w2(3); w2(5); w0(r|0xf0); a = r1(); b = r2(); w2(4); return j53(a,b); case 2: r = regr^0x29; w0(r); w2(1); w2(0X21); w2(0x23); a = r0(); w2(4); return a; case 3: case 4: case 5: w3(regr); w2(0x24); a = r4(); w2(4); return a; } return -1; }
static int fit3_read_regr( PIA *pi, int cont, int regr ) { int a, b; if (cont) { if (regr != 6) return 0xff; regr = 7; } switch (pi->mode) { case 0: w2(0xc); w0(regr + 0x10); w2(0x8); w2(0xc); w2(0xd); a = r1(); w2(0xf); b = r1(); w2(0xc); return j44(a,b); case 1: w2(0xc); w0(regr + 0x90); w2(0x8); w2(0xc); w2(0xec); w2(0xee); w2(0xef); a = r0(); w2(0xc); return a; case 2: w2(0xc); w0(regr + 0x90); w2(0x8); w2(0xc); w2(0xec); a = r4(); b = r4(); w2(0xc); return a; } return -1; }
static int epat_read_regr( PIA *pi, int cont, int regr ) { int a, b, r; r = regr + cont_map[cont]; switch (pi->mode) { case 0: w0(r); w2(1); w2(3); a = r1(); w2(4); b = r1(); return j44(a,b); case 1: w0(0x40+r); w2(1); w2(4); a = r1(); b = r2(); w0(0xff); return j53(a,b); case 2: w0(0x20+r); w2(1); w2(0x25); a = r0(); w2(4); return a; case 3: case 4: case 5: w3(r); w2(0x24); a = r4(); w2(4); return a; } return -1; /* never gets here */ }
static void epia_read_block( PIA *pi, char * buf, int count ) { int k, ph, a, b; switch (pi->mode) { case 0: w0(0x81); w2(1); w2(3); w0(0xc1); ph = 1; for (k=0;k<count;k++) { w2(2+ph); a = r1(); w2(4+ph); b = r1(); buf[k] = j44(a,b); ph = 1 - ph; } w0(0); w2(4); break; case 1: w0(0x91); w2(1); w0(0x10); w2(3); w0(0x51); w2(5); w0(0xd1); ph = 1; for (k=0;k<count;k++) { w2(4+ph); a = r1(); b = r2(); buf[k] = j53(a,b); ph = 1 - ph; } w0(0); w2(4); break; case 2: w0(0x89); w2(1); w2(0x23); w2(0x21); ph = 1; for (k=0;k<count;k++) { w2(0x24+ph); buf[k] = r0(); ph = 1 - ph; } w2(6); w2(4); break; case 3: if (count > 512) WR(0x84,3); w3(0); w2(0x24); for (k=0;k<count;k++) buf[k] = r4(); w2(4); WR(0x84,0); break; case 4: if (count > 512) WR(0x84,3); w3(0); w2(0x24); for (k=0;k<count/2;k++) ((u16 *)buf)[k] = r4w(); w2(4); WR(0x84,0); break; case 5: if (count > 512) WR(0x84,3); w3(0); w2(0x24); for (k=0;k<count/4;k++) ((u32 *)buf)[k] = r4l(); w2(4); WR(0x84,0); break; } }
static int ktti_read_regr( PIA *pi, int cont, int regr ) { int a, b, r; r = regr + cont_map[cont]; w0(r); w2(0xb); w2(0xa); w2(9); w2(0xc); w2(9); a = r1(); w2(0xc); b = r1(); w2(9); w2(0xc); w2(9); return j44(a,b); }
static void fit3_read_block( PIA *pi, char * buf, int count ) { int k, a, b, c, d; switch (pi->mode) { case 0: w2(0xc); w0(0x10); w2(0x8); w2(0xc); for (k=0;k<count/2;k++) { w2(0xd); a = r1(); w2(0xf); b = r1(); w2(0xc); c = r1(); w2(0xe); d = r1(); buf[2*k ] = j44(a,b); buf[2*k+1] = j44(c,d); } w2(0xc); break; case 1: w2(0xc); w0(0x90); w2(0x8); w2(0xc); w2(0xec); w2(0xee); for (k=0;k<count/2;k++) { w2(0xef); a = r0(); w2(0xee); b = r0(); buf[2*k ] = a; buf[2*k+1] = b; } w2(0xec); w2(0xc); break; case 2: w2(0xc); w0(0x90); w2(0x8); w2(0xc); w2(0xec); for (k=0;k<count;k++) buf[k] = r4(); w2(0xc); break; } }
static void on26_read_block( PIA *pi, char * buf, int count ) { int k, a, b; switch (pi->mode) { case 0: w0(1); P1; w0(1); P2; w0(2); P1; w0(0x18); P2; w0(0); P1; udelay(10); for (k=0;k<count;k++) { w2(6); a = r1(); w2(4); b = r1(); buf[k] = j44(a,b); } w0(2); P1; w0(8); P2; break; case 1: w0(1); P1; w0(1); P2; w0(2); P1; w0(0x19); P2; w0(0); P1; udelay(10); for (k=0;k<count/2;k++) { w2(0x26); buf[2*k] = r0(); w2(0x24); buf[2*k+1] = r0(); } w0(2); P1; w0(9); P2; break; case 2: w3(1); w3(1); w2(5); w4(1); w2(4); w3(0); w3(0); w2(0x24); udelay(10); for (k=0;k<count;k++) buf[k] = r4(); w2(4); break; case 3: w3(1); w3(1); w2(5); w4(1); w2(4); w3(0); w3(0); w2(0x24); udelay(10); for (k=0;k<count/2;k++) ((u16 *)buf)[k] = r4w(); w2(4); break; case 4: w3(1); w3(1); w2(5); w4(1); w2(4); w3(0); w3(0); w2(0x24); udelay(10); for (k=0;k<count/4;k++) ((u32 *)buf)[k] = r4l(); w2(4); break; } }
static void on20_read_block( PIA *pi, char * buf, int count ) { int k, l, h; op(1); vl(1); op(0); for (k=0;k<count;k++) if (pi->mode) { w2(4); w2(0x26); buf[k] = r0(); } else { w2(6); l = r1(); w2(4); w2(6); h = r1(); w2(4); buf[k] = j44(l,h); } w2(4); }
static int fit2_read_regr( PIA *pi, int cont, int regr ) { int a, b, r; if (cont) { if (regr != 6) return 0xff; r = 7; } else r = regr + 0x10; w2(0xc); w0(r); w2(4); w2(5); w0(0); a = r1(); w0(1); b = r1(); w2(4); return j44(a,b); }
static void dstr_read_block( PIA *pi, char * buf, int count ) { int k, a, b; w0(0x81); P1; if (pi->mode) { w0(0x19); } else { w0(9); } P2; w0(0x82); P1; P3; w0(0x20); P1; switch (pi->mode) { case 0: for (k=0;k<count;k++) { w2(6); a = r1(); w2(4); w2(6); b = r1(); w2(4); buf[k] = j44(a,b); } break; case 1: w0(0); for (k=0;k<count;k++) { w2(0x26); buf[k] = r0(); w2(0x24); } w2(4); break; case 2: w2(0x24); for (k=0;k<count;k++) buf[k] = r4(); w2(4); break; case 3: w2(0x24); for (k=0;k<count/2;k++) ((u16 *)buf)[k] = r4w(); w2(4); break; case 4: w2(0x24); for (k=0;k<count/4;k++) ((u32 *)buf)[k] = r4l(); w2(4); break; } }
static int aten_read_regr( PIA *pi, int cont, int regr ) { int a, b, r; r = regr + cont_map[cont] + 0x40; switch (pi->mode) { case 0: w0(r); w2(0xe); w2(6); w2(7); w2(6); w2(0); a = r1(); w0(0x10); b = r1(); w2(0xc); return j44(a,b); case 1: r |= 0x10; w0(r); w2(0xe); w2(6); w0(0xff); w2(0x27); w2(0x26); w2(0x20); a = r0(); w2(0x26); w2(0xc); return a; } return -1; }
static int on20_read_regr( PIA *pi, int cont, int regr ) { int h,l, r ; r = (regr<<2) + 1 + cont; op(1); vl(r); op(0); switch (pi->mode) { case 0: w2(4); w2(6); l = r1(); w2(4); w2(6); h = r1(); w2(4); w2(6); w2(4); w2(6); w2(4); return j44(l,h); case 1: w2(4); w2(0x26); r = r0(); w2(4); w2(0x26); w2(4); return r; } return -1; }
static void comm_read_block( PIA *pi, char * buf, int count ) { int i, l, h; switch (pi->mode) { case 0: w0(0x48); P1; for(i=0;i<count;i++) { w0(0); w2(6); l = r1(); w0(0x80); h = r1(); w2(4); buf[i] = j44(l,h); } break; case 1: w0(0x68); P1; w0(0); for(i=0;i<count;i++) { w2(0x26); buf[i] = r0(); w2(0x24); } w2(4); break; case 2: w3(0x68); (void)r1(); w2(0x24); for (i=0;i<count;i++) buf[i] = r4(); w2(4); break; case 3: w3(0x68); (void)r1(); w2(0x24); for (i=0;i<count/2;i++) ((u16 *)buf)[i] = r4w(); w2(4); break; case 4: w3(0x68); (void)r1(); w2(0x24); for (i=0;i<count/4;i++) ((u32 *)buf)[i] = r4l(); w2(4); break; } }
static void epat_read_block( PIA *pi, char * buf, int count ) { int k, ph, a, b; switch (pi->mode) { case 0: w0(7); w2(1); w2(3); w0(0xff); ph = 0; for(k=0;k<count;k++) { if (k == count-1) w0(0xfd); w2(6+ph); a = r1(); if (a & 8) b = a; else { w2(4+ph); b = r1(); } buf[k] = j44(a,b); ph = 1 - ph; } w0(0); w2(4); break; case 1: w0(0x47); w2(1); w2(5); w0(0xff); ph = 0; for(k=0;k<count;k++) { if (k == count-1) w0(0xfd); w2(4+ph); a = r1(); b = r2(); buf[k] = j53(a,b); ph = 1 - ph; } w0(0); w2(4); break; case 2: w0(0x27); w2(1); w2(0x25); w0(0); ph = 0; for(k=0;k<count-1;k++) { w2(0x24+ph); buf[k] = r0(); ph = 1 - ph; } w2(0x26); w2(0x27); buf[count-1] = r0(); w2(0x25); w2(4); break; case 3: w3(0x80); w2(0x24); for(k=0;k<count-1;k++) buf[k] = r4(); w2(4); w3(0xa0); w2(0x24); buf[count-1] = r4(); w2(4); break; case 4: w3(0x80); w2(0x24); for(k=0;k<(count/2)-1;k++) ((u16 *)buf)[k] = r4w(); buf[count-2] = r4(); w2(4); w3(0xa0); w2(0x24); buf[count-1] = r4(); w2(4); break; case 5: w3(0x80); w2(0x24); for(k=0;k<(count/4)-1;k++) ((u32 *)buf)[k] = r4l(); for(k=count-4;k<count-1;k++) buf[k] = r4(); w2(4); w3(0xa0); w2(0x24); buf[count-1] = r4(); w2(4); break; } }