home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 4: Demo 1
/
almathera_demo1.bin
/
sourcecode
/
dexion
/
deccrunch+load.s
< prev
next >
Wrap
Text File
|
1995-03-17
|
2KB
|
152 lines
; decruncher v1.1
read = $5a320
lowwr = $40000
execbase = 4
openlib = -408
open = -30
start:
move.l execbase,a6
lea dosname,a1
moveq #0,d0
jsr openlib(a6)
move.l d0,dosbase
beq error
move.l dosbase,a6
move.l #filename,d1
move #1005,d2
jsr -30(a6)
move.l d0,conhandle
beq error
move.l conhandle,d1
move.l #$50000,d2
move.l #$a320,d3
jsr -42(a6)
move.l d0,lange
beq error
jmp star
error:
moveq #8,d0
rts
dosname:
dc.b "dos.library",0,0
even
dosbase:
blk.l 1
conhandle:
dc.l $00000000
even
filename:
dc.b "sapper.dat1",0,0
even
lange:
dc.l $00000000
star:
jsr decr
s:
jsr $40000
rts
decr:
lea read,a0
lea lowwr,a1
move.l -(a0),a2
add.l a1,a2
move.l -(a0),d5
move.l -(a0),d0
eor.l d0,d5
notfinished:
lsr.l #1,d0
bne.S notempty1
bsr getnextlwd
notempty1:
bcs.S bigone
moveq #8,d1
moveq #1,d3
lsr.l #1,d0
bne.S notempty2
bsr getnextlwd
notempty2:
bcs.S dodupl
moveq #3,d1
clr.w d4
dojmp:
bsr rdd1bits
move.w d2,d3
add.w d4,d3
getd3chr:
moveq #7,d1
get8bits:
lsr.l #1,d0
bne.S notempty3
bsr getnextlwd
notempty3:
roxl.l #1,d2
dbf d1,get8bits
move.b d2,-(a2)
dbf d3,getd3chr
bra nextcmd
bigjmp:
moveq #8,d1
moveq #8,d4
bra dojmp
bigone:
moveq #2,d1
bsr rdd1bits
cmp.b #2,d2
blt.S midjumps
cmp.b #3,d2
beq.S bigjmp
moveq #8,d1
bsr rdd1bits
move.w d2,d3
move.w #12,d1
bra dodupl
midjumps:
move.w #9,d1
add.w d2,d1
addq #2,d2
move.w d2,d3
dodupl:
bsr rdd1bits
copyd3bytes:
subq #1,a2
move.b (a2,d2.w),(a2)
dbf d3,copyd3bytes
nextcmd:
cmp.l a2,a1
blt.L notfinished
tst.l d5
bne.S damage
rts ; illegal
damage:
move.w #$ffffffff,d0
damloop:
move.w d0,$dff180
subi.l #1,d0
bne.S damloop
rts ; illegal
getnextlwd:
move.l -(a0),d0
eor.l d0,d5
move.w #$10,ccr
roxr.l #1,d0
rts
rdd1bits:
subq.w #1,d1
clr.w d2
getbits:
lsr.l #1,d0
bne.S notempty
move.l -(a0),d0
eor.l d0,d5
move.w #$10,ccr
roxr.l #1,d0
notempty:
roxl.l #1,d2
dbf d1,getbits
rts