MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / MipsCheckImmediate

Function MipsCheckImmediate

pcsx2/DebugTools/MipsAssembler.cpp:278–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276
277
278bool MipsCheckImmediate(const char* Source, DebugInterface* cpu, int& dest, int& RetLen)
279{
280 char Buffer[512];
281 int BufferPos = 0;
282 int l;
283
284 if (MipsGetRegister(Source,l, MipsRegisters) != -1) // error
285 {
286 return false;
287 }
288
289 int SourceLen = 0;
290
291 while (true)
292 {
293 if (*Source == '\'' && *(Source+2) == '\'')
294 {
295 Buffer[BufferPos++] = *Source++;
296 Buffer[BufferPos++] = *Source++;
297 Buffer[BufferPos++] = *Source++;
298 SourceLen+=3;
299 continue;
300 }
301
302 if (*Source == 0 || *Source == '\n' || *Source == ',')
303 {
304 Buffer[BufferPos] = 0;
305 break;
306 }
307 if ( *Source == ' ' || *Source == '\t')
308 {
309 Source++;
310 SourceLen++;
311 continue;
312 }
313
314
315 if (*Source == '(') // could be part of the opcode
316 {
317 if (MipsGetRegister(Source+1,l, MipsRegisters) != -1) // end
318 {
319 Buffer[BufferPos] = 0;
320 break;
321 }
322 }
323 Buffer[BufferPos++] = *Source++;
324 SourceLen++;
325 }
326
327 if (BufferPos == 0) return false;
328 RetLen = SourceLen;
329
330 PostfixExpression postfix;
331 std::string error;
332 if (!cpu->initExpression(Buffer,postfix,error))
333 return false;
334
335 u64 value;

Callers 1

LoadEncodingMethod · 0.85

Calls 3

MipsGetRegisterFunction · 0.85
initExpressionMethod · 0.80
parseExpressionMethod · 0.80

Tested by

no test coverage detected