home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 3
/
FREEWARE.BIN
/
oh_fm
/
townsfos
/
fdump.bas
< prev
next >
Wrap
BASIC Source File
|
1980-01-02
|
2KB
|
77 lines
10000 '
10010 ' File Dump Utility : "FDUMP.BAS" : By TARO
10020 '
10030 '
10040 DEFINT A-Z:DIM D%(256)
10050 PRINT : PRINT "****** FDUMP : ファイル・ダンプ・ユーティリティ ******"
10060 PRINT
10070 PFLG=0
10080 '
10090 IF ARGC%>1 THEN *SK_1
10100 LINE INPUT " Filename ? ",FLNAME$ : IF FLNAME$="" THEN 10430
10110 INPUT " Printer ? (y/n) ",A$
10120 IF A$="y" OR A$="y" THEN PFLG=-1 ELSE PFLG=0
10130 GOTO *SK_2
10140 *SK_1
10150 FOR I=1 TO ARGC-1 : A$=ARGV$(I)
10160 IF A$="?" THEN *HELP
10170 IF A$="-p" OR A$="-P" THEN PFLG=-1:GOTO *SK_L
10180 IF FLNAME$="" THEN FLNAME$=A$
10190 *SK_L
10200 NEXT
10210 '
10220 *SK_2
10230 OPEN "I",#2,FLNAME$
10240 IF PFLG THEN OPEN "O",#1,"LPT0:" ELSE OPEN "O",#1,"SCRN:"
10250 ADD&=0
10260 PRINT #1 : PRINT #1,"***** Filename "+FLNAME$+" *****" : PRINT #1
10270 ADD&=0
10280 '
10290 IF EOF(2) THEN 10380 ' EOF
10300 R%=0 : FOR I%=0 TO 255 : D%(I%)=0 : NEXT
10310 D%(R%)=ASC(INPUT$(1,2)) : IF EOF(2) THEN GOSUB 10480 : GOTO 10380
10320 R%=R%+1
10330 IF R%<256 THEN 10310
10340 GOSUB 10480 'Dump
10350 ADD&=ADD&+256
10360 GOTO 10300
10370 '
10380 :
10390 PRINT : PRINT "** 完了 **"
10400 '
10410 ' End
10420 '
10430 :
10440 IF ARGC%=0 THEN END
10450 CLOSE
10460 RETURN *S_T_RETURN
10470 '
10480 : I%=0 : SUM%=0
10490 PRINT #1,"OffSet +0 +1 +2 +3 +4 +5 +6 +7|+8 +9 +A +B +C +D +E +F :SM: A S C I I"
10500 FOR Y%=O TO ((R%-1) \ 16)
10510 S$=RIGHT$("00000"+HEX$(ADD&+Y%*16),6)+" ":A$="":SUMX%=0
10520 FOR X%=0 TO 15 : C%=D%(I%)
10530 S$=S$+RIGHT$("0"+HEX$(C%),2)+" "
10540 IF C%<&H7F AND C%>&H1F THEN C$=CHR$(C%) ELSE C$="."
10550 A$=A$+C$:I%=I%+1:SUMX%=SUMX%+C%:SUM%=(SUM%+C%) MOD 256
10560 NEXT : MID$(S$,31,1)="|"
10570 PRINT #1,S$+":";RIGHT$("0"+HEX$( SUMX% MOD 256),2);": ";A$
10580 NEXT
10590 PRINT #1,STRING$(59,"-") : S$=" SUM : "
10600 FOR X%=0 TO 15
10610 SUMY%=0
10620 FOR Y%=0 TO 15
10630 SUMY%=SUMY%+D%(Y%*16+X%)
10640 NEXT
10650 S$=S$+RIGHT$("0"+HEX$(SUMY% MOD 256),2)+" "
10660 NEXT : MID$(S$,31,1)="|"
10670 PRINT #1,S$+":";RIGHT$("0"+HEX$(SUM%),2) : PRINT #1
10680 RETURN
10690 '
10700 *HELP
10710 S_A$="\n***** Help Message for FDump *****\n\n":GOSUB *S_PUTS_E
10720 S_A$=" FDump : File Dump Utility\n":GOSUB *S_PUTS_E
10730 S_A$=" Usage : FDump Filename [-p]\n":GOSUB *S_PUTS_E
10740 S_A$=" : -p Printer\n":GOSUB *S_PUTS_E
10750 RETURN *S_T_RETURN