New ps1/exe version from Jens.

committer: mfx <mfx> 1049665152 +0000
This commit is contained in:
Markus F.X.J. Oberhumer
2003-04-06 21:39:12 +00:00
parent b8a9b321fa
commit a1064dc2cb
4 changed files with 234 additions and 206 deletions
+47 -45
View File
@@ -32,18 +32,23 @@
#include <mr3k/macros.ash>
#define SZ_REG 4
do_regs MACRO _w
_w at,0(sp)
_w a0,4(sp)
_w a1,8(sp)
_w a2,12(sp)
_w a3,16(sp)
_w v0,20(sp)
_w v1,24(sp)
_w ra,28(sp)
_w at,SZ_REG*0(sp)
_w a0,SZ_REG*1(sp)
_w a1,SZ_REG*2(sp)
_w a2,SZ_REG*3(sp)
_w a3,SZ_REG*4(sp)
_w v0,SZ_REG*5(sp)
_w v1,SZ_REG*6(sp)
_w ra,SZ_REG*7(sp)
do_regs ENDM
DEFINE REG_SZ = (8*4)
#define REG_SZ (8*SZ_REG)
#define HI(a) (a >> 16)
#define LO(a) (a & 0xffff)
ORG 0
@@ -52,19 +57,14 @@ DEFINE REG_SZ = (8*4)
; =============
entry:
; __PSXPREP0__ ; needed by packer to calc the LS value
; __PS1MAIN0__
addiu at,zero,'LS' ; size of decomp. routine
sub sp,at ; adjust the stack with this size
; __PSXPREPZ__ ; needed by packer to calc the LS value
; __PSXSTSZ0__ ; needed by packer to calc the LS value
subu sp,at ; adjust the stack with this size
do_regs sw ; push used regs
; __PSXSTSZZ__
; __PSXMAIN0__
subiu a0,at,REG_SZ ; a0 = counter copyloop
addiu a3,sp,REG_SZ ; get offset for decomp. routine
move a1,a3
lui a2,'DH' ; load decomp routine HI offset
ori a2,'DL' ; and the LO offset
li a2,'DCRT' ; load decompression routine's offset
copyloop:
addi a0,-4
lw at,0(a2) ; memcpy *a2 -> at -> *a1
@@ -73,23 +73,21 @@ copyloop:
bnez a0,copyloop
addiu a1,4
lui a0,'CH' ; load COMPDATA HI offset
ori a0,'CL' ; and the LO part
; lui a1,'LH' ; compressed data length
; ori a1,'LL' ; HI and LO !disabled
; __PSXMAINZ__
li a0,'COMP' ; load COMPDATA HI offset
; li a1,'CDSZ' ; compressed data size !disabled
; __PS1MAINZ__
; =============
; __PSXJSTA0__
lui a2,'OH' ; load DECOMPDATA HI offset
; __PS1JSTA0__
lui a2,HI('DECO') ; load DECOMPDATA HI offset
jr a3
ori a2,'OL' ; load DECOMPDATA LO offset
; __PSXJSTAZ__
; __PSXJSTH0__
jr a3 ;
lui a2,'OH' ; same for HI only !(offset&0xffff)
; __PSXJSTHZ__
ori a2,LO('DECO') ; load DECOMPDATA LO offset
; __PS1JSTAZ__
; __PS1JSTH0__
jr a3
lui a2,HI('DECO') ; same for HI only !(offset&0xffff)
; __PS1JSTHZ__
; =============
; ============= DECOMPRESSION
@@ -104,17 +102,17 @@ copyloop:
# define SMALL
#endif
; __PSXDECO0__
; __PSXDECOZ__
; __PSXN2BD0__
; __PS1DECO0__
; __PS1DECOZ__
; __PS1N2BD0__
#include <mr3k/n2b_d.ash>
; __PSXN2BDZ__
; __PSXN2DD0__
; __PS1N2BDZ__
; __PS1N2DD0__
#include <mr3k/n2d_d.ash>
; __PSXN2DDZ__
; __PSXN2ED0__
; __PS1N2DDZ__
; __PS1N2ED0__
#include <mr3k/n2e_d.ash>
; __PSXN2EDZ__
; __PS1N2EDZ__
; =============
@@ -146,18 +144,18 @@ memset_unaligned:
; =============
; __PSXEXIT0__
; __PS1EXIT0__
li t2,160 ; flushes
jalr ra,t2 ; instruction
li t1,68 ; cache
do_regs lw ; pop used regs
DW 'JPEP' ; marker for the entry jump
addu sp,at
; __PSXEXITZ__
; __PS1EXITZ__
; =============
; __PSXPHDR0__
; __PS1PHDR0__
DB 85,80,88,33 ; 0 UPX_MAGIC_LE32
; another magic for PackHeader::putPackHeader
DB 161,216,208,213 ; UPX_MAGIC2_LE32
@@ -168,15 +166,19 @@ memset_unaligned:
DW 0 ; 24 original file size
DB 0 ; 28 filter id
DB 0 ; 29 filter cto
DB 0 ; unused
DB 0 ; unsused
DB 45 ; 31 header checksum
; __PSXPHDRZ__
; __PS1PHDRZ__
; =============
; __PS1RGSZ0__
DW REG_SZ
; __PS1RGSZZ__
eof:
; section .data
DW -1
DH eof
; vi:ts=8:et:nowrap