private List <UInt32> writeGetDescriptionForCustomSquareRoutine(AddressMapper addressMapper, VAVAddr routineStartAddress) { var asm = new List <UInt32>(); var gameUiTextGetString = addressMapper.toVersionAgnosticAddress((BSVAddr)0x800f78dc); var gameUiTextGetCardMsg = addressMapper.toVersionAgnosticAddress((BSVAddr)0x800f837c); var gameBoard = PowerPcAsm.make16bitValuePair((UInt32)addressMapper.toVersionAgnosticAddress((BSVAddr)0x8054d018)); asm.Add(PowerPcAsm.lis(7, gameBoard.upper16Bit)); // asm.Add(PowerPcAsm.addi(7, 7, gameBoard.lower16Bit)); // r7 <- start of gameboard table containing all squares asm.Add(PowerPcAsm.mulli(8, 24, 0x54)); // r8 <- squareId * 0x54 (the size of each square) asm.Add(PowerPcAsm.add(6, 7, 8)); // r6 <- the current square asm.Add(PowerPcAsm.lbz(8, 0x4d, 6)); // r8 <- square.squareType asm.Add(PowerPcAsm.cmpwi(8, 0x2e)); // if(square.squareType == 0x2e) asm.Add(PowerPcAsm.bne(3)); // { asm.Add(PowerPcAsm.lbz(4, 0x18, 6)); // r4 <- square.district_color asm.Add(PowerPcAsm.b(routineStartAddress, asm.Count, gameUiTextGetCardMsg)); // goto Game::uitext::get_card_message(r4) // } asm.Add(PowerPcAsm.li(6, 0x0)); // \ asm.Add(PowerPcAsm.li(7, 0x0)); // | No message arguments asm.Add(PowerPcAsm.li(8, 0x0)); // / asm.Add(PowerPcAsm.b(routineStartAddress, asm.Count, gameUiTextGetString)); // goto Game::uitext::get_string(r4, 0, 0, 0) return(asm); }