> 65Em  > Startup #:Close_All:" at line ";: (NA$=OS_GetEnv:ver$="0.13":debug%=0:Init:A%=_DEBUG(debug%):quiet%=A$<>"" 2A$="":"6502 Emulator v"ver$" (C)2006 J.G.Harston"'"Memory start: &"h0(mem%,8)" MemSz: &"h0(mz%,6)" MemMsk: &"h0(mm%,6) "":A%=_RUN(A$) Z run%:Go dquiet%:A%=_QUIT("") n"65Em* "A$:cmd(A$,0):0 x Init 5d$=".":s$="/":os%>6:d$="/":s$=".":os%=32:d$="\" Frunpath$=run$:runpath$,1)="""":runpath$=runpath$,2,runpath$-2) /runpath$=runpath$):d$+":",runpath$,1)) Ros%=32:mx%=@vdu%!208:my%=@vdu%!212:mw%=@vdu%!216:mh%=@vdu%!220:mc%=@vdu%?73+1 3mz%=memsize:mm%=mz%-1:mtop%=mz%:mbot%=0:run%= Lctrl%31,name%79,zp%7,mem%mz%:trace0%=0:trace1%=&FFFF:X%=ctrl%:Y%=X%256 +ra%=0:rx%=0:ry%=0:rp%=0:rs%=&1FF:rpc%=0 -osw0%=:err%=&100:escflg%=&FF:prog%=&F800 ="Load """+f_name(runpath$+"TOS64")+""" "+~(mem%+&F800) ?A%=mem%!&FFB7&FFFF:B%=0&35:mem%?(B%+&200)=mem%?(A%+B%): /mem%!&F0=&800:mem%!&F4=&8000:mem%?escflg%=0 EscInit: ;ݤmemsize:A%=2^((--1024)/2):A%<&10000:=A%=&10000 *Error:X%=ctrl%:Y%=X%256:-1:run%= Irun%::Close_All:" ("+~B%+") at "+Þ,<128<>17):-1:RegDump "F=25:run%:os%=32:run%=:23,22,mx%;my%;mw%,mh%,mc%,128:run%=: ,2=17:mem%?255=255:rp%=rp%(osw0%1):osw0%=: 6Orun%:mem%!err%=*256:$(mem%+err%+2)=$+0:rpc%=err%:=17:mem%?escflg%=&FF @ J?cmd(A$,link%):A$<>"":A$,1)=" ":A$=A$,2):A$,1)<>" " TA$=""A$,1)="|": ^A$,1)="*":A$,2): hA$,1)=".":"."+A$,2): r A$,1)="/":A$="RUN "+A$,2) |3uc(A$,2))="FX":A$,3)(A$,3,1)="0"):A$: 2A%=A$+" "," "):C$=uc(A$,A%-1)):A$=A$,A%+1) OA%=" BASIC CORE DEBUG GO HELP LOAD MDUMP MDIS MEDIT QUIT RUN "," "+C$+" ") A%:A%=("FN_"+C$+"(A$)"): A%=_run(C$+" "+A$,): ;ݤ_HELP(A$):'"6502 Emulator ";ver$:uc(A$)<>"6502":=0 b" BASIC"'" CORE "'" DEBUG [ [ ]]"'" GO ()"'" HELP" T" LOAD "'" MDUMP "'" MDIS "'" QUIT"'" RUN " =0  ݤ_MDIS(A$):N%,P%,C%:EscOn 5P%=("&"+A$)::C%=16:h0(P%,4);" ";:A$=dis(P%) *A%=0N%-1:h0(mem%?(P%+A%),2);" ";: <(17-3*N%);:A%=0N%-1:c(mem%?(P%+A%));::(7-N%);A$ %P%=P%+N%:C%=C%-1:C%=0:C%=:0:=0 !ݤ_MDUMP(A$):N%,P%,C%:EscOn /P%=("&"+A$):N%=16::C%=16:h0(P%,4);" "; *A%=0N%-1:h0(mem%?(P%+A%),2);" ";: &%A%=0N%-1:c(mem%?(P%+A%));:: 0%P%=P%+N%:C%=C%-1:C%=0:C%=:0:=0 :ݤ_BASIC(A$) D9"BASIC"':=_RUN(""""+runpath$+f_name("Basic")+"""") Nݤ_QUIT(A$):A$:halt%=:=0 XClose_All b"QUIT":=0 lݤ_RUN(A$):=_run(A$,) v4ݤ_run(A$,osc%):ȕA$,1)=" ":A$=A$)::A$="":=0 1A$,1)="""":A%=A$,"""",2)+1A%=A$+" "," ") C$=A$:F$=f_name(A$,A%-1)) +X%!2=0:A%=file(F$,5):A%:A%=X%!2A%=-1 &(A%&FFFFFF00)=&FFFBBC00:A%=&8000 #(A%&FFF00000)=&FFF00000:A%=-1 A%=-1:"/",osc%)+C$:=0  A%=0 1in%=(F$):gbpb(4,in%,name%,80,0):#in%:in%=0 #A%=name%?7:name%!A%=&29432800 (A%=A%+1:name%?A%=0:A%=name%!(A%+1) -(name%?6 64)=0:247,"Not a language":=0 ,(name%?6 15)>3:247,"Not 6502 code":=0 (name%?6 32)=0:A%=&8000   254,"No file header":=0    *"Load "+F$+" "+~(mem%+A%) 4rpc%=A%:=_go >ݤ_LOAD(A$):A%=A$," ") HBA%=0:F$=f_name(A$)F$=f_name(A$,A%-1)):A%=("&"+A$,A%+1)) R1A%=0:X%!2=0:file(F$,5):A%=X%!2A%=0:A%=-1 \&(A%&FFFFFF00)=&FFFBBC00:A%=&8000 f A%=0 p1in%=(F$):gbpb(4,in%,name%,80,0):#in%:in%=0 z#A%=name%?7:name%!A%=&29432800 (A%=A%+1:name%?A%=0:A%=name%!(A%+1) -(name%?6 64)=0:247,"Not a language":=0 ,(name%?6 15)>3:247,"Not 6502 code":=0 (name%?6 32)=0:A%=&8000  254,"No file header":=0   #"Load "+F$+" "+~(mem%+A%):=A% 3ݤ_GO(A$):A$="":rpc%=mem%!&FFFCrpc%=("&"+A$) !ݤ_go:ra%=0:rx%=0:ry%=0:rp%=0 )mem%!(rpc%+mem%?(rpc%+7))=&29432800 !prog%=rpc%:A%=rpc%+8:A%=A%+1 *mem%?A%=0:mem%?&FD=A%:mem%?&FE=A%256 %mem%?&EE=prog%:mem%?&EF=prog%256 %mem%?&F4=prog%:mem%?&F5=prog%256 $rs%=&1FF:ra%=1 . 8+$(mem%+&236)=A$:mem%?&F2=&36:mem%?&F3=2 B Go:=0 Lݤ_CORE(A$) V'A$=f_name(s(A$,A$+" "," ")-1))) `$"Save "+A$+" "+~mem%+"+"+~mz% jSetType(A$,&FFD) t=0 ~=ݤ_DEBUG(A$):A$="":"1=Register Dump"'"3=Single Step":=0 6debug%=0:trace0%=0:trace1%=&FFFF:uc(A$)="OFF":=0 )debug%=(A$):(debug%1):<9::>8 5A%=A$," "):A%:trace0%=(A$,A%+1)):A$=A$,A%+1) (A%=A$," "):A%:trace1%=(A$,A%+1)) =0 SetType(A$,A%):os%>8: "SetType "+A$+" "+~A%  -ݤc(A%):A%=A%255:A%<32A%>126:="."=A% 0ݤstr0(A%):A$="":?A%>31:A$=A$+?A%:A%=A%+1 ?A%<32A$>254:=A$ SRegDump:"A=&"h0(ra%,2)" X=&"h0(rx%,2)" Y=&"h0(ry%,2)" P=&"h0(rp%,2);" "; EA%=70-1:"-CZIDB5VN",(((rp%(2^A%))<>0)(A%+1))+1,1);::" "  %"XY=&";:DumpLine(rx%+256*ry%): " S=&";:DumpLine(rs%): "PC=&";:DumpLine(rpc%) (4A%=Dis_Code(65,rpc%,mem%+rpc%):$(X%+4);(56-) 2 126:="."=A% x0ݤstr0(A%):A$="":?A%>31:A$=A$+?A%:A%=A%+1 ?A%<32A$>254:=A$ "EscInit:esch%=esch%:esch%:  os%=32 >P%36,L%-1:[OPT 8:.escyes:mov byte[edi-1],0:mov eax,-1:ret 8.esch%:mov ecx,256:mov edi,[@vdu%-148]:mov al,27:cld >repnz scasb:jz escyes:xor eax,eax:ret:.escb%:dw 0:dw 0:]:  7esch%31:P=01:P%=esch%:[OPT P*2:MOV R11,R11,LSL#1 SLDR R12,escb%:STRB R11,[R12]:MOV PC,R14:.escb%:EQUD mem%+escflg%:]::escho%=0: $EscOff:escho%=escho%:escho%: Ios%<>32:ș"OS_ChangeEnvironment",9,esch%,0,0,escho%,escRo%,escbo%: 6"ESC OFF":escho%=:esch%:mem%?escflg%=&FF:  %EscOn:escho%=escho%:escho%=0: Gos%<>32:ș"OS_ChangeEnvironment",9,escho%,escRo%,escbo%:escho%=0: :escho%=0:"ESC ON": "(Go:abort%=:halt%=0:run%=:EscOff ,_:(debug%1):rpc%>=trace0% rpc%<=trace1%:x%=:y%=:30:RegDump:31,x%,y%:(debug%2): 6xB%=mem%?rpc%:rpc%=rpc%+1:("FNm"+~(B%&1C)+"+FN_"+~(B%(((B%1)<>1)&E3))):EscOn:run%=:quiet%abort%:RegDump @ J!ݤbr(A%):rpc%=rpc%+1:A%=0:=0 T9mem%?(rpc%-1)<128:rpc%=(rpc%+mem%?(rpc%-1))&F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_bget &83,&FFD4:=mos_bput &A3,&FFCE:=mos_find &63,&FFDA:=mos_args &B3:=mos_quit &C3:=mos_lang  X%=X%+mem%:Y%=X%256 Ȏm% &03,&FFF7:=mos_cli &23,&FFF1:=mos_word &53,&FFDD:=mos_file &93,&FFD1:=mos_gbpb  =0 ݤmos_cli:cmd($X%,):=0 ݤmos_byte $A%=&82:rx%=0:ry%=&00:=0 .A%=&83:rx%=0:ry%=&08:=0 8*A%=&84:rx%=prog%255:ry%=prog%256:=0 B3A%>123:A%<127:mem%?escflg%=128*(A%1):"FX15" Lhos%<>32:X%=X%255:A%=&FFF4:rx%=(A%&FF00)256:ry%=(A%&FF0000)65536:rp%=(A%&1000000)&1000000:=0 V>A%=128:rx%=7:ȗrx%,A%,A%:ry%=(rx%>>8)255:rx%=rx%255:=0 `>A%=128:rx%=8:ȗA%,rx%,A%:ry%=(rx%>>8)255:rx%=rx%255:=0 j ȎA% t0:rx%=32:=0 ~127:rx%=#rx%:=0 /128:A%=(rx%+256*ry%):rx%=A%:ry%=A%256:=0 =129:A%=(rx%+256*ry%):rx%=A%:ry%=A%256:carry(A%=-1):=0 134:rx%=:ry%=:=0 135:rx%=(,):ry%=:=0 160 Pry%=rx%+1:ry%=(@vdu%!(((ry%-4)+"0312",(ry%3)+1,1)-2)*4))(8*(1+(ry%1))) Irx%=(@vdu%!(((rx%-4)+"0312",(rx%3)+1,1)-2)*4))(8*(1+(rx%1))):=0  =0 ݤmos_word `A%=0:A%=!X%&FFFF:mem%?255=0:osw0%=:EscOn:""A$:EscOff:$(mem%+A%)=A$:osw0%=:ry%=A$:=0 os%<>32A%=10:&FFF1:=0  ȎA%  1:!X%=:=0 2:=!X%:=0 7:!X%,X%!2,X%!4,X%!6:=0 (S8:?X%,X%?1,X%?2,X%?3,X%?4,X%?5,X%?6,X%?7,X%?8,X%?9,X%?10,X%?11,X%?12,X%?13:=0 214:$X%=$:=0 <15:$=$X%:=0 F P=0 Zݤmos_file d3A%=254:X%?5=&FF:X%?5=0A%=254:X%!2=X%!2+mem% n3A%=255:X%?5=&FF:X%?5=0A%=255:X%!2=X%!2+mem% xLA%=0:X%?13=&FF:X%?13=0:X%?17=0A%=0:X%!10=X%!10+mem%:X%!14=X%!14+mem% fn%=mem%+(!X%&FFFF) bos%<32:ș"OS_File",A%,fn%,X%!2,X%!6,X%!10,X%!14ra%,,X%!2,X%!6,X%!10,X%!14ra%=file($fn%,A%) =0 6ݤmos_bget:ra%=(&FFD7):rp%=ra%256:ra%=ra%255:=0 ݤmos_bput:&FFD7:=0 ݤmos_find:A%=0:#Y%:=0 ,(A%&C0)=&40:ra%=openin($(mem%+X%)):=0 -(A%&C0)=&80:ra%=openout($(mem%+X%)):=0 ,(A%&C0)=&C0:ra%=openup($(mem%+X%)):=0 ݤmos_gbpb +ra%=X%?5:ra%=&FF:X%?5=0X%!1=X%!1+mem% .A%=&FFD1:ra%=&FF:X%?5=&FFX%!1=X%!1-mem% ra%=A%255:rp%=A%256:=0 ݤmos_args Y%=0:A%=0:ra%=fs:=0 *Y%=0:mem%!X%=args(ra%,Y%,mem%!X%):=0 "A%=0:mem%!X%=#Y%:ra%=0:=0 ,A%=1:#Y%=mem%!X%:ra%=0:=0 6A%=2:mem%!X%=#Y%:ra%=0:=0 @A%=3:#Y%=mem%!X%:ra%=0:=0 JA%=4:mem%!X%=#Y%:ra%=0:=0 T mem%!X%=args(A%,Y%,mem%!X%) ^=0 hݤmos_quit:= rݤmos_lang:=0 |Close_All:*EXEC "in%=in%:in%:A%=in%:in%=0:#A% 'out%=out%:out%:A%=out%:out%=0:#A%  /ݤs(A$):A$,1)=" ":A$=A$,2):A$,1)<>" " +A$,1)=" ":A$=A$,A$-1):A$,1)<>" " =A$ ݤuc(A$):B$:A$="":="" 5B$=B$+(A$((A$<"@")&DF)):A$=A$,2):A$="":=B$ ݤlc(A$):B$:A$="":="" 5B$=B$+(A$((A$<"_")&20)):A$=A$,2):A$="":=B$ #ݤh0(A%,N%)="0000000"+~A%,N%) "ݤh(A%,N%)=" "+~A%,N%) #ݤd0(A%,N%)="00000000"+A%,N%) #ݤd(A%,N%)=" "+A%,N%) :ݤo0(A%,N%):A$,B$:A%<0:B$="7":A%=A%&7FFFFFFFB$="0" 2A$=(A% 7)+A$:A%=A%8:A%=0:=N%,B$)+A$,N%) &9ݤo(A%,N%):A$,B$:A%<0:B$="7":A%=A%&7FFFFFFFB$=" " 02A$=(A% 7)+A$:A%=A%8:A%=0:=N%,B$)+A$,N%) ::ݤb0(A%,N%):A$,B$:A%<0:B$="1":A%=A%&7FFFFFFFB$="0" D2A$=(A% 1)+A$:A%=A%2:A%=0:=N%,B$)+A$,N%) N9ݤb(A%,N%):A$,B$:A%<0:B$="1":A%=A%&7FFFFFFFB$=" " X2A$=(A% 1)+A$:A%=A%2:A%=0:=N%,B$)+A$,N%) bݤdrv(A%)=(48+A%-7*(A%>9)) l"ݤDrv(A$)=A$-48+7*(A$>"9")31 v:ݤOS_GetEnv:A$,A%:X%=1:os%=((&FFF4)&FF00)256:X%-1 Jos%=32:>&FFFF:ș"GetModuleFileName",0,X%,255:A$=$$X%:run$=A$:=@cmd$ os%=32:A$=$&100 {A$=0:>&7FFF:run$=$&8100:ș"OS_GetEnv"A$,,A%:ș"OS_WriteEnv","",A%:A$=A$,1+A$+" "," ",1+A$," "))):A$=0:A$=run$ 0A$=0:?(P-3):A$=$&600A$=0:A$=$(-&300) 7A%=A$+" "," "):run$=A$,A%-1):run$<>"":=A$,A%+1) bY%=X%256:A%=9:?X%=0:X%!1=X%+16:X%!16=0:&FFD1:A%=X%+16:!A%?A%+A%?2<>8:A%?(A%+1)=13:=$(A%+1) ="" $os(A$):A$=42:A$A$<>"":A$  @exit(A%):"FX1,"+A%:quit$=quit$:A$=quit$:quit$="":os(A$) os%=32:ȘA% os%<6:*Quit  ݤDis_Name(cpu%)="65x02"  6ݤDis_Code(cpu%,Ptr%,Data%):op%,ins%,md%,b0%,num% @(op%&8F)=&8A:="TXATXSTAXTSXDEXPHXNOPPLX",3*(op%16)-23,3) Hop%=&20:="JSR "+mde(3) R;(op%&9F)=0:X%?2=(op%64):="BRK***RTIRTS",ins%*3+1,3) \)(op%&DF)=&5A:="PHYPLY",ins%*3-5,3) fop%=&89:="BIT "+mde(2) p$b0%=1:=alu(ins%)+" "+mde(md%) z)(op%31)=&12:=alu(ins%)+" "+mde(8) $(op%&EF)=&64:="STZ "+mde(md%) ((op%&FD)=&9C:="STZ "+mde(b0%*2+3) 3(op%&D7)=&96:=rot(ins%)+" "+mde(md%3)+",Y" ((op%7)=6:=rot(ins%)+" "+mde(md%) N(op%&1F)=16:num%=2:="B"+"PLMIVCVSCCCSNEEQ",1+2*ins%,2)+" "+jr(Data%?1) <(op%&8F)=10:=rot((ins%+(md%4)*1.5)((md%>4)1))+" A" 9(op%&E7)=4:="T"+"SR",1+(md%4),1)+"B "+mde(md%3) 6(op%&D3)=&C0:=bxy(ins%)+" "+mde(((md%3)-1)3) $(op%&E7)=&24:="BIT "+mde(md%) ,(op%&C7)=&84:=bxy(ins%)+" "+mde(md%) ;(op%&FD)=&A0:="LD"+"YX",1+((op%2)2),1)+" "+mde(2) R(op%&CF)=&4C:op%<>&5C:X%?2=64:="JMP "+"(",op%>&5F)+mde(md%)+")",op%>&5F) 0op%=&80:num%=2:X%?2=64:="BRA "+jr(Data%?1) !X%?2=128:="EQUB &"+h0(op%,2) 3ݤalu(A%)="ORAANDEORADCSTALDACMPSBC",A%*3+1,3) 3ݤrot(A%)="ASLROLLSRRORSTXLDXDECINC",A%*3+1,3) $3ݤbxy(A%)="***BIT***STZSTYLDYCPYCPX",A%*3+1,3) ./ݤmde(A%):num%=2:A%=2:="#&"+h0(Data%?1,2) 8>(A%2):num%=3:="&"+h0(Data%!1,4)+",X",A%=7)+",Y",A%=6) B+(A%1):="&"+h0(Data%?1,2)+",X",A%=5) L4="(&"+h0(Data%!1,2)+",X",A%=0)+")"+",Y",A%=4) VDݤjr(A%):A%<128:="&"+h0(Ptr%+A%+2,4)="&"+h0(Ptr%+A%+2-256,4) `Jݤfile(A$,A%):os%<32:$name%=A$:?X%=name%:X%?1=name%256:=(&FFDD)&FF jA$,".")=0:A$=A$+"." t9A%=255A%=5:X%!14=(A$):X%!14:X%!10=#X%!14:#X%!14 ~1A%=255:X%?6=0:"LOAD """+A$+""" "+~X%!2:=1 A%=5:X%!14:=1A%=5:=0 FA%=0:"SAVE """+A$+""" "+~X%!10+" "+~X%!14:X%!10=X%!14-X%!10:=1 BA%=7:"SAVE """+A$+""" "+~+"+"+~X%!10:X%!10=X%!14-X%!10:=1  A%=8  ::=2 "MKDIR "+A$:=2  =0 #gbpb(A%,chn%,addr%,num%,ptr%) 2)X%!5<1:  Bݤgbpb(A%):X%!1=data%:&FFD1:A%=data%+((1+?data%)((A%-2)=6)) A%?(1+?A%)=13:=$(A%+1) Eݤgbpb8(ptr%):X%!1=data%:X%!5=1:X%!9=ptr%:A%=8:&FFD1:X%!5=1:="" (#A%=data%:A%?(1+?A%)=13:=$(A%+1) 23ݤargs(A%,Y%,ptr%):X%,E%:?(P-3)=0:E%=Y%:Y%=0 <.<&8000:!&70:X%=&70:!X%=ptr%:&FFDA:=!X% F'ș"OS_Args",A%,Y%,ptr%,,ptr%:=ptr% P<ݤargsA(A%):<&8000:X%,Y%,E%,!&70:X%=&70:=(&FFDA)&FF Zș"OS_Args",A%A%:=A% d(ݤfs:os%<32:A%,Y%,E%:=(&FFDA)&FF n=29 x'cdir(A$):os%=32:A%=file(8,A$): file(5,A$)=0:"CDIR "+A$  ݤopenin(A$)=(f_name(A$))  ݤopenout(A$)=(f_name(A$)) ݤopenup(A$)=(f_name(A$)) Vݤf_name(A$):os%=32:A%,B%:B%=A%:A%=A$,"\",A%+1):A%=0:A$,".",B%)=0:A$=A$+"." =A$