ix=0; while (ox=torn[ix++]) { ox+=fpos; if (!(ox&0x88)) { top=cb[ox]; if (!(top&pl;)) { m_stFr[m_sp]=fpos; m_stTo[m_sp]=ox; m_sp++; } } }
var moff = new Array(0,0,32,41,13,0,0,0,18,0,0,0,23, (1) -1,1,-16,16,0, -17,-15,15,17,0, -1,1,-16,16,-17,-15,15,17,0, -33,-31,-14,-18,14,31,33,18,0, -1,1,-15,-16,-17,16,15,17,0);
if (fromp&0x0E) { jx=moff[fromp&0x0F]; while (t=moff[jx]) { ix=1; while (ix<8) (1) { ox=fpos+ix*t; if (ox&0x88) break; top=cb[ox]; if (top&pl;) break; m_moveSort[m_sp]=0; m_stFr[m_sp]=fpos; m_stTo[m_sp]=ox; if (top&pl;_inv) { ms=((lstCap==ox)?6000:2000+sc*(mv[cb[ox]]-mv[cb[fpos]])); m_moveSort[m_sp]=ms; bms(m_spStart,m_sp); break; } m_sp++; if (fromp&0x02) break; (2) ix++; } jx++; } }
if (fromp==0x03) // kung, rockad { if (!(ct[fpos]&pl;_inv)) // kung ej schackad { if ((!(ct[fpos-2]&pl;_inv))&&(!(ct[fpos-1]&pl;_inv))&& (!((cb[fpos-2]&0x3F)|(cb[fpos-1]&0x3F)))&& (cb[fpos-3]==(0x44|pl))&&(cb[fpos]==(0x43|pl))) { m_moveSort[m_sp]=500; m_stFr[m_sp]=fpos; m_stTo[m_sp]=fpos-2; bms(m_spStart,m_sp); m_sp++; } if ((!(ct[fpos+1]&pl;_inv))&&(!(ct[fpos+2]&pl;_inv))&& (!(ct[fpos+3]&pl;_inv))&& (!((cb[fpos+1]&0x3F)|(cb[fpos+2]&0x3F)|(cb[fpos+3]&0x3F)))&& (cb[fpos+4]==(0x44|pl))&&(cb[fpos]==(0x43|pl))) { m_moveSort[m_sp]=500; m_stFr[m_sp]=fpos; m_stTo[m_sp]=fpos+2; bms(m_spStart,m_sp); m_sp++; } } }