home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1989 January
/
1989-01.d64
/
disassembler
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
5KB
|
188 lines
10 rem copyright 1989 compute! publications, inc. - all rights reserved
20 nl=39:rem number of address labels
30 ml=820:rem starting address
40 :
50 poke53281,0:poke53280,6
60 print"[147][152] copyright 1989 compute! pub., inc."
70 printtab(11)"all rights reserved"
80 print" s m a r t d i s a s s e m b l e r "
90 printtab(13)"please wait..."
100 dim op$(255),tp%(255),lc(nl),lb$(nl)
110 dg$="0123456789abcdef":s$=" "
120 sp$=" "
130 cl$=sp$+" ":fori=0to255:readop$(i)
140 if op$(i)="" then op$(i)="byte":tp%(i)=14:goto160
150 read tp%(i)
160 next
170 fori=mlto ml+38:reada:pokei,a:next
180 a=int(ml/256):poke786,a:poke785,ml-a*256
190 fori=1tonl:readlb$(i),lc(i):next
200 input" starting address";sa
210 input" ending address";ea
220 ifea=0thenea=65535
230 ifea<=sa then210
240 f=0:pr=0:h=0:rm=0:print:gosub830:print"[147]":pc=sa
250 a$=str$(pc):if h then gosub780:a$=s$+right$(a$,4)
260 p$=a$+" ":printp$;:j=usr(pc):tc=pc:printop$(j);
270 ontp%(j)gosub440,470,530,550,560,580,600,620,640,660,680,700,490,720
280 pc=pc+n:print a$;tab(20);
290 if pr then print#3,p$;op$(j);a$;
300 a=len(p$+op$(j)+a$):c=23:a$="":fori=tctopc-1
310 print tab(c)usr(i):print"[145]";
320 a$=a$+str$(usr(i)):c=c+4:next
330 if pr then print#3,right$(sp$,28-a);a$
340 print:ifpc>ea then420
350 a=fre(0):rem force garbage collect.
360 geta$:ifa$="" then250
370 print" space[146] - continue f1[146] - menu[145]"
380 geta$:ifa$=""then380
390 print cl$;"[145][145]"
400 ifa$="[133]"thengosub830
410 goto250
420 if pr then print#3:close3
430 print"end of disassembly":end
440 a$=str$(usr(pc+1))
450 if h then gosub820
460 a$=" #"+right$(a$,len(a$)-1):n=2:return
470 l=usr(pc+1):m=usr(pc+2):ad=256*m+l:a$=str$(ad):ifhthengosub780
480 n=3:return
490 l=usr(pc+1):m=usr(pc+2):ad=256*m+l
500 if f then gosub740:if k then520
510 a$=str$(ad):if h then gosub780
520 n=3:return
530 a$=str$(usr(pc+1)):ifhthengosub820
540 n=2:return
550 a$="":n=1:return
560 a$=str$(usr(pc+1)):ifhthengosub820
570 a$=" ("+right$(a$,len(a$)-1)+",x):n=2:return
580 ad[178][183](pc[170]1):a$[178][196](ad):[139]h[167][141]820
590 a$[178]" ("[170][201](a$,[195](a$)[171]1)[170]"),y":n[178]2:[142]
600 ad[178][183](pc[170]1):a$[178][196](ad):[139]h[167][141]820
610 a$[178]a$[170]",x":n[178]2:[142]
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
630 a$[178]a$[170]",x":n[178]3:[142]
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
650 a$[178]a$[170]",y":n[178]3:[142]
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
670 n[178]2:[142]
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
690 a$[178]" ("[170][201](a$,[195](a$)[171]1)[170]")":n[178]3:[142]
700 ad[178][183](pc[170]1):a$[178][196](ad):[139]h[167][141]820
710 a$[178]a$[170]",y":n[178]2:[142]
720 a$[178][196](j):[139]h[167][141]820
730 n[178]1:[142]
740 i[178]1:k[178]0
750 [139] lc(i)[178]ad [167] a$[178]s$[170]lb$(i):k[178]1:[142]
760 i[178]i[170]1:[139] i[177]nl [167] [142]
770 [137]750
780 nn[178]4
790 h$[178]"":a[178][197](a$):[129]i[178]1[164]nn
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]
810 a$[178]s$[170]"$"[170]h$:[142]
820 nn[178]2:[137]790
830 [160]3
840 [153]"cont f1 - start/resume disassembly"
850 [153]" f3 - subroutine labels: ";:[139]f[167] [153]"on ":[137]870
860 [153]"off"
870 [153]"cont f5 - hex/decimal output: ";:[139] h [167][153]"hex ":[137]890
880 [153]"decimal"
890 [153]"cont f6 - disassemble under rom: ";:[139] rm [167][153]"yes":[137]910
900 [153]"no "
910 [153]"cont f7 - printer output: ";:[139]pr[167] [153]"yes":[137]930
920 [153]"no "
930 [153]"cont f8 - quitononononononononononononon"
940 [161]a$:[139]a$[178]""[167]940
950 a[178][198](a$):[139]a[178]140[167] [156]:[153]"load":[128]
960 [139]a[179][177]135[167]990
970 [139]h[167]h[178]0:[137]840
980 h[178]1:[137]840
990 [139]a[179][177]136[167]1020
1000 [139]pr [167] pr[178]0:[137]840
1010 pr[178]1:[137]840
1020 [139]a[179][177]134[167]1050
1030 [139]f[167]f[178]0:[137]840
1040 f[178]1:[137]840
1050 [139]a[179][177]139[167]1080
1060 [139] rm [167]rm[178]0:[137]840
1070 rm[178]1:[137]840
1080 [139]a[179][177]133[167]840
1090 [139]pr[167][159]3,4,0
1100 [151]2,rm
1110 [129]a[178]1[164]12:[153]cl$:[130]
1120 [153]"onononononononononononon";
1130 [142]
1140 :
1150 [131] brk,4,ora,5,,,,ora,3,asl,3,
1160 [131] php,4,ora,1,asl,4,,,ora,2
1170 [131] asl,2,,bpl,10,ora,6,,,
1180 [131] ora,7,asl,7,,clc,4,ora,9,,,
1190 [131] ora,8,asl,8,,jsr,13,and,5,,
1200 [131] bit,3,and,3,rol,3,,plp,4
1210 [131] and,1,rol,4,,bit,2,and,2
1220 [131] rol,2,,bmi,10,and,6,,,
1230 [131] and,7,rol,7,,sec,4,and,9,,,
1240 [131] and,8,rol,8,,rti,4,eor,5,,,
1250 [131] eor,3,lsr,3,,pha,4,eor,1
1260 [131] lsr,4,,jmp,13,eor,2,lsr,2,
1270 [131] bvc,10,eor,6,,,,eor,7,lsr,7,
1280 [131] cli,4,eor,9,,,,eor,8
1290 [131] lsr,8,,rts,4,adc,5,,,
1300 [131] adc,3,ror,3,,pla,4,adc,1
1310 [131] ror,4,,jmp,11,adc,2,ror,2,
1320 [131] bvs,10,adc,6,,,,adc,8,ror,7,
1330 [131] sei,4,adc,9,,,,adc,7
1340 [131] ror,8,,,sta,5,,,sty,3
1350 [131] sta,3,stx,3,,dey,4,,txa,4,
1360 [131] sty,2,sta,2,stx,2,,bcc,10
1370 [131] sta,6,,sty,7,,sta,7,stx,12,
1380 [131] tya,4,sta,9,txs,4,,,sta,8,,
1390 [131] ldy,1,lda,5,ldx,1,,ldy,3
1400 [131] lda,3,ldx,3,,tay,4,lda,1
1410 [131] tax,4,,ldy,2,lda,2,ldx,2,
1420 [131] bcs,10,lda,6,,,ldy,7,lda,7
1430 [131] ldx,12,,clv,4,lda,9,tsx,4,
1440 [131] ldy,8,lda,8,ldx,9,,cpy,1
1450 [131] cmp,5,,,cpy,3,cmp,3,dec,3,
1460 [131] iny,4,cmp,1,dex,4,,cpy,2
1470 [131] cmp,2,dec,2,,bne,10,cmp,6,,,
1480 [131] cmp,7,dec,7,,cld,4,cmp,9,,,
1490 [131] cmp,8,dec,8,,cpx,1,sbc,5,,
1500 [131] cpx,3,sbc,3,inc,3,,inx,4
1510 [131] sbc,1,nop,4,,cpx,2,sbc,2
1520 [131] inc,2,,beq,10,sbc,6,,,
1530 [131] sbc,7,inc,7,,sed,4,sbc,9,,,
1540 [131] sbc,8,inc,8,
1550 :
1560 [131] 32,247,183,165,101,133,251
1570 [131] 165,100,133,252,160,0,165,2,240,7,120,165
1580 [131] 1,41,252,133,1,177,251,168
1590 [131] 165,1,9,3,133,1,88,169,0
1600 [131] 76,145,179
1610 :
1620 [143] label data
1630 :
1640 [131] chrout,65490,getin,65508
1650 [131] setlfs,65466,setmsg,65424
1660 [131] setnam,65469,save,65496
1670 [131] load,65493,open,65472
1680 [131] chrin,65487,close,65475
1690 [131] clall,65511,chkin,65478
1700 [131] readst,65463,chkout,65481
1710 [131] clrchn,65484,plot,65520
1720 [131] listen,65457,ciout,65448
1730 [131] cint,65409,second,65427
1740 [131] scnkey,65439,restor,65418
1750 [131] talk,65460,iobase,65523
1760 [131] acptr,65445,ioinit,65412
1770 [131] membot,65436,memtop,65433
1780 [131] unlsn,65454,vector,65421
1790 [131] untlk,65451,settim,65499
1800 [131] settmo,65442,ramtas,65415
1810 [131] rdtim,65502,udtim,65514
1820 [131] tksa,65430,stop,65505
1830 [131] screen,65517
1840 :
1850 [143] add your own address labels
1860 [143] in data statements after
1870 [143] these lines