Clean up codehandler formatting

This commit is contained in:
booto 2018-02-03 13:09:31 +08:00
parent aae8634a58
commit 8d1d8afd32

View File

@ -68,16 +68,14 @@ _start:
andi. r26,r26,0xF9FF andi. r26,r26,0xF9FF
mtmsr r26 mtmsr r26
stfd f2,152(r1) # stores f2 stfd f2,152(r1) # stores f2
stfd f3,160(r1) # stores f3 stfd f3,160(r1) # stores f3
lis r31,cheatdata@h #0x8000 lis r31,cheatdata@h #0x8000
lis r20, 0xCC00 lis r20, 0xCC00
lhz r28, 0x4010(r20) lhz r28, 0x4010(r20)
ori r21, r28, 0xFF ori r21, r28, 0xFF
sth r21, 0x4010(r20) # disable MP3 memory protection sth r21, 0x4010(r20) # disable MP3 memory protection
@ -103,8 +101,8 @@ _start:
bne- _exitcodehandler # lf no code list skip code handler bne- _exitcodehandler # lf no code list skip code handler
addi r15,r15,8 addi r15,r15,8
b _readcodes b _readcodes
_exitcodehandler:
_exitcodehandler:
sth r28,0x4010(r20) # restore memory protection value sth r28,0x4010(r20) # restore memory protection value
lfd f2,152(r1) # loads f2 lfd f2,152(r1) # loads f2
@ -160,7 +158,6 @@ _readcodes:
mr r12,r16 #lf pointer is used, address = pointer mr r12,r16 #lf pointer is used, address = pointer
cmpwi cr4,r5,0 #compares sub code type with 0 in cr4 cmpwi cr4,r5,0 #compares sub code type with 0 in cr4
cmpwi r10,1 cmpwi r10,1
@ -234,7 +231,6 @@ _write_string: #endianess ?
mr r9,r4 mr r9,r4
bne- cr7,_skip_and_align #lf code execution is false, skip string code data bne- cr7,_skip_and_align #lf code execution is false, skip string code data
_stb: _stb:
subic. r9,r9,1 #r9 -= 1 (and compares r9 with 0) subic. r9,r9,1 #r9 -= 1 (and compares r9 with 0)
blt- _skip_and_align #lf r9 < 0 then exit blt- _skip_and_align #lf r9 < 0 then exit
@ -258,7 +254,6 @@ _write_serial:
rlwinm r10,r5,16,20,31 #r10 = NNN (# of times to write -1) rlwinm r10,r5,16,20,31 #r10 = NNN (# of times to write -1)
rlwinm r5,r5,4,28,31 #r5 = T (0:8bits/1:16bits/2:32bits) rlwinm r5,r5,4,28,31 #r5 = T (0:8bits/1:16bits/2:32bits)
_loop_serial: _loop_serial:
cmpwi cr5,r5,1 cmpwi cr5,r5,1
beq- cr5,+16 #lf 16bits beq- cr5,+16 #lf 16bits
@ -305,8 +300,6 @@ _conditional:
bgt cr3,_addresscheck2 #lf code type==6 -> address check bgt cr3,_addresscheck2 #lf code type==6 -> address check
add r12,r12,r3 #address = (ba/po)+(XXXXXX) add r12,r12,r3 #address = (ba/po)+(XXXXXX)
blt cr3,+12 #jump lf code type <5 (==1) blt cr3,+12 #jump lf code type <5 (==1)
blt cr5,_condition_sub #compare [rN][rM] blt cr5,_condition_sub #compare [rN][rM]
b _conditional16_2 #counter compare b _conditional16_2 #counter compare
@ -349,7 +342,6 @@ _skip_LE:#2
_skip_GE:#3 _skip_GE:#3
blt- cr6,_true_end #CT23, CT27, CT2B or CT2F (lf r4<r4) blt- cr6,_true_end #CT23, CT27, CT2B or CT2F (lf r4<r4)
_skip: _skip:
ori r8,r8,1 #r8|=1 (execution status set to false) ori r8,r8,1 #r8|=1 (execution status set to false)
_true_end: _true_end:
@ -362,7 +354,6 @@ _true_end:
andi. r12,r8,0x1 #else lf.. code result true clear counter andi. r12,r8,0x1 #else lf.. code result true clear counter
beq _clearcounter beq _clearcounter
_increase_counter: _increase_counter:
addi r12,r11,0x10 #else increase the counter addi r12,r11,0x10 #else increase the counter
rlwimi r11,r12,0,12,27 #update counter rlwimi r11,r12,0,12,27 #update counter
@ -374,7 +365,6 @@ _savecounter:
stw r11,-8(r15) #save counter stw r11,-8(r15) #save counter
b _readcodes b _readcodes
#CT2============================================================================ #CT2============================================================================
#load base adress (0): 40TYZ00N XXXXXXXX = (load/add:T) ba from [(ba/po:Y)+XXXXXXXX(+rN:Z)] #load base adress (0): 40TYZ00N XXXXXXXX = (load/add:T) ba from [(ba/po:Y)+XXXXXXXX(+rN:Z)]
@ -394,7 +384,6 @@ _ba_pointer:
bne- cr7,_readcodes bne- cr7,_readcodes
rlwinm r9,r3,2,26,29 #r9 = extract N, makes N*4 rlwinm r9,r3,2,26,29 #r9 = extract N, makes N*4
rlwinm r14,r3,16,31,31 #r3 = add ba/po flag bit (Y) rlwinm r14,r3,16,31,31 #r3 = add ba/po flag bit (Y)
@ -425,7 +414,6 @@ _p01:
add r4,r12,r4 #address = XXXXXXXX (+rN) + (ba/po) add r4,r12,r4 #address = XXXXXXXX (+rN) + (ba/po)
cmpwi cr5,r14,1 cmpwi cr5,r14,1
beq cr5,+8 #address = (ba/po)+XXXXXXXX(+rN) beq cr5,+8 #address = (ba/po)+XXXXXXXX(+rN)
lwz r4,0(r4) #address = [(ba/po)+XXXXXXXX(+rN)] lwz r4,0(r4) #address = [(ba/po)+XXXXXXXX(+rN)]
@ -438,8 +426,6 @@ _p01:
add r4,r4,r16 #po += XXXXXXXX (+rN) + (ba/po) add r4,r4,r16 #po += XXXXXXXX (+rN) + (ba/po)
b _pend b _pend
_p2: _p2:
rlwinm. r5,r3,20,31,31 #r3 = rN use bit (Z) rlwinm. r5,r3,20,31,31 #r3 = rN use bit (Z)
beq +12 #flag is not set(=0), address = XXXXXXXX beq +12 #flag is not set(=0), address = XXXXXXXX
@ -453,7 +439,6 @@ _p2:
stwx r16,r12,r4 #[(ba/po)+XXXXXXXX] = pointer stwx r16,r12,r4 #[(ba/po)+XXXXXXXX] = pointer
b _readcodes b _readcodes
_pend: _pend:
bge cr4,+12 bge cr4,+12
mr r6,r4 #store result to base address mr r6,r4 #store result to base address
@ -461,7 +446,6 @@ _pend:
mr r16,r4 #store result to pointer mr r16,r4 #store result to pointer
b _readcodes b _readcodes
#CT3============================================================================ #CT3============================================================================
#set repeat (0): 6000ZZZZ 0000000P = set repeat #set repeat (0): 6000ZZZZ 0000000P = set repeat
#execute repeat (1): 62000000 0000000P = execute repeat #execute repeat (1): 62000000 0000000P = execute repeat
@ -484,7 +468,6 @@ _repeat_goto:
beq- cr7,_readcodes #S=1, skip lf false, don't skip lf true beq- cr7,_readcodes #S=1, skip lf false, don't skip lf true
b _b_bl_blr_nocheck b _b_bl_blr_nocheck
_b_bl_blr: _b_bl_blr:
bne- cr7,_readcodes #lf code execution set to false skip code bne- cr7,_readcodes #lf code execution set to false skip code
@ -507,8 +490,6 @@ _b:
add r15,r15,r4 #next code address +/-=line XXXX add r15,r15,r4 #next code address +/-=line XXXX
b _readcodes b _readcodes
_repeat: _repeat:
bne- cr7,_readcodes #lf code execution set to false skip code bne- cr7,_readcodes #lf code execution set to false skip code
@ -549,7 +530,6 @@ _execute_repeat:
_operation_rN: _operation_rN:
bne- cr7,_readcodes bne- cr7,_readcodes
rlwinm r11,r3,2,26,29 #r11 = extract N, makes N*4 rlwinm r11,r3,2,26,29 #r11 = extract N, makes N*4
@ -566,7 +546,6 @@ _operation_rN:
cmpwi cr4,r5,3 cmpwi cr4,r5,3
bge- cr4,_op34 #lf sub code type = 3/4 bge- cr4,_op34 #lf sub code type = 3/4
cmpwi cr4,r5,1 cmpwi cr4,r5,1
_op12: #load/store _op12: #load/store
@ -591,7 +570,6 @@ _load:
b _store_reg b _store_reg
_store: _store:
rlwinm r19,r3,28,20,31 #r9=r3 ror 12 (N84UYZZZ) rlwinm r19,r3,28,20,31 #r9=r3 ror 12 (N84UYZZZ)
_storeloop: _storeloop:
@ -616,26 +594,17 @@ _storeloopend:
bge _storeloop bge _storeloop
b _readcodes b _readcodes
_op0: _op0:
rlwinm. r5,r3,16,31,31 #+(ba/po) flag : Y rlwinm. r5,r3,16,31,31 #+(ba/po) flag : Y
beq +8 #value = XXXXXXXX beq +8 #value = XXXXXXXX
add r4,r4,r12 #value = XXXXXXXX+(ba/po) add r4,r4,r12 #value = XXXXXXXX+(ba/po)
andi. r5,r14,1 #add flag : S andi. r5,r14,1 #add flag : S
beq _store_reg #add flag not set (=0), rN=value beq _store_reg #add flag not set (=0), rN=value
add r4,r4,r9 #add flag set (=1), rN=rN+value add r4,r4,r9 #add flag set (=1), rN=rN+value
b _store_reg b _store_reg
_op34: #operation 1 & 2 _op34: #operation 1 & 2
rlwinm r10,r3,16,30,31 #extracts Y rlwinm r10,r3,16,30,31 #extracts Y
rlwinm r14,r4,2,26,29 #r14 = extract M (in r4), makes M*=4 rlwinm r14,r4,2,26,29 #r14 = extract M (in r4), makes M*=4
@ -644,32 +613,25 @@ _op34: #operation 1 & 2
bne cr4,+8 bne cr4,+8
subi r19,r15,4 #lf CT3, 2nd value address = XXXXXXXX's address subi r19,r15,4 #lf CT3, 2nd value address = XXXXXXXX's address
lwz r4,0(r26) #1st value = rN lwz r4,0(r26) #1st value = rN
lwz r9,0(r19) #2nd value = rM/XXXXXXXX lwz r9,0(r19) #2nd value = rM/XXXXXXXX
andi. r11,r10,1 #lf [] for 1st value andi. r11,r10,1 #lf [] for 1st value
beq +8 beq +8
mr r26,r4 mr r26,r4
andi. r11,r10,2 #lf [] for 2nd value andi. r11,r10,2 #lf [] for 2nd value
beq +16 beq +16
mr r19,r9 mr r19,r9
bne+ cr4,+8 bne+ cr4,+8
add r19,r12,r19 #lf CT3, 2nd value address = XXXXXXXX+(ba/op) add r19,r12,r19 #lf CT3, 2nd value address = XXXXXXXX+(ba/op)
rlwinm. r5,r3,12,28,31 #operation # flag : T rlwinm. r5,r3,12,28,31 #operation # flag : T
cmpwi r5,9 cmpwi r5,9
bge _op_float bge _op_float
_operation_bl: _operation_bl:
bl _operation_bl_return bl _operation_bl_return
@ -743,7 +705,6 @@ _operation_bl_return:
mtlr r10 mtlr r10
blr blr
#copy1 (5) : 8AYYYYNM XXXXXXXX = copy YYYY bytes from [rN] to ([rM]+)XXXXXXXX #copy1 (5) : 8AYYYYNM XXXXXXXX = copy YYYY bytes from [rN] to ([rM]+)XXXXXXXX
#copy2 (6) : 8CYYYYNM XXXXXXXX = copy YYYY bytes from ([rN]+)XXXXXX to [rM] #copy2 (6) : 8CYYYYNM XXXXXXXX = copy YYYY bytes from ([rN]+)XXXXXX to [rM]
@ -771,8 +732,6 @@ _op56:
cmpw r5,r4 cmpw r5,r4
b _copy_loop b _copy_loop
#=============================================================================== #===============================================================================
#This is a routine called by _memory_copy and _compare_NM_16 #This is a routine called by _memory_copy and _compare_NM_16
@ -798,7 +757,6 @@ _load_NM:
beq cr5,+8 beq cr5,+8
lhz r9,0(r9) #...and lf CT5 then M = 16 bits at [XXXXXX+base address] lhz r9,0(r9) #...and lf CT5 then M = 16 bits at [XXXXXX+base address]
blr blr
#CT5============================================================================ #CT5============================================================================
@ -830,7 +788,6 @@ _compare16_NM:
b _conditional b _conditional
_compare16_counter: _compare16_counter:
rlwinm r11,r3,28,16,31 #extract counter value from r3 in r11 rlwinm r11,r3,28,16,31 #extract counter value from r3 in r11
b _conditional b _conditional
@ -869,7 +826,6 @@ _hook_addresscheck:
bne- cr4,_hook1 #lf sub code type ==2 bne- cr4,_hook1 #lf sub code type ==2
_hook2: _hook2:
bne- cr7,_readcodes bne- cr7,_readcodes
@ -904,7 +860,6 @@ _hook1:
isync isync
b _skip_and_align b _skip_and_align
_addresscheck1: _addresscheck1:
cmpwi cr4,r5,6 cmpwi cr4,r5,6
beq cr4,_onoff beq cr4,_onoff
@ -920,7 +875,6 @@ _addresscheck2:
bge _skip bge _skip
b _readcodes b _readcodes
_onoff: _onoff:
rlwinm r5,r26,31,31,31 #extracts old exec status (x b a) rlwinm r5,r26,31,31,31 #extracts old exec status (x b a)
xori r5,r5,1 xori r5,r5,1
@ -929,18 +883,13 @@ _onoff:
beq _onoff_end beq _onoff_end
rlwimi r26,r8,1,30,30 rlwimi r26,r8,1,30,30
xori r26,r26,2 xori r26,r26,2
rlwinm. r5,r26,31,31,31 #extracts b rlwinm. r5,r26,31,31,31 #extracts b
beq +8 beq +8
xori r26,r26,1 xori r26,r26,1
stw r26,-4(r15) #updates the code value in the code list stw r26,-4(r15) #updates the code value in the code list
_onoff_end: _onoff_end:
rlwimi r8,r26,0,31,31 #current execution status = a rlwimi r8,r26,0,31,31 #current execution status = a
@ -1097,5 +1046,3 @@ regbuffer:
codelist: codelist:
.space 2*4 .space 2*4
.end .end