home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Antic Magazine 1987 May
/
Antic_Magazine_1987_05_Antic_Side_B.atr
/
typost.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
2KB
|
63 lines
1000 ' TYPO/ST
1010 ' (c) 1986 Antic Publishing
1020 ' Written by Patrick Bass and Bill Marquardt
1030 ' Version 050286
1040 '-----------------------------------------------------------------
1050 '
1060 DISK=1: OUTPUT=2: TRUE=(-1): FALSE=0: CHECKSUMMING=TRUE
1070 TV=FALSE: PRINTER=FALSE
1080 '
1090 print "File to Check:": input FILENAME$
1100 print "Output on:"
1110 print "(S)creen or ": print "(P)rinter ": input DEVICE$
1120 if( DEVICE$="p" )or( DEVICE$="P" )then PRINTER=TRUE else TV=TRUE
1130 '
1140 if TV then print "Checksum for file: ": print FILENAME$: print
1150 if PRINTER then lprint "Checksum for file: ";FILENAME$: lprint
1160 '
1170 '-----------------------------------------------------------------
1180 open "I", #DISK, FILENAME$
1190 '
1200 while CHECKSUMMING
1210 LINENUMBER=0: CHECKSUM=0
1220 '
1230 gosub GETALINE
1240 '
1250 DECIMAL=CHECKSUM: gosub DECTOHEX
1260 OUTPUT$=str$( LINENUMBER )+" :"+HI$+LO$
1270 if PRINTER then lprint OUTPUT$ else print OUTPUT$
1280 wend
1290 '
1300 close DISK
1310 end
1320 '
1330 '-----------------------------------------------------------------
1340 GETALINE:
1350 BLINE$="": on error goto 1300
1360 GOTALINE=FALSE
1370 '
1380 while not GOTALINE
1390 line input#DISK, BLINE$
1400 if len( BLINE$ )>1 then GOTALINE=TRUE
1410 wend
1420 '
1430 LINENUMBER=val( BLINE$ )
1440 for CHAR=1 to len( BLINE$ )
1450 OK=TRUE
1460 CHARACTER$=mid$( BLINE$, CHAR, 1 )
1470 if CHARACTER$=" " then OK=FALSE
1480 if OK then CHECKSUM=CHECKSUM+asc( CHARACTER$+chr$( 0 ))
1490 next CHAR
1500 return
1510 '
1520 '-----------------------------------------------------------------
1530 DECTOHEX:
1540 DECIMAL=abs( DECIMAL )
1550 HI=int( DECIMAL/256 ): LO=( DECIMAL-( HI*256 ))
1560 HH=int( HI/16 ): HL=( HI-( HH*16 ))
1570 LH=int( LO/16 ): LL=( LO-( LH*16 ))
1580 HI$=chr$( 48+HH-( 7*( HH>9 )))+chr$( 48+HL-( 7*( HL>9 )))
1590 LO$=chr$( 48+LH-( 7*( LH>9 )))+chr$( 48+LL-( 7*( LL>9 )))
1600 return