bool SqlCommand::PushField(int index, const void* value, int length) { MZ_ASSERT_TRUE(length >= 0); if (!CheckIndex(index)) { m_sqlConnection.SetLastError("SqlCommand PushField Error << field index[%d]" "out of range[%d", index, m_fieldNumber); return false; } auto& fieldParam = m_fieldParams[index]; if (length > fieldParam.m_length) { m_sqlConnection.SetLastError("SqlCommand PushField Error << data length[%d]" "is greater than buffer length[%d]", length, fieldParam.m_length); return false; } if (value != nullptr) { memcpy(fieldParam.m_buffer, value, length); fieldParam.m_acturalLength = length; fieldParam.m_isNull = 0; } else { fieldParam.m_acturalLength = 0; fieldParam.m_isNull = 1; } return true; }
long CStringCollect::Remove(const VARIANT FAR& removeValue) { int nIndex = -1; VARIANT varTemp; VariantInit(&varTemp); const VARIANT* pvar = &removeValue; if (removeValue.vt != VT_BSTR) { if (VariantChangeType(&varTemp, (VARIANT*)&removeValue, 0, VT_I4) == NOERROR) pvar = &varTemp; else if (VariantChangeType(&varTemp, (VARIANT*)&removeValue, 0, VT_BSTR) == NOERROR) pvar = &varTemp; else AfxThrowOleException(DISP_E_TYPEMISMATCH); } if (pvar->vt == VT_BSTR) nIndex = (int)Find(CString(pvar->bstrVal)); else if (pvar->vt == VT_I4) nIndex = (int)pvar->lVal; VariantClear(&varTemp); CheckIndex(nIndex); m_strArray.RemoveAt(nIndex); return (long)m_strArray.GetSize(); }
void CVLDatabase::Remove(int index) { CheckIndex(index); VLDBItem *item = allItems[index]; int id = item->id; int k; int cp; allCount--; ::memmove(allItems + index, allItems + index + 1, sizeof(VLDBItem*) * (allCount - index)); for (k = index; k < allCount; k++) { allItems[k]->index--; } cp = VLDBAllCapacity(allCount); if (allCapacity != cp) { allItems = (VLDBItem**)realloc(allItems, sizeof(VLDBItem*) * cp); allCapacity = cp; } heap.Free(item->features); heap.Free((BYTE*)item); if (opened) { if (FindRecord(id)) try { recordset->Delete(adAffectCurrent); } catch (_com_error &e) { ComErrorToException(e, string("Can not delete record from the database")); } } }
long PopupPrefs::onInsertCustomItem(FXObject*o, FXSelector sel, void*p) { FXMenuCommand*mc; if (ToolsTree::SelectTool(this, user_menus, mc)) { const char*newpath=(const char*)mc->getUserData(); if (newpath) { // If the command is already in the used items list, just select it... for (FXint i=0; i<used_items->getNumItems(); i++) { const char*oldpath=(const char*)used_items->getItemData(i); if (oldpath && (strcmp(newpath, oldpath)==0)) { used_items->selectItem(i); used_items->setCurrentItem(i); used_items->makeItemVisible(i); CheckIndex(); return 1; } } FXString label; if (FXStat::exists(newpath) && UserMenu::MakeLabelFromPath(newpath,label)) { FXListItem*item=new PopupListItem(label,NULL,(void*)newpath); InsertItem(item); } } } return 1; }
int RedisDriver::ElemNum() { if (!CheckIndex()) { return 0; } return m_pReplyArray[m_nFetchIndex]->elements; }
TextureClient* PersistentBufferProviderShared::GetTexture(Maybe<uint32_t> aIndex) { if (aIndex.isNothing() || !CheckIndex(aIndex.value())) { return nullptr; } return mTextures[aIndex.value()]; }
void CVLDatabase::SetFaceID(int index, const string &faceId) { CheckIndex(index); CopyFaceID(allItems[index]->faceId, allItems[index]->faceIdLength, faceId.c_str(), (DWORD) faceId.length()); if (opened) { UpdateRecord(index); } }
ECode FloatArrayBuffer::Get( /* [in] */ Int32 index, /* [out] */ Float* value) { VALIDATE_NOT_NULL(value); FAIL_RETURN(CheckIndex(index)) *value = (*mBackingArray)[mArrayOffset + index]; return NOERROR; }
int RedisDriver::ElemType(int nElemIndex) { if (!CheckIndex()) { return 0; } redisReply* pReply = m_pReplyArray[m_nFetchIndex]->element[nElemIndex]; return pReply->type; }
Object *Vector::RemoveAt(int index) { CheckIndex(index); Object *o = elements[index]; for (int i = index; i < curSize - 1; i++) { // shift elements left elements[i] = elements[i + 1]; } // for curSize--; return o; } // Vector::RemoveAt
void CHaveReferenceVertex::SetVertex(uint index, const Vertex & value) { CheckIndex(index); for (auto & element : m_pVertex[index]) { *element = value; } }
void Vector::InsertAt(int index, Object *o) { CheckIndex(index); if (curSize == curCap) IncreaseCapacity(); for (int i = curSize; i > index; i--) { // shift elements right elements[i] = elements[i - 1]; } // for elements[index] = o; curSize++; } // Vector::InsertAt
void CVLDatabase::SetFeatures(int index, const void *features, DWORD size) { CheckIndex(index); heap.Free(allItems[index]->features); allItems[index]->features = heap.Alloc((DWORD)size); ::memcpy(allItems[index]->features, features, size); allItems[index]->featuresSize = size; if (opened) { UpdateRecord(index); } }
ECode Int32ArrayBuffer::Put( /* [in] */ Int32 index, /* [in] */ Int32 d) { if (mIsReadOnly) { // throw new ReadOnlyBufferException(); return E_READ_ONLY_BUFFER_EXCEPTION; } FAIL_RETURN(CheckIndex(index)); (*mBackingArray)[mArrayOffset + index] = d; return NOERROR; }
bool CheckVariable_AddressExpression(int& expSourcePtr) { bool bIndex = false; if (!CheckIndex(bIndex, expSourcePtr)) { return false; } if (!bIndex) { g_pCompilerData->error = true; g_pCompilerData->error_msg = g_pErrorStrings[error_eleftb]; return false; } return true; }
int64_t RedisDriver::ToInt64(int nElemIndex) { if (!CheckIndex()) { return 0; } redisReply* pReply = m_pReplyArray[m_nFetchIndex]->element[nElemIndex]; if (pReply->type == REDIS_REPLY_INTEGER) { return (int64_t)pReply->integer; } else { return (int64_t)atoll(pReply->str ? pReply->str : ""); } }
int CUploadTask::GetUploadIndex( ULONGLONG &ullPos,ULONGLONG &ullSize ) { if (m_UnFinish.Size()==0) return -1; if (m_Item.strUploadId==_T("")) { ullPos=m_UnFinish.m_DataPairs[0].m_ullFirstMark; ullSize=m_UnFinish.m_DataPairs[0].m_ullLastMark-m_UnFinish.m_DataPairs[0].m_ullFirstMark+1; return 0; } else { ullPos=m_UnFinish.m_DataPairs[0].m_ullFirstMark; ullSize=m_UnFinish.m_DataPairs[0].m_ullLastMark-m_UnFinish.m_DataPairs[0].m_ullFirstMark+1; if (ullSize>m_ullPiecesize) ullSize=m_ullPiecesize; return CheckIndex(ullPos); } }
ColumnType FunctionContext::GetColumnType(unsigned int index) const { CheckIndex(index); return static_cast<SQLite::ColumnType>(sqlite3_value_type(argv_[index])); }
bool FunctionContext::IsNullValue(unsigned int index) const { CheckIndex(index); return sqlite3_value_type(argv_[index]) == SQLITE_NULL; }
string CVLDatabase::FaceID(int index) { CheckIndex(index); return allItems[index]->faceId; }
DWORD CVLDatabase::FeaturesSize(int index) { CheckIndex(index); return allItems[index]->featuresSize; }
const BYTE *CVLDatabase::Features(int index) { CheckIndex(index); return (BYTE *)allItems[index]->features; }
/** * Gets id. */ int CVLDatabase::ID(int index) { CheckIndex(index); return allItems[index]->id; }
std::string FunctionContext::GetStringValue(unsigned int index) const { CheckIndex(index); return std::string(reinterpret_cast<const char*>(sqlite3_value_text(argv_[index]))); }
int64_t FunctionContext::GetInt64Value(unsigned int index) const { CheckIndex(index); return sqlite3_value_int64(argv_[index]); }
bool CheckVariable(bool& bVariable, unsigned char& type, unsigned char& size, int& address, int& indexSourcePtr) { address = g_pElementizer->GetValue(); indexSourcePtr = 0; unsigned char varType = (unsigned char)(g_pElementizer->GetType() & 0xFF); if (varType >= type_var_byte && varType <= type_var_long) { type = type_var_byte; // adjust address base on the var size if (varType < type_var_long) { address += g_pCompilerData->var_long; } if (varType == type_var_byte) { address += g_pCompilerData->var_word; } } else if (varType >= type_dat_byte && varType <= type_dat_long) { type = type_dat_byte; } else if (varType >= type_loc_byte && varType <= type_loc_long) { type = type_loc_byte; } else { type = varType; if (varType == type_size) { size = (unsigned char)(g_pElementizer->GetValue() & 0xFF); if (!CheckVariable_AddressExpression(address)) { return false; } bool bIndex = false; if (!CheckIndex(bIndex, indexSourcePtr)) { return false; } bVariable = true; return true; } else { size = 2; if (varType == type_spr) { if (!CheckVariable_AddressExpression(address)) { return false; } bVariable = true; return true; } else if (varType == type_reg) { bool bIndex = false; if (!CheckIndexRange(bIndex, indexSourcePtr)) { return false; } if (bIndex) { size = 3; } bVariable = true; return true; } else { bVariable = false; return true; } } } // if we got here then it's a var/dat/loc type // set size size = varType; size -= type; bool bIndex = false; if (!CheckIndex(bIndex, indexSourcePtr)) { return false; } if (!bIndex) { // check for .byte/word/long{[index]} if (g_pElementizer->CheckElement(type_dot)) { bool bEof = false; if (!g_pElementizer->GetNext(bEof)) // get byte/word/long { return false; } if (g_pElementizer->GetType() != type_size) { g_pCompilerData->error = true; g_pCompilerData->error_msg = g_pErrorStrings[error_ebwol]; return false; } if (size < (g_pElementizer->GetValue() & 0xFF)) // new size must be same or smaller { g_pCompilerData->error = true; g_pCompilerData->error_msg = g_pErrorStrings[error_sombs]; return false; } size = (g_pElementizer->GetValue() & 0xFF); // update size bool bIndexCheck = false; if (!CheckIndex(bIndexCheck, indexSourcePtr)) { return false; } } } bVariable = true; return true; }
double FunctionContext::GetDoubleValue(unsigned int index) const { CheckIndex(index); return sqlite3_value_double(argv_[index]); }
BSTR CStringCollect::GetItem(long nIndex) { CheckIndex(nIndex); return m_strArray.ElementAt((int)nIndex-1).AllocSysString(); }
void S9xTraceCPUToBuf(char *output) { static PC_t pc; char t[256]; char *s = output; pc.xPBPC = Registers.PBPC; sprintf(s, "%.6x ", (uint32)pc.xPBPC); uint8 op = dreadb(pc.xPBPC); pc.W.xPC++; uint8 op0 = dreadb(pc.xPBPC); pc.W.xPC++; uint8 op1 = dreadb(pc.xPBPC); pc.W.xPC++; uint8 op2 = dreadb(pc.xPBPC); #define op8 ((op0)) #define op16 ((op0) | (op1 << 8)) #define op24 ((op0) | (op1 << 8) | (op2 << 16)) #define a8 (CheckEmulation() || CheckMemory()) #define x8 (CheckEmulation() || CheckIndex()) switch(op) { case 0x00: sprintf(t, "brk #$%.2x ", op8); break; case 0x01: sprintf(t, "ora ($%.2x,x) [%.6x]", op8, decode(OPTYPE_IDPX, op8)); break; case 0x02: sprintf(t, "cop #$%.2x ", op8); break; case 0x03: sprintf(t, "ora $%.2x,s [%.6x]", op8, decode(OPTYPE_SR, op8)); break; case 0x04: sprintf(t, "tsb $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x05: sprintf(t, "ora $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x06: sprintf(t, "asl $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x07: sprintf(t, "ora [$%.2x] [%.6x]", op8, decode(OPTYPE_ILDP, op8)); break; case 0x08: sprintf(t, "php "); break; case 0x09: if(a8)sprintf(t, "ora #$%.2x ", op8); else sprintf(t, "ora #$%.4x ", op16); break; case 0x0a: sprintf(t, "asl a "); break; case 0x0b: sprintf(t, "phd "); break; case 0x0c: sprintf(t, "tsb $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x0d: sprintf(t, "ora $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x0e: sprintf(t, "asl $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x0f: sprintf(t, "ora $%.6x [%.6x]", op24, decode(OPTYPE_LONG, op24)); break; case 0x10: sprintf(t, "bpl $%.4x [%.6x]", uint16(decode(OPTYPE_RELB, op8)), decode(OPTYPE_RELB, op8)); break; case 0x11: sprintf(t, "ora ($%.2x),y [%.6x]", op8, decode(OPTYPE_IDPY, op8)); break; case 0x12: sprintf(t, "ora ($%.2x) [%.6x]", op8, decode(OPTYPE_IDP, op8)); break; case 0x13: sprintf(t, "ora ($%.2x,s),y [%.6x]", op8, decode(OPTYPE_ISRY, op8)); break; case 0x14: sprintf(t, "trb $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x15: sprintf(t, "ora $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x16: sprintf(t, "asl $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x17: sprintf(t, "ora [$%.2x],y [%.6x]", op8, decode(OPTYPE_ILDPY, op8)); break; case 0x18: sprintf(t, "clc "); break; case 0x19: sprintf(t, "ora $%.4x,y [%.6x]", op16, decode(OPTYPE_ADDRY, op16)); break; case 0x1a: sprintf(t, "inc "); break; case 0x1b: sprintf(t, "tcs "); break; case 0x1c: sprintf(t, "trb $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x1d: sprintf(t, "ora $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0x1e: sprintf(t, "asl $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0x1f: sprintf(t, "ora $%.6x,x [%.6x]", op24, decode(OPTYPE_LONGX, op24)); break; case 0x20: sprintf(t, "jsr $%.4x [%.6x]", op16, decode(OPTYPE_ADDR_PC, op16)); break; case 0x21: sprintf(t, "and ($%.2x,x) [%.6x]", op8, decode(OPTYPE_IDPX, op8)); break; case 0x22: sprintf(t, "jsl $%.6x [%.6x]", op24, decode(OPTYPE_LONG, op24)); break; case 0x23: sprintf(t, "and $%.2x,s [%.6x]", op8, decode(OPTYPE_SR, op8)); break; case 0x24: sprintf(t, "bit $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x25: sprintf(t, "and $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x26: sprintf(t, "rol $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x27: sprintf(t, "and [$%.2x] [%.6x]", op8, decode(OPTYPE_ILDP, op8)); break; case 0x28: sprintf(t, "plp "); break; case 0x29: if(a8)sprintf(t, "and #$%.2x ", op8); else sprintf(t, "and #$%.4x ", op16); break; case 0x2a: sprintf(t, "rol a "); break; case 0x2b: sprintf(t, "pld "); break; case 0x2c: sprintf(t, "bit $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x2d: sprintf(t, "and $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x2e: sprintf(t, "rol $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x2f: sprintf(t, "and $%.6x [%.6x]", op24, decode(OPTYPE_LONG, op24)); break; case 0x30: sprintf(t, "bmi $%.4x [%.6x]", uint16(decode(OPTYPE_RELB, op8)), decode(OPTYPE_RELB, op8)); break; case 0x31: sprintf(t, "and ($%.2x),y [%.6x]", op8, decode(OPTYPE_IDPY, op8)); break; case 0x32: sprintf(t, "and ($%.2x) [%.6x]", op8, decode(OPTYPE_IDP, op8)); break; case 0x33: sprintf(t, "and ($%.2x,s),y [%.6x]", op8, decode(OPTYPE_ISRY, op8)); break; case 0x34: sprintf(t, "bit $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x35: sprintf(t, "and $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x36: sprintf(t, "rol $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x37: sprintf(t, "and [$%.2x],y [%.6x]", op8, decode(OPTYPE_ILDPY, op8)); break; case 0x38: sprintf(t, "sec "); break; case 0x39: sprintf(t, "and $%.4x,y [%.6x]", op16, decode(OPTYPE_ADDRY, op16)); break; case 0x3a: sprintf(t, "dec "); break; case 0x3b: sprintf(t, "tsc "); break; case 0x3c: sprintf(t, "bit $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0x3d: sprintf(t, "and $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0x3e: sprintf(t, "rol $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0x3f: sprintf(t, "and $%.6x,x [%.6x]", op24, decode(OPTYPE_LONGX, op24)); break; case 0x40: sprintf(t, "rti "); break; case 0x41: sprintf(t, "eor ($%.2x,x) [%.6x]", op8, decode(OPTYPE_IDPX, op8)); break; case 0x42: sprintf(t, "wdm "); break; case 0x43: sprintf(t, "eor $%.2x,s [%.6x]", op8, decode(OPTYPE_SR, op8)); break; case 0x44: sprintf(t, "mvp $%.2x,$%.2x ", op1, op8); break; case 0x45: sprintf(t, "eor $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x46: sprintf(t, "lsr $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x47: sprintf(t, "eor [$%.2x] [%.6x]", op8, decode(OPTYPE_ILDP, op8)); break; case 0x48: sprintf(t, "pha "); break; case 0x49: if(a8)sprintf(t, "eor #$%.2x ", op8); else sprintf(t, "eor #$%.4x ", op16); break; case 0x4a: sprintf(t, "lsr a "); break; case 0x4b: sprintf(t, "phk "); break; case 0x4c: sprintf(t, "jmp $%.4x [%.6x]", op16, decode(OPTYPE_ADDR_PC, op16)); break; case 0x4d: sprintf(t, "eor $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x4e: sprintf(t, "lsr $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x4f: sprintf(t, "eor $%.6x [%.6x]", op24, decode(OPTYPE_LONG, op24)); break; case 0x50: sprintf(t, "bvc $%.4x [%.6x]", uint16(decode(OPTYPE_RELB, op8)), decode(OPTYPE_RELB, op8)); break; case 0x51: sprintf(t, "eor ($%.2x),y [%.6x]", op8, decode(OPTYPE_IDPY, op8)); break; case 0x52: sprintf(t, "eor ($%.2x) [%.6x]", op8, decode(OPTYPE_IDP, op8)); break; case 0x53: sprintf(t, "eor ($%.2x,s),y [%.6x]", op8, decode(OPTYPE_ISRY, op8)); break; case 0x54: sprintf(t, "mvn $%.2x,$%.2x ", op1, op8); break; case 0x55: sprintf(t, "eor $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x56: sprintf(t, "lsr $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x57: sprintf(t, "eor [$%.2x],y [%.6x]", op8, decode(OPTYPE_ILDPY, op8)); break; case 0x58: sprintf(t, "cli "); break; case 0x59: sprintf(t, "eor $%.4x,y [%.6x]", op16, decode(OPTYPE_ADDRY, op16)); break; case 0x5a: sprintf(t, "phy "); break; case 0x5b: sprintf(t, "tcd "); break; case 0x5c: sprintf(t, "jml $%.6x [%.6x]", op24, decode(OPTYPE_LONG, op24)); break; case 0x5d: sprintf(t, "eor $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0x5e: sprintf(t, "lsr $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0x5f: sprintf(t, "eor $%.6x,x [%.6x]", op24, decode(OPTYPE_LONGX, op24)); break; case 0x60: sprintf(t, "rts "); break; case 0x61: sprintf(t, "adc ($%.2x,x) [%.6x]", op8, decode(OPTYPE_IDPX, op8)); break; case 0x62: sprintf(t, "per $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x63: sprintf(t, "adc $%.2x,s [%.6x]", op8, decode(OPTYPE_SR, op8)); break; case 0x64: sprintf(t, "stz $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x65: sprintf(t, "adc $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x66: sprintf(t, "ror $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x67: sprintf(t, "adc [$%.2x] [%.6x]", op8, decode(OPTYPE_ILDP, op8)); break; case 0x68: sprintf(t, "pla "); break; case 0x69: if(a8)sprintf(t, "adc #$%.2x ", op8); else sprintf(t, "adc #$%.4x ", op16); break; case 0x6a: sprintf(t, "ror a "); break; case 0x6b: sprintf(t, "rtl "); break; case 0x6c: sprintf(t, "jmp ($%.4x) [%.6x]", op16, decode(OPTYPE_IADDR_PC, op16)); break; case 0x6d: sprintf(t, "adc $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x6e: sprintf(t, "ror $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x6f: sprintf(t, "adc $%.6x [%.6x]", op24, decode(OPTYPE_LONG, op24)); break; case 0x70: sprintf(t, "bvs $%.4x [%.6x]", uint16(decode(OPTYPE_RELB, op8)), decode(OPTYPE_RELB, op8)); break; case 0x71: sprintf(t, "adc ($%.2x),y [%.6x]", op8, decode(OPTYPE_IDPY, op8)); break; case 0x72: sprintf(t, "adc ($%.2x) [%.6x]", op8, decode(OPTYPE_IDP, op8)); break; case 0x73: sprintf(t, "adc ($%.2x,s),y [%.6x]", op8, decode(OPTYPE_ISRY, op8)); break; case 0x74: sprintf(t, "stz $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x75: sprintf(t, "adc $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x76: sprintf(t, "ror $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x77: sprintf(t, "adc [$%.2x],y [%.6x]", op8, decode(OPTYPE_ILDPY, op8)); break; case 0x78: sprintf(t, "sei "); break; case 0x79: sprintf(t, "adc $%.4x,y [%.6x]", op16, decode(OPTYPE_ADDRY, op16)); break; case 0x7a: sprintf(t, "ply "); break; case 0x7b: sprintf(t, "tdc "); break; case 0x7c: sprintf(t, "jmp ($%.4x,x) [%.6x]", op16, decode(OPTYPE_IADDRX, op16)); break; case 0x7d: sprintf(t, "adc $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0x7e: sprintf(t, "ror $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0x7f: sprintf(t, "adc $%.6x,x [%.6x]", op24, decode(OPTYPE_LONGX, op24)); break; case 0x80: sprintf(t, "bra $%.4x [%.6x]", uint16(decode(OPTYPE_RELB, op8)), decode(OPTYPE_RELB, op8)); break; case 0x81: sprintf(t, "sta ($%.2x,x) [%.6x]", op8, decode(OPTYPE_IDPX, op8)); break; case 0x82: sprintf(t, "brl $%.4x [%.6x]", uint16(decode(OPTYPE_RELW, op16)), decode(OPTYPE_RELW, op16)); break; case 0x83: sprintf(t, "sta $%.2x,s [%.6x]", op8, decode(OPTYPE_SR, op8)); break; case 0x84: sprintf(t, "sty $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x85: sprintf(t, "sta $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x86: sprintf(t, "stx $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0x87: sprintf(t, "sta [$%.2x] [%.6x]", op8, decode(OPTYPE_ILDP, op8)); break; case 0x88: sprintf(t, "dey "); break; case 0x89: if(a8)sprintf(t, "bit #$%.2x ", op8); else sprintf(t, "bit #$%.4x ", op16); break; case 0x8a: sprintf(t, "txa "); break; case 0x8b: sprintf(t, "phb "); break; case 0x8c: sprintf(t, "sty $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x8d: sprintf(t, "sta $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x8e: sprintf(t, "stx $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x8f: sprintf(t, "sta $%.6x [%.6x]", op24, decode(OPTYPE_LONG, op24)); break; case 0x90: sprintf(t, "bcc $%.4x [%.6x]", uint16(decode(OPTYPE_RELB, op8)), decode(OPTYPE_RELB, op8)); break; case 0x91: sprintf(t, "sta ($%.2x),y [%.6x]", op8, decode(OPTYPE_IDPY, op8)); break; case 0x92: sprintf(t, "sta ($%.2x) [%.6x]", op8, decode(OPTYPE_IDP, op8)); break; case 0x93: sprintf(t, "sta ($%.2x,s),y [%.6x]", op8, decode(OPTYPE_ISRY, op8)); break; case 0x94: sprintf(t, "sty $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x95: sprintf(t, "sta $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0x96: sprintf(t, "stx $%.2x,y [%.6x]", op8, decode(OPTYPE_DPY, op8)); break; case 0x97: sprintf(t, "sta [$%.2x],y [%.6x]", op8, decode(OPTYPE_ILDPY, op8)); break; case 0x98: sprintf(t, "tya "); break; case 0x99: sprintf(t, "sta $%.4x,y [%.6x]", op16, decode(OPTYPE_ADDRY, op16)); break; case 0x9a: sprintf(t, "txs "); break; case 0x9b: sprintf(t, "txy "); break; case 0x9c: sprintf(t, "stz $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0x9d: sprintf(t, "sta $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0x9e: sprintf(t, "stz $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0x9f: sprintf(t, "sta $%.6x,x [%.6x]", op24, decode(OPTYPE_LONGX, op24)); break; case 0xa0: if(x8)sprintf(t, "ldy #$%.2x ", op8); else sprintf(t, "ldy #$%.4x ", op16); break; case 0xa1: sprintf(t, "lda ($%.2x,x) [%.6x]", op8, decode(OPTYPE_IDPX, op8)); break; case 0xa2: if(x8)sprintf(t, "ldx #$%.2x ", op8); else sprintf(t, "ldx #$%.4x ", op16); break; case 0xa3: sprintf(t, "lda $%.2x,s [%.6x]", op8, decode(OPTYPE_SR, op8)); break; case 0xa4: sprintf(t, "ldy $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0xa5: sprintf(t, "lda $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0xa6: sprintf(t, "ldx $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0xa7: sprintf(t, "lda [$%.2x] [%.6x]", op8, decode(OPTYPE_ILDP, op8)); break; case 0xa8: sprintf(t, "tay "); break; case 0xa9: if(a8)sprintf(t, "lda #$%.2x ", op8); else sprintf(t, "lda #$%.4x ", op16); break; case 0xaa: sprintf(t, "tax "); break; case 0xab: sprintf(t, "plb "); break; case 0xac: sprintf(t, "ldy $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0xad: sprintf(t, "lda $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0xae: sprintf(t, "ldx $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0xaf: sprintf(t, "lda $%.6x [%.6x]", op24, decode(OPTYPE_LONG, op24)); break; case 0xb0: sprintf(t, "bcs $%.4x [%.6x]", uint16(decode(OPTYPE_RELB, op8)), decode(OPTYPE_RELB, op8)); break; case 0xb1: sprintf(t, "lda ($%.2x),y [%.6x]", op8, decode(OPTYPE_IDPY, op8)); break; case 0xb2: sprintf(t, "lda ($%.2x) [%.6x]", op8, decode(OPTYPE_IDP, op8)); break; case 0xb3: sprintf(t, "lda ($%.2x,s),y [%.6x]", op8, decode(OPTYPE_ISRY, op8)); break; case 0xb4: sprintf(t, "ldy $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0xb5: sprintf(t, "lda $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0xb6: sprintf(t, "ldx $%.2x,y [%.6x]", op8, decode(OPTYPE_DPY, op8)); break; case 0xb7: sprintf(t, "lda [$%.2x],y [%.6x]", op8, decode(OPTYPE_ILDPY, op8)); break; case 0xb8: sprintf(t, "clv "); break; case 0xb9: sprintf(t, "lda $%.4x,y [%.6x]", op16, decode(OPTYPE_ADDRY, op16)); break; case 0xba: sprintf(t, "tsx "); break; case 0xbb: sprintf(t, "tyx "); break; case 0xbc: sprintf(t, "ldy $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0xbd: sprintf(t, "lda $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0xbe: sprintf(t, "ldx $%.4x,y [%.6x]", op16, decode(OPTYPE_ADDRY, op16)); break; case 0xbf: sprintf(t, "lda $%.6x,x [%.6x]", op24, decode(OPTYPE_LONGX, op24)); break; case 0xc0: if(x8)sprintf(t, "cpy #$%.2x ", op8); else sprintf(t, "cpy #$%.4x ", op16); break; case 0xc1: sprintf(t, "cmp ($%.2x,x) [%.6x]", op8, decode(OPTYPE_IDPX, op8)); break; case 0xc2: sprintf(t, "rep #$%.2x ", op8); break; case 0xc3: sprintf(t, "cmp $%.2x,s [%.6x]", op8, decode(OPTYPE_SR, op8)); break; case 0xc4: sprintf(t, "cpy $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0xc5: sprintf(t, "cmp $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0xc6: sprintf(t, "dec $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0xc7: sprintf(t, "cmp [$%.2x] [%.6x]", op8, decode(OPTYPE_ILDP, op8)); break; case 0xc8: sprintf(t, "iny "); break; case 0xc9: if(a8)sprintf(t, "cmp #$%.2x ", op8); else sprintf(t, "cmp #$%.4x ", op16); break; case 0xca: sprintf(t, "dex "); break; case 0xcb: sprintf(t, "wai "); break; case 0xcc: sprintf(t, "cpy $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0xcd: sprintf(t, "cmp $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0xce: sprintf(t, "dec $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0xcf: sprintf(t, "cmp $%.6x [%.6x]", op24, decode(OPTYPE_LONG, op24)); break; case 0xd0: sprintf(t, "bne $%.4x [%.6x]", uint16(decode(OPTYPE_RELB, op8)), decode(OPTYPE_RELB, op8)); break; case 0xd1: sprintf(t, "cmp ($%.2x),y [%.6x]", op8, decode(OPTYPE_IDPY, op8)); break; case 0xd2: sprintf(t, "cmp ($%.2x) [%.6x]", op8, decode(OPTYPE_IDP, op8)); break; case 0xd3: sprintf(t, "cmp ($%.2x,s),y [%.6x]", op8, decode(OPTYPE_ISRY, op8)); break; case 0xd4: sprintf(t, "pei ($%.2x) [%.6x]", op8, decode(OPTYPE_IDP, op8)); break; case 0xd5: sprintf(t, "cmp $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0xd6: sprintf(t, "dec $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0xd7: sprintf(t, "cmp [$%.2x],y [%.6x]", op8, decode(OPTYPE_ILDPY, op8)); break; case 0xd8: sprintf(t, "cld "); break; case 0xd9: sprintf(t, "cmp $%.4x,y [%.6x]", op16, decode(OPTYPE_ADDRY, op16)); break; case 0xda: sprintf(t, "phx "); break; case 0xdb: sprintf(t, "stp "); break; case 0xdc: sprintf(t, "jmp [$%.4x] [%.6x]", op16, decode(OPTYPE_ILADDR, op16)); break; case 0xdd: sprintf(t, "cmp $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0xde: sprintf(t, "dec $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0xdf: sprintf(t, "cmp $%.6x,x [%.6x]", op24, decode(OPTYPE_LONGX, op24)); break; case 0xe0: if(x8)sprintf(t, "cpx #$%.2x ", op8); else sprintf(t, "cpx #$%.4x ", op16); break; case 0xe1: sprintf(t, "sbc ($%.2x,x) [%.6x]", op8, decode(OPTYPE_IDPX, op8)); break; case 0xe2: sprintf(t, "sep #$%.2x ", op8); break; case 0xe3: sprintf(t, "sbc $%.2x,s [%.6x]", op8, decode(OPTYPE_SR, op8)); break; case 0xe4: sprintf(t, "cpx $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0xe5: sprintf(t, "sbc $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0xe6: sprintf(t, "inc $%.2x [%.6x]", op8, decode(OPTYPE_DP, op8)); break; case 0xe7: sprintf(t, "sbc [$%.2x] [%.6x]", op8, decode(OPTYPE_ILDP, op8)); break; case 0xe8: sprintf(t, "inx "); break; case 0xe9: if(a8)sprintf(t, "sbc #$%.2x ", op8); else sprintf(t, "sbc #$%.4x ", op16); break; case 0xea: sprintf(t, "nop "); break; case 0xeb: sprintf(t, "xba "); break; case 0xec: sprintf(t, "cpx $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0xed: sprintf(t, "sbc $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0xee: sprintf(t, "inc $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0xef: sprintf(t, "sbc $%.6x [%.6x]", op24, decode(OPTYPE_LONG, op24)); break; case 0xf0: sprintf(t, "beq $%.4x [%.6x]", uint16(decode(OPTYPE_RELB, op8)), decode(OPTYPE_RELB, op8)); break; case 0xf1: sprintf(t, "sbc ($%.2x),y [%.6x]", op8, decode(OPTYPE_IDPY, op8)); break; case 0xf2: sprintf(t, "sbc ($%.2x) [%.6x]", op8, decode(OPTYPE_IDP, op8)); break; case 0xf3: sprintf(t, "sbc ($%.2x,s),y [%.6x]", op8, decode(OPTYPE_ISRY, op8)); break; case 0xf4: sprintf(t, "pea $%.4x [%.6x]", op16, decode(OPTYPE_ADDR, op16)); break; case 0xf5: sprintf(t, "sbc $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0xf6: sprintf(t, "inc $%.2x,x [%.6x]", op8, decode(OPTYPE_DPX, op8)); break; case 0xf7: sprintf(t, "sbc [$%.2x],y [%.6x]", op8, decode(OPTYPE_ILDPY, op8)); break; case 0xf8: sprintf(t, "sed "); break; case 0xf9: sprintf(t, "sbc $%.4x,y [%.6x]", op16, decode(OPTYPE_ADDRY, op16)); break; case 0xfa: sprintf(t, "plx "); break; case 0xfb: sprintf(t, "xce "); break; case 0xfc: sprintf(t, "jsr ($%.4x,x) [%.6x]", op16, decode(OPTYPE_IADDRX, op16)); break; case 0xfd: sprintf(t, "sbc $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0xfe: sprintf(t, "inc $%.4x,x [%.6x]", op16, decode(OPTYPE_ADDRX, op16)); break; case 0xff: sprintf(t, "sbc $%.6x,x [%.6x]", op24, decode(OPTYPE_LONGX, op24)); break; } #undef op8 #undef op16 #undef op24 #undef a8 #undef x8 strcat(s, t); strcat(s, " "); sprintf(t, "A:%.4x X:%.4x Y:%.4x S:%.4x D:%.4x DB:%.2x ", Registers.A.W, Registers.X.W, Registers.Y.W, Registers.S.W, Registers.D, Registers.DB); strcat(s, t); if(CheckEmulation()) { sprintf(t, "%c%c%c%c%c%c%c%c", CheckNegative() ? 'N' : 'n', CheckOverflow() ? 'V' : 'v', CheckMemory() ? '1' : '0', CheckIndex() ? 'B' : 'b', CheckDecimal() ? 'D' : 'd', CheckIRQ() ? 'I' : 'i', CheckZero() ? 'Z' : 'z', CheckCarry() ? 'C' : 'c'); } else { sprintf(t, "%c%c%c%c%c%c%c%c", CheckNegative() ? 'N' : 'n', CheckOverflow() ? 'V' : 'v', CheckMemory() ? 'M' : 'm', CheckIndex() ? 'X' : 'x', CheckDecimal() ? 'D' : 'd', CheckIRQ() ? 'I' : 'i', CheckZero() ? 'Z' : 'z', CheckCarry() ? 'C' : 'c'); } strcat(s, t); strcat(s, " "); //sprintf(t, "V:%3d H:%4d", cpu.vcounter(), cpu.hcounter()); sprintf(t, "V:%3d", CPU.V_Counter); strcat(s, t); //strcat(s, "\n"); }
void CStringCollect::SetItem(long nIndex, LPCTSTR lpszNewValue) { CheckIndex(nIndex); m_strArray.ElementAt((int)nIndex-1) = lpszNewValue; }