Files
Persona2-PSX-asm-sources/2_EP/EP_city_calcs.asm
2025-11-25 10:59:13 +05:00

60 lines
1.5 KiB
NASM

/////////////////////////////////////////////////////////////////////////////////
//
// Persona 2 Eternal Punishment (PSX) JAP / Custom Characters/Data Patch
// Author: Sergey Shemet 21/11/2025
//
// v 1.0 - Patch for city text coords calculations
//
.psx
.open "2_EP/BIN/0721_CITYCODE.bin", 0x800AB000
.org 0x800c4700
GetNewChar:
addiu v1,v1,1
StartReading:
lhu v0,0x0(a0) ;a0 - curTextAddr
nop
sltiu v0,v0,0x1000
bne v0,zero,GetNewChar ;if currentChar<1000 - goto next addr+2b
addiu a0,a0,2
jr ra
move v0,v1 ;return v0,v1 - charsNum
RetunCharsToCity:
lhu v0,0x0(a0)
nop
srl v0,v0,0xD ;;;;Check 13th bit (1byte system !!!)
bne v0,zero,IsMy1byteCity
clear v1 ;v1 = charCount
j StartReading
nop
IsMy1byteCity:
lhu v0,0x0(a0)
nop
andi v0,v0,0xff ;Clear from cmd flag
jr ra
move v1,v0 ;return v0,v1 - charsNum
;check lenght for hiuse names for overallcoords calc
;.org 0x800ad30c
;jal RetunCharsToCity
;checklenghth for housename RECT
.org 0x800ad688
jal RetunCharsToCity
;.org 0x800af1dc
;jal RetunCharsToCityDiv2 ;OR ReturnCharsInString
;jal 0x8001af1c
.close
// compile with ./armips -sym 2_EP/BUILD_LOGS/0721_CITY.map -temp 2_EP/BUILD_LOGS/0721_CITY.txt 2_EP/EP_city_calcs.asm