home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1989 January / 1989-01.d64 / disassembler (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  188 lines

  1. 10 rem copyright 1989 compute! publications, inc. - all rights reserved
  2. 20 nl=39:rem  number of address labels
  3. 30 ml=820:rem  starting address
  4. 40 :
  5. 50 poke53281,0:poke53280,6
  6. 60 print"[147][152]   copyright 1989 compute! pub., inc."
  7. 70 printtab(11)"all rights reserved"
  8. 80 print"  s m a r t   d i s a s s e m b l e r   "
  9. 90 printtab(13)"please wait..."
  10. 100 dim op$(255),tp%(255),lc(nl),lb$(nl)
  11. 110 dg$="0123456789abcdef":s$=" "
  12. 120 sp$="                            "
  13. 130 cl$=sp$+"         ":fori=0to255:readop$(i)
  14. 140 if op$(i)="" then op$(i)="byte":tp%(i)=14:goto160
  15. 150 read tp%(i)
  16. 160 next
  17. 170 fori=mlto ml+38:reada:pokei,a:next
  18. 180 a=int(ml/256):poke786,a:poke785,ml-a*256
  19. 190 fori=1tonl:readlb$(i),lc(i):next
  20. 200 input" starting address";sa
  21. 210 input" ending address";ea
  22. 220 ifea=0thenea=65535
  23. 230 ifea<=sa then210
  24. 240 f=0:pr=0:h=0:rm=0:print:gosub830:print"[147]":pc=sa
  25. 250 a$=str$(pc):if h then gosub780:a$=s$+right$(a$,4)
  26. 260 p$=a$+"  ":printp$;:j=usr(pc):tc=pc:printop$(j);
  27. 270 ontp%(j)gosub440,470,530,550,560,580,600,620,640,660,680,700,490,720
  28. 280 pc=pc+n:print a$;tab(20);
  29. 290 if pr then print#3,p$;op$(j);a$;
  30. 300 a=len(p$+op$(j)+a$):c=23:a$="":fori=tctopc-1
  31. 310 print tab(c)usr(i):print"[145]";
  32. 320 a$=a$+str$(usr(i)):c=c+4:next
  33. 330 if pr then print#3,right$(sp$,28-a);a$
  34. 340 print:ifpc>ea then420
  35. 350 a=fre(0):rem force garbage collect.
  36. 360 geta$:ifa$="" then250
  37. 370 print"     space[146] - continue     f1[146] - menu[145]"
  38. 380 geta$:ifa$=""then380
  39. 390 print cl$;"[145][145]"
  40. 400 ifa$="[133]"thengosub830
  41. 410 goto250
  42. 420 if pr then print#3:close3
  43. 430 print"end of disassembly":end
  44. 440 a$=str$(usr(pc+1))
  45. 450 if h then gosub820
  46. 460 a$=" #"+right$(a$,len(a$)-1):n=2:return
  47. 470 l=usr(pc+1):m=usr(pc+2):ad=256*m+l:a$=str$(ad):ifhthengosub780
  48. 480 n=3:return
  49. 490 l=usr(pc+1):m=usr(pc+2):ad=256*m+l
  50. 500 if f then gosub740:if k then520
  51. 510 a$=str$(ad):if h then gosub780
  52. 520 n=3:return
  53. 530 a$=str$(usr(pc+1)):ifhthengosub820
  54. 540 n=2:return
  55. 550 a$="":n=1:return
  56. 560 a$=str$(usr(pc+1)):ifhthengosub820
  57. 570 a$=" ("+right$(a$,len(a$)-1)+",x):n=2:return
  58. 580 ad[178][183](pc[170]1):a$[178][196](ad):[139]h[167][141]820
  59. 590 a$[178]" ("[170][201](a$,[195](a$)[171]1)[170]"),y":n[178]2:[142]
  60. 600 ad[178][183](pc[170]1):a$[178][196](ad):[139]h[167][141]820
  61. 610 a$[178]a$[170]",x":n[178]2:[142]
  62. 620 l[178][183](pc[170]1):m[178][183](pc[170]2):ad[178]256[172]m[170]l:a$[178][196](ad):[139]h[167][141]780
  63. 630 a$[178]a$[170]",x":n[178]3:[142]
  64. 640 l[178][183](pc[170]1):m[178][183](pc[170]2):ad[178]256[172]m[170]l:a$[178][196](ad):[139]h[167][141]780
  65. 650 a$[178]a$[170]",y":n[178]3:[142]
  66. 660 n[178][183](pc[170]1):[139]n[177]127[167]n[178]n[171]256:ad[178]pc[170]n[170]2:a$[178][196](ad):[139]h[167][141]780
  67. 670 n[178]2:[142]
  68. 680 l[178][183](pc[170]1):m[178][183](pc[170]2):ad[178]256[172]m[170]l:a$[178][196](ad):[139]h[167][141]780
  69. 690 a$[178]" ("[170][201](a$,[195](a$)[171]1)[170]")":n[178]3:[142]
  70. 700 ad[178][183](pc[170]1):a$[178][196](ad):[139]h[167][141]820
  71. 710 a$[178]a$[170]",y":n[178]2:[142]
  72. 720 a$[178][196](j):[139]h[167][141]820
  73. 730 n[178]1:[142]
  74. 740 i[178]1:k[178]0
  75. 750 [139] lc(i)[178]ad [167] a$[178]s$[170]lb$(i):k[178]1:[142]
  76. 760 i[178]i[170]1:[139] i[177]nl [167] [142]
  77. 770 [137]750
  78. 780 nn[178]4
  79. 790 h$[178]"":a[178][197](a$):[129]i[178]1[164]nn
  80. 800 t[178][181](a[173]16):h$[178][202](dg$,a[171]16[172]t[170]1,1)[170]h$:a[178]t:[130]
  81. 810 a$[178]s$[170]"$"[170]h$:[142]
  82. 820 nn[178]2:[137]790
  83. 830 [160]3
  84. 840 [153]"cont   f1 - start/resume disassembly"
  85. 850 [153]"   f3 - subroutine labels: ";:[139]f[167] [153]"on ":[137]870
  86. 860 [153]"off"
  87. 870 [153]"cont   f5 - hex/decimal output: ";:[139] h [167][153]"hex    ":[137]890
  88. 880 [153]"decimal"
  89. 890 [153]"cont   f6 - disassemble under rom: ";:[139] rm [167][153]"yes":[137]910
  90. 900 [153]"no "
  91. 910 [153]"cont   f7 - printer output: ";:[139]pr[167] [153]"yes":[137]930
  92. 920 [153]"no "
  93. 930 [153]"cont   f8 - quitononononononononononononon"
  94. 940 [161]a$:[139]a$[178]""[167]940
  95. 950 a[178][198](a$):[139]a[178]140[167] [156]:[153]"load":[128]
  96. 960 [139]a[179][177]135[167]990
  97. 970 [139]h[167]h[178]0:[137]840
  98. 980 h[178]1:[137]840
  99. 990 [139]a[179][177]136[167]1020
  100. 1000 [139]pr [167] pr[178]0:[137]840
  101. 1010 pr[178]1:[137]840
  102. 1020 [139]a[179][177]134[167]1050
  103. 1030 [139]f[167]f[178]0:[137]840
  104. 1040 f[178]1:[137]840
  105. 1050 [139]a[179][177]139[167]1080
  106. 1060 [139] rm [167]rm[178]0:[137]840
  107. 1070 rm[178]1:[137]840
  108. 1080 [139]a[179][177]133[167]840
  109. 1090 [139]pr[167][159]3,4,0
  110. 1100 [151]2,rm
  111. 1110 [129]a[178]1[164]12:[153]cl$:[130]
  112. 1120 [153]"onononononononononononon";
  113. 1130 [142]
  114. 1140 :
  115. 1150 [131] brk,4,ora,5,,,,ora,3,asl,3,
  116. 1160 [131] php,4,ora,1,asl,4,,,ora,2
  117. 1170 [131] asl,2,,bpl,10,ora,6,,,
  118. 1180 [131] ora,7,asl,7,,clc,4,ora,9,,,
  119. 1190 [131] ora,8,asl,8,,jsr,13,and,5,,
  120. 1200 [131] bit,3,and,3,rol,3,,plp,4
  121. 1210 [131] and,1,rol,4,,bit,2,and,2
  122. 1220 [131] rol,2,,bmi,10,and,6,,,
  123. 1230 [131] and,7,rol,7,,sec,4,and,9,,,
  124. 1240 [131] and,8,rol,8,,rti,4,eor,5,,,
  125. 1250 [131] eor,3,lsr,3,,pha,4,eor,1
  126. 1260 [131] lsr,4,,jmp,13,eor,2,lsr,2,
  127. 1270 [131] bvc,10,eor,6,,,,eor,7,lsr,7,
  128. 1280 [131] cli,4,eor,9,,,,eor,8
  129. 1290 [131] lsr,8,,rts,4,adc,5,,,
  130. 1300 [131] adc,3,ror,3,,pla,4,adc,1
  131. 1310 [131] ror,4,,jmp,11,adc,2,ror,2,
  132. 1320 [131] bvs,10,adc,6,,,,adc,8,ror,7,
  133. 1330 [131] sei,4,adc,9,,,,adc,7
  134. 1340 [131] ror,8,,,sta,5,,,sty,3
  135. 1350 [131] sta,3,stx,3,,dey,4,,txa,4,
  136. 1360 [131] sty,2,sta,2,stx,2,,bcc,10
  137. 1370 [131] sta,6,,sty,7,,sta,7,stx,12,
  138. 1380 [131] tya,4,sta,9,txs,4,,,sta,8,,
  139. 1390 [131] ldy,1,lda,5,ldx,1,,ldy,3
  140. 1400 [131] lda,3,ldx,3,,tay,4,lda,1
  141. 1410 [131] tax,4,,ldy,2,lda,2,ldx,2,
  142. 1420 [131] bcs,10,lda,6,,,ldy,7,lda,7
  143. 1430 [131] ldx,12,,clv,4,lda,9,tsx,4,
  144. 1440 [131] ldy,8,lda,8,ldx,9,,cpy,1
  145. 1450 [131] cmp,5,,,cpy,3,cmp,3,dec,3,
  146. 1460 [131] iny,4,cmp,1,dex,4,,cpy,2
  147. 1470 [131] cmp,2,dec,2,,bne,10,cmp,6,,,
  148. 1480 [131] cmp,7,dec,7,,cld,4,cmp,9,,,
  149. 1490 [131] cmp,8,dec,8,,cpx,1,sbc,5,,
  150. 1500 [131] cpx,3,sbc,3,inc,3,,inx,4
  151. 1510 [131] sbc,1,nop,4,,cpx,2,sbc,2
  152. 1520 [131] inc,2,,beq,10,sbc,6,,,
  153. 1530 [131] sbc,7,inc,7,,sed,4,sbc,9,,,
  154. 1540 [131] sbc,8,inc,8,
  155. 1550 :
  156. 1560 [131] 32,247,183,165,101,133,251
  157. 1570 [131] 165,100,133,252,160,0,165,2,240,7,120,165
  158. 1580 [131] 1,41,252,133,1,177,251,168
  159. 1590 [131] 165,1,9,3,133,1,88,169,0
  160. 1600 [131] 76,145,179
  161. 1610 :
  162. 1620 [143]  label data
  163. 1630 :
  164. 1640 [131] chrout,65490,getin,65508
  165. 1650 [131] setlfs,65466,setmsg,65424
  166. 1660 [131] setnam,65469,save,65496
  167. 1670 [131] load,65493,open,65472
  168. 1680 [131] chrin,65487,close,65475
  169. 1690 [131] clall,65511,chkin,65478
  170. 1700 [131] readst,65463,chkout,65481
  171. 1710 [131] clrchn,65484,plot,65520
  172. 1720 [131] listen,65457,ciout,65448
  173. 1730 [131] cint,65409,second,65427
  174. 1740 [131] scnkey,65439,restor,65418
  175. 1750 [131] talk,65460,iobase,65523
  176. 1760 [131] acptr,65445,ioinit,65412
  177. 1770 [131] membot,65436,memtop,65433
  178. 1780 [131] unlsn,65454,vector,65421
  179. 1790 [131] untlk,65451,settim,65499
  180. 1800 [131] settmo,65442,ramtas,65415
  181. 1810 [131] rdtim,65502,udtim,65514
  182. 1820 [131] tksa,65430,stop,65505
  183. 1830 [131] screen,65517
  184. 1840 :
  185. 1850 [143]  add your own address labels
  186. 1860 [143]  in data statements after
  187. 1870 [143]  these lines
  188.