home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 9
/
FreshFishVol9-CD2.bin
/
bbs
/
util
/
appvm-0.9.lha
/
AppVM
/
read.s
< prev
next >
Wrap
Text File
|
1992-03-28
|
931b
|
54 lines
include std
START: move.l 4.w,a6
lea dosname,a1
moveq #0,d0
EXEC OpenLibrary ;get DOS
move.l d0,DOS_LIB_PTR
move.l #1000000,d0
move.l #0,d1
EXEC AllocMem ;get buffer
move.l d0,a4
move.l DOS_LIB_PTR,a6
move.l #fname,d1
move.l #MODE_OLDFILE,d2 ;open file to checksum
DOS Open
move.l d0,fhandle
moveq #0,d4 ;clear accum.
bra wh_data
;---------------
accum_longs move.l a4,a3 ;reset chunk ptr
lsr.l #2,d1 ;bytes-> longs counter
accu add.l (a3)+,d4 ;add 'em up
subq.l #1,d1
bne accu
wh_data move.l fhandle,d1
move.l a4,d2
move.l #1000000,d3 ;read a chunk in.
DOS Read
move.l d0,d1 ;while not EOF, go sum all longs
bne accum_longs
;---------------
move.l fhandle,d1 ;close file
DOS Close
move.l 4.w,a6
move.l #1000000,d0
move.l a4,a1
EXEC FreeMem ;release buffer
rts
DOS_LIB_PTR ds.l 1
fhandle ds.l 1
dosname DOSNAME
fname dc.b "WORK:HUGE",0