;//////////////////////////////////////////////////////
;//         ETERNAL PUNISHMENT TITLE CODE PATCH


.psx

.open "2_EP/BIN/0681.BIN", 0x800AB000

.org 0x800b5300
.area 0xFC,0



    lhu v0,0x0(s0)
    move r4,s0           ;loading text addr to r4
    
    andi v0,0xff        ;clear text length

    addu s0,s0,v0         ;move text addr + charLen
    addiu s0,2          ;move text addr +2 (code)
    andi v0,v0,1
    beq v0,zero,notAnd1
    nop
    addiu s0,s0,1       ; make text addr odd (next line/code)
notAnd1:

    andi r5,s3,0xffff   ;load X
    andi r6,s1,0xffff   ;load Y
     li   r7, 1          ;white color
    jal 0x80090000      ;call print text
    sw r7,0x10(sp)      ;store shadow ON in stack+10

    lui v1,0x800c
    sw    v0,-0x6f8c(v1)           ;=>DAT_TITLE__800b9074       ;save DMAParams Addr???
    lhu v1,0x0(s0)          ;load next codes
    li  v0,0x1103           ;end text code
    beq v1,v0,textdone      ;this is end of text
    addiu s0,s0,2           ;move en
    addiu s1,s1,0xe     ; Y = Y + 14
    

nextLine:
    lhu v0,0x0(s0)



    move r4,s0           ;loading text addr to r4
    andi v0,0xff        ;clear text length

    addu s0,s0,v0         ;move text addr + charLen
    addiu s0,2          ;move text addr +2 (code)
    andi v0,v0,1
    beq v0,zero,notAnd1_2
    nop
    addiu s0,s0,1       ; make text addr odd (next line/code)
notAnd1_2:
    
    andi r5,s3,0xffff   ;load X
    andi r6,s1,0xffff   ;load Y
    jal 0x80090000      ;call print text
    li   r7, 1          ;white color
    lui v1,0x800c
    lw   r4,-0x6f8c(v1) ;=>DAT_TITLE__800b9074       ;load DMAParams Addr???
    jal 0x8001b8d8      ;       CloseTextDMA
    move r5,v0

    lhu v0,0x0(s0)
    li  v1,0x1103           ;end text code

    addiu s0,2          ;move text addr +2 (code)
    bne v1,v0,nextLine      ;this is end of text
    addiu s1,s1,0xe     ; Y = Y + 14

textdone:
.endarea
.close
