8-Bit Software Online Conversion
Disassembler - Listing
10REM Two pass 65C02 disassembler (C)
J.de B.P. 19870325
20MODE135:CLOSE#0
30DIM Hash%(255),stack%(256),Motype$(
15),Nbytes(15),set% &1004
40REM 6502 code hash table for mode a
nd mnemonic position,holds stack,holds t
ext characters for mode display,holds nu
mber of bytes for each mode.
50ON ERROR PROCerror:GOTO50
60PROCvars:RESTORE:PROCfildim
70ON ERROR PROCerror:GOTO70
80VDU28 0 24 39 1
90REPEAT:CLS:G%=FNmenu0
100IF(G%=0)OR(G%=2) THENIFFNin(2,21,1,
1,on$+"Are you sure :"+off$,"Y","YN")="N
" UNTILFALSE
110IF(G%=0)CLS:PRINTon$"Ended."off$:EN
D
120IF(G%=1)CLS:PROCcli
130IF(G%=2)PROCinit:CLS:PROCmenu1:D%=-
1:top%=start%:bottom%=end%
140IF(G%>2)ANDNOTD%PRINTTAB(2,21)on$"F
irst Select Memory Area"off$;:PROCcur(7)
:PROCcur(0*INKEY(300)):UNTILFALSE
150IF(G%=3)CLS:PROCtload
160IF(G%=4)CLS:PROCtsave
170IF(G%=5)CLS:PROCmenu2:PROCdis1
180IF(G%=6)CLS:PROCmenu3
190IF(G%=7)PRINTTAB(2,21)on$"Hello Wel
ly Boots : Mr Computer"off$;:PROCcur(7):
PROCcur(0*INKEY(300))
200IF(G%=8)CLS:PROCmenu5
210IF(G%=9)CLS:PROCdis2
220UNTILFALSE
230DEFPROCvars
240on$=CHR$132+CHR$157+CHR$135:off$="
"+CHR$156
250VDU26 12:PRINTon$"Two pass 65C02 di
sassembler"off$:VDU28 0 24 39 1
260pntr%=0:file%=0:spool%=0:rom%=?&F4:
D%=0:@%=1:os=0
270file$=STRING$(25," "):spool$=file$:
map$=file$:file$="":spool$="":map$=""
280A$=STRING$(255," "):line$=A$:prompt
$=A$:inp$=A$:cli$=A$:allhex$="0123456789
ABCDEF"
290start%=&C000:end%=&FFFF:top%=&C000:
bottom%=&FFFF:printer=3:page=15
300ENDPROC
310DEFPROCfildim:MNE$=STRING$(255," ")
:MNE$=""
320FOR I%=1TO15:READ Nbytes(I%):NEXT:F
ORI%=1TO15:READ Motype$(I%):NEXT
330MNE$=STRING$(255," "):MNE$=""
340MNE$=MNE$+"ADCANDASLBCCBCSBEQBITBMI
BNEBPL"
350MNE$=MNE$+"BRKBVCBVSCLCCLDCLICLVCMP
CPXCPY"
360MNE$=MNE$+"DECDEXDEYEORINCINXINYJMP
JSRLDA"
370MNE$=MNE$+"LDXLDYLSRNOPORAPHAPHPPLA
PLPROL"
380MNE$=MNE$+"RORRTIRTSSBCSECSEDSEISTA
STXSTY"
390MNE$=MNE$+"TAXTAYTYATSXTXATXS"
400REM New 65C02 opcodes
410MNE$=MNE$+"BRAPHYPHXPLYPLXSTZTSBTRB
"
420READ Q$:REPEAT:REPEAT:IF LEFT$(Q$,1
)="-" THEN Nmne%=ABS(EVAL(Q$)):READQ$
430UNTIL LEFT$(Q$,1)<>"-"
440Q%=EVAL("&"+Q$):I%=(Q% AND &FF):Has
h%(I%)=(Q% AND &FF00)+Nmne%:READ Q$
450UNTIL Q$="*"
460ENDPROC
470DEFFNmenu0:LOCAL E%,A$
480FORE%=0TO9:PRINTTAB(36,2*E%+1)off$;
:NEXT:PRINTTAB(0,0);
490PRINT'"0>"on$"Exit the program"
500PRINT'"1>"on$"OS * command"
510PRINT'"2>"on$"Select another area o
f memory"
520PRINT'"3>"on$"Load tracing map"
530PRINT'"4>"on$"Save tracing map"
540PRINT'"5>"on$"Trace from an entry p
oint"
550PRINT'"6>"on$"Reset area to data"
560PRINT'"7>"on$"A string just for Wel
ly"
570PRINT'"8>"on$"Select range to be pr
inted"
580PRINT'"9>"on$"Disassemble selected
range"
590REPEAT
600A$=FNin(2,21,1,0,on$+"Select an opt
ion"+off$,"",allhex$)
610IFE%=0 E%=EVAL("&"+A$) ELSE E%=E%-&
B0
620UNTIL E%<10:PRINTTAB(2,E%*2+1)CHR$1
35CHR$157CHR$132TAB(2,21)SPC(39);
630=E%
640DEFPROCcli:LOCAL cli$
650REPEAT:cli$=FNin(0,1,118,20,"*","|"
+cli$,"")
660IFcli$<>"" VDU28 0 24 39 5 12:os=-1
:OSCLIcli$:os=0:VDU28 0 24 39 1
670REPEATUNTILFNin(0,23,0,20,on$+"RETU
RN to continue"+off$,"","")=""
680PRINTTAB(0,23)SPC(24);:UNTILE%<>&B1
:ENDPROC
690DEFPROCinit
700spool%=0:stack%=-1:moshow$="
"
710FORI=0TO&1000STEP4:set%!I=0:NEXT
720ENDPROC
730DEFPROCmenu1:LOCALE%,F%:REPEAT:F%=T
RUE
740fm=(FNin(0,1,1,1,on$+"File or memor
y :"+off$,MID$("FM",2+fm,1),"FM")="F"
)
750IFfm PROCmenu1F ELSEPROCmenu1M
760start%=EVAL("&"+FNin(0,5,4,1,on$+"S
tart address :"+off$,FNhex(start%,4)
,allhex$))
770end%=EVAL("&"+FNin(0,7,4,1,on$+"End
address :"+off$,FNhex(end%,4),all
hex$))
780IF(start%>end%)OR(end%-start%>&4000
)F%=FALSE
790opnt%=EVAL("&"+FNin(0,9,4,1,on$+"Ta
rget address :"+off$,FNhex(opnt%+star
t%,4),allhex$))-start%
800UNTILE%<>6ANDF%:ENDPROC
810DEFPROCmenu1M:CLOSE#file%:file%=0:P
RINTTAB(27,3)SPC(12);
820rom%=EVAL("&"+FNin(0,3,1,1,on$+"Rom
socket number :"+off$,FNhex(rom%,1),all
hex$)):map$="TrMem"
830ENDPROC
840DEFPROCmenu1F:CLOSE#file%:file%=0
850file$=FNin(0,3,10,0,on$+"Input file
name :"+off$,file$,"")
860file%=OPENINfile$:start%=0:end%=EXT
#file%:map$="Tr"+file$
870ENDPROC
880DEFPROCmenu2
890REPEATREPEATentry$=FNin(0,1,4,21,on
$+"Known entry points "+off$+CHR$13+CHR
$10+on$+"RETURN if no more : "+off$,"",a
llhex$):UNTILE%=0
900IFentry$<>""VDU28 0 24 39 5:PROCpus
h(EVAL("&"+entry$)-opnt%):VDU28 0 24 39
1:E%=6
910UNTILE%=0:VDU28 0 4 39 1 12 28 0 24
39 1:ENDPROC
920DEFPROCdis1
930PRINT'on$"Tracing in progress."off$
:VDU28 0 24 39 5
940REPEAT:IFstack%=-1 THENUNTILTRUE:VD
U28 0 24 39 1:ENDPROC
950pntr%=FNpull:IF(pntr%<start%)OR(pnt
r%>end%)UNTILFALSE
960IF Hash%(FNpeek(pntr%,1))AND&F00 TH
ENPROCfollow(pntr%)
970UNTILFALSE
980ENDPROC
990DEFPROCfollow(pntr%)
1000REPEAT:IFFNset(pntr%)=3 UNTILTRUE:E
NDPROC
1010H%=Hash%(FNpeek(pntr%,1)):IF(H%AND&
F00)=0 UNTILTRUE:ENDPROC
1020FORN%=1TONbytes(H% DIV&100):PROCset
(pntr%+N%-1,2):NEXT:PROCset(pntr%,3)
1030IF H%MOD&100=&1C THENPROCjmpjsr1:UN
TILTRUE:ENDPROC
1040IF H%MOD&100=&1D THENPROCjmpjsr1
1050IF H%MOD&100=&2A THENUNTILTRUE:ENDP
ROC
1060IF H%MOD&100=&2B THENUNTILTRUE:ENDP
ROC
1070IF H%MOD&100=&0B THENPROCbrk1:UNTIL
TRUE:ENDPROC
1080IF(H%DIV&100=10) THENoff%=FNpeek(pn
tr%+1,1):off%=((256-off%)*(off%>127)-off
%*(off%<128)):PROCpush(pntr%+2+off%)
1090IF H%MOD&100=&80 THENUNTILTRUE:STOP
P:ENDPROC
1100pntr%=pntr%+Nbytes(H%DIV&100)
1110UNTILpntr%>end%:ENDPROC
1120DEFPROCbrk1
1130pntr%=pntr%+1:PROCset(pntr%,2)
1140REPEAT:pntr%=pntr%+1:PROCset(pntr%,
2):UNTILFNpeek(pntr%,1)=0:ENDPROC
1150DEFPROCjmpjsr1:LOCAL Q%,I%
1160Q%=FNpeek(pntr%+1,2)
1170IFQ%<start%+opnt% OR Q%>end%+opnt%
ENDPROC
1180Q%=Q%-opnt%
1190IFH%DIV&100=6 PROCpush(Q%):ENDPROC
1200IFH%DIV&100=13 LOCALpntr%,H%:pntr%=
Q%:PROCjmpjsr1
1210IFH%DIV&100=15 REM
1220ENDPROC
1230DEFPROCtsave:LOCAL B%,Q%
1240REPEAT:map$=FNin(0,1,10,0,on$+"Save
to filename :"+off$,map$,""):UNTILE%=
0
1250PRINT:B%=OPENUPmap$:IFB%<>0 IFFNin(
0,3,1,1,on$+"Overwrite file ?"+off$,"Y",
"YN")="N" CLOSE#B%:ENDPROC
1260IFB%=0 B%=OPENOUTmap$
1270PRINTTAB(0,5)on$"Saving "map$;off$:
FORQ%=0TO&FFF:BPUT#B%,set%?Q%:NEXT:CLOSE
#B%:ENDPROC
1280DEFPROCtload:LOCAL B%,Q%
1290REPEAT:map$=FNin(0,1,10,20,on$+"Loa
d from filename :"+off$,map$,""):UNTILE%
=0
1300PRINT:B%=OPENINmap$:IFB%=0 VDU7:END
PROC
1310PRINT'on$"Loading "map$;off$:FORQ%=
0TO&FFF:set%?Q%=BGET#B%:NEXT:CLOSE#B%:EN
DPROC
1320DEFPROCpush(push%):IFstack%>&FF THE
NCLS:PRINT"Stack overflow":END
1330LOCAL B%,Q%
1340IFstack%>-1 FORB%=0TOstack%:Q%=Q%-(
stack%(B%)=push%):NEXT
1350Q%=(Q%=0)AND(FNset(push%)<>3)
1360IFQ% stack%=stack%+1:stack%(stack%)
=push%:IFstack%<41PRINTTAB(10*((stack%)D
IV20),(stack%)MOD20)FNhex(stack%,2)" : "
FNhex(push%,4);
1370ENDPROC
1380DEFFNpull:IFstack%<0 THENCLS:PRINT"
Stack underflow":END
1390stack%=stack%-1:IFstack%<41PRINTTAB
(10*((stack%+1)DIV20),(stack%+1)MOD20)SP
C(10);
1400=stack%(stack%+1)AND&FFFF
1410DEFPROCmenu3
1420LOCAL E%,F%,T%,I%:REPEAT
1430F%=EVAL("&"+FNin(0,1,4,1,on$+"Start
address :"+off$,FNhex(F%,4),allhex$
))-opnt%
1440T%=EVAL("&"+FNin(0,3,4,1,on$+"End a
ddress :"+off$,FNhex(T%,4),allhex$
))-opnt%
1450IF""=FNin(0,5,0,21,on$+"Return to c
onfirm reset :"+off$,"","")
1460UNTIL(E%=0)AND(F%<=T%)AND(F%>=start
%)AND(F%<=end%)AND(T%>=start%)AND(T%<=en
d%)
1470FORI%=F%TOT%:PRINTTAB(0,7)on$"Reset
ting address :"off$FNhex(I%+opnt%,4):PRO
Cset(I%,0):NEXT:ENDPROC
1480DEFPROCmenu5:REPEAT
1490top%=EVAL("&"+FNin(0,1,4,1,on$+"Beg
in disassembly :"+off$,FNhex(top%+opnt%,
4),allhex$))-opnt%
1500bottom%=EVAL("&"+FNin(0,3,4,1,on$+"
Cease disassembly :"+off$,FNhex(bottom%+
opnt%,4),allhex$))-opnt%
1510printer=3+(FNin(0,5,1,1,on$+"Output
to printer :"+off$,MID$("YN",printer-1,
1),"YN")="Y")
1520page=15+(FNin(0,7,1,1,on$+"Paged mo
de on :"+off$,MID$("YN",page-13,1),"
YN")="Y")
1530spool%=FNin(0,9,1,1,on$+"Spool to a
file :"+off$,MID$("YN",2+spool%,1),"Y
N")="Y"
1540IFspool% spool$=FNin(0,11,10,1,on$+
"Spool filename :"+off$,spool$,"")
1550IF(top%>end%)OR(bottom%<top%)OR(bot
tom%<start%)E%=6
1560UNTILE%=0:ENDPROC
1570DEFPROCdis2
1580PRINT'on$"Intelligent disassembly"o
ff$''on$"Printer "MID$("on off",(printer
-2)*3+1,3)" Page mode "MID$("on off",(pa
ge-14)*3+1,3)off$'
1590IFspool%PRINTon$" Spool "spool$off$
'
1600VDU page,printer:IFspool% OSCLI"SPO
OL "+spool$
1610FORpntr%=top% TObottom%:PRINTTAB(0)
FNhex(pntr%+opnt%,4)" ";
1620IF(FNset(pntr%)=3)AND(Hash%(FNpeek(
pntr%,1))<>0)THENPROCcode2 ELSEPROCdata2
1630PROCpause:NEXT
1640IFspool% OSCLI"SPOOL"
1650VDU3,15
1660PRINT'on$"Press any key to return t
o Menu"off$:PROCcur(3):PROCcur(0*GET)
1670ENDPROC
1680DEFPROCcode2
1690LOCAL H%,mode,mn%,mn$,N%:H%=Hash%(F
Npeek(pntr%,1))
1700mode=H%DIV&100:mn%=H%AND&FF:N%=Nbyt
es(mode):mn$=MID$(MNE$,(mn%-1)*3+1,3):mo
show$=Motype$(mode)
1710IFmn%=11 PROCbrk2:ENDPROC
1720IFmode=10 off%=FNpeek(pntr%+1,1):of
f%=((256-off%)*(off%>127)-off%*(off%<128
)):PROCnum(pntr%+2+off%+opnt%)
1730IF(N%=2)AND(mode<>10)PROCnum(FNpeek
(pntr%+1,1))
1740IF(N%=3) PROCnum(FNpeek(pntr%+1,2))
1750IFmn%=29 ORmn%=28 PROCjmpjsr2
1760PROCascii(N%):PRINTmn$" "moshow$
1770pntr%=pntr%+N%-1
1780ENDPROC
1790DEFPROCbrk2:PROCascii(2):LOCAL Q%
1800pntr%=pntr%+1:B%=FNpeek(pntr%,1):PR
INTmn$" &"FNhex(B%,2)TAB(22)"""";:pntr%=
pntr%+1:Q%=pntr%
1810REPEATB%=FNpeek(Q%,1)
1820IFB%>31 ANDB%<127 THENPRINTCHR$B%;E
LSEPRINT""""TAB(22)"&"FNhex(B%,2)TAB(22)
"""";:PROCpause
1830IFCOUNT>37THENPRINT""""TAB(22)"""";
1840Q%=Q%+1:UNTILB%=0:PRINT"""":Q%=Q%-p
ntr%
1850IFQ%>3 THENREPEAT:PROCpause:PROCasc
ii(4):Q%=Q%-4:pntr%=pntr%+4:UNTILQ%<4
1860IFQ%PROCpause:PROCascii(Q%)
1870pntr%=pntr%+Q%-1
1880ENDPROC
1890DEFPROCjmpjsr2
1900:
1910:
1920:
1930:
1940:
1950ENDPROC
1960DEFPROCdata2
1970LOCAL B%:B%=-(FNset(pntr%)=0)-(FNse
t(pntr%+1)=0)-(FNset(pntr%+2)=0)-(FNset(
pntr%+3)=0):B%=B%-(B%=0)
1980PROCascii(B%):PRINT:pntr%=pntr%+B%-
1
1990ENDPROC
2000DEFPROCset(pntr%,type%):LOCAL B%,Q%
:B%=(pntr%-start%)DIV4:Q%=(pntr%-start%)
MOD4
2010IFpntr%<start% OR pntr%>end% THENEN
DPROC
2020set%?B%=set%?B%ANDNOT(3*2^(Q%*2)):s
et%?B%=set%?B%OR(type%*2^(Q%*2)):ENDPROC
2030DEFFNset(isset):LOCAL B%,Q%:B%=(iss
et-start%)DIV4:Q%=(isset-start%)MOD4
2040IFisset<start% OR isset>end% THEN=0
2050=((set%?B%)DIV(2^(Q%*2)))AND3
2060DEFFNpeek(addr%,len%):LOCAL I%,R%,A
%,X%,Y%
2070IFfm ANDfile% THEN=FNfilepeek(addr%
,len%)
2080IFrom%=?&F4 THENFORI%=len%-1TO0STEP
-1:R%=R%*&100+addr%?I%:NEXT:=R%
2090FORI%=len%-1TO0STEP-1:X%=addr%+I%:Y
%=rom%:?&F6=X%MOD&100:?&F7=X%DIV&100:A%=
USR(&FFB9)AND&FF:R%=R%*&100+A%:NEXT
2100=R%
2110DEFFNfilepeek(addr%,len%)
2120LOCAL E%:E%=EXT#file%
2130FORI%=len%-1TO0STEP-1
2140R%=R%*&100:IFaddr%+I%<=E% THENPTR#f
ile%=addr%+I%:R%=R%+BGET#file%
2150NEXT:=R%
2160DEFPROCascii(asc%):LOCALI%,B%:PRINT
TAB(5);
2170FORI%=0TOasc%-1:PRINTFNhex(FNpeek(p
ntr%+I%,1),2)" ";:NEXT:PRINTTAB(17);
2180FORI%=0TOasc%-1:B%=FNpeek(pntr%+I%,
1):IFB%>31 ANDB%<127 THENPRINTCHR$B%;ELS
EPRINT".";
2190NEXT:PRINTTAB(22);:ENDPROC
2200DEFPROCnum(num%)
2210LOCAL N2,N4:N2=INSTR(moshow$,".."):
N4=INSTR(moshow$,"....")
2220IFN4=0 THENmoshow$=LEFT$(moshow$,N2
-1)+FNhex(num%,2)+MID$(moshow$,N2+2) ELS
Emoshow$=LEFT$(moshow$,N4-1)+FNhex(num%,
4)+MID$(moshow$,N4+4)
2230ENDPROC
2240DEFFNhex(hex,hexlen)=RIGHT$(STRING$
(hexlen,"0")+STR$÷hex,hexlen)
2250DEFFNgetmulti:=GET$
2260DEFPROCpause:A%=INKEY(0):IFA%=-1 EN
DPROC ELSELOCALC%:C%=COUNT
2270VDU3,15:PROCcur(7):PRINTon$"Pause"o
ff$;:PROCcur(0*GET):PRINTSTRING$(11,CHR$
127)CHR$13STRING$(C%,CHR$9);:VDUpage,pri
nter:ENDPROC
2280DEFPROCerror
2290IFFNosbyte(4,0,0)ORFNosbyte(225,1,0
)ORFNosbyte(12,2,0)
2300IF(ERR=254)ANDos REPORT:IFINKEY(300
)OR1 ENDPROC
2310PROCcur(5):ONERROROFF
2320IF(ERR=17)ANDNOTINKEY(-1) ENDPROC
2330IFFNosbyte(&77,0,0)
2340REPORT:PRINT" at line "ERL:END
2350DEFFNin(P%,V%,L%,F%,prp$,li$,key$)
2360LOCALin$,ins,curs,cnv,prp,b1%,b2%,s
hf
2370b1%=((FNosbyte(225,&B0,0)AND&FF00)D
IV&100)+(FNosbyte(226,&80,0)AND&FF00)+((
FNosbyte(227,&90,0)AND&FF00)*&100)+(FNos
byte(228,1,0)AND&FF00)*&10000
2380b2%=(FNosbyte(4,2,0)AND&FF00)DIV&10
0
2390cnv=F%MOD10:prp=(F%DIV100)MOD10:in$
=STRING$(L%," "):IFLEN(li$)>L%li$=LEFT$(
li$,L%):VDU7
2400PRINTTAB(P%,V%)prp$" ";:P%=POS:V%=V
POS
2410REPEATE%=0:in$=li$:curs=1
2420REPEATPROCcur(0):PRINTTAB(P%,V%);
2430IF(prp AND1)=0PRINTin$;ELSEPRINTSTR
ING$(LENin$,CHR$255);
2440IF(prp AND2)=0PRINTSTRING$(L%-LENin
$,"`");ELSEPRINTSTRING$(L%-LENin$," ");
2450PRINTSTRING$(L%-curs+1,CHR$8);:IFin
s PROCcur(2-(curs>L%))ELSEPROCcur(1)
2460£%=ASCFNgetmulti:shf=INKEY(-2)*-2-I
NKEY(-1)
2470IF£%=&7F PROCdel
2480IF£%<27ANDshf AND2 £%=£%+96
2490IF(£%>31)AND(£%<127)PROCchar
2500IF(£%AND&8F>&8A)PROCarrow
2510UNTIL(£%=9)OR(£%=13)OR(£%>&AF AND£%
<&BB)
2520IF£%=9 E%=6ELSEIF£%<>13 E%=£%
2530IF£%=13OR£%=9 £%=0
2540UNTILFNcompress OR£%
2550PROCcur(0):PRINTTAB(P%,V%);
2560IF(prp AND1)=0PRINTin$;ELSEPRINTSTR
ING$(LENin$,CHR$255);
2570IF(prp AND2)=0PRINTSTRING$(L%-LENin
$,"`");ELSEPRINTSTRING$(L%-LENin$," ");
2580IFFNosbyte(4,b2%AND&FF,0)
2590IFFNosbyte(225,b1%AND&FF,0)ORFNosby
te(226,(b1%DIV&100)AND&FF,0)ORFNosbyte(2
27,(b1%DIV&10000)AND&FF,0)ORFNosbyte(228
,(b1%DIV&1000000)AND&FF,0)
2600=in$
2610DEFPROCcur(C%):LOCAL flag
2620IFC%>3THENflag=18:C%=C%AND3
2630flag=flag-32*(C%=0)-96*(C%=2)-64*(C
%=3):VDU23 0 10 flag,0;0;0;:ENDPROC
2640DEFFNosbyte(A%,X%,Y%):=USR&FFF4
2650DEFPROCchar:IFFNosbyte(12,25,0)
2660IFcurs>L%VDU7:ENDPROC
2670IFcnv=0ORNOTFNalpha(CHR$£%) PROCadd
char:ENDPROC
2680IFcnv=1 THEN£%=£%AND&5F
2690IFcnv=2 THEN£%=£%OR &20
2700IFshf AND2 PROCaddchar:ENDPROC
2710IF(cnv>2AND(shf AND1))OR(cnv>3ANDcu
rs=1) THEN£%=£%AND&5F
2720IFcurs<2 PROCaddchar:ENDPROC
2730IF(cnv>4ANDMID$(in$,curs-1,1)=" ")O
R(cnv>5ANDFNalpha(MID$(in$,curs-1,1))=0)
£%=£%AND&5F
2740PROCaddchar:ENDPROC
2750DEFFNalpha(alph$):=(alph$>"@"ANDalp
h$<"[")OR(alph$>"£"ANDalph$<"¼")
2760DEFPROCaddchar
2770IF(curs>L%)OR((£%=255)ORkey$=""ORIN
STR(key$,CHR$£%))=0 VDU7:ENDPROC
2780IFins SOUND3,-5,200,1:IFLEN(in$)=L%
VDU7:ENDPROC
2790LOCALi$:i$=LEFT$(in$,curs-1)+CHR$£%
:in$=i$+MID$(in$,curs+ins+1,255-LENi$):c
urs=curs+1:ENDPROC
2800DEFPROCdel:IFFNosbyte(12,10,0)
2810IF(shf=0)AND(curs<2)OR(shf=1)AND(cu
rs>LENin$) ENDPROC
2820curs=curs+(shf=0):in$=LEFT$(in$,cur
s-1)+MID$(in$,curs+1,LENin$-curs):ENDPRO
C
2830DEFPROCarrow:IFFNosbyte(12,5,0)
2840IF(£%=&BB)in$=li$:curs=1
2850IF(£%=&8B)
2860IF(£%=&9B)in$="":curs=1
2870IF(£%=&BC)curs=curs+(curs>1)
2880IF(£%=&8C)curs=1
2890IF(£%=&9C)
2900IF(£%=&BD)curs=curs-(curs<=LENin$)
2910IF(£%=&8D)curs=LENin$+1
2920IF(£%=&9D)in$=LEFT$(in$,curs-1)
2930IF(£%=&BE)
2940IF(£%=&8E)ins=FALSE
2950IF(£%=&9E)
2960IF(£%=&BF):LOCAL`%:`%=£%:£%=255:PRO
Caddchar:£%=`%
2970IF(£%=&8F)ins=TRUE
2980IF(£%=&9F)
2990ENDPROC
3000DEFFNcompress:LOCALsear,strp:strp=(
F%DIV10)MOD10
3010REPEATsear=-INSTR(in$,CHR$255)*(in$
<>""):IFsear in$=LEFT$(in$,sear-1)+MID$(
in$,sear+1,LENin$-sear)
3020UNTILsear=0
3030IFRIGHT$(in$,1)=" "REPEATin$=LEFT$(
in$,LENin$-1):UNTILRIGHT$(in$,1)<>" "
3040IF(strp AND1)=0THENin$=FNspace`stri
p(in$)
3050strp=strp DIV2
3060IFstrp=0THEN=in$<>""
3070IFstrp=2THEN=LENin$=L%
3080=TRUE
3090DEFFNspace`strip(strip$):LOCALloop%
:REPEATloop%=loop%+1:UNTILMID$(strip$,lo
op%,1)<>" "ORloop%>LEN(strip$):=MID$(str
ip$,loop%)
3100:
3110REM Jump table data
3120REM Fast 6502 disassembler data for
BBC micro
3130REM J.M. Leach, June 1982
3140REM
3150REM Mode descriptors order :
3160REM 1) Accumulator 2) Immediate 3)
Zero Page 4) Zero Page,X
3170REM 5) Zero Page,Y 6) Absolute 7)
Absolute,X 8) Absolute,Y
3180REM 9) Implied 10) Relative 11)
(Indirect,X)12) (Indirect),Y
3190REM 13) Absolute Indirect Jump
3200REM 14) Zero Page Indirect
3210REM 15) *** *** UNUSED *** ***
3220REM
3230REM Number of bytes for each mode
3240DATA 1,2,2,2,2,3,3,3,1,2,2,2,3,2,3
3250REM Display format for each mode
3260DATA"A" ,"#&.." ,"&.." ,"
&..,X"
3270DATA"&..,Y" ,"&...." ,"&....,X","
&....,Y"
3280DATA"" ,"&...." ,"(&..,X)","
(&..),Y"
3290DATA"(&....)","(&..)" ,"(&....,X)"
3300REM
3310REM Build hash table to hold charac
teristics for each 6502 code
3320REM In the following data statement
s a negative number gives the position o
f the associated mnemonic in the MNE$ st
ring
3330REM the following (hexadecimal) num
bers give the instruction mode (1 digit)
and
3340REM the instruction code (2 digits)
which directs the position in the hash
table
3350REM
3360DATA -1,269,365,475,66D,77D,879,B61
,C71,D72
3370DATA -2,229,325,435,62D,73D,839,B21
,C31,D32
3380DATA -3,10A,306,416,60E,71E
3390DATA -4,A90
3400DATA -5,AB0
3410DATA -6,AF0
3420DATA -7,289,324,62C,434,73C
3430DATA -8,A30
3440DATA -9,AD0
3450DATA -10,A10
3460DATA -11,900
3470DATA -12,A50
3480DATA -13,A70
3490DATA -14,918
3500DATA -15,9D8
3510DATA -16,958
3520DATA -17,9B8
3530DATA -18,2C9,3C5,4D5,6CD,7DD,8D9,BC
1,CD1,DD2
3540DATA -19,2E0,3E4,6EC
3550DATA -20,2C0,3C4,6CC
3560DATA -21,13A,3C6,4D6,6CE,7DE
3570DATA -22,9CA
3580DATA -23,988
3590DATA -24,249,345,455,64D,75D,859,B4
1,C51,D52
3600DATA -25,11A,3E6,4F6,6EE,7FE
3610DATA -26,9E8
3620DATA -27,9C8
3630DATA -28,64C,D6C,F7C
3640DATA -29,620
3650DATA -30,2A9,3A5,4B5,6AD,7BD,8B9,BA
1,CB1,DB2
3660DATA -31,2A2,3A6,5B6,6AE,8BE
3670DATA -32,2A0,3A4,4B4,6AC,7BC
3680DATA -33,14A,346,456,64E,75E
3690DATA -34,9EA
3700DATA -35,209,305,415,60D,71D,819,B0
1,C11,D12
3710DATA -36,948
3720DATA -37,908
3730DATA -38,968
3740DATA -39,928
3750DATA -40,12A,326,436,62E,73E
3760DATA -41,16A,366,476,66E,67E
3770DATA -42,940
3780DATA -43,960
3790DATA -44,2E9,3E5,4F5,6ED,7FD,8F9,BE
1,CF1,DF2
3800DATA -45,938
3810DATA -46,9F8
3820DATA -47,978
3830DATA -48,385,495,68D,79D,899,B81,C9
1,D92
3840DATA -49,386,596,68E
3850DATA -50,384,494,68C
3860DATA -51,9AA
3870DATA -52,9A8
3880DATA -53,998
3890DATA -54,9BA
3900DATA -55,98A
3910DATA -56,99A
3920DATA -57,A80
3930DATA -58,95A
3940DATA -59,9DA
3950DATA -60,97A
3960DATA -61,9FA
3970DATA -62,364,474,69C,79E
3980DATA -63,304,60C
3990DATA -64,314,61C
4000DATA "*"