Static void ar9287_olpc_temp_compensation(struct athn_softc *sc) { const struct ar9287_eeprom *eep = sc->sc_eep; int8_t pdadc, slope, tcomp; uint32_t reg; reg = AR_READ(sc, AR_PHY_TX_PWRCTRL4); pdadc = MS(reg, AR_PHY_TX_PWRCTRL_PD_AVG_OUT); DPRINTFN(DBG_RF, sc, "PD Avg Out=%d\n", pdadc); if (sc->sc_pdadc == 0 || pdadc == 0) return; /* No frames transmitted yet. */ /* Compute Tx gain temperature compensation. */ if (sc->sc_eep_rev >= AR_EEP_MINOR_VER_2) slope = eep->baseEepHeader.tempSensSlope; else slope = 0; if (slope != 0) /* Prevents division by zero. */ tcomp = ((pdadc - sc->sc_pdadc) * 4) / slope; else tcomp = 0; DPRINTFN(DBG_RF, sc, "OLPC temp compensation=%d\n", tcomp); /* Write compensation value for both Tx chains. */ reg = AR_READ(sc, AR_PHY_CH0_TX_PWRCTRL11); reg = RW(reg, AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, tcomp); AR_WRITE(sc, AR_PHY_CH0_TX_PWRCTRL11, reg); reg = AR_READ(sc, AR_PHY_CH1_TX_PWRCTRL11); reg = RW(reg, AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, tcomp); AR_WRITE(sc, AR_PHY_CH1_TX_PWRCTRL11, reg); AR_WRITE_BARRIER(sc); }
DWORD CWinRect::CombineOverlapping(LPRECT pRectList, DWORD dwRectListSize, LONG xThreshold, LONG yThreshold, DWORD max, LPDWORD pdwFree) {_STT(); // Combine overlapping rects BOOL dwCombined = 0; for ( DWORD i = 0; i < dwRectListSize; i++ ) for ( DWORD c = i + 1; c < dwRectListSize; c++ ) { RECT dst; if ( ( RW( pRectList[ i ] ) != 0 && RH( pRectList[ i ] ) != 0 ) && ( RW( pRectList[ c ] ) != 0 && RH( pRectList[ c ] ) != 0 ) && IsAdjacentRect( &pRectList[ i ], &pRectList[ c ] ) ) if ( UnionRect( &dst, &pRectList[ i ], &pRectList[ c ] ) ) { dwCombined++; // Copy the new rect CopyRect( &pRectList[ i ], &dst ); // Lose the old rect ZeroMemory( &pRectList[ c ], sizeof( pRectList[ c ] ) ); // Save pointer to blank if needed if ( dwCombined == 1 && pdwFree != NULL ) *pdwFree = c; // Punt if user doesn't want any more if ( !max ) return dwCombined; i = 0; c = 1; max--; } // end if } // end for return dwCombined; }
Eigen::VectorXd Prj2Dto3D(VectorXd X, VectorXd fx){ Eigen::MatrixXd RW(3,3); Eigen::VectorXd hRL(3),h(3); int fku=1.95; int fkv=1.95; int u0=162; int v0=125; float u,v; RW(0,0)=0.1; RW(0,1)=0.1; RW(0,2)=0.1; RW(1,0)=0.1; RW(1,1)=0.1; RW(1,2)=0.1; RW(2,0)=0.1; RW(2,1)=0.1; RW(2,2)=0.1; hRL= RW*(fx-X); u=u0-fku*hRL(0)/hRL(2); v=v0-fkv*hRL(1)/hRL(2); h(0)=u; h(1)=v; return h; }
void NITDemuxer::onSection( BYTE *section, SIZE_T len ) { desc::Demuxer descDemuxer; desc::MapOfDescriptors netDescriptors; std::vector<Nit::ElementaryInfo> elements; SSIZE_T offset = PSI_PAYLOAD_OFFSET; bool isActualNetwork = (PSI_TABLE(section) == PSI_TID_NIT_ACTUAL); WORD networkID = PSI_EXTENSION(section); Version version = PSI_VERSION(section); // Network descriptors offset += descDemuxer.parse( netDescriptors, section+offset ); offset += 2; // Transport stream loop length while (offset < len) { Nit::ElementaryInfo info; info.tsID = RW(section,offset); info.nitID = RW(section,offset); // Transport Stream Descriptors offset += descDemuxer.parse( info.descriptors, section+offset ); elements.push_back( info ); } Nit *nit = new Nit( version, networkID, isActualNetwork, netDescriptors, elements ); _onParsed( nit ); }
uint8_t nrf_base::RW_Reg(uint8_t reg,uint8_t value) //¼Ä´æÆ÷·ÃÎʺ¯Êý£ºÓÃÀ´ÉèÖÃ24L01 µÄ¼Ä´æÆ÷µÄÖµ¡£ { byte status_1; digitalWrite(_CSN,LOW); status_1=RW(reg); RW(value); digitalWrite(_CSN,HIGH); return status_1; }
uint8_t nrf_base::Read(uint8_t reg) //¶ÁÈ¡¼Ä´æÆ÷ÖµµÄº¯Êý { byte reg_val; digitalWrite(_CSN,LOW); RW(reg); reg_val=RW(0); digitalWrite(_CSN,HIGH); return reg_val; }
/* ***************************************************************** * 写寄存器 ***************************************************************** */ uint8_t ANO_NRF::Write_Reg(uint8_t reg, uint8_t value) { uint8_t status; CSN_L(); /* 选通器件 */ status = RW(reg); /* 写寄存器地址 */ RW(value); /* 写数据 */ CSN_H(); /* 禁止该器件 */ return status; }
/* ***************************************************************** * 读寄存器 ***************************************************************** */ uint8_t ANO_NRF::Read_Reg(uint8_t reg) { uint8_t reg_val; CSN_L(); /* 选通器件 */ RW(reg); /* 写寄存器地址 */ reg_val = RW(0); /* 读取该寄存器返回数据 */ CSN_H(); /* 禁止该器件 */ return reg_val; }
void mwmp::PacketPlayerAnimPlay::Packet(RakNet::BitStream *bs, bool send) { PlayerPacket::Packet(bs, send); RW(player->animation.groupname, send); RW(player->animation.mode, send); RW(player->animation.count, send); RW(player->animation.persist, send); }
uint8_t nrf_base::Read_Buf(uint8_t reg ,uint8_t *pBuf, uint8_t bytes) //½ÓÊÕ»º³åÇø·ÃÎʺ¯ { byte status_1,byte_ctr; digitalWrite(_CSN,LOW); status_1=RW(reg); for(byte_ctr=0; byte_ctr<bytes; byte_ctr++) { pBuf[byte_ctr]=RW(0); } digitalWrite(_CSN,HIGH); return status_1; }
void ar9380_set_correction(struct athn_softc *sc, struct ieee80211_channel *c) { const struct ar9380_eeprom *eep = sc->eep; const struct ar9380_modal_eep_header *modal; uint32_t reg; int8_t slope; int i, corr, temp, temp0; if (IEEE80211_IS_CHAN_2GHZ(c)) modal = &eep->modalHeader2G; else modal = &eep->modalHeader5G; for (i = 0; i < AR9380_MAX_CHAINS; i++) { ar9380_get_correction(sc, c, i, &corr, &temp); if (i == 0) temp0 = temp; reg = AR_READ(sc, AR_PHY_TPC_11_B(i)); reg = RW(reg, AR_PHY_TPC_11_OLPC_GAIN_DELTA, corr); AR_WRITE(sc, AR_PHY_TPC_11_B(i), reg); /* Enable open loop power control. */ reg = AR_READ(sc, AR_PHY_TPC_6_B(i)); reg = RW(reg, AR_PHY_TPC_6_ERROR_EST_MODE, 3); AR_WRITE(sc, AR_PHY_TPC_6_B(i), reg); } /* Enable temperature compensation. */ if (IEEE80211_IS_CHAN_5GHZ(c) && eep->base_ext2.tempSlopeLow != 0) { if (c->ic_freq <= 5500) { slope = athn_interpolate(c->ic_freq, 5180, eep->base_ext2.tempSlopeLow, 5500, modal->tempSlope); } else { slope = athn_interpolate(c->ic_freq, 5500, modal->tempSlope, 5785, eep->base_ext2.tempSlopeHigh); } } else slope = modal->tempSlope; reg = AR_READ(sc, AR_PHY_TPC_19); reg = RW(reg, AR_PHY_TPC_19_ALPHA_THERM, slope); AR_WRITE(sc, AR_PHY_TPC_19, reg); reg = AR_READ(sc, AR_PHY_TPC_18); reg = RW(reg, AR_PHY_TPC_18_THERM_CAL, temp0); AR_WRITE(sc, AR_PHY_TPC_18, reg); AR_WRITE_BARRIER(sc); }
uint8_t nrf_base::Write_Buf(uint8_t reg, uint8_t *pBuf, uint8_t bytes) //·¢É仺³åÇø·ÃÎʺ¯ { byte status_1,byte_ctr; digitalWrite(_CSN,LOW); status_1=RW(reg); //delayMicroseconds(10); for(byte_ctr=0; byte_ctr<bytes; byte_ctr++) { RW(*pBuf++); } digitalWrite(_CSN,HIGH); return status_1; }
/* ***************************************************************** * * 写缓冲区 * ***************************************************************** */ uint8_t ANO_NRF::Write_Buf(uint8_t reg, uint8_t *pBuf, uint8_t uchars) { uint8_t i; uint8_t status; CSN_L(); /* 选通器件 */ status = RW(reg); /* 写寄存器地址 */ for(i=0; i<uchars; i++) { RW(pBuf[i]); /* 写数据 */ } CSN_H(); /* 禁止该器件 */ return status; }
/* ***************************************************************** * 读缓冲区 ***************************************************************** */ uint8_t ANO_NRF::Read_Buf(uint8_t reg, uint8_t *pBuf, uint8_t uchars) { uint8_t i; uint8_t status; CSN_L(); /* 选通器件 */ status = RW(reg); /* 写寄存器地址 */ for(i=0; i<uchars; i++) { pBuf[i] = RW(0); /* 读取返回数据 */ } CSN_H(); /* 禁止该器件 */ return status; }
void CDlgImgView::SizeDlg() { // Ensure window if ( !::IsWindow( GetSafeHwnd() ) ) return; if ( RW( m_rect ) <= 32 || RH( m_rect ) <= 32 ) return; RECT win; GetWindowRect( &win ); win.right = win.left + RW( m_rect ) + 16; win.bottom = win.top + RH( m_rect ) + 48; MoveWindow( &win, TRUE ); Size(); }
void ANO_NRF::Init(u8 model, u8 ch) { CE_L(); Write_Buf(NRF_WRITE_REG+RX_ADDR_P0,RX_ADDRESS,RX_ADR_WIDTH); //写RX节点地址 Write_Buf(NRF_WRITE_REG+TX_ADDR,TX_ADDRESS,TX_ADR_WIDTH); //写TX节点地址 Write_Reg(NRF_WRITE_REG+EN_AA,0x01); //使能通道0的自动应答 Write_Reg(NRF_WRITE_REG+EN_RXADDR,0x01); //使能通道0的接收地址 Write_Reg(NRF_WRITE_REG+SETUP_RETR,0x1a); //设置自动重发间隔时间:500us;最大自动重发次数:10次 2M波特率下 Write_Reg(NRF_WRITE_REG+RF_CH,ch); //设置RF通道为CHANAL Write_Reg(NRF_WRITE_REG+RF_SETUP,0x0f); //设置TX发射参数,0db增益,2Mbps,低噪声增益开启 //Write_Reg(NRF_WRITE_REG+RF_SETUP,0x07); //设置TX发射参数,0db增益,1Mbps,低噪声增益开启 ///////////////////////////////////////////////////////// if(model==1) //RX { Write_Reg(NRF_WRITE_REG+RX_PW_P0,RX_PLOAD_WIDTH); //选择通道0的有效数据宽度 Write_Reg(NRF_WRITE_REG + CONFIG, 0x0f); // IRQ收发完成中断开启,16位CRC,主接收 } else if(model==2) //TX { Write_Reg(NRF_WRITE_REG+RX_PW_P0,RX_PLOAD_WIDTH); //选择通道0的有效数据宽度 Write_Reg(NRF_WRITE_REG + CONFIG, 0x0e); // IRQ收发完成中断开启,16位CRC,主发送 } else if(model==3) //RX2 { Write_Reg(FLUSH_TX,0xff); Write_Reg(FLUSH_RX,0xff); Write_Reg(NRF_WRITE_REG + CONFIG, 0x0f); // IRQ收发完成中断开启,16位CRC,主接收 RW(0x50); RW(0x73); Write_Reg(NRF_WRITE_REG+0x1c,0x01); Write_Reg(NRF_WRITE_REG+0x1d,0x06); } else //TX2 { Write_Reg(NRF_WRITE_REG + CONFIG, 0x0e); // IRQ收发完成中断开启,16位CRC,主发送 Write_Reg(FLUSH_TX,0xff); Write_Reg(FLUSH_RX,0xff); RW(0x50); RW(0x73); Write_Reg(NRF_WRITE_REG+0x1c,0x01); Write_Reg(NRF_WRITE_REG+0x1d,0x06); } CE_H(); delayms(50); }
SSIZE_T parse( BYTE *data, SIZE_T len, Descriptors &descriptors ) { SSIZE_T offset = 0; WORD compatibilityLen = RW(data,offset); if (!compatibilityLen) { // Ignore if not present return 2; } WORD descriptorCount = RW(data,offset); printf( "[dsmcc::compatiblity] Compatibility descriptor: dataLen=%ld, descLen=%d, count=%d\n", len, compatibilityLen, descriptorCount ); // Check if len is ok if (len < compatibilityLen) { printf( "[dsmcc::compatiblity] No data available to parse Compatibility descriptor: descLen=%ld, available=%d\n", len, compatibilityLen ); return compatibilityLen+2; } // Parse descriptors for (WORD desc=0; desc<descriptorCount; desc++) { Descriptor desc; desc.type = RB(data,offset); //BYTE dLen = RB(data,offset); offset += 1; desc.specifier = RDW(data,offset); desc.model = RW(data,offset); desc.version = RW(data,offset); // Parse sub descriptors BYTE subCount = RB(data,offset); for (BYTE sub=0; sub<subCount; sub++) { BYTE subType = RB(data,offset); BYTE subLen = RB(data,offset); // AdditionalInformation offset += subLen; printf( "[dsmcc::compatibility] Warning, subdescriptor not parsed: count=%d, type=%x, len=%x\n", subCount, subType, subLen ); } descriptors.push_back( desc ); } return compatibilityLen+2; }
BOOL CPubImgView::Regen( DWORD i ) { RECT rect; GetClientRect( &rect ); // Punt if no image list if ( m_pImgList == NULL || m_pImgList->Size() == 0 ) { m_video.Destroy(); return TRUE; } long w = RW( rect ); long h = RH( rect ); // Just allocate what we need if ( w > h ) rect.right = rect.left + ( h * m_pImgList->Size() ); else rect.bottom = rect.top + ( w + m_pImgList->Size() ); // Create offscreen buffer if ( !m_video.Create( NULL, &rect ) ) return FALSE; // Fill in the background CGrDC::FillSolidRect( m_video, &rect, GetSysColor( COLOR_3DFACE ) ); // Draw the images if ( !Draw( m_video, &rect ) ) return FALSE; // Show the changes Update(); return TRUE; }
void ExecuteLoop(void) /* fetch and dispatch loop */ { register void (**tab)(void); tab=table; rep: while(--nInst>=0) { #ifdef TRACE if (pc>tracelo) DoTrace(); #endif tab[code=RW(pc++)](); } if (doPoll) dosignal(); if(extraFlag) { nInst=nInst2; ExceptionProcessing(); if(nInst>0) goto rep; } }
void mwmp::PacketPlayerCharGen::Packet(RakNet::BitStream *bs, bool send) { PlayerPacket::Packet(bs, send); RW(player->charGenState, send); }
BOOL CWinRect::AddRectToList(LPRECT pRect, LPRECT pRectList, DWORD dwRectListSize, LONG xThreshold, LONG yThreshold ) {_STT(); // Add if possible RECT dst; DWORD i = 0, blank = MAXDWORD; for ( i = 0; i < dwRectListSize; i++ ) { // If valid area if ( RW( pRectList[ i ] ) != 0 && RH( pRectList[ i ] ) != 0 ) { if ( IsAdjacentRect( &pRectList[ i ], pRect, xThreshold, yThreshold ) ) if ( UnionRect( &dst, &pRectList[ i ], pRect ) ) { CopyRect( &pRectList[ i ], &dst ); return TRUE; } } // end if // Save blank location else if ( blank == MAXDWORD ) blank = i; } // end for // Any more blank slots? if ( blank == MAXDWORD ) { // Attempt to create an empty slot if ( !CombineOverlapping( pRectList, dwRectListSize, xThreshold, yThreshold, 1, &blank ) ) return FALSE; } // end if // Add to slot CopyRect( &pRectList[ blank ], pRect ); return TRUE; }
PUBLIC void ar9287_1_3_setup_async_fifo(struct athn_softc *sc) { uint32_t reg; /* * MAC runs at 117MHz (instead of 88/44MHz) when ASYNC FIFO is * enabled, so the following counters have to be changed. */ AR_WRITE(sc, AR_D_GBL_IFS_SIFS, AR_D_GBL_IFS_SIFS_ASYNC_FIFO_DUR); AR_WRITE(sc, AR_D_GBL_IFS_SLOT, AR_D_GBL_IFS_SLOT_ASYNC_FIFO_DUR); AR_WRITE(sc, AR_D_GBL_IFS_EIFS, AR_D_GBL_IFS_EIFS_ASYNC_FIFO_DUR); AR_WRITE(sc, AR_TIME_OUT, AR_TIME_OUT_ACK_CTS_ASYNC_FIFO_DUR); AR_WRITE(sc, AR_USEC, AR_USEC_ASYNC_FIFO_DUR); AR_SETBITS(sc, AR_MAC_PCU_LOGIC_ANALYZER, AR_MAC_PCU_LOGIC_ANALYZER_DISBUG20768); reg = AR_READ(sc, AR_AHB_MODE); reg = RW(reg, AR_AHB_CUSTOM_BURST, AR_AHB_CUSTOM_BURST_ASYNC_FIFO_VAL); AR_WRITE(sc, AR_AHB_MODE, reg); AR_SETBITS(sc, AR_PCU_MISC_MODE2, AR_PCU_MISC_MODE2_ENABLE_AGGWEP); AR_WRITE_BARRIER(sc); }
// used for transformation from vertex position in GS window.coords (I hope) // to view coordinates (in range 0, 1). float4 CRenderTarget::DefaultBitBltPos() { float4 v = float4(1, -1, 0.5f / (float)RW(fbw), 0.5f / (float)RH(fbh)); v *= 1.0f / 32767.0f; ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltPos, v, "g_sBitBltPos"); return v; }
void C3DList::OnLButtonDown(UINT nFlags, CPoint point) { SetCapture(); RECT rect, hs, vs; GetClientRect( &rect ); m_scrollbar.GetClientRect( &vs ); rect.right -= RW( vs ); // If horizontal scroll bar if ( !GetListCtrl().GetHeader().IsAutosizing() ) { m_hscroll.GetClientRect( &hs ); rect.bottom -= RH( hs ); } // end if // Let list handle button press if ( m_list.OnLButtonDown( nFlags, &point, &rect ) ) { RECT rect; GetClientRect( &rect ); rect.right -= GetSystemMetrics( SM_CXVSCROLL ); rect.bottom -= GetSystemMetrics( SM_CYHSCROLL ); RedrawWindow( &rect ); UpdateVScrollBar(); } // end if CStatic::OnLButtonDown(nFlags, point); }
// Used to transform texture coordinates from GS (when 0,0 is upper left) to // OpenGL (0,0 - lower left). float4 CRenderTarget::DefaultBitBltTex() { // I really sure that -0.5 is correct, because OpenGL have no half-offset // issue, DirectX known for. float4 v = float4(1, -1, 0.5f / (float)RW(fbw), -0.5f / (float)RH(fbh)); ZZshSetParameter4fv(pvsBitBlt.prog, pvsBitBlt.sBitBltTex, v, "g_sBitBltTex"); return v; }
static Cond InstallQemlRom(void) { if(!qemlPatch) { if (isMinerva) { ROMINIT_CMD_ADDR=0x0; qemlPatch=LookFor2(&ROMINIT_CMD_ADDR,0x0c934afbl,1,48*1024); if (testMinervaVersion("1.89")) { uw32 mpatch_addr=0x4e6; if(V3)printf("Minerva 1.89, checking for >1MB patch\n"); if ( RW((Ptr)theROM+mpatch_addr)==0xd640 ) { WW((Ptr)theROM+mpatch_addr,0xd680); if(V3)printf("....applied patch\n"); } } } else /* not Minerva */ { ROMINIT_CMD_ADDR=0x4a00; qemlPatch=LookFor(&ROMINIT_CMD_ADDR,0x0c934afbl,1000); } if (!qemlPatch) printf("Warning: could not patch ROM scan sequence\n"); if(qemlPatch) { WW(((uw16*)((Ptr)theROM+ROMINIT_CMD_ADDR)),ROMINIT_CMD_CODE); WW(((uw16*)((Ptr)theROM+MDVIO_CMD_ADDR)),MDVIO_CMD_CODE); /* device driver routines */ WW(((uw16*)((Ptr)theROM+MDVO_CMD_ADDR)),MDVO_CMD_CODE); WW(((uw16*)((Ptr)theROM+MDVC_CMD_ADDR)),MDVC_CMD_CODE); WW(((uw16*)((Ptr)theROM+MDVSL_CMD_ADDR)),MDVSL_CMD_CODE); WW(((uw16*)((Ptr)theROM+MDVFO_CMD_ADDR)),MDVFO_CMD_CODE); #ifdef SERIAL #ifndef NEWSERIAL if(isMinerva) { printf("sorry, old style SER driver won't work\n"); return qemlPatch; } else { WW (((uw16 *) ((Ptr) theROM + 0xbb6l)), OSERIO_CMD_CODE); /* I/O */ WW (((uw16 *) ((Ptr) theROM + 0xad0l)), OSERO_CMD_CODE); /* Open */ WW (((uw16 *) ((Ptr) theROM + 0xb8el)), OSERC_CMD_CODE); /* Close */ } #else #warning UNUSED NEWSERIAL #endif #else #warning UNUSED SERIAL #endif } } return qemlPatch; }
/* returns -1 bad name, 0 not found, >0 success*/ int decode_name(char *name, struct NAME_PARS *ndescr, open_arg *parblk) { int res; open_arg rval; struct PARENTRY *pars; char *nend; int j; int i=ndescr->pcount; ppname=rest_name; #ifdef TEST printf("decode_name: dev_name %s file name %s\n",name+2,ndescr->name); #endif if ( RW(name)<strlen(ndescr->name) || strncasecmp(name+2,ndescr->name,strlen(ndescr->name)) ) return 0; nend=name; if (RW(name)>1024) return -1; name=rest_name; j=RW(nend)-strlen(ndescr->name); strncpy(name,nend+2+strlen(ndescr->name),j); name[j]=0; nend=&name[j]; pars=ndescr->pars; while(i-- /*&& name<nend*/ && pars->func) { res=(*(pars->func))(&name,nend-name,pars->opt,pars->values,&rval); switch (res) { case -1 : return -1; case 0 : case 1 : pars++; *parblk++=rval; break; default: #ifdef TEST printf("decode_name problem\n"); #endif return -1; } } if (name != nend) return -1; else return 1; }
static Cond LookFor2(w32 *a,uw32 w,uw16 w1,long nMax) { rty: while(nMax-->0 && RL((Ptr)theROM+(*a))!=w) (*a)+=2; if (RW((Ptr)theROM+(*a)+4)==w1) return nMax>0; (*a)+=2; if (nMax>0) goto rty; return 0; }
static void i80286_data_descriptor_full(i80286_state *cpustate, int reg, UINT16 selector, int cpl, UINT32 trap, UINT16 offset, int size) { if (PM) { UINT16 desc[3]; UINT8 r; UINT32 addr; /* selector format 15..3 number/address in descriptor table 2: 0 global, 1 local descriptor table 1,0: requested privileg level must be higher or same as current privileg level in code selector */ if ((reg != SS) && !IDXTBL(selector)) { cpustate->sregs[reg]=0; cpustate->limit[reg]=0; cpustate->base[reg]=0; cpustate->rights[reg]=0; cpustate->valid[reg]=0; return; } if ((addr = i80286_selector_address(cpustate,selector)) == -1) throw trap; desc[0] = ReadWord(addr); desc[1] = ReadWord(addr+2); desc[2] = ReadWord(addr+4); r = RIGHTS(desc); if (!SEGDESC(r)) throw trap; if (reg == SS) { if (!IDXTBL(selector)) throw trap; if (DPL(r)!=cpl) throw trap; if (RPL(selector)!=cpl) throw trap; if (!RW(r) || CODE(r)) throw trap; if (!PRES(r)) throw TRAP(STACK_FAULT,(IDXTBL(selector)+(trap&1))); } else { if ((DPL(r) < PMAX(cpl,RPL(selector))) && (!CODE(r) || (CODE(r) && !CONF(r)))) throw trap; if (CODE(r) && !READ(r)) throw trap; if (!PRES(r)) throw TRAP(SEG_NOT_PRESENT,(IDXTBL(selector)+(trap&1))); } if (offset+size) { if ((CODE(r) || !EXPDOWN(r)) && ((offset+size-1) > LIMIT(desc))) throw (reg==SS)?TRAP(STACK_FAULT,(trap&1)):trap; if (!CODE(r) && EXPDOWN(r) && ((offset <= LIMIT(desc)) || ((offset+size-1) > 0xffff))) throw (reg==SS)?TRAP(STACK_FAULT,(trap&1)):trap; } SET_ACC(desc); WriteWord(addr+4, desc[2]); cpustate->sregs[reg]=selector; cpustate->limit[reg]=LIMIT(desc); cpustate->base[reg]=BASE(desc); cpustate->rights[reg]=RIGHTS(desc); } else { cpustate->sregs[reg]=selector; cpustate->base[reg]=selector<<4; } cpustate->valid[reg]=1; }
void CDlgInform::Size() { // Ensure we have a valid window if ( !::IsWindow( GetSafeHwnd() ) ) return; RECT rect; m_text.GetTextSize( &rect ); // Add a little room // InflateRect( &rect, 40, 20 ); rect.right += 60; rect.bottom += 40; // correct size rect.bottom += GetSystemMetrics( SM_CYCAPTION ) + GetSystemMetrics( SM_CYBORDER ) + 32; if ( RW( rect ) < 280 ) rect.right = rect.left + 280; // Set window position SetWindowPos( NULL, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE ); CenterWindow(); GetClientRect( &rect ); // Set the text control position if ( ::IsWindow( m_text.GetSafeHwnd() ) ) m_text.SetWindowPos( NULL, rect.left, rect.top, RW( rect ), RH( rect ) - 24, SWP_NOZORDER | SWP_NOACTIVATE ); rect.top = rect.bottom - 24; // Set the text control position if ( ::IsWindow( m_status.GetSafeHwnd() ) ) m_status.SetWindowPos( NULL, rect.left, rect.top, RW( rect ), RH( rect ), SWP_NOZORDER | SWP_NOACTIVATE ); }