-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path6809.min.js
1 lines (1 loc) · 22.4 KB
/
6809.min.js
1
!function(e){"undefined"!=typeof module?module.exports=e():"function"==typeof define&&"object"==typeof define.amd?define(e):this.CPU6809=e()}(function(){function c(e,a,r){ue|=(128&(e^a^r^r>>1))>>6}function s(e,a,r){ue|=(32768&(e^a^r^r>>1))>>14}function C(){return 256*re+ce}function f(e){re=e>>8&255,ce=255&e}function L(e){ie(--ne,255&e)}function R(e){ie(--ne,255&e),ie(--ne,e>>8&255)}function P(e){ie(--ke,255&e)}function v(e){ie(--ke,255&e),ie(--ke,e>>8&255)}function T(e){return Ae(ne++)}function M(e){return 256*Ae(ne++)+Ae(ne++)}function U(e){return Ae(ke++)}function E(e){return 256*Ae(ke++)+Ae(ke++)}function b(e){switch(15&e){case 0:return C();case 1:return se;case 2:return be;case 3:return ke;case 4:return ne;case 5:return te;case 8:return re;case 9:return ce;case 10:return ue;case 11:return Be;default:return null}}function k(e,a){switch(15&e){case 0:return void f(a);case 1:return void(se=a);case 2:return void(be=a);case 3:return void(ke=a);case 4:return void(ne=a);case 5:return void(te=a);case 8:return void(re=a);case 9:return void(ce=a);case 10:return void(ue=a);case 11:return void(Be=a);default:return}}function d(e,a){var r=136&e;128!=r&&8!=r||(r=0),a?(r=b(e>>4),k(e>>4,b(e)),k(e,r)):k(e,b(e>>4))}function O(e){return 127<e?e-256:e}function N(e){return 32767<e?e-65536:e}function I(){var e=Ae(te++);return te&=65535,e}function l(){var e=Ae(te++);te&=65535;var a=Ae(te++);return te&=65535,256*e+a}function X(e){var a=Ae(e++);e&=65535;var r=Ae(e++);return e&=65535,256*a+r}function Y(e,a){ie(e++,a>>8&255),ie(e&=65535,255&a)}function h(){var e,a=I();switch(96&a){case 0:e=se;break;case 32:e=be;break;case 64:e=ke;break;case 96:e=ne}var r,c=null,s=null;if(128&a){switch(15&a){case 0:c=(s=e)+1,Se+=2;break;case 1:c=(s=e)+2,Se+=3;break;case 2:s=c=e-1,Se+=2;break;case 3:s=c=e-2,Se+=3;break;case 4:s=e;break;case 5:s=e+O(ce),Se+=1;break;case 6:s=e+O(re),Se+=1;break;case 7:s=0;break;case 8:s=e+O(I()),Se+=1;break;case 9:s=e+N(l()),Se+=4;break;case 10:s=0;break;case 11:Se+=4,s=e+C();break;case 12:r=O(I()),s=te+r,Se+=1;break;case 13:r=N(l()),s=te+r,Se+=5;break;case 14:s=0;break;case 15:Se+=5,s=l()}s&=65535,16&a&&(s=256*Ae(s)+Ae(s+1&65535),Se+=3)}else{var b=31&a;15<b&&(b-=32),s=e+b,Se+=1}if(null!==c)switch(96&a){case 0:se=c;break;case 32:be=c;break;case 64:ke=c;break;case 96:ne=c}return 65535&s}function p(e){ue&=-13,0===e&&(ue|=4),32768&e&&(ue|=8)}function w(e){return e++,ue&=-15,ue|=fe[e&=255],0!==e&&128!=e||(ue|=2),e}function G(e){return e--,ue&=-15,ue|=fe[e&=255],127!==e&&255!=e||(ue|=2),e}function $(e,a){var r=e-a;return ue&=-16,ue|=fe[255&r],256&r&&(ue|=1),c(e,a,r),255&r}function m(e,a){var r=e-a;return ue&=-16,0==(65535&r)&&(ue|=4),32768&r&&(ue|=8),65536&r&&(ue|=1),s(e,a,r),65535&r}function J(e,a){var r=e+a;return ue&=-48,ue|=fe[255&r],256&r&&(ue|=1),c(e,a,r),16&(r^e^a)&&(ue|=32),255&r}function g(e,a){var r=e+a;return ue&=-16,0==(65535&r)&&(ue|=4),32768&r&&(ue|=8),65536&r&&(ue|=1),s(e,a,r),65535&r}function H(e,a){var r=e+a+(1&ue);return ue&=-48,ue|=fe[255&r],256&r&&(ue|=1),c(e,a,r),16&(r^e^a)&&(ue|=32),255&r}function V(e,a){var r=e-a-(1&ue);return ue&=-16,ue|=fe[255&r],256&r&&(ue|=1),c(e,a,r),255&r}function x(e,a){var r=e-a;ue&=-16,ue|=fe[255&r],256&r&&(ue|=1),c(e,a,r)}function y(e,a){var r=e-a;ue&=-16,0==(65535&r)&&(ue|=4),32768&r&&(ue|=8),65536&r&&(ue|=1),s(e,a,r)}function W(e){return ue&=-16,128==e&&(ue|=2),ue|=0===(e=1+(255&~e))?4:1,128&e&&(ue|=8),128&e&&(ue|=8),e}function j(e){return ue&=-14,1&e&&(ue|=1),0===(e>>=1)&&(ue|=4),255&e}function F(e){return ue&=-14,1&e&&(ue|=1),ue|=fe[e=128&e|e>>1],e}function Q(e){var a=e;return ue&=-16,128&e&&(ue|=1),ue|=fe[e<<=1],128&(e^a)&&(ue|=2),e}function Z(e){var a=e,r=1&ue;return ue&=-16,128&e&&(ue|=1),ue|=fe[e=e<<1|r],128&(e^a)&&(ue|=2),e}function q(e){var a=1&ue;return ue&=-14,1&e&&(ue|=1),ue|=fe[e=e>>1|a<<7],e}function z(e,a){return ue&=-15,ue|=fe[e^=a],e}function K(e,a){return ue&=-15,ue|=fe[e|=a],e}function _(e,a){return ue&=-15,ue|=fe[e&=a],e}function ee(e){return ue&=-15,ue|=fe[e^=255],ue|=1,e}function ae(){return 256*Be+I()}function a(){var e,a,r,c,s,b,k,n,t=Se,u=null,B=null,i=I();switch(Se+=De[i],i){case 0:u=ae(),ie(u,W(Ae(u)));break;case 3:u=ae(),ie(u,ee(Ae(u)));break;case 4:u=ae(),ie(u,j(Ae(u)));break;case 6:u=ae(),ie(u,q(Ae(u)));break;case 7:u=ae(),ie(u,F(Ae(u)));break;case 8:u=ae(),ie(u,Q(Ae(u)));break;case 9:u=ae(),ie(u,Z(Ae(u)));break;case 10:u=ae(),ie(u,G(Ae(u)));break;case 12:u=ae(),ie(u,w(Ae(u)));break;case 13:u=ae(),B=Ae(u),ue&=-15,ue|=fe[B];break;case 14:u=ae(),te=u;break;case 15:u=ae(),ie(u,0),ue&=-12,ue|=4;break;case 18:case 19:break;case 22:u=N(l()),te+=u;break;case 23:u=N(l()),R(te),te+=u;break;case 25:var A,o=0,S=240&re,D=15&re;(9<D||32&ue)&&(o|=6),128<S&&9<D&&(o|=96),(144<S||1&ue)&&(o|=96),ue&=-15,256&(A=o+re)&&(ue|=1),ue|=fe[re=255&A];break;case 26:ue|=I();break;case 28:ue&=I();break;case 29:re=128&ce?255:0,p(C()),ue&=-3;break;case 30:B=I(),d(B,!0);break;case 31:B=I(),d(B,!1);break;case 32:u=O(I()),te+=u;break;case 33:u=O(I());break;case 34:u=O(I()),5&ue||(te+=u);break;case 35:u=O(I()),5&ue&&(te+=u);break;case 36:u=O(I()),1&ue||(te+=u);break;case 37:u=O(I()),1&ue&&(te+=u);break;case 38:u=O(I()),4&ue||(te+=u);break;case 39:u=O(I()),4&ue&&(te+=u);break;case 40:u=O(I()),2&ue||(te+=u);break;case 41:u=O(I()),2&ue&&(te+=u);break;case 42:u=O(I()),8&ue||(te+=u);break;case 43:u=O(I()),8&ue&&(te+=u);break;case 44:u=O(I()),8&ue^(2&ue)<<2||(te+=u);break;case 45:u=O(I()),8&ue^(2&ue)<<2&&(te+=u);break;case 46:u=O(I()),8&ue^(2&ue)<<2||4&ue||(te+=u);break;case 47:u=O(I()),(8&ue^(2&ue)<<2||4&ue)&&(te+=u);break;case 48:0===(se=h())?ue|=4:ue&=-5;break;case 49:0===(be=h())?ue|=4:ue&=-5;break;case 50:ne=h();break;case 51:ke=h();break;case 52:k=I(),n=0,128&k&&(R(te),n+=2),64&k&&(R(ke),n+=2),32&k&&(R(be),n+=2),16&k&&(R(se),n+=2),8&k&&(L(Be),n++),4&k&&(L(ce),n++),2&k&&(L(re),n++),1&k&&(L(ue),n++),Se+=n;break;case 53:s=I(),b=0,1&s&&(ue=T(),b++),2&s&&(re=T(),b++),4&s&&(ce=T(),b++),8&s&&(Be=T(),b++),16&s&&(se=M(),b+=2),32&s&&(be=M(),b+=2),64&s&&(ke=M(),b+=2),128&s&&(te=M(),b+=2),Se+=b;break;case 54:r=I(),c=0,128&r&&(v(te),c+=2),64&r&&(v(ne),c+=2),32&r&&(v(be),c+=2),16&r&&(v(se),c+=2),8&r&&(P(Be),c++),4&r&&(P(ce),c++),2&r&&(P(re),c++),1&r&&(P(ue),c++),Se+=c;break;case 55:e=I(),a=0,1&e&&(ue=U(),a++),2&e&&(re=U(),a++),4&e&&(ce=U(),a++),8&e&&(Be=U(),a++),16&e&&(se=E(),a+=2),32&e&&(be=E(),a+=2),64&e&&(ne=E(),a+=2),128&e&&(te=E(),a+=2),Se+=a;break;case 57:te=M();break;case 58:se+=ce;break;case 59:(ue=T())&oe&&(Se+=9,re=T(),ce=T(),Be=T(),se=M(),be=M(),ke=M()),te=M();break;case 60:ue&=I();break;case 61:0===(u=re*ce)?ue|=4:ue&=-5,128&u?ue|=1:ue&=-2,f(u);break;case 63:ue|=oe,R(te),R(ke),R(be),R(se),L(Be),L(ce),L(re),L(ue),ue|=80,te=X(65530);break;case 64:re=W(re);break;case 67:re=ee(re);break;case 68:re=j(re);break;case 70:re=q(re);break;case 71:re=F(re);break;case 72:re=Q(re);break;case 73:re=Z(re);break;case 74:re=G(re);break;case 76:re=w(re);break;case 77:ue&=-15,ue|=fe[re];break;case 79:re=0,ue&=-12,ue|=4;break;case 80:ce=W(ce);break;case 83:ce=ee(ce);break;case 84:ce=j(ce);break;case 86:ce=q(ce);break;case 87:ce=F(ce);break;case 88:ce=Q(ce);break;case 89:ce=Z(ce);break;case 90:ce=G(ce);break;case 92:ce=w(ce);break;case 93:ue&=-15,ue|=fe[ce];break;case 95:ce=0,ue&=-12,ue|=4;break;case 96:u=h(),ie(u,W(Ae(u)));break;case 99:u=h(),ie(u,ee(Ae(u)));break;case 100:u=h(),ie(u,j(Ae(u)));break;case 102:u=h(),ie(u,q(Ae(u)));break;case 103:u=h(),ie(u,F(Ae(u)));break;case 104:u=h(),ie(u,Q(Ae(u)));break;case 105:u=h(),ie(u,Z(Ae(u)));break;case 106:u=h(),ie(u,G(Ae(u)));break;case 108:u=h(),ie(u,w(Ae(u)));break;case 109:u=h(),B=Ae(u),ue&=-15,ue|=fe[B];break;case 110:u=h(),te=u;break;case 111:u=h(),ie(u,0),ue&=-12,ue|=4;break;case 112:u=l(),ie(u,W(Ae(u)));break;case 115:u=l(),ie(u,ee(Ae(u)));break;case 116:u=l(),ie(u,j(Ae(u)));break;case 118:u=l(),ie(u,q(Ae(u)));break;case 119:u=l(),ie(u,F(Ae(u)));break;case 120:u=l(),ie(u,Q(Ae(u)));break;case 121:u=l(),ie(u,Z(Ae(u)));break;case 122:u=l(),ie(u,G(Ae(u)));break;case 124:u=l(),ie(u,w(Ae(u)));break;case 125:u=l(),B=Ae(u),ue&=-15,ue|=fe[B];break;case 126:u=l(),te=u;break;case 127:u=l(),ie(u,0),ue&=-12,ue|=4;break;case 128:re=$(re,I());break;case 129:x(re,I());break;case 130:re=V(re,I());break;case 131:f(m(C(),l()));break;case 132:re=_(re,I());break;case 133:_(re,I());break;case 134:re=I(),ue&=-15,ue|=fe[re];break;case 136:re=z(re,I());break;case 137:re=H(re,I());break;case 138:re=K(re,I());break;case 139:re=J(re,I());break;case 140:y(se,l());break;case 141:u=O(I()),R(te),te+=u;break;case 142:se=l(),p(se),ue&=-3;break;case 144:u=ae(),re=$(re,Ae(u));break;case 145:u=ae(),x(re,Ae(u));break;case 146:u=ae(),re=V(re,Ae(u));break;case 147:u=ae(),f(m(C(),X(u)));break;case 148:u=ae(),re=_(re,Ae(u));break;case 149:u=ae(),_(re,Ae(u));break;case 150:u=ae(),re=Ae(u),ue&=-15,ue|=fe[re];break;case 151:u=ae(),ie(u,re),ue&=-15,ue|=fe[re];break;case 152:u=ae(),re=z(re,Ae(u));break;case 153:u=ae(),re=H(re,Ae(u));break;case 154:u=ae(),re=K(re,Ae(u));break;case 155:u=ae(),re=J(re,Ae(u));break;case 156:u=ae(),y(se,X(u));break;case 157:u=ae(),R(te),te=u;break;case 158:u=ae(),se=X(u),p(se),ue&=-3;break;case 159:u=ae(),Y(u,se),p(se),ue&=-3;break;case 160:u=h(),re=$(re,Ae(u));break;case 161:u=h(),x(re,Ae(u));break;case 162:u=h(),re=V(re,Ae(u));break;case 163:u=h(),f(m(C(),X(u)));break;case 164:u=h(),re=_(re,Ae(u));break;case 165:u=h(),_(re,Ae(u));break;case 166:u=h(),re=Ae(u),ue&=-15,ue|=fe[re];break;case 167:u=h(),ie(u,re),ue&=-15,ue|=fe[re];break;case 168:u=h(),re=z(re,Ae(u));break;case 169:u=h(),re=H(re,Ae(u));break;case 170:u=h(),re=K(re,Ae(u));break;case 171:u=h(),re=J(re,Ae(u));break;case 172:u=h(),y(se,X(u));break;case 173:u=h(),R(te),te=u;break;case 174:u=h(),se=X(u),p(se),ue&=-3;break;case 175:u=h(),Y(u,se),p(se),ue&=-3;break;case 176:u=l(),re=$(re,Ae(u));break;case 177:u=l(),x(re,Ae(u));break;case 178:u=l(),re=V(re,Ae(u));break;case 179:u=l(),f(m(C(),X(u)));break;case 180:u=l(),re=_(re,Ae(u));break;case 181:u=l(),_(re,Ae(u));break;case 182:u=l(),re=Ae(u),ue&=-15,ue|=fe[re];break;case 183:u=l(),ie(u,re),ue&=-15,ue|=fe[re];break;case 184:u=l(),re=z(re,Ae(u));break;case 185:u=l(),re=H(re,Ae(u));break;case 186:u=l(),re=K(re,Ae(u));break;case 187:u=l(),re=J(re,Ae(u));break;case 188:u=l(),y(se,X(u));break;case 189:u=l(),R(te),te=u;break;case 190:u=l(),se=X(u),p(se),ue&=-3;break;case 191:u=l(),Y(u,se),p(se),ue&=-3;break;case 192:ce=$(ce,I());break;case 193:x(ce,I());break;case 194:ce=V(ce,I());break;case 195:f(g(C(),l()));break;case 196:ce=_(ce,I());break;case 197:_(ce,I());break;case 198:ce=I(),ue&=-15,ue|=fe[ce];break;case 200:ce=z(ce,I());break;case 201:ce=H(ce,I());break;case 202:ce=K(ce,I());break;case 203:ce=J(ce,I());break;case 204:u=l(),f(u),p(u),ue&=-3;break;case 206:ke=l(),p(ke),ue&=-3;break;case 208:u=ae(),ce=$(ce,Ae(u));break;case 209:u=ae(),x(ce,Ae(u));break;case 210:u=ae(),ce=V(ce,Ae(u));break;case 211:u=ae(),f(g(C(),X(u)));break;case 212:u=ae(),ce=_(ce,Ae(u));break;case 213:u=ae(),_(ce,Ae(u));break;case 214:u=ae(),ce=Ae(u),ue&=-15,ue|=fe[ce];break;case 215:u=ae(),ie(u,ce),ue&=-15,ue|=fe[ce];break;case 216:u=ae(),ce=z(ce,Ae(u));break;case 217:u=ae(),ce=H(ce,Ae(u));break;case 218:u=ae(),ce=K(ce,Ae(u));break;case 219:u=ae(),ce=J(ce,Ae(u));break;case 220:u=ae(),B=X(u),f(B),p(B),ue&=-3;break;case 221:u=ae(),Y(u,C()),ue&=-3;break;case 222:u=ae(),ke=X(u),p(se),ue&=-3;break;case 223:u=ae(),Y(u,ke),p(ke),ue&=-3;break;case 224:u=h(),ce=$(ce,Ae(u));break;case 225:u=h(),x(ce,Ae(u));break;case 226:u=h(),ce=V(ce,Ae(u));break;case 227:u=h(),f(g(C(),X(u)));break;case 228:u=h(),ce=_(ce,Ae(u));break;case 229:u=h(),_(ce,Ae(u));break;case 230:u=h(),ce=Ae(u),ue&=-15,ue|=fe[ce];break;case 231:u=h(),ie(u,ce),ue&=-15,ue|=fe[ce];break;case 232:u=h(),ce=z(ce,Ae(u));break;case 233:u=h(),ce=H(ce,Ae(u));break;case 234:u=h(),ce=K(ce,Ae(u));break;case 235:u=h(),ce=J(ce,Ae(u));break;case 236:u=h(),B=X(u),f(B),p(B),ue&=-3;break;case 237:u=h(),Y(u,C()),ue&=-3;break;case 238:u=h(),ke=X(u),p(ke),ue&=-3;break;case 239:u=h(),Y(u,ke),p(ke),ue&=-3;break;case 240:u=l(),ce=$(ce,Ae(u));break;case 241:u=l(),x(ce,Ae(u));break;case 242:u=l(),ce=V(ce,Ae(u));break;case 243:u=l(),f(g(C(),X(u)));break;case 244:u=l(),ce=_(ce,Ae(u));break;case 245:u=l(),_(ce,Ae(u));break;case 246:u=l(),ce=Ae(u),ue&=-15,ue|=fe[ce];break;case 247:u=l(),ie(u,ce),ue&=-15,ue|=fe[ce];break;case 248:u=l(),ce=z(ce,Ae(u));break;case 249:u=l(),ce=H(ce,Ae(u));break;case 250:u=l(),ce=K(ce,Ae(u));break;case 251:u=l(),ce=J(ce,Ae(u));break;case 252:u=l(),B=X(u),f(B),p(B),ue&=-3;break;case 253:u=l(),Y(u,C()),ue&=-3;break;case 254:u=l(),ke=X(u),p(ke),ue&=-3;break;case 255:u=l(),Y(u,ke),p(ke),ue&=-3;break;case 16:switch(i=I(),Se+=Ce[i],i){case 33:u=N(l());break;case 34:u=N(l()),5&ue||(te+=u);break;case 35:u=N(l()),5&ue&&(te+=u);break;case 36:u=N(l()),1&ue||(te+=u);break;case 37:u=N(l()),1&ue&&(te+=u);break;case 38:u=N(l()),4&ue||(te+=u);break;case 39:u=N(l()),4&ue&&(te+=u);break;case 40:u=N(l()),2&ue||(te+=u);break;case 41:u=N(l()),2&ue&&(te+=u);break;case 42:u=N(l()),8&ue||(te+=u);break;case 43:u=N(l()),8&ue&&(te+=u);break;case 44:u=N(l()),8&ue^(2&ue)<<2||(te+=u);break;case 45:u=N(l()),8&ue^(2&ue)<<2&&(te+=u);break;case 46:u=N(l()),8&ue^(2&ue)<<2&&4&ue||(te+=u);break;case 47:u=N(l()),(8&ue^(2&ue)<<2||4&ue)&&(te+=u);break;case 63:ue|=oe,R(te),R(ke),R(be),R(se),L(Be),L(ce),L(re),L(ue),ue|=80,te=X(65524);break;case 131:y(C(),l());break;case 140:y(be,l());break;case 142:be=l(),p(be),ue&=-3;break;case 147:u=ae(),y(C(),X(u));break;case 156:u=ae(),y(be,X(u));break;case 158:u=ae(),be=X(u),p(be),ue&=-3;break;case 159:u=ae(),Y(u,be),p(be),ue&=-3;break;case 163:u=h(),y(C(),X(u));break;case 172:u=h(),y(be,X(u));break;case 174:u=h(),be=X(u),p(be),ue&=-3;break;case 175:u=h(),Y(u,be),p(be),ue&=-3;break;case 179:u=l(),y(C(),X(u));break;case 188:u=l(),y(be,X(u));break;case 190:u=l(),be=X(u),p(be),ue&=-3;break;case 191:u=l(),Y(u,be),p(be),ue&=-3;break;case 206:ne=l(),p(ne),ue&=-3;break;case 222:u=ae(),ne=X(u),p(ne),ue&=-3;break;case 223:u=ae(),Y(u,ne),p(ne),ue&=-3;break;case 238:u=h(),ne=X(u),p(ne),ue&=-3;break;case 239:u=h(),Y(u,ne),p(ne),ue&=-3;break;case 254:u=l(),ne=X(u),p(ne),ue&=-3;break;case 255:u=l(),Y(u,ne),p(ne),ue&=-3}break;case 17:switch(i=I(),Se+=Ce[i],i){case 63:ue|=oe,R(te),R(ke),R(be),R(se),L(Be),L(ce),L(re),L(ue),ue|=80,te=X(65522);break;case 131:y(ke,l());break;case 140:y(ne,l());break;case 147:u=ae(),y(ke,X(u));break;case 156:u=ae(),y(ne,X(u));break;case 163:u=h(),y(ke,X(u));break;case 172:u=h(),y(ne,X(u));break;case 179:u=l(),y(ke,X(u));break;case 188:u=l(),y(ne,X(u))}}return re&=255,ce&=255,ue&=255,Be&=255,se&=65535,be&=65535,ke&=65535,ne&=65535,te&=65535,Se-t}function n(){re|=0,ce|=0,se|=0,be|=0,ke|=0,ne|=0,te=X(65534),ue|=80,Se=Be=0}var re,ce,se,be,ke,ne,te,ue,Be,ie,Ae,oe=128,Se=0,De=[6,0,0,6,6,0,6,6,6,6,6,0,6,6,3,6,0,0,2,4,0,0,5,9,0,2,3,0,3,2,8,6,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5,0,5,3,6,9,11,0,19,2,0,0,2,2,0,2,2,2,2,2,0,2,2,0,2,2,0,0,2,2,0,2,2,2,2,2,0,2,2,0,2,6,0,0,6,6,0,6,6,6,6,6,0,6,6,3,6,7,0,0,7,7,0,7,7,7,7,7,0,7,7,4,7,2,2,2,4,2,2,2,0,2,2,2,2,4,7,3,0,4,4,4,6,4,4,4,4,4,4,4,4,6,7,5,5,4,4,4,6,4,4,4,4,4,4,4,4,6,7,5,5,5,5,5,7,5,5,5,5,5,5,5,5,7,8,6,6,2,2,2,4,2,2,2,0,2,2,2,2,3,0,3,0,4,4,4,6,4,4,4,4,4,4,4,4,5,5,5,5,4,4,4,6,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,7,5,5,5,5,5,5,5,5,6,6,6,6],Ce=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,5,0,4,0,0,0,0,7,0,0,0,0,0,0,0,0,7,0,6,6,0,0,0,7,0,0,0,0,0,0,0,0,7,0,6,6,0,0,0,8,0,0,0,0,0,0,0,0,8,0,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,7],fe=[4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8],Le=[[2,1,"NEG"],[1,0,"???"],[1,0,"???"],[2,1,"COM"],[2,1,"LSR"],[1,0,"???"],[2,1,"ROR"],[2,1,"ASR"],[2,1,"LSL"],[2,1,"ROL"],[2,1,"DEC"],[1,0,"???"],[2,1,"INC"],[2,1,"TST"],[2,1,"JMP"],[2,1,"CLR"],[1,0,"Prefix"],[1,0,"Prefix"],[1,2,"NOP"],[1,2,"SYNC"],[1,0,"???"],[1,0,"???"],[3,3,"LBRA"],[3,3,"LBSR"],[1,0,"???"],[1,2,"DAA"],[2,4,"ORCC"],[1,0,"???"],[2,4,"ANDCC"],[1,2,"SEX"],[2,20,"EXG"],[2,20,"TFR"],[2,5,"BRA"],[2,5,"BRN"],[2,5,"BHI"],[2,5,"BLS"],[2,5,"BCC"],[2,5,"BCS"],[2,5,"BNE"],[2,5,"BEQ"],[2,5,"BVC"],[2,5,"BVS"],[2,5,"BPL"],[2,5,"BMI"],[2,5,"BGE"],[2,5,"BLT"],[2,5,"BGT"],[2,5,"BLE"],[2,6,"LEAX"],[2,6,"LEAY"],[2,6,"LEAS"],[2,6,"LEAU"],[2,10,"PSHS"],[2,10,"PULS"],[2,11,"PSHU"],[2,11,"PULU"],[1,0,"???"],[1,2,"RTS"],[1,2,"ABX"],[1,2,"RTI"],[2,2,"CWAI"],[1,2,"MUL"],[1,2,"RESET"],[1,2,"SWI1"],[1,2,"NEGA"],[1,0,"???"],[1,0,"???"],[1,2,"COMA"],[1,2,"LSRA"],[1,0,"???"],[1,2,"RORA"],[1,2,"ASRA"],[1,2,"ASLA"],[1,2,"ROLA"],[1,2,"DECA"],[1,0,"???"],[1,2,"INCA"],[1,2,"TSTA"],[1,0,"???"],[1,2,"CLRA"],[1,2,"NEGB"],[1,0,"???"],[1,0,"???"],[1,2,"COMB"],[1,2,"LSRB"],[1,0,"???"],[1,2,"RORB"],[1,2,"ASRB"],[1,2,"ASLB"],[1,2,"ROLB"],[1,2,"DECB"],[1,0,"???"],[1,2,"INCB"],[1,2,"TSTB"],[1,0,"???"],[1,2,"CLRB"],[2,6,"NEG"],[1,0,"???"],[1,0,"???"],[2,6,"COM"],[2,6,"LSR"],[1,0,"???"],[2,6,"ROR"],[2,6,"ASR"],[2,6,"LSL"],[2,6,"ROL"],[2,6,"DEC"],[1,0,"???"],[2,6,"INC"],[2,6,"TST"],[2,6,"JMP"],[2,6,"CLR"],[3,7,"NEG"],[1,0,"???"],[1,0,"???"],[3,7,"COM"],[3,7,"LSR"],[1,0,"???"],[3,7,"ROR"],[3,7,"ASR"],[3,7,"LSL"],[3,7,"ROL"],[3,7,"DEC"],[1,0,"???"],[3,7,"INC"],[3,7,"TST"],[3,7,"JMP"],[3,7,"CLR"],[2,4,"SUBA"],[2,4,"CMPA"],[2,4,"SBCA"],[3,8,"SUBD"],[2,4,"ANDA"],[2,4,"BITA"],[2,4,"LDA"],[1,0,"???"],[2,4,"EORA"],[2,4,"ADCA"],[2,4,"ORA"],[2,4,"ADDA"],[3,8,"CMPX"],[2,5,"BSR"],[3,8,"LDX"],[1,0,"???"],[2,1,"SUBA"],[2,1,"CMPA"],[2,1,"SBCA"],[2,1,"SUBd"],[2,1,"ANDA"],[2,1,"BITA"],[2,1,"LDA"],[2,1,"STA"],[2,1,"EORA"],[2,1,"ADCA"],[2,1,"ORA"],[2,1,"ADDA"],[2,1,"CMPX"],[2,1,"JSR"],[2,1,"LDX"],[2,1,"STX"],[2,6,"SUBA"],[2,6,"CMPA"],[2,6,"SBCA"],[2,6,"SUBD"],[2,6,"ANDA"],[2,6,"BITA"],[2,6,"LDA"],[2,6,"STA"],[2,6,"EORA"],[2,6,"ADCA"],[2,6,"ORA"],[2,6,"ADDA"],[2,6,"CMPX"],[2,6,"JSR"],[2,6,"LDX"],[2,6,"STX"],[3,7,"SUBA"],[3,7,"CMPA"],[3,7,"SBCA"],[3,7,"SUBD"],[3,7,"ANDA"],[3,7,"BITA"],[3,7,"LDA"],[3,7,"STA"],[3,7,"EORA"],[3,7,"ADCA"],[3,7,"ORA"],[3,7,"ADDA"],[3,7,"CMPX"],[3,7,"JSR"],[3,7,"LDX"],[3,7,"STX"],[2,4,"SUBB"],[2,4,"CMPB"],[2,4,"SBCB"],[3,8,"ADDD"],[2,4,"ANDB"],[2,4,"BITB"],[2,4,"LDB"],[1,0,"???"],[2,4,"EORB"],[2,4,"ADCB"],[2,4,"ORB"],[2,4,"ADDB"],[3,8,"LDD"],[1,0,"???"],[3,8,"LDU"],[1,0,"???"],[2,1,"SUBB"],[2,1,"CMPB"],[2,1,"SBCB"],[2,1,"ADDD"],[2,1,"ANDB"],[2,1,"BITB"],[2,1,"LDB"],[2,1,"STB"],[2,1,"EORB"],[2,1,"ADCB"],[2,1,"ORB "],[2,1,"ADDB"],[2,1,"LDD "],[2,1,"STD "],[2,1,"LDU "],[2,1,"STU "],[2,6,"SUBB"],[2,6,"CMPB"],[2,6,"SBCB"],[2,6,"ADDD"],[2,6,"ANDB"],[2,6,"BITB"],[2,6,"LDB"],[2,6,"STB"],[2,6,"EORB"],[2,6,"ADCB"],[2,6,"ORB"],[2,6,"ADDB"],[2,6,"LDD"],[2,6,"STD"],[2,6,"LDU"],[2,6,"STU"],[3,7,"SUBB"],[3,7,"CMPB"],[3,7,"SBCB"],[3,7,"ADDD"],[3,7,"ANDB"],[3,7,"BITB"],[3,7,"LDB"],[3,7,"STB"],[3,7,"EORB"],[3,7,"ADCB"],[3,7,"ORB"],[3,7,"ADDB"],[3,7,"LDD"],[3,7,"STD"],[3,7,"LDU"],[3,7,"STU"]],Re={63:[2,2,"SWI3"],131:[4,8,"CMPU"],140:[4,8,"CMPS"],147:[3,1,"CMPU"],156:[3,1,"CMPS"],163:[3,6,"CMPU"],172:[3,6,"CMPS"],179:[4,7,"CMPU"],188:[4,7,"CMPS"]},Pe={33:[5,3,"LBRN"],34:[5,3,"LBHI"],35:[5,3,"LBLS"],36:[5,3,"LBCC"],37:[5,3,"LBCS"],38:[5,3,"LBNE"],39:[5,3,"LBEQ"],40:[5,3,"LBVC"],41:[5,3,"LBVS"],42:[5,3,"LBPL"],43:[5,3,"LBMI"],44:[5,3,"LBGE"],45:[5,3,"LBLT"],46:[5,3,"LBGT"],47:[5,3,"LBLE"],63:[2,2,"SWI2"],131:[4,8,"CMPD"],140:[4,8,"CMPY"],142:[4,8,"LDY"],147:[3,1,"CMPD"],156:[3,1,"CMPY"],158:[3,1,"LDY"],159:[3,1,"STY"],163:[3,6,"CMPD"],172:[3,6,"CMPY"],174:[3,6,"LDY"],175:[3,6,"STY"],179:[4,7,"CMPD"],188:[4,7,"CMPY"],190:[4,7,"LDY"],191:[4,7,"STY"],206:[4,8,"LDS"],222:[3,1,"LDS"],223:[3,1,"STS"],238:[3,6,"LDS"],239:[3,6,"STS"],254:[4,7,"LDS"],255:[4,7,"STS"]};return{steps:function(e){for(;0<e;)e-=a()},T:function(){return Se},memr:function(e){return Ae(e)},reset:n,init:function(e,a,r){ie=e,Ae=a,n()},status:function(){return{pc:te,sp:ne,u:ke,a:re,b:ce,x:se,y:be,dp:Be,flags:ue}},interrupt:function(){},nmi:function(){},set:function(e,a){switch(e.toUpperCase()){case"PC":return void(te=a);case"A":return void(re=a);case"B":return void(ce=a);case"X":return void(se=a);case"Y":return void(be=a);case"SP":return void(ne=a);case"U":return void(ke=a);case"FLAGS":return void(ue=a)}},flagsToString:function(){for(var e="",a="EFHINZVC",r=0;r<8;r++){e+=0==(ue&128>>r)?a[r].toLowerCase():a[r]}return e},disasm:function(e,a,r,c,s,b){function k(e,a){for(var r=e.toString(16);r.length<a;)r="0"+r;return r.toUpperCase()}function n(e){return k(255&e,2)}function t(e){return k(e,4)}var u,B,i,A=Le[e];if(16===e){if(void 0===(A=Pe[a]))return["???",2];e=a,a=r,r=c,c=s}if(17===e){if(void 0===(A=Re[a]))return["???",2];e=a,a=r,r=c,c=s}var o=A[0],S=A[1],D=A[2];switch(S){case 0:break;case 1:D+=" $"+n(a);break;case 2:break;case 3:D+=" #$"+t(256*a+r<32768?256*a+r+b:256*a+r+b-65536);break;case 4:D+=" #$"+n(a);break;case 5:D+=" #$"+t(a<128?a+b+2:a+b-254);break;case 6:D+=" ";var C=a,f=["X","Y","U","S"][(96&C)>>5];if(!(128&C)){var L=31&C;15<L&&(L-=32),D+=L+","+f;break}var R=15&C,P=127<r?r-256:r,v=32767<256*r+c?256*r+c-65536:256*r+c;if(16&C)switch(R){case 0:D+="???";break;case 1:D+="[,"+f+"++]";break;case 2:D+="???";break;case 3:D+="[,--"+f+"]";break;case 4:D+="[,"+f+"]";break;case 5:D+="[B,"+f+"]";break;case 6:D+="[A,"+f+"]";break;case 7:D+="???";break;case 8:D+="["+P+","+f+"]",o++;break;case 9:D+="["+v+","+f+"]",o+=2;break;case 10:D+="???";break;case 11:D+="[D,"+f+"]";break;case 12:D+="["+P+",PC]",o++;break;case 13:D+="["+v+",PC]",o+=2;break;case 14:D+="???";break;case 15:D+="[$"+t(256*r+c)+"]",o+=2}else switch(R){case 0:D+=","+f+"+";break;case 1:D+=","+f+"++";break;case 2:D+=",-"+f;break;case 3:D+=",--"+f;break;case 4:D+=","+f;break;case 5:D+="B,"+f;break;case 6:D+="A,"+f;break;case 7:D+="???";break;case 8:D+=P+","+f,o++;break;case 9:D+=v+","+f,o+=2;break;case 10:D+="???";break;case 11:D+="D,"+f;break;case 12:D+=P+",PC",o++;break;case 13:D+=v+",PC",o+=2;break;case 14:D+="???";break;case 15:D+="$"+t(256*r+c),o+=2}break;case 7:D+=" $"+t(256*a+r);break;case 8:D+=" #$"+t(256*a+r);break;case 10:for(u=["PC","U","Y","X","DP","B","A","CC"],B=[],i=0;i<8;i++)0!=(1&a)&&B.push(u[7-i]),a>>=1;D+=" "+B.join(",");break;case 11:for(u=["PC","S","Y","X","DP","B","A","CC"],B=[],i=0;i<8;i++)0!=(1&a)&&B.push(u[7-i]),a>>=1;D+=" "+B.join(",");break;case 20:D+=" "+(u=["D","X","Y","U","S","PC","?","?","A","B","CC","DP","?","?","?","?"])[a>>4]+","+u[15&a]}return[D,o]}}});