From 8487ed7416482c79a4d06e149982966713b5e21a Mon Sep 17 00:00:00 2001 From: uyjulian Date: Sat, 22 Feb 2020 11:04:22 -0600 Subject: [PATCH] Inline assembler compatibility with new toolchain --- ee_core/src/asm.S | 7 + ee_core/src/cheat_engine.S | 234 ++++++++++++++++++++++++++++ ee_core/src/gsm_engine.S | 153 ++++++++++++++++++ modules/ds34bt/iop/smsutils.s | 6 + modules/ds34usb/iop/smsutils.s | 6 + modules/iopcore/cdvdman/smsutils.s | 6 + modules/iopcore/udnl/udnl_asm.s | 6 + modules/network/SMSTCPIP/inet.s | 6 + modules/network/SMSUTILS/SMSUTILS.s | 6 + src/gui.c | 12 ++ 10 files changed, 442 insertions(+) diff --git a/ee_core/src/asm.S b/ee_core/src/asm.S index 47c814347..e2516eeab 100644 --- a/ee_core/src/asm.S +++ b/ee_core/src/asm.S @@ -387,10 +387,17 @@ InitRegsExecPS2: por $t1, $zero, $zero por $t2, $zero, $zero por $t3, $zero, $zero +.ifdef .gasversion. + por $a4, $zero, $zero + por $a5, $zero, $zero + por $a6, $zero, $zero + por $a7, $zero, $zero +.else por $t4, $zero, $zero por $t5, $zero, $zero por $t6, $zero, $zero por $t7, $zero, $zero +.endif por $s0, $zero, $zero por $s1, $zero, $zero por $s2, $zero, $zero diff --git a/ee_core/src/cheat_engine.S b/ee_core/src/cheat_engine.S index a50cbb868..ee1c9de1b 100644 --- a/ee_core/src/cheat_engine.S +++ b/ee_core/src/cheat_engine.S @@ -81,10 +81,17 @@ EngineHandler: sd $t1, 0x48($sp) sd $t2, 0x50($sp) sd $t3, 0x58($sp) +.ifdef .gasversion. + sd $a4, 0x60($sp) + sd $a5, 0x68($sp) + sd $a6, 0x70($sp) + sd $a7, 0x78($sp) +.else sd $t4, 0x60($sp) sd $t5, 0x68($sp) sd $t6, 0x70($sp) sd $t7, 0x78($sp) +.endif sd $s0, 0x80($sp) sd $s1, 0x88($sp) sd $s2, 0x90($sp) @@ -113,10 +120,17 @@ eh_jal: ld $s2, 0x90($sp) ld $s1, 0x88($sp) ld $s0, 0x80($sp) +.ifdef .gasversion. + ld $a7, 0x78($sp) + ld $a6, 0x70($sp) + ld $a5, 0x68($sp) + ld $a4, 0x60($sp) +.else ld $t7, 0x78($sp) ld $t6, 0x70($sp) ld $t5, 0x68($sp) ld $t4, 0x60($sp) +.endif ld $t3, 0x58($sp) ld $t2, 0x50($sp) ld $t1, 0x48($sp) @@ -152,11 +166,19 @@ CodeHandler: * $t0 - ptr to code list * $t1 - ptr to jump table for code types * $t3 - total number of codes +.ifdef .gasversion. + * $a4 - number of codes done +.else * $t4 - number of codes done +.endif */ lw $t3, numcodes beqz $t3, ch_ret +.ifdef .gasversion. + li $a4, 0 +.else li $t4, 0 +.endif la $t0, codelist la $t1, type_tab ch_loop: @@ -165,20 +187,33 @@ ch_loop: * $a0 - RAM address * $a1 - code value */ +.ifdef .gasversion. + sll $at, $a4, 3 +.else sll $at, $t4, 3 +.endif addu $t2, $t0, $at lw $a0, 0($t2) beqz $a0, next srl $a2, $a0, 28 sll $a2, 2 addu $a2, $t1 +.ifdef .gasversion. + lw $a5, 0($a2) + beqz $a5, next +.else lw $t5, 0($a2) beqz $t5, next +.endif sll $a0, 7 srl $a0, 7 /* jump to code type handler */ +.ifdef .gasversion. + jr $a5 +.else jr $t5 +.endif lw $a1, 4($t2) type_0: /* @@ -236,31 +271,70 @@ type_3: * * It increments/decrements the current value at address @a by value @v. */ +.ifdef .gasversion. + srl $a6, $a0, 20 + andi $at, $a6, 1 /* 0=inc, 1=dec */ +.else srl $t6, $a0, 20 andi $at, $t6, 1 /* 0=inc, 1=dec */ +.endif andi $a0, 0xffff sll $a1, 7 srl $a1, 7 +.ifdef .gasversion. + andi $a6, 6 /* zero for 8 bit */ + andi $a2, $a6, 2 /* non-zero for 16 bit */ + beqzl $a6, 1f + lbu $a5, 0($a1) +.else andi $t6, 6 /* zero for 8 bit */ andi $a2, $t6, 2 /* non-zero for 16 bit */ beqzl $t6, 1f lbu $t5, 0($a1) +.endif bnezl $a2, 1f +.ifdef .gasversion. + lhu $a5, 0($a1) + lw $a5, 0($a1) +.else lhu $t5, 0($a1) lw $t5, 0($a1) +.endif lw $a0, 8($t2) +.ifdef .gasversion. + addiu $a4, 1 +.else addiu $t4, 1 +.endif 1: beqzl $at, 2f +.ifdef .gasversion. + addu $a5, $a0 + subu $a5, $a0 +.else addu $t5, $a0 subu $t5, $a0 +.endif 2: +.ifdef .gasversion. + beqzl $a6, next + sb $a5, 0($a1) +.else beqzl $t6, next sb $t5, 0($a1) +.endif bnezl $a2, next +.ifdef .gasversion. + sh $a5, 0($a1) +.else sh $t5, 0($a1) +.endif b next +.ifdef .gasversion. + sw $a5, 0($a1) +.else sw $t5, 0($a1) +.endif type_4: /* * "32-bit constant serial write" @@ -274,7 +348,11 @@ type_4: */ lw $a2, 8($t2) lw $a3, 12($t2) +.ifdef .gasversion. + srl $a5, $a1, 16 +.else srl $t5, $a1, 16 +.endif andi $a1, 0xffff sll $a1, 2 1: @@ -282,11 +360,20 @@ type_4: nop sw $a2, 0($a0) addu $a2, $a3 +.ifdef .gasversion. + addiu $a5, -1 + bgtz $a5, 1b +.else addiu $t5, -1 bgtz $t5, 1b +.endif addu $a0, $a1 b next +.ifdef .gasversion. + addiu $a4, 1 +.else addiu $t4, 1 +.endif type_5: /* * "Copy bytes" @@ -299,15 +386,27 @@ type_5: */ lw $a2, 8($t2) 1: +.ifdef .gasversion. + lb $a5, 0($a0) +.else lb $t5, 0($a0) +.endif nop +.ifdef .gasversion. + sb $a5, 0($a2) +.else sb $t5, 0($a2) +.endif addiu $a2, 1 addiu $a1, -1 bgtz $a1, 1b addiu $a0, 1 b next +.ifdef .gasversion. + addiu $a4, 1 +.else addiu $t4, 1 +.endif type_6: /* * "Pointer write" @@ -327,22 +426,48 @@ type_6: * Loads 32-bit base address from address @a, adds offset @i to it, and * constantly writes the value @v to the final address. */ +.ifdef .gasversion. + lw $a5, 0($a0) +.else lw $t5, 0($a0) +.endif li $at, 0x3ffffffc +.ifdef .gasversion. + and $a5, $at + beqz $a5, 1f +.else and $t5, $at beqz $t5, 1f +.endif lhu $a2, 10($t2) lw $a3, 12($t2) +.ifdef .gasversion. + addu $a5, $a3 +.else addu $t5, $a3 +.endif beqzl $a2, 1f +.ifdef .gasversion. + sb $a1, 0($a5) +.else sb $a1, 0($t5) +.endif addiu $a2, -1 beqzl $a2, 1f +.ifdef .gasversion. + sh $a1, 0($a5) + sw $a1, 0($a5) +.else sh $a1, 0($t5) sw $a1, 0($t5) +.endif 1: b next +.ifdef .gasversion. + addiu $a4, 1 +.else addiu $t4, 1 +.endif type_7: /* * "Boolean operation" @@ -368,24 +493,52 @@ type_7: * Performs a bitwise logical operation between value @v and the value * stored at address @a. */ +.ifdef .gasversion. + srl $a6, $a1, 20 + andi $at, $a6, 1 /* 0=8 bit, 1=16 bit */ + andi $a6, 6 /* 0=OR, 2=AND, 4=XOR */ +.else srl $t6, $a1, 20 andi $at, $t6, 1 /* 0=8 bit, 1=16 bit */ andi $t6, 6 /* 0=OR, 2=AND, 4=XOR */ +.endif bnezl $at, 1f +.ifdef .gasversion. + lhu $a5, 0($a0) + lbu $a5, 0($a0) +.else lhu $t5, 0($a0) lbu $t5, 0($a0) +.endif 1: +.ifdef .gasversion. + beqzl $a6, 2f + or $a5, $a1 + addiu $a6, -2 + beqzl $a6, 2f + and $a5, $a1 + xor $a5, $a1 +.else beqzl $t6, 2f or $t5, $a1 addiu $t6, -2 beqzl $t6, 2f and $t5, $a1 xor $t5, $a1 +.endif 2: bnezl $at, next +.ifdef .gasversion. + sh $a5, 0($a0) +.else sh $t5, 0($a0) +.endif b next +.ifdef .gasversion. + sb $a5, 0($a0) +.else sb $t5, 0($a0) +.endif type_c: /* * "32-bit do all following codes if equal to" @@ -395,8 +548,13 @@ type_c: * All following codes will be executed only if 32-bit value at address * @a is equal to value @v. */ +.ifdef .gasversion. + lw $a5, 0($a0) + bne $a5, $a1, ch_ret +.else lw $t5, 0($a0) bne $t5, $a1, ch_ret +.endif nop b next nop @@ -419,50 +577,112 @@ type_d: */ srl $a3, $a1, 16 andi $a3, 1 +.ifdef .gasversion. + srl $a6, $a1, 20 +.else srl $t6, $a1, 20 +.endif srl $a2, $a1, 24 beqzl $a2, 1f /* set @n to 1 if 0 for compatibility */ li $a2, 1 1: beqz $a3, 2f +.ifdef .gasversion. + andi $a6, 7 + lbu $a5, 0($a0) +.else andi $t6, 7 lbu $t5, 0($a0) +.endif b 3f andi $a1, 0xff 2: +.ifdef .gasversion. + lhu $a5, 0($a0) +.else lhu $t5, 0($a0) +.endif andi $a1, 0xffff 3: +.ifdef .gasversion. + beqzl $a6, 4f /* equal */ + subu $a5, $a1 +.else beqzl $t6, 4f /* equal */ subu $t5, $a1 +.endif li $at, 1 /* not equal */ +.ifdef .gasversion. + beql $a6, $at, 5f + subu $a5, $a1 +.else beql $t6, $at, 5f subu $t5, $a1 +.endif li $at, 2 /* less than */ +.ifdef .gasversion. + beql $a6, $at, 5f + sltu $a5, $a1 +.else beql $t6, $at, 5f sltu $t5, $a1 +.endif li $at, 3 /* greater than */ +.ifdef .gasversion. + beql $a6, $at, 5f + sltu $a5, $a1, $a5 +.else beql $t6, $at, 5f sltu $t5, $a1, $t5 +.endif li $at, 4 /* NAND */ +.ifdef .gasversion. + beql $a6, $at, 4f + and $a5, $a1 +.else beql $t6, $at, 4f and $t5, $a1 +.endif li $at, 5 /* AND */ +.ifdef .gasversion. + beql $a6, $at, 5f + and $a5, $a1 +.else beql $t6, $at, 5f and $t5, $a1 +.endif li $at, 6 /* NOR */ +.ifdef .gasversion. + beql $a6, $at, 4f + or $a5, $a1 +.else beql $t6, $at, 4f or $t5, $a1 +.endif b 5f /* OR */ +.ifdef .gasversion. + or $a5, $a1 +.else or $t5, $a1 +.endif 4: /* skip if non-zero */ +.ifdef .gasversion. + bnezl $a5, next + addu $a4, $a2 +.else bnezl $t5, next addu $t4, $a2 +.endif b next nop 5: /* skip if zero */ +.ifdef .gasversion. + beqzl $a5, next + addu $a4, $a2 +.else beqzl $t5, next addu $t4, $a2 +.endif b next nop type_e: @@ -489,16 +709,30 @@ type_e: or $a2, $at sll $a0, $a1, 7 srl $a0, 7 +.ifdef .gasversion. + li $a5, 0xd0000000 + or $a5, $a0 +.else li $t5, 0xd0000000 or $t5, $a0 +.endif move $a1, $a2 +.ifdef .gasversion. + sw $a5, 0($t2) /* store converted address */ +.else sw $t5, 0($t2) /* store converted address */ +.endif b type_d sw $a1, 4($t2) /* store converted value */ next: /* next code */ +.ifdef .gasversion. + addiu $a4, 1 + sltu $at, $a4, $t3 +.else addiu $t4, 1 sltu $at, $t4, $t3 +.endif bnez $at, ch_loop nop ch_ret: diff --git a/ee_core/src/gsm_engine.S b/ee_core/src/gsm_engine.S index 3ae50e19f..d482bbf33 100644 --- a/ee_core/src/gsm_engine.S +++ b/ee_core/src/gsm_engine.S @@ -219,10 +219,17 @@ addiu $sp, $sp, 0x0010 # Restore sp during return # $t1 = rt # $t2 = value in rt # $t3 = base +.ifdef .gasversion. +# $a4 = address +# $a5 = address holding rt within array +# $a6 = address holding base within array +# $a7 = new value for rt +.else # $t4 = address # $t5 = address holding rt within array # $t6 = address holding base within array # $t7 = new value for rt +.endif # .globl GSHandler @@ -243,10 +250,17 @@ sq $t0, 0x080($k1) sq $t1, 0x090($k1) sq $t2, 0x0A0($k1) sq $t3, 0x0B0($k1) +.ifdef .gasversion. +sq $a4, 0x0C0($k1) +sq $a5, 0x0D0($k1) +sq $a6, 0x0E0($k1) +sq $a7, 0x0F0($k1) +.else sq $t4, 0x0C0($k1) sq $t5, 0x0D0($k1) sq $t6, 0x0E0($k1) sq $t7, 0x0F0($k1) +.endif sq $s0, 0x100($k1) sq $s1, 0x110($k1) sq $s2, 0x120($k1) @@ -649,16 +663,29 @@ andi $t1,$t1,0x0FFF addi $t1,$t1,1 # t1 = Source_Width = Source_DW + 1 divu $t1,$t0 # LO = Source_Pixels_Width = Source_Width / Source_Width_Scale dsrl32 $t0,$v1,0 +.ifdef .gasversion. +andi $a5,$t0,0x0FFF +mflo $a4 # t4 = LO = Source_Pixels_Width +addi $a6,$a5,1 # t6 = Target_Width = Target_DW + 1 +divu $a6,$a4 # LO = Target_Width_Scale = Target_Width / Source_Pixels_Width +.else andi $t5,$t0,0x0FFF mflo $t4 # t4 = LO = Source_Pixels_Width addi $t6,$t5,1 # t6 = Target_Width = Target_DW + 1 divu $t6,$t4 # LO = Target_Width_Scale = Target_Width / Source_Pixels_Width +.endif mflo $t0 # t0 = LO = Target_Width_Scale bne $t0,$zero,have_DISPLAY_write_2 # in case of (!Target_Width_Scale) nop # { +.ifdef .gasversion. +or $a7,$zero,$a5 # t7 = Target_DW = Target_Width - 1 +sub $t0,$a6,$a4 # t0 = Target_Width - Source_Pixels_Width +li $a4,0 # t4 = Target_MAGH = 0 +.else or $t7,$zero,$t5 # t7 = Target_DW = Target_Width - 1 sub $t0,$t6,$t4 # t0 = Target_Width - Source_Pixels_Width li $t4,0 # t4 = Target_MAGH = 0 +.endif beql $zero,$zero,have_DISPLAY_write_4 # } nop # otherwise # Target_Width_Scale nonzero @@ -669,10 +696,17 @@ bgtzl $t1,have_DISPLAY_write_3 # in case of (Target_Width_Scale > 16) or $t0,$zero,16 # t0 = Target_Width_Scale = 16; have_DISPLAY_write_3: +.ifdef .gasversion. +mult $t1,$a4,$t0 # LO = Calculated_Width = (Source_Pixels_Width * Target_Width_Scale) +addi $a7,$t1,-1 # t7 = Calculated_DW = Calculated_Width - 1 +addi $a4,$t0,-1 # t4 = Calculated_MAGH = Target_Width_Scale - 1 +sub $t0,$a5,$a7 # t0 = Target_DW - Calculated_DW +.else mult $t1,$t4,$t0 # LO = Calculated_Width = (Source_Pixels_Width * Target_Width_Scale) addi $t7,$t1,-1 # t7 = Calculated_DW = Calculated_Width - 1 addi $t4,$t0,-1 # t4 = Calculated_MAGH = Target_Width_Scale - 1 sub $t0,$t5,$t7 # t0 = Target_DW - Calculated_DW +.endif have_DISPLAY_write_4: # } dsra $t0,$t0,1 # t0 = t0 / 2 = Half_Excess_Width (can be negative) @@ -683,32 +717,71 @@ dsra $t0,$t0,1 # t0 = t0 / 2 = Half_Excess_Width (can be negative) # | DX | 11:0 | int 0:12:0 | x pos in display area (VCK units) | 0xFFF | # '------^-------^------------^---------------------------------------^-------^ andi $t1,$v1,0x0FFF # t1 = Target_DX +.ifdef .gasversion. +add $a6,$t0,$t1 # t6 = Calculated_DX = Target_DX + Half_Excess_Width +bltzl $a6,have_DISPLAY_write_5 # in case of (Calculated_DX < 0) +and $a6,$a6,$zero # Calculated_DX = 0; +.else add $t6,$t0,$t1 # t6 = Calculated_DX = Target_DX + Half_Excess_Width bltzl $t6,have_DISPLAY_write_5 # in case of (Calculated_DX < 0) and $t6,$t6,$zero # Calculated_DX = 0; +.endif have_DISPLAY_write_5: +.ifdef .gasversion. +sub $t0,$t1,$a6 # t0 = Target_DX - Calculated_DX +.else sub $t0,$t1,$t6 # t0 = Target_DX - Calculated_DX +.endif bgtzl $t0,have_DISPLAY_write_6 # in case of (Target_DX > Calculated_DX) +.ifdef .gasversion. +add $a7,$a7,$t0 # t7 = Calculated_DW = Calculated_DW + Target_DX - Calculated_DX # Target DW adjusted +.else add $t7,$t7,$t0 # t7 = Calculated_DW = Calculated_DW + Target_DX - Calculated_DX # Target DW adjusted +.endif have_DISPLAY_write_6: +.ifdef .gasversion. +andi $a7,$a7,0x0FFF +andi $a4,$a4,0x000F +andi $a6,$a6,0x0FFF +dsll32 $t0,$a7,0 # t0 = Calculated_DW +.else andi $t7,$t7,0x0FFF andi $t4,$t4,0x000F andi $t6,$t6,0x0FFF dsll32 $t0,$t7,0 # t0 = Calculated_DW +.endif or $v0,$v0,$t0 # v0 = Adapted_DISPLAY = (Adapted_DISPLAY) OR (Calculated_DW) +.ifdef .gasversion. +dsll $t0,$a4,23 +.else dsll $t0,$t4,23 +.endif or $v0,$v0,$t0 # v0 = Adapted_DISPLAY = (Adapted_DISPLAY) OR (Calculated_MAGH) lw $t1, X_offset($s2) # t1 = X_offset (signed) +.ifdef .gasversion. +add $a6, $a6, $t1 # t6 = Calculated_DX = Calculated_DX + X_offset +bltzl $a6, have_DISPLAY_write_7 # Is the result not greater or equal to zero? +move $a6, $zero # t6 = Calculated_DX = 0 +.else add $t6, $t6, $t1 # t6 = Calculated_DX = Calculated_DX + X_offset bltzl $t6, have_DISPLAY_write_7 # Is the result not greater or equal to zero? move $t6, $zero # t6 = Calculated_DX = 0 +.endif have_DISPLAY_write_7: +.ifdef .gasversion. +andi $a6,$a6,0x0FFF +.else andi $t6,$t6,0x0FFF +.endif +.ifdef .gasversion. +or $v0,$v0,$a6 # v0 = Adapted_DISPLAY = (Adapted_DISPLAY) OR (Calculated_DX) +.else or $v0,$v0,$t6 # v0 = Adapted_DISPLAY = (Adapted_DISPLAY) OR (Calculated_DX) +.endif # ----- VERTICAL FIELDS ------- # .------.-------.------------.---------------------------------------.-------. @@ -731,17 +804,33 @@ andi $t1,$t1,0x07FF addi $t1,$t1,1 # Source_Height = Source_DH + 1 divu $t1,$t0 # LO = Source_Pixels_Height = Source_Height / Source_Height_Scale dsrl32 $t0,$v1,12 +.ifdef .gasversion. +andi $a5,$t0,0x07FF +mflo $a4 # t4 = LO = Source_Pixels_Height +addi $a6,$a5,1 # t6 = Target_Height = Target_DH + 1 +divu $a6,$a4 # LO = Target_Height_Scale = Target_Height / Source_Pixels_Height +.else andi $t5,$t0,0x07FF mflo $t4 # t4 = LO = Source_Pixels_Height addi $t6,$t5,1 # t6 = Target_Height = Target_DH + 1 divu $t6,$t4 # LO = Target_Height_Scale = Target_Height / Source_Pixels_Height +.endif mflo $t0 # t0 = LO = Target_Height_Scale bne $t0,$zero,have_DISPLAY_write_8 # in case of (!Target_Height_Scale) nop # { +.ifdef .gasversion. +or $a7,$zero,$a5 # t7 = Target_DH = Target_Height - 1 +sub $t0,$a6,$a4 # t0 = Target_Height - Source_Pixels_Height +.else or $t7,$zero,$t5 # t7 = Target_DH = Target_Height - 1 sub $t0,$t6,$t4 # t0 = Target_Height - Source_Pixels_Height +.endif b have_DISPLAY_write_10 # } +.ifdef .gasversion. +move $a4, $zero # t4 = Target_MAGV = 0 +.else move $t4, $zero # t4 = Target_MAGV = 0 +.endif # otherwise, Target_Height_Scale nonzero have_DISPLAY_write_8: # { @@ -750,10 +839,17 @@ bgtzl $t1,have_DISPLAY_write_9 # in case of (Target_Height_Scale > 4) or $t0,$zero,4 # t0 = Target_Height_Scale = 4; have_DISPLAY_write_9: +.ifdef .gasversion. +mult $t1,$a4,$t0 # t1 = Calculated_Height = (Source_Pixels_Height * Target_Height_Scale) +addi $a7,$t1,-1 # t7 = Calculated_DH = Calculated_Height - 1 +addi $a4,$t0,-1 # t4 = Calculated_MAGV = Target_Height_Scale - 1 +sub $t0,$a5,$a7 # t0 = Target_DH - Calculated_DH +.else mult $t1,$t4,$t0 # t1 = Calculated_Height = (Source_Pixels_Height * Target_Height_Scale) addi $t7,$t1,-1 # t7 = Calculated_DH = Calculated_Height - 1 addi $t4,$t0,-1 # t4 = Calculated_MAGV = Target_Height_Scale - 1 sub $t0,$t5,$t7 # t0 = Target_DH - Calculated_DH +.endif have_DISPLAY_write_10: # } dsra $t0,$t0,1 # t0 = t0 / 2 = Half_Excess_Height (can be negative) @@ -765,14 +861,28 @@ dsra $t0,$t0,1 # t0 = t0 / 2 = Half_Excess_Height (can be negative) # '------^-------^------------^---------------------------------------^-------^ dsrl $t1,$v1,12 andi $t1,$t1,0x07FF # t1 = Target_DY +.ifdef .gasversion. +add $a6,$t0,$t1 # t6 = Calculated_DY = Target_DY + Half_Excess_Height +bltzl $a6,have_DISPLAY_write_11 # in case of (Calculated_DY < 0) +and $a6,$a6,$zero # Calculated_DY = 0; +.else add $t6,$t0,$t1 # t6 = Calculated_DY = Target_DY + Half_Excess_Height bltzl $t6,have_DISPLAY_write_11 # in case of (Calculated_DY < 0) and $t6,$t6,$zero # Calculated_DY = 0; +.endif have_DISPLAY_write_11: +.ifdef .gasversion. +sub $t0,$t1,$a6 # t0 = Target_DY - Calculated_DY +.else sub $t0,$t1,$t6 # t0 = Target_DY - Calculated_DY +.endif bgtzl $t0,have_DISPLAY_write_12 # in case of (Target_DY > Calculated_DY) +.ifdef .gasversion. +add $a7,$a7,$t0 # t7 = Calculated_DH = Calculated_DH + Target_DY - Calculated_DY # Target DH adjusted +.else add $t7,$t7,$t0 # t7 = Calculated_DH = Calculated_DH + Target_DY - Calculated_DY # Target DH adjusted +.endif have_DISPLAY_write_12: lb $t0, Interlace_FRAME_Mode_Flag($s3) # in case of Double Height not needed @@ -783,30 +893,66 @@ ld $t0, Target_SMODE2($s1) andi $t0,$t0,1 # in case of Target_SMODE2.INT = 1 (Interlace Mode) bne $t0,$zero,have_DISPLAY_write_13 # Calculation is complete nop +.ifdef .gasversion. +beql $a4,$zero,have_DISPLAY_write_13 # in case of Calculated_MAGV = 0 +addi $a4,$a4,1 # go use Calculated_MAGV = Calculated_MAGV + 1 +addi $a4,$a4,2 # Calculated_MAGV = Calculated_MAGV + 2 (Because scale was 2 or larger) +addi $t0,$a4,-4 # Compare Calculated_MAGV with 4 (too large ?) +.else beql $t4,$zero,have_DISPLAY_write_13 # in case of Calculated_MAGV = 0 addi $t4,$t4,1 # go use Calculated_MAGV = Calculated_MAGV + 1 addi $t4,$t4,2 # Calculated_MAGV = Calculated_MAGV + 2 (Because scale was 2 or larger) addi $t0,$t4,-4 # Compare Calculated_MAGV with 4 (too large ?) +.endif bgezl $t0,have_DISPLAY_write_13 # in case of Calculated_MAGV too large +.ifdef .gasversion. +ori $a4,$zero,3 # go use Calculated_MAGV = 3 +.else ori $t4,$zero,3 # go use Calculated_MAGV = 3 +.endif have_DISPLAY_write_13: +.ifdef .gasversion. +andi $a7,$a7,0x07FF +andi $a4,$a4,0x0003 +andi $a6,$a6,0x07FF +dsll32 $t0,$a7,12 +.else andi $t7,$t7,0x07FF andi $t4,$t4,0x0003 andi $t6,$t6,0x07FF dsll32 $t0,$t7,12 +.endif or $v0,$v0,$t0 # v0 = Adapted_DISPLAY = (Adapted_DISPLAY) OR (Calculated_DH) +.ifdef .gasversion. +dsll $t0,$a4,27 +.else dsll $t0,$t4,27 +.endif or $v0,$v0,$t0 # v0 = Adapted_DISPLAY = (Adapted_DISPLAY) OR (Calculated_MAGV) lw $t1, Y_offset($s2) # t1 = Y_offset (signed) +.ifdef .gasversion. +add $a6, $a6, $t1 # t6 = Calculated_DY = Calculated_DY + Y_offset +bltzl $a6, have_DISPLAY_write_14 # Is the result not greater or equal to zero? +move $a6, $zero +.else add $t6, $t6, $t1 # t6 = Calculated_DY = Calculated_DY + Y_offset bltzl $t6, have_DISPLAY_write_14 # Is the result not greater or equal to zero? move $t6, $zero +.endif have_DISPLAY_write_14: +.ifdef .gasversion. +andi $a6,$a6,0x07FF +.else andi $t6,$t6,0x07FF +.endif +.ifdef .gasversion. +dsll $t0,$a6,12 +.else dsll $t0,$t6,12 +.endif jr $ra or $v0,$v0,$t0 # v0 = Adapted_DISPLAY = (Adapted_DISPLAY) OR (Calculated_DY) @@ -899,10 +1045,17 @@ lq $a3, 0x070($k0) # lq $t1, 0x090($k0) # lq $t2, 0x0A0($k0) lq $t3, 0x0B0($k0) +.ifdef .gasversion. +lq $a4, 0x0C0($k0) +lq $a5, 0x0D0($k0) +lq $a6, 0x0E0($k0) +lq $a7, 0x0F0($k0) +.else lq $t4, 0x0C0($k0) lq $t5, 0x0D0($k0) lq $t6, 0x0E0($k0) lq $t7, 0x0F0($k0) +.endif lq $s0, 0x100($k0) lq $s1, 0x110($k0) lq $s2, 0x120($k0) diff --git a/modules/ds34bt/iop/smsutils.s b/modules/ds34bt/iop/smsutils.s index 11eb997c8..3de679964 100644 --- a/modules/ds34bt/iop/smsutils.s +++ b/modules/ds34bt/iop/smsutils.s @@ -7,6 +7,12 @@ # Pulled out 'sde' library from MIPS. # by Eugene Plotnikov */ +.ifdef .gasversion. +.section .mdebug.abi32 +.nan legacy +.module softfloat +.module nooddspreg +.endif .set noreorder .set noat .set nomacro diff --git a/modules/ds34usb/iop/smsutils.s b/modules/ds34usb/iop/smsutils.s index 11eb997c8..3de679964 100644 --- a/modules/ds34usb/iop/smsutils.s +++ b/modules/ds34usb/iop/smsutils.s @@ -7,6 +7,12 @@ # Pulled out 'sde' library from MIPS. # by Eugene Plotnikov */ +.ifdef .gasversion. +.section .mdebug.abi32 +.nan legacy +.module softfloat +.module nooddspreg +.endif .set noreorder .set noat .set nomacro diff --git a/modules/iopcore/cdvdman/smsutils.s b/modules/iopcore/cdvdman/smsutils.s index 11eb997c8..3de679964 100644 --- a/modules/iopcore/cdvdman/smsutils.s +++ b/modules/iopcore/cdvdman/smsutils.s @@ -7,6 +7,12 @@ # Pulled out 'sde' library from MIPS. # by Eugene Plotnikov */ +.ifdef .gasversion. +.section .mdebug.abi32 +.nan legacy +.module softfloat +.module nooddspreg +.endif .set noreorder .set noat .set nomacro diff --git a/modules/iopcore/udnl/udnl_asm.s b/modules/iopcore/udnl/udnl_asm.s index bd4c260c5..4ca9da2a3 100644 --- a/modules/iopcore/udnl/udnl_asm.s +++ b/modules/iopcore/udnl/udnl_asm.s @@ -1,3 +1,9 @@ +.ifdef .gasversion. +.section .mdebug.abi32 +.nan legacy +.module softfloat +.module nooddspreg +.endif .set noat .set noreorder diff --git a/modules/network/SMSTCPIP/inet.s b/modules/network/SMSTCPIP/inet.s index ed40259a1..81a92a11d 100644 --- a/modules/network/SMSTCPIP/inet.s +++ b/modules/network/SMSTCPIP/inet.s @@ -6,6 +6,12 @@ # Licenced under Academic Free License version 2.0 # Review ps2sdk README & LICENSE files for further details. # +.ifdef .gasversion. +.section .mdebug.abi32 +.nan legacy +.module softfloat +.module nooddspreg +.endif .set noreorder .set nomacro diff --git a/modules/network/SMSUTILS/SMSUTILS.s b/modules/network/SMSUTILS/SMSUTILS.s index c4c41d81f..7f71b3cd4 100644 --- a/modules/network/SMSUTILS/SMSUTILS.s +++ b/modules/network/SMSUTILS/SMSUTILS.s @@ -7,6 +7,12 @@ # Pulled out 'sde' library from MIPS. # */ +.ifdef .gasversion. +.section .mdebug.abi32 +.nan legacy +.module softfloat +.module nooddspreg +.endif .set noreorder .set noat .set nomacro diff --git a/src/gui.c b/src/gui.c index 6283b4207..246c56f0b 100644 --- a/src/gui.c +++ b/src/gui.c @@ -1006,6 +1006,17 @@ static float fade(float t) static void VU0MixVec(VU_VECTOR *a, VU_VECTOR *b, float mix, VU_VECTOR *res) { asm( +#if __GNUC__ > 3 + "lqc2 $vf1, 0(%0)\n" // load the first vector + "lqc2 $vf2, 0(%1)\n" // load the second vector + "lw $2, 0(%2)\n" // load value from ptr to reg + "qmtc2 $2, $vf3\n" // load the mix value from reg to VU + "vaddw.x $vf5, $vf0, $vf0\n" // vf5.x = 1 + "vsub.x $vf4x, $vf5x, $vf3x\n" // subtract 1 - vf3,x, store the result in vf4.x + "vmulax.xyzw $ACC, $vf1, $vf3x\n" // multiply vf1 by vf3.x, store the result in ACC + "vmaddx.xyzw $vf1, $vf2, $vf4x\n" // multiply vf2 by vf4.x add ACC, store the result in vf1 + "sqc2 $vf1, 0(%3)\n" // transfer the result in acc to the ee +#else "lqc2 vf1, 0(%0)\n" // load the first vector "lqc2 vf2, 0(%1)\n" // load the second vector "lw $2, 0(%2)\n" // load value from ptr to reg @@ -1015,6 +1026,7 @@ static void VU0MixVec(VU_VECTOR *a, VU_VECTOR *b, float mix, VU_VECTOR *res) "vmulax.xyzw ACC, vf1, vf3x\n" // multiply vf1 by vf3.x, store the result in ACC "vmaddx.xyzw vf1, vf2, vf4x\n" // multiply vf2 by vf4.x add ACC, store the result in vf1 "sqc2 vf1, 0(%3)\n" // transfer the result in acc to the ee +#endif : : "r"(a), "r"(b), "r"(&mix), "r"(res)); }