home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Vectronix 2
/
VECTRONIX2.iso
/
FILES_02
/
PP31.MSA
/
AUTOMATI.ON
/
SOURCE
/
ULTRA.S
< prev
Wrap
Text File
|
1985-11-20
|
11KB
|
338 lines
*
* Ultraload (Uni-load II)
*
* Written by Dack of The Un-Nameables
* (Based on Uni-load by The Law)
*
* Includes depacker to/from odd addresses
*
* NOTE:-
*
* buff_len = Max length of a PACKED file
* max_files = No. of files open at once + 6
*
* only packed files are buffered, unpacked data
* is treated as normal...
*
* gam = filename to $4b
*
opt c+,d-
buff_len equ $18c0a
max_files equ 32
bra main
gam dc.b "entvap",0
even
text DC.B "Vapour presents . . ."
DC.B 00,00
EVEN
;SET TABS TO 10 FOR DISASSEMBLY
main MOVEA.L 4(A7),A5
move.l $c(a5),d0
add.l $14(a5),d0
add.l $1c(a5),d0
add.l #$200,d0
add.l #buff_len,d0 ;add buffer length
move.l d0,-(sp)
move.l a5,-(sp)
move.l #$4a0000,-(sp)
trap #1
lea $c(a7),a7
dc.l $a000a00a
clr.w -(sp)
pea $ffffffff
move.l (a7),-(sp)
move.w #5,-(sp)
trap #14
lea $c(a7),a7
dc.w $a009
pea text
move.w #9,-(a7)
trap #1
addq.l #6,a7
*
* buffer address
* (Can be absolute....)
*
move.l #buff_start,buff_add ;set buffer start address
CHEAT CLR.L -(A7)
MOVE.W #$20,-(A7)
TRAP #$01
ADDQ.L #6,A7
LEA SUPERLNG(PC),A6
MOVE.L D0,(A6)
MOVE.L $84,tr1
MOVE.L #T1,$84
MOVE.L SUPERLNG(PC),-(A7)
MOVE.W #$20,-(A7)
TRAP #$01
ADDQ.L #6,A7
stkk clr.w in_use
clr.l $60000
pea $60000
move.l (a7),-(sp)
move.l #gam,-(sp)
move.l #$4b0000,-(sp)
trap #1
lea $0c(a7),a7
clr.w -(sp)
trap #1
SUPERLNG DC.L 0
;multi file read 1st October 1989
;fix 11th October 1989 for decode from odd address
;bastard bug to find
T1 tst.w inside
bne bye
MOVEM.L a0-a6/d0-d7,reg
movea.l a7,a1
addq.l #6,a1
move.w (a7),d0
btst #$d,d0
bne.s ok1
move.l usp,a1
ok1 cmpi.w #0,(a1)
bne.s next1
move.l tr1(pc),$84.w
bra.s open
next1 cmpi.w #$3d,(a1)
beq openup
cmpi.w #$3f,(a1)
beq read
cmpi.w #$3e,(a1)
beq close
cmpi.w #$42,(a1)
beq seek
cmpi.w #$4e,(a1)
beq ffirst
cmpi.w #$3c,(a1)
beq create
cmpi.w #$40,(a1)
beq write
open movem.l reg(pc),a0-a6/d0-d7
bye dc.w $4ef9
tr1 dc.l $0
openup move.w #1,inside ;do normal traps
lea f_names,a0
add.l #300,a0
move.l #5,d0
s_loop addq.l #1,d0
add.l #60,a0
tst.b (a0)
bne.s s_loop ;search for empty slot
;d0=my pretend file handle
move.l d0,d7
****
move.l d0,d6
move.l a0,a5
move.l 2(a1),a6 ;save file name address
;open file
clr.w -(a7)
move.l a6,-(a7)
move.w #$3d,-(a7)
trap #1
addq.l #8,a7
tst.l d0
bmi error ;in case file not there
move.w d0,d4
clr.l i_buff
pea i_buff
move.l #8,-(a7)
move.w d4,-(a7)
move.w #$3f,-(a7)
trap #1
lea 12(a7),a7
clr.w -(a7)
move.w d4,-(a7)
clr.l -(a7)
move.w #$42,-(a7)
trap #1
lea 10(a7),a7
cmp.l #"LSD!",i_buff
beq.s nermal
lea real_hand,a0
lsl.l #2,d7
move.l d4,(a0,d7.w)
move.b #"0",(a5)
bra not_good
;copy file name to storage
nermal move.l #59,d0
c_loop move.b (a6)+,(a5)+
dbra d0,c_loop
move.l i_len,d5
not_com lea f_lengths,a0
lsl.l #2,d7
move.l d5,(a0,d7.w) ;save file length in array
lea so_read,a0
move.l #0,(a0,d7.w)
lea real_hand,a0
move.l #-1,(a0,d7.w)
;close file as finished
move.w d4,-(a7)
move.w #$3e,-(a7)
trap #1
addq.l #4,a7
not_good
clr.w inside ;my traps again
move.l d6,-(a7)
movem.l reg,a0-a6/d0-d7
move.l (a7)+,d0 ;give back my handle
rte
read clr.l d0
move.w 2(a1),d0 ;get handle
cmp.l in_use,d0
beq all_in ;already loaded
move.l d0,d1
lsl.l #2,d1
lea real_hand,a0
move.l (a0,d1.w),d2
cmp.l #-1,d2
beq.s cor_blimey
move.l 4(a1),d0
move.l 8(a1),d1
move.w #1,inside
move.l d1,-(a7)
move.l d0,-(a7)
move.w d2,-(a7)
move.w #$3f,-(a7)
trap #1
lea 12(a7),a7
clr.w inside
move.l d0,d4
bra titter
cor_blimey move.l a1,a5
move.w #1,inside
move.l d0,in_use
mulu #60,d0
lea f_names,a0
add.l d0,a0 ;get correct filename
clr.w -(a7)
move.l a0,-(a7)
move.w #$3d,-(a7)
trap #1
addq.l #8,a7
move.w d0,d6
move.l buff_add,-(a7)
move.l #buff_len,-(a7)
move.w d0,-(a7)
move.w #$3f,-(a7)
trap #1
lea 12(a7),a7
move.w d6,-(a7)
move.w #$3e,-(a7)
trap #1
addq.l #4,a7
clr.w inside
move.l buff_add,a0
move.l a0,a1
add.l #200,a1
move.l 4(a0),d7 ;length
bsr DEPACK
move.l buff_add,a0
move.l a0,a1
add.l #200,a1
m2_back move.b (a1)+,(a0)+
subq.l #1,d7
bne.s m2_back
read_in move.l a5,a1 ;put stack back in a1
all_in move.l 4(a1),d0 ;bytes to move
move.l d0,d4
move.l 8(a1),a0 ;whereto
move.l in_use,d1
lsl.l #2,d1 ;*4
lea so_read,a2
lea f_lengths,a3
move.l (a2,d1.w),d2 ;current offset
move.l (a3,d1.w),d3 ;length of this file
move.l buff_add,a1
add.l d2,a1
do_it move.b (a1)+,(a0)+
addq.l #1,d2
cmp.l d2,d3
blt.s past_end
subq.l #1,d0
bne.s do_it
bra.s wibble
past_end move.l d3,d2 ;if past end then offset=end
wibble move.l d2,(a2,d1.w) ;save new offset
sub.l d0,d4 ;get number of bytes read