home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1995 January
/
1995-01b.d64
/
checksum
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
2KB
|
55 lines
0 rem
1 rem checksum program
2 rem using crc checksum
3 rem by d.pankhurst
4 rem copyright 1995
5 rem
100 poke55,peek(45):poke56,peek(46)+6:clr
105 ms=peek(56)*256+peek(55):me=ms:re=53245
110 gosub 4300:rem init
120 gosub 4500:ifx$=""thenend:rem name
130 gosub 6800:ifefthen120:rem get file
140 gosub 6000:rem checksum
160 goto 120
4300 rem"[192][192][192]init
4305 lf[178]0:sf[178]0:cf[178]0:fp[178]1135 :cn[178]0
4310 [150] [165] h(x)[178][181](x[173]256)
4315 [150] [165] l(x)[178]x[171]([165] h(x))[172]256
4320 [150] [165] b(x)[178]x[171](x[179]0)[172]65536
4325 [150] [165] d(x)[178][194](x)[170]256[172][194](x[170]1)
4330 di$[178]"":di[178]0:[153]"load"di$:[151]53280,di:[151] 53281,di
4335 [153][163]50)"len(NULL)len lenhecksum (NULL)rogram
4340 printtab(10)"[195]opyright 1995-[195]ompute
4345 [153][163]11)"atnll (NULL)ights (NULL)eserved
4350 printtab(45)" [205]ax [198]ile [211]ize is"int((re-ms)/256)"[157] blocks "
4355 print" [197]nter [198]ilename or [210]eturn [193]lone to [209]uit
4395 [142]
4500 [143]"tantantanget file name
4525 fd=0:printtab(16);:x$="[198]ile:":x=16:gosub 9000:nm$=x$:return
6000 rem"[192][192][192]get checksum
6010 [151]2,[165]l(ms):[151]3,[165]h(ms)
6015 [151]4,[165]l(me):[151]5,[165]h(me)
6050 [141]63999:[158]x
6060 ch[178][194](780)[170]256[172][194](781)
6065 [153][163]0)"onlenhecksum:"ch:[142]
6800 :[143]"tantantanload
6830 ms=fnd(55):rem reset to just behind basic
6920 y=678:x$=nm$
6922 fori=1tolen(x$):pokey+i,asc(mid$(x$,i,1)):next
6925 poke781,167:poke782,2:poke780,len(x$):sys65469
6930 poke780,1:poke781,8:poke782,0:sys65466
6940 poke780,0:poke781,fnl(ms):poke782,fnh(ms):sys65493
6960 me=peek(781)+256*peek(782)
6970 lf=0:ef=peek(783)and1
6972 ifefthenprint" error loading! file not found [146]":me=ms+5
6990 return
9000 rem"[192][192][192]input text
9005 cu$[178]" cmd":[153]x$" "cu$;:p[178]0:[151]198,0:x$[178]""
9010 [151]204,0:[146]198,7:[151]204,1:[161]y$:y[178][198](y$):[139]y[178]13[167]9060
9020 [139]y[178]20[175]p[177]0[167]p[178]p[171]1:[153]y$cu$;:x$[178][200](x$,[195](x$)[171]1):[137]9010
9030 [139]p[177][178]x[167]9010
9040 [139]y$[179]" "[176]y$[177]"(NULL)"[176](y$[179]"atn"[175]y$[177]"_")[167]9010
9050 [153]" cmd";y$cu$;:x$[178]x$[170]y$:p[178]p[170]1:[137]9010
9060 [153]" ":x[178][195](x$):[142]
63999 x[178][194](61)[170]256[172][194](62)[170]30:[142]