home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1986 January
/
1986-01.d64
/
disassembler
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
7KB
|
231 lines
100 ba=53280:pr=65490:co=646:ac=780:print"[147]":pokeba,0:pokeba+1,0
110 fora=828to985:readb:pokea,b:next
120 data 32,253,174,32,158,173,32,130,183,168,169,0,145,34,162,0,181,0,157
130 data 0,160,202,208,248,165,34,133,122,165,35,133,123,32,172,3,169,1,133
140 data 129,208,7,32,121,0,201,0,240,43,32,115,0,176,32,32,172,3,169
150 data 36,32,210,255,32,131,174,32,155,188,165,100,240,3,32,181,3,165,101
160 data 32,181,3,32,172,3,76,101,3,32,210,255,76,101,3,120,162,0,169
170 data 54,133,1,189,0,160,149,0,202,208,248,169,55,133,1,88,96,166,122
180 data 208,2,198,123,198,122,96,72,74,74,74,74,32,195,3,104,41,15,76
190 data 195,3,170,189,202,3,76,210,255,48,49,50,51,52,53,54,55,56,57
200 data 65,66,67,68,69,70
210 open15,8,15:print#15,"m-w";chr$(106)chr$(0)chr$(1)chr$(133):close15
220 open1,0
230 pokeac,147:syspr:dim c$(255),c(255)
240 pokeco,1:print" disk disassembler"
250 reada$,b,c:ifa$="end"then290
260 c$(b)=a$:c(b)=c
270 goto250
280 poke152,0:open1,0:print"[147]"tab(4)" disk disassembler":q$="":nu$=""
290 print:print:print"enter disassembly: r[146]am or d[146]isk"
300 getmd$:ifmd$="d"ormd$="r"then320
310 goto300
320 ifmd$="r"then340
330 goto390
340 print:print"enter starting address: ";
350 input#1,sa
360 print:print"enter ending address"
370 print"(if not known put 0): ";
380 input#1,ed:print:goto420
390 print:print"enter ml file name: ";
400 input#1,f$:open2,8,2,"0:"+f$:close2:open15,8,15:input#15,a$,b$,c$,d$
410 ifval(a$)>0then860
420 print:print"do you want list hold [y/n]: ";
430 getsp$:ifsp$="y"orsp$="n"then450
440 goto430
450 printsp$:ifsp$="y"thenlh=1
460 ifsp$="n"thenlh=0
470 close15:poke198,0
480 print"send to screen [y/n]: ";
490 getsp$:ifsp$="y"orsp$="n"then510
500 goto490
510 poke198,0
520 printsp$:ifsp$="y"thensc=1
530 ifsp$="n"thensc=0
540 print"send to printer [y/n]: ";
550 getsp$:ifsp$="y"orsp$="n"then570
560 goto550
570 poke198,0
580 printsp$:ifsp$="y"thenpr=1
590 ifsp$="n"thenpr=0
600 print"send to disk [y/n]: ";
610 poke198,0
620 getsp$:ifsp$="y"orsp$="n"then640
630 goto620
640 printsp$:ifsp$="y"thendi=1
650 ifdi=1andlh=1thenprint"list hold disactivated[146]":lh=0:er=1:gosub860
660 ifsp$="n"thendi=0
670 ifdi=0then700
680 print"enter destination's file name: ";
690 input#1,d$:print:poke198,0
700 hf=0:print"hexadecimal output [y/n]: ";:poke198,0
710 getsp$:ifsp$<>"y"andsp$<>"n"then710
720 printsp$:ifsp$="y"thenhf=1
730 print"information correct [y/n]: ";
740 getyn$:ifyn$="y"oryn$="n"then760
750 goto740
760 printyn$:ifyn$="n"then280
770 print"[147]addr. command op code ":close1
780 print"[163][163][163][163][163] [163][163][163][163][163][163][163] [163][163][163][163][163][163][163] "
790 ifmd$="d"thenopen15,8,15:print#15,"i0"
800 ifmd$="d"thenopen2,8,0,f$:close1
810 ifst<>0then860
820 ifdi=1thengosub1770:rem goto init file
830 ifpr=1thenopen4,4
840 ifst<>0then860
850 goto990
860 rem check for error
870 cc=0:ifval(a$)>0thener=0
880 ifer<>1thenprint"io/error:[146] ";a$;",";b$;",";c$;",";d$
890 ifer<>1thenclose1:close2:close3:close15
900 poke54276,0:s=54272:v=s+24:pokev,4
910 pokes+5,0*16+0:pokes+6,15*16+0:pokes+4,33
920 pokes,4:pokes+1,48:fora=0to350:next:pokes,2:pokes+1,24:fora=0to350:next
930 cc=cc+1:ifcc<>3then920
940 pokev,0:ifer=1thenreturn
950 print:print"press any key[146] to restart"
960 ifpeek(197)<>64then280
970 goto960
980 rem start disassembler
990 ifmd$="d"thenget#2,lo$:rem get starting address
1000 ifmd$="d"thenget#2,hi$:lo=asc(lo$+chr$(0)):hi=asc(hi$+chr$(0))
1010 ifmd$="d"thensa=hi*256+lo:rem starting address
1020 ifdi=1andqq=0thengosub1770
1030 ifpeek(653)then1030
1040 sx=sx+1:ifsx=19andlh=1thengosub2040
1050 ifhfandscandq$<>""thensys828,q$:printtab(20);:sys828,nu$:print:goto1070
1060 ifsc=1thenprintq$,nu$
1070 ifpr=1thenprint#4,q$+chr$(16)+"20"+nu$
1080 ifdi=1thengosub1840
1090 q$="":nu$=""
1100 gosub2000:rem get the command
1110 nu$=nu$+str$(cd)
1120 ifst<>0anddi=1thengosub1970:close1:close2:close4:close15:end
1130 ifst<>0thenclose1:close2:close4:close15:end
1140 ifsa>ed+1anded<>0thenaa=1
1150 ifaa=1anddi=0thenclose4:end
1160 ifdi=1andaa=1thengosub1970:close1:close2:close4:close15:end
1170 c$=c$(cd):c=c(cd)
1180 q$=q$+right$("0000"+mid$(str$(sa-1),2),5)+" "+left$(c$,3)
1190 ifc(cd)=1thenq$=q$+" ":goto1030:rem 1 byte
1200 ifc(cd)=2then1250:rem 2 byte
1210 ifc(cd)=3then1420:rem 3 byte
1220 ifc(cd)=4then1710:rem conditions
1230 q$=q$+".byte "
1240 q$=q$+str$(cd):goto1030
1250 rem 2 byte command
1260 d$=mid$(c$,4,1):gosub2000
1270 nu$=nu$+str$(cd)
1280 s$=str$(cd):z$=right$(s$,len(s$)-1)
1290 ifd$="0"then1340
1300 ifd$="#"then1350
1310 ifd$="i"then1360
1320 ifd$="a"then1410
1330 goto1230:rem bad command
1340 q$=q$+str$(cd):goto1370
1350 q$=q$+" #"+z$:goto1030
1360 q$=q$+" ("+z$+")"
1370 d$=mid$(c$,5,1)
1380 ifd$="y"thenq$=q$+",y":goto1030
1390 ifd$="x"thenq$=q$+",x":goto1030
1400 goto1030
1410 q$=q$+z$:goto1030
1420 rem 3 byte command
1430 d$=mid$(c$,4,1)
1440 gosub2000:lo=cd:nu$=nu$+str$(lo)
1450 gosub2000:hi=cd:nu$=nu$+str$(hi)
1460 cd=hi*256+lo
1470 cd$=right$(str$(cd),len(str$(cd))-1)
1480 ifd$="0"then1540
1490 ifd$="#"then1550
1500 ifd$="i"then1560
1510 ifd$="a"then1630
1520 ifd$=""then1690
1530 goto1230:rem bad command
1540 q$=q$+" "+cd$:goto1030
1550 q$=q$+" #"+cd$:goto1030
1560 q$=q$+" ("+cd$+")"
1570 d$=mid$(c$,5,1)
1580 ifd$=""then1030
1590 ifd$="y"thenq$=q$+",y":goto1030
1600 ifd$="x"thenq$=q$+",x":goto1030
1610 ifd$="n"then1030
1620 goto1230:rem bad command
1630 d$=mid$(c$,5,1)
1640 ifd$=""thenq$=q$+" "+cd$:goto1030
1650 q$=q$+" "+cd$
1660 ifd$="x"thenq$=q$+",x"
1670 ifd$="y"thenq$=q$+",y"
1680 goto1030
1690 q$=q$+" "+cd$:goto1030
1700 goto1230:rem bad command
1710 rem handle condition commands
1720 gosub2000
1730 tt=0:nu$=nu$+str$(cd)
1740 ifcd>=129thentt=1:cd=cd-128
1750 iftt=1thenq$=q$+str$(sa-(128-cd)):goto1030
1760 q$=q$+str$(sa+cd):goto1030
1770 rem initialize to disk file
1780 open1,8,1,"@0:"+d$+",p,w"
1790 li=2049:qq=1
1800 hi=int(li/256):lo=li-(hi*256)
1810 print#1,chr$(lo);
1820 print#1,chr$(hi);
1830 return
1840 rem goto disk
1850 ifcd=199thengosub1970:return
1860 ifval(q$)=0thenreturn
1870 hi=int(li/256):lo=li-(hi*256)
1880 print#1,chr$(lo);
1890 print#1,chr$(hi);
1900 ss=val(q$)
1910 hi=int(ss/256):lo=ss-(hi*256)
1920 print#1,chr$(lo);
1930 print#1,chr$(hi);
1940 dd$=mid$(q$,7,20)
1950 print#1,dd$;chr$(0);
1960 return
1970 rem close disk
1980 print#1,chr$(0);chr$(0);chr$(0);chr$(0)
1990 close1:return
2000 rem*get*byte*off*of*disk*or*ram
2010 ifmd$="d"thenget#2,cd$:cd=asc(cd$+chr$(0)):sa=sa+1
2020 ifmd$="r"thencd=peek(sa):sa=sa+1
2030 return
2040 sx=0:print:print"press any key[146] to continue,f1[146] to abort."
2050 geta$:ifa$=""then2050
2060 ifa$<>"[133]"then2080
2070 close2:goto280
2080 print"[147]addr. command op code"
2090 print"[163][163][163][163][163] [163][163][163][163][163][163][163] [163][163][163][163][163][163][163]":print:return
2100 dataadc#,105,2,adc00,101,2,adc0x,117,2,adcab,109,3,adcax,128,3,adcay,121,3
2110 dataadcix,97,2,adciy,113,2
2120 dataand#,41,2,and00,37,2,and0x,53,2,andab,45,3,andax,61,3,anday,57,3
2130 dataandix,33,2,andiy,49,2
2140 dataaslac,10,1,asl00,6,2,asl0x,22,2,aslab,14,3,aslax,30,3
2150 databcc,144,4,bcs,176,4,beq,240,4,bit00,36,2,bitab,44,3,bmi,48,4,bne,208,4
2160 databpl,16,4,brk,0,1,bvc,80,4,bvs,112,4,clc,24,1,cld,216,1,cli,88,1
2170 dataclv,184,1,cmp#,201,2,cmp00,197,2,cmp0x,213,2,cmpab,205,3,cmpax,221,3
2180 datacmpay,217,3,cmpix,193,2,cmpiy,209,2
2190 datacpx#,224,2,cpx00,228,2,cpxab,236,3,cpy#,192,2,cpy00,196,2,cpyab,204,3
2200 datadec00,198,2,dec0x,214,2,decab,206,3,decax,222,3,dex,202,1,dey,136,1
2210 dataeor#,73,2,eor00,69,2,eor0x,85,2,eorab,77,3,eorab,93,3,eorax,93,3
2220 dataeoray,89,3,eorix,65,2,eoriy,81,2,inc00,230,2,inc0x,246,2,incab,238,3
2230 dataincax,254,3,inx,232,1,iny,200,1,jmpab,76,3,jmpin,108,3,jsr,32,3
2240 datalda#,169,2,lda00,165,2,lda0x,181,2,ldaab,173,3,ldaax,189,3,ldaay,185,3
2250 dataldaix,161,2,ldaiy,177,2,ldx#,162,2,ldx00,166,2,ldx0y,182,2,ldxab,174,3
2260 dataldxay,190,3,ldy#,160,2,ldy00,164,2,ldy0x,180,2,ldyab,172,3,ldyax,188,3
2270 datalsrac,74,1,lsr00,70,2,lsr0x,86,2,lsrab,78,3,lsrax,94,3,nop,234,1
2280 dataora#,9,2,ora00,5,2,ora0x,21,2,oraab,