===========================================================================
| 6004 | |
| 6005 | //=========================================================================== |
| 6006 | int _SearchMemoryFind ( |
| 6007 | MemorySearchValues_t vMemorySearchValues, |
| 6008 | WORD nAddressStart, |
| 6009 | WORD nAddressEnd ) |
| 6010 | { |
| 6011 | int nFound = 0; |
| 6012 | |
| 6013 | g_vMemorySearchResults.clear(); |
| 6014 | g_vMemorySearchResults.push_back( NO_6502_TARGET ); |
| 6015 | |
| 6016 | uint32_t nAddress; // NB. can't be uint16_t, since need to count up to 0x10000 if nAddressEnd is 0xFFFF |
| 6017 | for ( nAddress = nAddressStart; nAddress <= nAddressEnd; nAddress++ ) |
| 6018 | { |
| 6019 | bool bMatchAll = true; |
| 6020 | |
| 6021 | uint32_t nAddress2 = nAddress; |
| 6022 | |
| 6023 | int nMemBlocks = (int) vMemorySearchValues.size(); |
| 6024 | for ( int iBlock = 0; iBlock < nMemBlocks; iBlock++, nAddress2++ ) |
| 6025 | { |
| 6026 | MemorySearch_t ms = vMemorySearchValues.at( iBlock ); |
| 6027 | ms.m_bFound = false; |
| 6028 | |
| 6029 | if ((ms.m_iType == MEM_SEARCH_BYTE_EXACT ) || |
| 6030 | (ms.m_iType == MEM_SEARCH_NIB_HIGH_EXACT) || |
| 6031 | (ms.m_iType == MEM_SEARCH_NIB_LOW_EXACT )) |
| 6032 | { |
| 6033 | BYTE nTarget = ReadByteFromMemory(nAddress2); |
| 6034 | |
| 6035 | if (ms.m_iType == MEM_SEARCH_NIB_LOW_EXACT) |
| 6036 | nTarget &= 0x0F; |
| 6037 | |
| 6038 | if (ms.m_iType == MEM_SEARCH_NIB_HIGH_EXACT) |
| 6039 | nTarget &= 0xF0; |
| 6040 | |
| 6041 | if (ms.m_nValue == nTarget) |
| 6042 | { // ms.m_nAddress = nAddress2; |
| 6043 | ms.m_bFound = true; |
| 6044 | continue; |
| 6045 | } |
| 6046 | else |
| 6047 | { |
| 6048 | bMatchAll = false; |
| 6049 | break; |
| 6050 | } |
| 6051 | } |
| 6052 | else |
| 6053 | if (ms.m_iType == MEM_SEARCH_BYTE_1_WILD) |
| 6054 | { |
| 6055 | // match by definition |
| 6056 | } |
| 6057 | else |
| 6058 | { |
| 6059 | // start 2ndary search |
| 6060 | // if next block matches, then this block matches (since we are wild) |
| 6061 | if ((iBlock + 1) == nMemBlocks) // there is no next block, hence we match |
| 6062 | continue; |
| 6063 |
no test coverage detected