home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1985 May
/
Ahoy_Magazine_85-05_1985_Double_L.d64
/
dskdu
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
4KB
|
164 lines
1 n$="*dskdu*":n1$="by mark johansen"
2 da=8:goto8000
10 rem*hex in
12 n=0:if len(h$)=0 then return
14 for hx=1tolen(h$):n1=asc(mid$(h$,hx,1)):n1=n1-48:if n1>9 then n1=n1-7
16 n=n*16+n1:next
18 return
1000 rem*read
1010 print"[147]";n$:print"";n1$:print
1020 input"track";h$:gosub10:t=n
1030 input"sector";h$:gosub10:s=n
1110 print#15,"u1:2,0,"t;s:gosub9000:if er>0 then 1000
1120 print#15,"b-p:2,0"
1130 d%(0)=0:poke 828,peek(71):poke 829,peek(72):sys880
1160 gosub9000:if er>0 then 1000
2000 rem*view/mod
2010 p=0
2100 rem flash screen
2102 if p<0 then p=192
2104 if p>192 then p=0
2110 print"[147]track ";hx$(t/16);hx$(t and 15)
2120 print"sector ";hx$(s/16);hx$(s and 15)
2130 print
2140 for l=p to p+63 step 4:print hx$(l/16);hx$(land15);":";
2150 for by=l to l+3:print hx$(d%(by)/16);hx$(d%(by)and15);" ";:next
2160 for by=l to l+3:c$=chr$(d%(by)):if c$<" " or c$>"_" or c$=chr$(34) then c$="."
2170 print c$;:next
2180 print:next
2200 rem*allow mods
2210 l=0:c=0
2220 by=p+l*4+c/2:hx=cand1:h1$(0)=hx$(d%(by)/16):h1$(1)=hx$(d%(by)and15):c1=int(c*1.5)
2225 poke 781,l+3:poke 782,c1+3:poke 783,0:sys65520
2230 poke 204,0
2240 get i$:if i$="" then 2240
2250 poke 204,1:print h1$(hx);
2260 if i$="[133]" then p=p-64:goto2100
2270 if i$="[134]" then p=p+64:goto2100
2280 if i$="[136]" then 1000
2285 if i$="[138]" then t=d%(0):s=d%(1):goto1110
2290 if i$="" then 2750
2300 if i$="" then 2700
2310 if i$="[145]" then 2800
2320 if i$="[157]" then 2850
2330 if i$="[140]" then 3000
2340 if i$="[137]" then 4000
2350 if i$="" then 2210
2400 if i$<"0" or i$>"f" or i$>"9" and i$<"a" then 7000
2410 print "[157]"i$;
2430 h1$(hx)=i$:h$=h1$(0)+h1$(1)
2450 gosub10:d%(by)=n
2460 poke 781,l+3:poke 782,c/2+15:poke 783,0:sys65520
2470 c$=chr$(d%(by)):if c$<" " or c$>"_" or c$=chr$(34) then c$="."
2480 print c$;
2490 rem fall thru into cursor right
2700 rem cursor right
2710 c=c+1:if c>7 then c=0:goto2750
2720 goto2220
2750 rem cursor down
2760 l=l+1:if l>15 then l=0
2770 goto2220
2800 rem cursor up
2810 l=l-1:if l<0 then l=15
2820 goto2220
2850 rem cursor left
2860 c=c-1:if c<0 then c=7:goto2800
2870 goto2220
3000 rem*write
3010 print"[147]preparing to write"
3020 print" track ";hx$(t/16);hx$(t and15);" sector ";hx$(s/16);hx$(s and15)
3030 print:print"<ret> to write":print"any other key to abort"
3040 get i$:if i$="" then 3040
3050 if i$<>chr$(13) then 2100
3100 rem do write
3110 print#15,"b-p:2,0"
3120 print"writing ..."
3130 d%(0)=d%(0):poke 828,peek(71):poke 829,peek(72):sys910
3140 print#15,"u2:2,0,";t;s:gosub9000:if er then 2100
3150 goto2100
4000 rem*quit
4010 close2:close15
4020 print"[147]done ..."
4030 poke 204,0:end
7000 rem*help
7010 print"[147]dskdu help":print
7020 print"f1 previous page"
7030 print"f3 next page"
7050 print"f7 read sector"
7060 print"f4 read next sector"
7065 print" in file"
7070 print"f8 write sector"
7080 print"crsr controls"
7090 print" up,down,left,right"
7100 print"home top left corner"
7120 print"0-9,a-f"
7130 print" overwrite nibble"
7140 print"f2 quit"
7200 print:print"(any key to cont)"
7210 get i$:if i$="" then 7210
7220 goto2100
8000 poke53280,2:poke53281,0:poke646,1
8001 rem*init
8020 open15,da,15
8030 open2,da,2,"#"
8040 dim d%(255)
8050 dim hx$(15):for by=0to15:read hx$(by):next
8060 data 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f
8070 dim h1$(1)
8100 rem load ml routines
8110 read ad:if ad<0 then 8190
8120 read b:if b>=0 then poke ad,b:ad=ad+1:goto 8120
8130 goto 8110
8190 goto1000
8200 rem read/write routines
8210 data 840:rem setup
8220 data 173,60,3:rem lda 828
8230 data 174,61,3:rem ldx 829
8240 data 133,251:rem sta !251
8250 data 134,252:rem stx !252
8260 data 169,0:rem lda #0
8270 data 141,62,3:rem sta 830
8280 data 96,-1:rem rts
8300 data 860:rem advance pointer
8310 data 24:rem clc
8320 data 165,251:rem lda !251
8330 data 105,2:rem adc #2
8340 data 133,251:rem sta !251
8350 data 165,252:rem lda !252
8360 data 105,0:rem adc #0
8370 data 133,252:rem sta !252
8380 data 96,-1:rem rts
8400 data 880:rem read routine
8410 data 162,2:rem ldx #2
8420 data 32,198,255:rem jsr chkin
8430 data 32,72,3:rem jsr setup
8440 data 32,207,255:rem jsr chrin
8450 data 160,1:rem ldy #1
8460 data 145,251:rem sta (251,y
8470 data 32,92,3:rem jsr advptr
8480 data 206,62,3:rem dec 830
8490 data 208,241:rem bne -15
8500 data 32,204,255:rem jsr clrchn
8510 data 96,-1:rem rts
8600 data 910:rem write routine
8610 data 162,2:rem ldx #2
8620 data 32,201,255:rem jsr chkout
8630 data 32,72,3:rem jsr setup
8640 data 160,1:rem ldy #1
8650 data 177,251:rem lda (251,y
8660 data 32,210,255:rem jsr chrout
8670 data 32,92,3:rem jsr advptr
8680 data 206,62,3:rem dec 830
8690 data 208,241:rem bne -15
8700 data 32,204,255:rem jsr clrchn
8710 data 96,-1:rem rts
8720 data -1
9000 rem disk check
9020 input#15,er,er$,et,es
9030 if er=0 then return
9050 print "[147]";er;er$:print"";et;es
9060 print:print"f2 to quit":print"any other key to cont"
9070 get i$:if i$="" then 9070
9080 if i$="[137]" or i$="[133]" then 4000
9090 return