home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
DEMOS
/
UB_68000.LZH
/
fdump.b
< prev
next >
Wrap
Text File
|
1996-05-20
|
1KB
|
66 lines
* FDUMP file dump program
dim character:byte
dim filenum:byte
dim filename:string[32]
dim bytectr:long
dim addrctr:long
dim ascii:string[16]
dim hex:string[49]
addrctr=0
on error goto badfile
filename=NextArg
if len(filename)=0 then help
if filename="-?" or filename="--help" then help
open #filenum,filename:read+binary
lp1
bytectr=0
ascii=" "
hex=zhex$(addrctr)+" "
addrctr=addrctr+16
lp2
gosub getbyte
if STATUS<1 then
if bytectr>0 then
gosub display
endif
end
endif
inc bytectr
if character>$1f and character<$7f then
mid$(ascii,bytectr,1)=chr$(character)
else
mid$(ascii,bytectr,1)="."
endif
hex=hex+right$(zhex$(character),2)
if mod(bytectr,4)=0 then
hex=hex+" "
endif
if bytectr=16 then
gosub display
goto lp1
else
goto lp2
endif
display
print hex;tab(52);ascii
return
getbyte
get #filenum,character
return
badfile
print "cannot open ";filename
end
help
print
print "fdump filename"
print "performs hexadecimal and ascii dump of file specified"
print
end