home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 43 / 043.d81 / sector editor (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1988-01-01  |  18.2 KB  |  815 lines

  1. 0 rem *********************************
  2. 1 rem ** video ventures disk editor! **
  3. 2 rem **       copyright  1987       **
  4. 3 rem **                             **
  5. 4 rem **   programmed by shawn ort   **
  6. 5 rem *********************************
  7. 6 poke53280,12:poke53281,12:poke646,0
  8. 8 poke650,128
  9. 9 print"[147]";chr$(9);chr$(8);
  10. 10 print"             [211][197][195][212][207][210] [197][196][201][212][207][210]"
  11. 15 print"        [194][217] [211][200][193][215][206] [207][210][212]   ([195]) 1987"
  12. 20 print"                                 [146]"
  13. 22 print"              1. [197][196][201][212] [196][201][211][203]   [144]    [146]"
  14. 24 print"              2. [196][201][210][197][195][212][207][210][217]   [144]    [146]"
  15. 26 print"              3. [194][207][207][212] [196][201][211][203]   [144]   [146]"
  16. 28 print"                                 [146]"
  17. 30 print"      [161]                          [146][161]"
  18. 32 print"      [161]   [192][178][192]       [192][178][192]    [192][178][192]   [146][161]"
  19. 34 print"      [161]    [173][174]        [173][174]    [176][189]    [146][161]"
  20. 36 print"      [161]     [173][174]        [173][174]  [176][189]     [146][161]"
  21. 38 print"      [161]      [173][174]        [173][174][176][189]      [146][161]"
  22. 40 print"      [161]       [173][174]        [171][189]       [146][161]"
  23. 42 print"      [161]        [173][174]      [176][189]        [146][161]"
  24. 44 print"      [161]         [173][174]    [176][189]         [146][161]"
  25. 46 print"      [161]          [173][174]  [176][189]          [146][161]"
  26. 48 print"      [161]           [173][174][176][189]           [146][161]"
  27. 50 print"      [161]            [173][189]            [146][161]"
  28. 52 print"      [161]                          [146][161]"
  29. 53 print"[144]"
  30. 55 mn$(1)="   1. [197][196][201][212] [196][201][211][203]   [144]"
  31. 56 mn$(2)="   2. [196][201][210][197][195][212][207][210][217]   [144]"
  32. 57 mn$(3)="   3. [194][207][207][212] [196][201][211][203]   [144]"
  33. 58 c=1
  34. 59 print"":rem print down
  35. 60 forx=1to3
  36. 61 ifx=cthen print tab(11);"[158]";mn$(x):goto63
  37. 62 print tab(11);"";mn$(x)
  38. 63 nextx
  39. 64 get a$:ifa$=""then64
  40. 65 ifa$="[145]"then69
  41. 66 ifa$=""then71
  42. 67 ifa$=chr$(13)ora$="1"ora$="2"ora$="3"then75
  43. 68 goto64
  44. 69 ifc=1thenc=3:goto59
  45. 70 c=c-1:goto59
  46. 71 ifc=3thenc=1:goto59
  47. 72 c=c+1:goto59
  48. 75 rem goto routine
  49. 76 poke781,23:sys59903:ifa$="1"then100
  50. 77 ifa$="2"then1000
  51. 78 ifa$="3"then90
  52. 80 ifc=1then100
  53. 81 ifc=2then1000
  54. 82 ifc=3then90
  55. 83 run
  56. 90 rem ** boot disk **
  57. 91 print"[147]  [193]re you sure you want to quit? ([217]/[206])"
  58. 92 geta$:ifa$=""then92
  59. 93 ifa$<>"y"anda$<>"[217]"thenrun
  60. 94 open15,8,15,"r:hello connect=hello connect":poke646,12
  61. 95 input#15,a$:close15:print"":ifa$="63"then98
  62. 96 open15,8,15,"i0":close15:print"[144][201]nsert [204][207][193][196][211][212][193][210] disk!":forx=1to1500:next
  63. 97 goto90
  64. 98 print"load"chr$(34);"hello connect";chr$(34)",8,1[145][145][145]"
  65. 99 poke631,13:poke632,82:poke633,85:poke634,78:poke635,13:poke198,5:end
  66. 100 rem *******************************
  67. 105 rem **  start of editor program  **
  68. 110 rem *******************************
  69. 115 rem
  70. 120 print"[144][197]nter [212]rack:";:gosub1500:ift<>99then122
  71. 121 gosub5000:goto120
  72. 122 printchr$(9):ift=0thent=18:s=0
  73. 124 print"[147]";chr$(14):gosub125:goto225
  74. 125 rem ** read block **
  75. 126 if t<0 or t>41thenreturn
  76. 127 if s>20thenreturn
  77. 130 gosub2200:open15,8,15:open2,8,2,"#"
  78. 131 j=128:gosub600:gosub155
  79. 132 print#15,"m-r"chr$(0)chr$(3)chr$(255)
  80. 135 sys49152:rem read and store 1
  81. 140 print#15,"m-r"chr$(224)chr$(3)chr$(255)
  82. 145 sys49310:rem read and store 2
  83. 150 close2:gosub2000:close15:sys49447
  84. 155 print"";:forx=1to8:print"   [181]";tab(36);"[182]":nextx
  85. 160 print"   [183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183]":return
  86. 165 rem ** edit and save **
  87. 168 gosub400
  88. 170 print"[144][212]rack";t;"[157] [211]ector";s;"[157]  ":print""
  89. 172 print"[206]ext track & sector    ";peek(1028);",";peek(1029)
  90. 173 print"[208]ress: [198]1[146] to exit without writing"
  91. 174 print"       [198]3[146] to edit in assembly"
  92. 175 print"       [198]7[146] to edit in hex or decimal"
  93. 176 print"[144][208]ress [210][197][212][213][210][206] [144]when ready to write sector";
  94. 179 sys49616
  95. 180 p=peek(254):wait207,1:poke204,1:poke198,0
  96. 181 ifp=13then194
  97. 182 ifp=133then190
  98. 183 ifp=134then40000
  99. 184 ifp=136then800
  100. 185 goto179
  101. 190 rem ** exit **
  102. 192 print"[147]":sys49447:poke199,0:gosub155:goto225
  103. 194 rem ** save **
  104. 195 gosub400:poke199,0:poke204,1:sys49342
  105. 196 print"[144][146]                      ";t;",";s:tt=t:ss=s
  106. 198 input"[146][145]save at track, sector";t,s
  107. 199 if t=tt then ifs=ssthen204
  108. 200 print"save at track";t;"sector";s:print"are you sure?"
  109. 201 geta$:ifa$=""then201
  110. 202 ifa$="y"ora$="[217]"then204
  111. 203 ifa$="n"ora$="[206]"thent=tt:s=ss:goto195
  112. 204 gosub2200:open2,8,2,"#":open15,8,15:print#15,"b-p:"2;0
  113. 205 sys49592
  114. 210 print#15,"u2:"2;0;t;s
  115. 215 gosub2100:close2:close15:print"[147]":gosub130:goto225
  116. 220 rem
  117. 225 rem ** sub-menu
  118. 230 print""
  119. 235 print"[211]-[211]elect track, sector  [197]-[197]dit sector"
  120. 240 print"[198]-[198]orward               [194]-[194]ackward"
  121. 245 print"[193]-[193]uto mode             [204]-[204]ock/unlock"
  122. 246 print"[208]-[208]rint contents        [200]-[200]eader info"
  123. 247 print"[206]-[206]ext track, sector    [216]-[197]xit"
  124. 250 print"[144][212]rack";t;"[157] [211]ector";s;"[157]  ":print""
  125. 251 print"[206]ext [212]rack, [211]ector        [157][157][157][157][157][157][157][157]";peek(1028);peek(1029);"    "
  126. 252 geta$:ifa$=""then252
  127. 257 ifa$=""then252
  128. 258 ifa$="s"ora$="[211]"then115
  129. 260 ifa$="e"ora$="[197]"then165
  130. 265 ifa$="f"ora$="[198]"thengosub300:if e<>1thensys49436:gosub155
  131. 270 ifa$="b"ora$="[194]"thengosub340:if e<>1thensys49436:gosub155
  132. 275 ifa$="a"ora$="[193]"then500
  133. 280 ifa$="x"ora$="[216]"then run
  134. 281 ifa$="n"ora$="[206]"thengosub450
  135. 282 ifa$="p"ora$="[208]"then700
  136. 283 ifa$="l"ora$="[204]"then750
  137. 284 ifa$="h"ora$="[200]"then1100
  138. 285 ifa$="+"thentt=t:t=t-1:gosub3000
  139. 286 ifa$="-"thentt=t:t=t+1:gosub3000
  140. 287 goto250
  141. 300 rem ** forward **
  142. 302 s=s+1
  143. 305 ift=35ands>16thenaa$="off":s=16:return
  144. 310 bq=20
  145. 320 ift<18thengosub332:goto325
  146. 321 ift<25thengosub334:goto325
  147. 322 ift<31thengosub336:goto325
  148. 323 ift<41thengosub338:goto325
  149. 325 goto125
  150. 332 ifs>20thent=t+1:s=0
  151. 333 return
  152. 334 ifs>18thent=t+1:s=0
  153. 335 return
  154. 336 ifs>17thent=t+1:s=0
  155. 337 return
  156. 338 ifs>16thent=t+1:s=0
  157. 339 return
  158. 340 rem ** backward **
  159. 341 s=s-1
  160. 342 ift=1ands<0thens=s+1:return
  161. 345 ift<19thengosub352:goto350
  162. 346 ift<26thengosub354:goto350
  163. 347 ift<32thengosub356:goto350
  164. 348 ift<36thengosub358:goto350
  165. 350 goto130
  166. 352 ifs<0thent=t-1:s=20
  167. 353 return
  168. 354 ifs<0thent=t-1:s=18
  169. 355 return
  170. 356 ifs<0thent=t-1:s=17
  171. 357 return
  172. 358 ifs<0thent=t-1:s=16
  173. 359 return
  174. 400 rem clear bottom window
  175. 405 forx=10to25:poke781,x:sys59903:nextx
  176. 410 return
  177. 450 rem * next track and sector *
  178. 452 ifpeek(1028)=0thenreturn
  179. 454 ifpeek(1028)>35thenreturn
  180. 456 ifpeek(1029)>22thenreturn
  181. 458 t=peek(1028):s=peek(1029):goto125
  182. 500 rem ** auto mode **
  183. 505 gosub400:gosub560:gosub520
  184. 510 geta$:ifa$=""then510
  185. 512 ifa$="f"ora$="[198]"then530
  186. 514 ifa$="b"ora$="[194]"then540
  187. 516 ifa$="n"ora$="[206]"then550
  188. 518 ifa$="x"ora$="[216]"thengosub400:goto225
  189. 519 goto510
  190. 520 rem update
  191. 522 print"[144][212]rack";t;"[157] [211]ector";s;"[157]  ":print""
  192. 524 print"[206]ext [212]rack, [211]ector        [157][157][157][157][157][157][157][157]";peek(1028);peek(1029);"    "
  193. 526 return
  194. 530 rem auto forward
  195. 532 geta$:ifa$="f"ora$="[198]"then500
  196. 534 gosub300:gosub520
  197. 535 if e<>1thengosub560
  198. 536 goto532
  199. 540 rem auto backward
  200. 542 geta$:ifa$="b"ora$="[194]"then500
  201. 544 gosub340:gosub520
  202. 545 if e<>1thengosub560
  203. 546 goto542
  204. 550 rem auto next
  205. 552 geta$:ifa$="n"ora$="[206]"then500
  206. 553 tt=t:ss=s
  207. 554 gosub520:t=peek(1028):s=peek(1029)
  208. 556 if t=0thent=tt:s=ss:gosub520:goto500
  209. 557 gosub450:ife<>1then500
  210. 558 goto550
  211. 560 print""
  212. 565 print"         auto mode"
  213. 570 print"[198]-forward               [194]-backward"
  214. 575 print"[206]-next track, sector    [216]-exit"
  215. 578 print"-options are toggled with the same key-"
  216. 580 return
  217. 600 rem job queue  : job in j
  218. 605 x=0
  219. 610 print#15,"m-w"chr$(6)chr$(0)chr$(2)chr$(t)chr$(s)
  220. 615 print#15,"m-w"chr$(0)chr$(0)chr$(1)chr$(j)
  221. 620 x=x+1
  222. 625 print#15,"m-r"chr$(0)chr$(0)
  223. 630 get#15,e$
  224. 635 if e$=""thene$=chr$(0)
  225. 640 e=asc(e$)
  226. 645 if x=500 then return
  227. 650 if e>127 then620
  228. 655 return
  229. 700 gosub400:rem * print contents *
  230. 705 print"print disk contents"
  231. 710 print"[144][208]ress [210][197][212][213][210][206] [144]to print,"
  232. 715 print"any other key to abort."
  233. 720 geta$:ifa$=""then720
  234. 725 ifa$<>chr$(13)then735
  235. 730 open4,4:print#4,"":close4:ifst<>0thenprint"turn printer on!":goto705
  236. 731 gosub400:print"printing, please wait..."
  237. 732 gosub30000
  238. 735 gosub400:goto225
  239. 750 rem ** lock/unlock disk **
  240. 755 forx=10to25:poke781,x:sys59903:nextx
  241. 760 print"[204]ock/[213]nlock [196]isk"
  242. 761 print"[208]ress: [204] to lock disk"
  243. 762 print"       [213] to unlock disk"
  244. 763 print"[144][208]ress any other key to abort"
  245. 765 geta$:ifa$=""then765
  246. 770 ifa$="l"ora$="[204]"then775
  247. 771 ifa$="u"ora$="[213]"then785
  248. 772 rem ** go back to view menu **
  249. 773 forx=10to25:poke781,x:sys59903:nextx:goto225
  250. 775 rem ** lock disk **
  251. 776 gosub2200:open15,8,15,"i0":open2,8,2,"#"
  252. 777 print#15,"u1:";2;0;18;0:gosub2100
  253. 778 print#15,"b-p:";2;2
  254. 779 print#2,chr$(1);:gosub2100
  255. 780 print#15,"u2:";2;0;18;0:gosub2100
  256. 781 close2:print#15,"i0":close15:goto773:rem go to menu
  257. 785 rem ** unlock disk **
  258. 786 gosub2200:open15,8,15:print#15,"i0":open2,8,2,"#"
  259. 787 print#15,"u1:";2;0;18;0:gosub2100
  260. 788 print#15,"b-p:";2;2
  261. 789 print#2,chr$(65);:gosub2100
  262. 790 print#15,"m-w";chr$(1);chr$(1);chr$(1);chr$(65)
  263. 791 print#15,"m-w";chr$(2);chr$(7);chr$(1);chr$(65)
  264. 792 print#15,"u2:";2;0;18;0:gosub2100
  265. 793 close2:print#15,"i0":close15
  266. 794 goto773
  267. 800 rem ** edit in hex and decimal **
  268. 802 gosub400:poke204,1:x=4:y=0
  269. 805 gosub900
  270. 810 geta$:a=1024+x+(40*y):p=peek(a)
  271. 815 if p>127thenpokea,p-128
  272. 820 if p<128thenpokea,p+128
  273. 825 d=p:gosub896:pokea,p:gosub850
  274. 830 ifa$="[145]"theny=y-1:ify<0theny=7:goto810
  275. 832 ifa$=""theny=y+1:ify>7theny=0:goto810
  276. 834 ifa$="[157]"thenx=x-1:ifx<4thenx=35:goto810
  277. 836 ifa$=""thenx=x+1:ifx>35thenx=4:goto810
  278. 838 ifa$="[133]"then190:rem exit
  279. 840 ifa$="[134]"then860:rem hex
  280. 842 ifa$="[135]"then878:rem dec
  281. 844 ifa$="[136]"thenpokea,p:print"[144]":printtab(20);"              ":goto165
  282. 846 ifa$=chr$(13)then194
  283. 848 goto810
  284. 850 print"[144][214]alue under cursor                   "
  285. 851 print"[145][214]alue under cursor    [157][157][157][157][158]";p;"$";h$;"  [144]"
  286. 852 print"[206]ext track & sector                "
  287. 853 print"[145][206]ext track & sector    [158]";peek(1028);",";peek(1029)
  288. 854 print"[144]":printtab(20);"[208]osition:     "
  289. 855 print"[145]";tab(20);"[208]osition: [158]";((y*32)+x)-4
  290. 856 :return
  291. 860 rem * enter hex value *
  292. 862 d=peek(a):gosub896:rem dec to hex
  293. 864 print"                             "
  294. 866 print"                     ";h$
  295. 868 input"[197]nter new value    ";v$
  296. 870 iflen(v$)<>2thenv$=left$(v$,2)
  297. 872 h$=chr$(48)+chr$(48)+v$
  298. 874 gosub 890:ifd>255ord<0then870
  299. 876 pokea,d:goto805
  300. 878 rem * enter decimal value *
  301. 880 print"                                     "
  302. 882 print"                 ";peek(a)
  303. 884 input"[197]nter new value ";v
  304. 886 ifv>255orv<0then882
  305. 888 pokea,v:goto805
  306. 890 rem convert hex to decimal
  307. 892 d=0:fori=1to4:d%=asc(h$):d%=d%-48+(d%>64)*7:h$=mid$(h$,2):d=16*d+d%:next
  308. 894 return:rem decimal is in d
  309. 896 rem convert decimal to hex
  310. 898 h$="":d=d/4096:fori=1to4:d%=d:h$=h$+chr$(48+d%-(d%>9)*7):d=16*(d-d%):next
  311. 899 h$=right$(h$,2):return
  312. 900 rem edit in hex and dec menu
  313. 902 print""
  314. 904 print"[208]ress: [198]1[146] to exit"
  315. 906 print"      [198]3[146] to change value in hex    "
  316. 908 print"       [198]5[146] to change value in decimal"
  317. 910 print"       f7[146] to edit in text   "
  318. 912 print"[144][208]ress [210][197][212][213][210][206] [144]when done"
  319. 914 return
  320. 999 end
  321. 1000 rem  ** dir **
  322. 1005 gosub2200:open15,8,15,"i0":close15
  323. 1010 open1,8,2,"$"
  324. 1012 print"[147]                                        [146]";
  325. 1013 print"[212]ype [212]rk,[211]ctr  [198]ilename           size  [146]";
  326. 1014 print"                                        [146]";chr$(9)
  327. 1015 sys24576
  328. 1020 close1
  329. 1021 z$=chr$(0):open1,8,0,"$0:"
  330. 1022 forzz=1to18:get#1,a$,b$:nextzz:close1
  331. 1023 f=asc(a$+z$)+256*(asc(b$+z$))
  332. 1024 print"[157]";f;"[194]locks free."
  333. 1025 print"[144][208]ress [211][208][193][195][197] [144]to continue"
  334. 1030 wait197,32
  335. 1035 run
  336. 1100 rem header info
  337. 1105 gosub400
  338. 1107 print""
  339. 1110 open15,8,15
  340. 1115 print#15,"m-r"chr$(22)chr$(0)chr$(5)
  341. 1120 get#15,a$:a$=a$+chr$(0)
  342. 1125 print"id#1       ";asc(a$)""
  343. 1130 get#15,a$:a$=a$+chr$(0)
  344. 1135 print"id#2       ";asc(a$)""
  345. 1140 get#15,a$:a$=a$+chr$(0)
  346. 1145 print"track      ";asc(a$)""
  347. 1150 get#15,a$:a$=a$+chr$(0)
  348. 1155 print"sector     ";asc(a$)""
  349. 1160 get#15,a$:a$=a$+chr$(0)
  350. 1165 print"checksum   ";asc(a$)""
  351. 1168 close15
  352. 1170 print"press any key to return to menu"
  353. 1175 geta$:ifa$=""then1175
  354. 1180 gosub400:goto225
  355. 1500 rem input routine
  356. 1505 t$="":sys25042:poke782,14:poke781,23:sys65520
  357. 1510 poke204,0:wait198,255:wait207,1
  358. 1515 geta$:ifpeek(203)=0then1515
  359. 1520 ifa$=chr$(13)then1540
  360. 1522 ifa$<chr$(48)ora$>chr$(57)then1515
  361. 1525 t$=t$+a$:iflen(t$)>2thenprint"  ":wait207,1:poke204,1:goto1505
  362. 1530 wait207,1:printa$;
  363. 1535 goto1515
  364. 1540 wait207,1:poke204,1:s$="":sys25042:poke782,20:poke781,23:sys65520
  365. 1542 wait207,1:poke204,1:print" [211]ector: ";
  366. 1545 poke204,0:wait198,255:wait207,1
  367. 1550 geta$:ifpeek(203)=0then1550
  368. 1555 ifa$=chr$(13)then1570
  369. 1558 ifa$<chr$(48)ora$>chr$(57)then1550
  370. 1560 s$=s$+a$:iflen(s$)>2thenprint"  ":wait207,1:poke204,1:goto1540
  371. 1565 wait207,1:printa$;:goto1550
  372. 1570 ift$=""thent=0:wait207,1:poke204,1:return
  373. 1575 t=val(t$):s=val(s$)
  374. 1580 wait207,1:poke204,1
  375. 1585 ift>0andt<18ands<21thenreturn
  376. 1590 ift>17andt<25ands<19thenreturn
  377. 1595 ift>24andt<31ands<18thenreturn
  378. 1600 ift>30andt<42ands<17thenreturn
  379. 1605 t=99:return
  380. 2000 close15:close2:close1
  381. 2005 if e=1thenpoke53280,12:return
  382. 2010 poke53280,0:return
  383. 2100 input#15,a,a$,b,c
  384. 2105 ifa$="ok"thenreturn
  385. 2108 print"error on save"
  386. 2110 close15:close2:close1
  387. 2115 forx=9to25:poke781,x:sys59903:nextx
  388. 2120 print"";a;a$;b;c
  389. 2125 goto115
  390. 2200 rem check if drive is present
  391. 2205 open15,8,15:close15
  392. 2210 ifst=0thenreturn
  393. 2215 print"[147]device not present!!!!"
  394. 2220 print"turn your disk drive back on and press"
  395. 2225 print"any key to go to the main menu."
  396. 2230 geta$:ifa$=""then2230
  397. 2235 run
  398. 2600 rem send to printer
  399. 2605 print"printing... please wait."
  400. 2610 open4,4:print#4,"":close4:ifst=0then2635
  401. 2615 print"printer isn't present!"
  402. 2620 print"press any key to return to main menu"
  403. 2625 geta$:ifa$=""then2625
  404. 2630 run
  405. 2635 open4,4:open2,8,2,"edit.doc,s,r"
  406. 2640 print"[147]";chr$(14):sys 25115
  407. 2655 close1:print#4,"":close4
  408. 2660 print:print"done!":goto2570
  409. 3000 rem + decrease track
  410. 3005 gosub1585
  411. 3010 ift=99thent=tt:return
  412. 3015 goto125
  413. 5000 print:print"[145]        illegal track or sector!      "
  414. 5010 fora=1to50:poke54296,15:poke54296,.:next
  415. 5020 fora=1to500:next
  416. 5030 print"[145]                                      ":return
  417. 30000 rem screen copy
  418. 30010 r$=chr$(145):v$=chr$(146):open4,4:forg=0to400
  419. 30020 p=1024+g:c=peek(p)
  420. 30021 ifc=162thenc$=chr$(8)+chr$(255)+chr$(248)+chr$(255)+chr$(248)+chr$(255)
  421. 30022 ifc=162thenc$=c$+chr$(128)+chr$(15):c=1222:goto30025
  422. 30023 ifc=34thenc$=chr$(8)+chr$(128)+chr$(135)+chr$(128)+chr$(135)+chr$(128)
  423. 30024 ifc=34thenc$=c$+chr$(128)+chr$(15):c=1222:goto30025
  424. 30025 if(g)/40=int((g)/40)thenprint#4,chr$(8):print#4,chr$(15);
  425. 30028 ifc=1222then30065
  426. 30029 c$=""
  427. 30030 ifc>128thenc=c-128:c$=chr$(18)
  428. 30040 ifc<32orc>95thenc=c+64:goto30060
  429. 30050 ifc>63andc<96thenc=c+128
  430. 30060 c$=c$+chr$(c)
  431. 30065 iflen(c$)>1thenc$=c$+v$+r$
  432. 30070 print#4,chr$(17);c$;:next:print#4,"":close4:return
  433. 40000 rem edit in assembly
  434. 40001 poke52300+300,t:poke52300+301,s:clr:print"[147]"
  435. 40002 poke53265,peek(53265)and239:dim cd$(256),tp(256)
  436. 40003 forx=0to255:readcd$(x),tp(x):nextx
  437. 40004 poke53265,peek(53265)or16
  438. 40005 print"[147][144] edit in assembly command summary:";chr$(142)
  439. 40006 print"note: xxxx is any memory location"
  440. 40007 print"      between $cc4c and $cd4c."
  441. 40008 print"d xxxx         disassemble at xxxx"
  442. 40009 print"p xxxx         disassemble to printer"
  443. 40010 print"xxxx 4c 00 80  change memory"
  444. 40011 print"#53380         convert number to hex"
  445. 40012 print"$c000          convert number to decimal";
  446. 40013 print"x              exit this mode"
  447. 40015 open1,0:input#1,a$:close1
  448. 40016 ifleft$(a$,1)="d"then40025:goto40015
  449. 40017 ifleft$(a$,1)="x"then40150
  450. 40018 ifmid$(a$,5,1)=" "thengosub40125:a$="d":goto40016
  451. 40019 ifleft$(a$,1)="#"thenb$=mid$(a$,2,5):d=val(b$):gosub40115:printh$:h$=""
  452. 40020 ifleft$(a$,1)="$"thenh$=mid$(a$,2,4):gosub40120:printd
  453. 40021 ifleft$(a$,1)="p"thenopen4,4:cmd4:goto40025
  454. 40024 printchr$(13);:goto40015
  455. 40025 rem * disassemble *
  456. 40026 h$=right$(a$,4):gosub40120:ifd<52300ord>52300+500then40024
  457. 40027 rl=d:print"[147]";
  458. 40028 forx=0to22
  459. 40029 d=rl:gosub40115
  460. 40030 printh$;" ";
  461. 40031 ol=rl:p=peek(rl):pp=tp(p)
  462. 40032 ifpp=1thengosub40050
  463. 40033 ifpp=2thengosub40055
  464. 40034 ifpp=3thengosub40060
  465. 40035 ifpp=4thengosub40065
  466. 40036 ifpp=5thengosub40070
  467. 40037 ifpp=6thengosub40075
  468. 40038 ifpp=7thengosub40080
  469. 40039 ifpp=8thengosub40085
  470. 40040 ifpp=10thengosub40090
  471. 40041 ifpp=11thengosub40100
  472. 40042 ifpp=12thengosub40105
  473. 40044 ifpp=14thengosub40110
  474. 40045 nextx:close4:d=rl:gosub40115:print"d ";h$;chr$(13);"[145]";:goto40015
  475. 40050 rem * accumulator, implied
  476. 40051 d=p:gosub40115
  477. 40052 printright$(h$,2);
  478. 40053 print"        ";cd$(p)
  479. 40054 rl=rl+1:return
  480. 40055 rem * immediate
  481. 40056 d=p:gosub40115:printright$(h$,2);" ";
  482. 40057 d=peek(rl+1):gosub40115:printright$(h$,2);
  483. 40058 print"     ";cd$(p);" #$";right$(h$,2)
  484. 40059 rl=rl+2:return
  485. 40060 rem * zero page
  486. 40061 d=p:gosub40115:printright$(h$,2);" ";
  487. 40062 d=peek(rl+1):gosub40115:printright$(h$,2);
  488. 40063 print"     ";cd$(p);" $";right$(h$,2)
  489. 40064 rl=rl+2:return
  490. 40065 rem * zero page,x
  491. 40066 d=p:gosub40115:printright$(h$,2);" ";
  492. 40067 d=peek(rl+1):gosub40115:printright$(h$,2);
  493. 40068 print"     ";cd$(p);" $";right$(h$,2);",x"
  494. 40069 rl=rl+2:return
  495. 40070 rem * zero page,y
  496. 40071 d=p:gosub40115:printright$(h$,2);" ";
  497. 40072 d=peek(rl+1):gosub40115:printright$(h$,2);
  498. 40073 print"     ";cd$(p);" $";right$(h$,2);",y"
  499. 40074 rl=rl+2:return
  500. 40075 rem * absolute
  501. 40076 d=p:gosub40115:printright$(h$,2);:d=peek(rl+1):gosub40115
  502. 40077 b$=right$(h$,2):print" ";b$;:d=peek(rl+2):gosub40115:a$=right$(h$,2)+b$
  503. 40078 print" ";right$(h$,2);"  ";cd$(p);" $";a$
  504. 40079 rl=rl+3:return
  505. 40080 rem * absolute,x
  506. 40081 d=p:gosub40115:printright$(h$,2);" ";:d=peek(rl+1):gosub40115
  507. 40082 b$=right$(h$,2):printb$;:d=peek(rl+2):gosub40115:a$=right$(h$,2)+b$
  508. 40083 print" ";right$(h$,2);"  ";cd$(p);" $";a$;",x"
  509. 40084 rl=rl+3:return
  510. 40085 rem * absolute,y
  511. 40086 d=p:gosub40115:printright$(h$,2);" ";:d=peek(rl+1):gosub40115
  512. 40087 b$=right$(h$,2):printb$;:d=peek(rl+2):gosub40115:a$=right$(h$,2)+b$
  513. 40088 print" ";right$(h$,2);"  ";cd$(p);" $";a$;",y"
  514. 40089 rl=rl+3:return
  515. 40090 rem * relative
  516. 40091 d=p:gosub40115:printright$(h$,2);" ";:d=peek(rl+1):gosub40115
  517. 40092 printright$(h$,2);:d=peek(rl+1):ifd=255thend=1:goto40095
  518. 40093 ifd=254thend=0:goto40095
  519. 40094 d=d+2
  520. 40095 d=ol+d:gosub40115:print"     ";cd$(p);" $";h$
  521. 40096 rl=rl+2:return
  522. 40100 rem * (indirect,x)
  523. 40101 d=p:gosub40115:printright$(h$,2);" ";
  524. 40102 d=peek(rl+1):gosub40115:printright$(h$,2);
  525. 40103 print"     ";cd$(p);" ($";right$(h$,2);",x)"
  526. 40104 rl=rl+2:return
  527. 40105 rem * (indirect,y)
  528. 40106 d=p:gosub40115:printright$(h$,2);" ";
  529. 40107 d=peek(rl+1):gosub40115:printright$(h$,2);
  530. 40108 print"     ";cd$(p);" ($";right$(h$,2);"),y"
  531. 40109 rl=rl+2:return
  532. 40110 rem * (indirect)
  533. 40111 d=p:gosub40115:printright$(h$,2);:d=peek(rl+1):gosub40115
  534. 40112 b$=right$(h$,2):printb$;:d=peek(rl+2):gosub40115:a$=right$(h$,2)+b$
  535. 40113 printtab(15);cd$(p);"($";a$;")"
  536. 40114 rl=rl+3:return
  537. 40115 rem dec to hex
  538. 40116 h$="":d=d/4096:fori=1to4:d%=d:h$=h$+chr$(48+d%-(d%>9)*7):d=16*(d-d%):next
  539. 40117 return
  540. 40120 rem hex to dec
  541. 40121 iflen(h$)<>4thenreturn
  542. 40122 d=0:fori=1to4:d%=asc(h$):d%=d%-48+(d%>64)*7:h$=mid$(h$,2):d=16*d+d%:next
  543. 40123 return
  544. 40125 rem * change *
  545. 40126 h$=left$(a$,4):gosub40120:rl=d
  546. 40127 h$="00"+mid$(a$,6,2):gosub40120
  547. 40128 pokerl,d:b$=mid$(a$,9,2)
  548. 40129 ifb$="  "thenreturn
  549. 40130 h$="00"+b$:gosub40120
  550. 40131 pokerl+1,d:b$=mid$(a$,12,2)
  551. 40132 ifb$="  "thenreturn
  552. 40133 h$="00"+b$:gosub40120
  553. 40134 pokerl+2,d:return
  554. 40150 rem return to edit in text
  555. 40151 t=peek(52300+300)
  556. 40152 s=peek(52300+301)
  557. 40153 print"[147]":sys49447:poke199,0
  558. 40154 gosub155:printchr$(14)
  559. 40155 goto170
  560. 50000 rem * data for edit in assembly *
  561. 50001 rem * command, opcode, type (mode)
  562. 50002 data brk,1
  563. 50003 data ora,11
  564. 50004 data ???,1
  565. 50005 data ???,1
  566. 50006 data ???,1
  567. 50007 data ora,3
  568. 50008 data asl,3
  569. 50009 data ???,1
  570. 50010 data php,1
  571. 50011 data ora,2
  572. 50012 data asl,1
  573. 50013 data ???,1
  574. 50014 data ???,1
  575. 50015 data ora,6
  576. 50016 data asl,6
  577. 50017 data ???,1
  578. 50018 data bpl,10
  579. 50019 data ora,12
  580. 50020 data ???,1
  581. 50021 data ???,1
  582. 50022 data ???,1 
  583. 50023 data ora,7
  584. 50024 data asl,7
  585. 50025 data ???,1
  586. 50026 data clc,1
  587. 50027 data ora,7
  588. 50029 data ???,1
  589. 50030 data ???,1
  590. 50031 data ???,1
  591. 50032 data ora,7
  592. 50033 data asl,7
  593. 50034 data ???,1
  594. 50035 data jsr,6
  595. 50036 data and,11
  596. 50037 data ???,1
  597. 50038 data ???,1
  598. 50039 data bit,3
  599. 50040 data and,3
  600. 50041 data rol,3
  601. 50042 data ???,1
  602. 50043 data plp,1
  603. 50044 data and,2
  604. 50045 data rol,1
  605. 50046 data ???,1
  606. 50047 data bit,6
  607. 50049 data and,6
  608. 50050 data rol,6
  609. 50051 data ???,1
  610. 50052 data bmi,10
  611. 50053 data and,12
  612. 50054 data ???,1
  613. 50055 data ???,1
  614. 50056 data ???,1
  615. 50057 data and,4
  616. 50058 data rol,4
  617. 50059 data ???,1
  618. 50060 data sec,1
  619. 50061 data and,8
  620. 50062 data ???,1
  621. 50063 data ???,1
  622. 50064 data ???,1
  623. 50065 data and,7
  624. 50066 data rol,7
  625. 50067 data ???,1
  626. 50068 data rti,1
  627. 50069 data eor,11
  628. 50070 data ???,1
  629. 50071 data ???,1
  630. 50072 data ???,1
  631. 50073 data eor,3
  632. 50074 data lsr,3
  633. 50075 data ???,1
  634. 50076 data pha,1
  635. 50077 data eor,2
  636. 50078 data lsr,1
  637. 50079 data ???,1
  638. 50080 data jmp,6
  639. 50081 data eor,6
  640. 50082 data lsr,6
  641. 50083 data ???,1
  642. 50084 data bvc,10
  643. 50085 data eor,12
  644. 50086 data ???,1
  645. 50087 data ???,1
  646. 50088 data ???,1
  647. 50089 data eor,4
  648. 50090 data lsr,4
  649. 50091 data ???,1
  650. 50092 data cli,1
  651. 50093 data eor,8
  652. 50094 data ???,1
  653. 50095 data ???,1
  654. 50096 data ???,1
  655. 50097 data eor,7
  656. 50098 data lsr,7
  657. 50099 data ???,1
  658. 50100 data rts,1
  659. 50101 data adc,11
  660. 50102 data ???,1,???,1
  661. 50103 data ???,1
  662. 50104 data adc,3
  663. 50105 data ror,3
  664. 50106 data ???,1
  665. 50107 data pla,1
  666. 50108 data adc,2
  667. 50109 data ror,1
  668. 50110 data ???,1
  669. 50115 data jmp,14
  670. 50116 data adc,6
  671. 50117 data ror,6
  672. 50118 data ???,1
  673. 50119 data bvs,10
  674. 50120 data adc,12
  675. 50121 data ???,1
  676. 50122 data ???,1
  677. 50123 data ???,1
  678. 50124 data adc,4
  679. 50125 data ror,4
  680. 50126 data ???,1
  681. 50127 data sei,1
  682. 50128 data adc,8
  683. 50129 data ???,1
  684. 50130 data ???,1
  685. 50131 data ???,1
  686. 50132 data adc,7
  687. 50133 data ror,7
  688. 50134 data ???,1
  689. 50135 data ???,1
  690. 50136 data sta,11
  691. 50137 data ???,1
  692. 50138 data ???,1
  693. 50139 data sty,3
  694. 50140 data sta,3
  695. 50141 data stx,3
  696. 50142 data ???,1
  697. 50143 data dey,1
  698. 50144 data ???,1
  699. 50145 data txa,1
  700. 50146 data ???,1
  701. 50147 data sty,6
  702. 50148 data sta,6
  703. 50149 data stx,6
  704. 50150 data ???,1
  705. 50151 data bcc,10
  706. 50152 data sta,12
  707. 50153 data ???,1
  708. 50154 data ???,1
  709. 50155 data sty,4
  710. 50156 data sta,4
  711. 50157 data stx,5
  712. 50158 data ???,1
  713. 50159 data tya,1
  714. 50160 data sta,8
  715. 50161 data txs,1
  716. 50162 data ???,1
  717. 50163 data ???,1
  718. 50164 data sta,7
  719. 50165 data ???,1
  720. 50166 data ???,1
  721. 50167 data ldy,2
  722. 50168 data lda,11
  723. 50169 data ldx,2
  724. 50170 data ???,1
  725. 50171 data ldy,3
  726. 50172 data lda,3
  727. 50173 data ldx,3
  728. 50174 data ???,1
  729. 50175 data tay,1
  730. 50176 data lda,2
  731. 50177 data tax,1
  732. 50178 data ???,1
  733. 50179 data ldy,6
  734. 50180 data lda,6
  735. 50181 data ldx,6
  736. 50182 data ???,1
  737. 50183 data bcs,10
  738. 50184 data lda,12
  739. 50185 data ???,1
  740. 50186 data ???,1
  741. 50187 data ldy,4
  742. 50188 data lda,4
  743. 50189 data ldx,5
  744. 50190 data ???,1
  745. 50191 data clv,1
  746. 50192 data lda,8
  747. 50193 data tsx,1
  748. 50194 data ???,1
  749. 50195 data ldy,7
  750. 50196 data lda,7
  751. 50197 data ldx,8
  752. 50198 data ???,1
  753. 50199 data cpy,2
  754. 50200 data cmp,11
  755. 50201 data ???,1
  756. 50202 data ???,1
  757. 50203 data cpy,3
  758. 50204 data cmp,3
  759. 50205 data dec,3
  760. 50206 data ???,1
  761. 50207 data iny,1
  762. 50208 data cmp,2
  763. 50209 data dex,1
  764. 50210 data ???,1
  765. 50211 data cpy,6
  766. 50212 data cmp,6
  767. 50213 data dec,6
  768. 50214 data ???,1
  769. 50215 data bne,10
  770. 50216 data cmp,12
  771. 50217 data ???,1
  772. 50218 data ???,1
  773. 50219 data ???,1
  774. 50220 data cmp,4
  775. 50221 data dec,4
  776. 50222 data ???,1
  777. 50223 data cld,1
  778. 50224 data cmp,8
  779. 50225 data ???,1
  780. 50226 data ???,1
  781. 50227 data ???,1
  782. 50228 data cmp,7
  783. 50229 data dec,7
  784. 50230 data ???,1
  785. 50231 data cpx,2
  786. 50232 data sbc,11
  787. 50233 data ???,1
  788. 50234 data ???,1
  789. 50235 data cpx,3
  790. 50236 data sbc,3
  791. 50237 data inc,3
  792. 50238 data ???,1
  793. 50239 data inx,1
  794. 50240 data sbc,2
  795. 50241 data nop,1
  796. 50242 data ???,1
  797. 50243 data cpx,6
  798. 50178 data sbc,6
  799. 50245 data inc,6
  800. 50246 data ???,1
  801. 50247 data beq,10
  802. 50248 data sbc,12
  803. 50249 data ???,1,???,1,???,1
  804. 50250 data sbc,4
  805. 50251 data inc,4
  806. 50252 data ???,1
  807. 50253 data sed,1
  808. 50254 data sbc,8
  809. 50255 data ???,1
  810. 50256 data ???,1
  811. 50257 data ???,1
  812. 50258 data sbc,7
  813. 50259 data inc,7
  814. 50260 data ???,1
  815.