#include <stdio.h>
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
int main(){ unsigned short mem[4][65536], M[4]= { 1, 1, 1, 1 },
            N[4]= { 2, 2, 2, 2 }, S[4], slt= 0, OP, P= 0x17e8, Q, R, K=0, V=0,
            i, n, h, k, b, big=2, zeix, zei, dtast=0, vram=0, ini, count, modx, modn, modw, modq=0,

            tabelle[65]={0x80,0xc0,0xc0,0xa0,0xc1,0xc0,0xc0,0xc0,0xac,0xad,0xa4,0xa2,0xaa,0xa3,0xa8,0xa6,
                         0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xa9,0xab,0xc0,0xa1,0xc0,0xc0,
                         0xc0,0xf9,0xf5,0xfd,0xfe,0xff,0xf0,0xf6,0xb6,0xbe,0xb4,0xb5,0xb7,0xbf,0   ,0xa5,
                         0xf4,0   ,0xf1,0xfa,0xbc,0xfb,0xbd,0   ,0   ,0   ,0xf8,0xae,0xa7,0xaf,0xc0,0xf2,0xc0};

            unsigned long zeit= 0, sum; char st[65], buf[2], sr[65], *znam, name[9]="emtext-a"; FILE *datei;

            int screen; unsigned long ws, sw, bl, ye; Display *disp; Window win, rootwin; GC my;

            XSizeHints sihi; XColor colh, colx; Colormap colmap; XEvent xev; XPoint punkt[2048]; KeySym key;

       R= P; if(!(sizeof(short)==2)){printf("\nVariablentyp short ist nicht 2Byte\n"); return(0);}

       datei = fopen("coka","r"); if (!datei){printf("\nDatei coka nicht gefunden\n"); return(0);}
       for (n=0; n<1024; n++) { fscanf(datei,"%64s",st);
           for (i=0; i<32; i++) { h=st[i*2]; b=st[i*2+1];
             if (h>57) h=h-39; if (b>57) b=b-39;
             mem[1][n*32+i] = ((h-48)*16+(b-48)) & 255; }}
       fclose(datei);

       for (i=0;i<10368;i++) { mem[0][i] = mem[1][i+0x4d00]; mem[1][i+0x4d00] = 255; }

       datei = fopen("teca","r"); if (datei){
       for (n=0; n<1024; n++) { fscanf(datei,"%64s",st);
           for (i=0; i<32; i++) { h=st[i*2]; b=st[i*2+1];
             if (h>57) h=h-39; if (b>57) b=b-39;
             mem[0][n*32+i] = ((h-48)*16+(b-48)) & 255; }}
       fclose(datei); }

       for(i=0;i<128;i++) printf("\n");
       printf("\n\n ACHTUNG - wenn Grafikfenster offen dann nicht klicken");
       printf("\n\n Gefahr von FATAL ERROR  /  Grafik beenden mit shift-q");
       printf("\n\n ab(br)echen - (c)ontinue  ");
       scanf("%4s", st); if(!(st[0]=='c' && st[1]==0)) return(0);

       disp = XOpenDisplay(NULL); if(disp==NULL) return(0);
       screen = XDefaultScreen(disp); rootwin = RootWindow(disp,screen);
       ws = WhitePixel(disp,screen); sw = BlackPixel(disp,screen); ye = ws; bl =sw;

       colmap = DefaultColormap(disp,screen); if(DefaultDepth(disp,screen)>1){
                if(XAllocNamedColor(disp,colmap,"yellow",&colh,&colx)) ye=colh.pixel;
                if(XAllocNamedColor(disp,colmap,"blue"  ,&colh,&colx)) bl=colh.pixel;}

       win = XCreateSimpleWindow(disp,rootwin,8,8,1056,544,4,sw,bl);

       sihi.flags = PSize | PMinSize | PMaxSize;
       sihi.min_width = 1056;
       sihi.max_width = 1056;
       sihi.min_height = 544;
       sihi.max_height = 544;
       XSetStandardProperties ( disp, win, "  ", "  ", None, 0, 0, &sihi );

       XSelectInput(disp,win, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask |
                ButtonReleaseMask); XMapWindow(disp,win); my = XCreateGC(disp,win,0,0); ini=1;

while(1){ if(zeit>0xfffffff || modq>0){ XSync(disp,True); XFreeGC(disp,my);
                               XDestroyWindow(disp,win); XCloseDisplay(disp);

          if(modq>2) printf("\nerrH  P= %x",P); if(modq>1){ printf("\nAbbruch\n\n"); return(0); }

          if(zeit>0xfffffff){ printf("\nt>limit  P= %x\n",P); zeit=zeit-0x10000000; }

          printf("\nresi(z)e Ab(br)uch (r)eset (l)oad (s)ave (c)ontinue  "); scanf("%4s",st);

      if(!((st[0]=='z' || st[0]=='r' || st[0]=='l' || st[0]=='s' || st[0]=='c') && st[1]==0)) return(0);

      sr[65]=0;

      if(st[0]=='l') { printf("\n(storno: #)  load/ Dateikennbuchstabe: ");
                    scanf("%4s",sr); if(sr[0]>96 && sr[0]<123) { name[7]=sr[0]; datei = fopen(name,"r");
                    if(datei) { for (n=0; n<256; n++) { fscanf(datei,"%64s",sr); for (i=0; i<32; i++) {
                    h=sr[i*2]; b=sr[i*2+1]; if (h>57) h=h-39; if (b>57) b=b-39;
                    mem[1][vram+0xa000+n*32+i] = ((h-48)*16+(b-48)) & 255; }} fclose(datei); }}}

      if(st[0]=='s') { printf("\n(storno: #)  save/ Dateikennbuchstabe: ");
                    scanf("%4s",sr); if(sr[0]>96 && sr[0]<123) { name[7]=sr[0]; datei = fopen(name,"w");
                    if(datei) { for (n=0; n<256; n++) { for(i=0; i<32; i++) { b=mem[1][vram+0xa000+n*32+i];
                    h=((b>>4) & 15)+48; b=(b & 15)+48; if(h>57) h=h+39; if(b>57) b=b+39;
                    sr[2*i]=(char) h; sr[2*i+1]=(char) b; } fprintf(datei,"%s\n",sr); } fclose(datei); }}}

      if(st[0]=='z') big=3-big;

      if(st[0]=='r'){ M[0]=1;M[1]=1;M[2]=1;M[3]=1;N[0]=2;N[1]=2;N[2]=2;N[3]=2;
                      P=0x17e8; K=0x8000; R=P; zeit=0; modq=0;}

       disp = XOpenDisplay(NULL); if(disp==NULL) return(0);
       screen = XDefaultScreen(disp); rootwin = RootWindow(disp,screen);
       win = XCreateSimpleWindow(disp,rootwin,8,8,528*big,272*big,4,sw,bl);

       sihi.flags = PSize | PMinSize | PMaxSize;
       sihi.min_width = 528*big;
       sihi.max_width = 528*big;
       sihi.min_height = 272*big;
       sihi.max_height = 272*big;
       XSetStandardProperties ( disp, win, "  ", "  ", None, 0, 0, &sihi );

       XSelectInput(disp,win, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask |
                ButtonReleaseMask); XMapWindow(disp,win); my = XCreateGC(disp,win,0,0); ini=1; }

if(!modq) {  n=M[0]; if(n==1 && P>0x7fff) OP=mem[n][P ^ vram]; else OP=mem[n][P]; P++; zeit++;

 if(OP && (OP<0x40)) {
    if((OP & 0xf9)==0   ) { n= (OP>>1) & 3; S[n]=S[0];    continue; }
    if((OP & 0xf9)==1   ) { n= (OP>>1) & 3; S[n]=K;       continue; }
    if((OP & 0xf9)==0x20) { n= (OP>>1) & 3; S[n]= 0;      continue; }
    if((OP & 0xf9)==0x21) { n= (OP>>1) & 3; S[n]= K>>8;   continue; }
    if((OP & 0xe0)==0   ) { n= (OP>>3) & 3; S[n]=S[n]+(OP & 7)+1; continue; }
    if((OP & 0xe0)==0x20) { n= (OP>>3) & 3; S[n]=S[n]-(OP & 7)-1; continue; }}

 if(OP>0xdf) switch (OP) {
    case 0xe1: if(K & 255   ) V=1; continue;
    case 0xe0: K= K & 0xff00; if(V) K=K+255;    V=0; continue;
    case 0xe3: if(K & 0xff00) V=1; continue;
    case 0xe2: K= K & 255   ; if(V) K=K+0xff00; V=0; continue;
    case 0xe5: K= K+0x8000;   continue;
    case 0xe6: K= K & 0x7fff; continue;
    case 0xe4: K= K | 0x8000; continue;
    case 0xe7: if(K & 0x8000) V=1-V; continue;
    case 0xe8: V=(V<<8)+(K & 0xff);
               K=(V>>1)+(K & 0xff00);     V= V & 1;       continue;
    case 0xe9: V=V+(K<<1);
               K=(V & 0xff)+(K & 0xff00); V= (V>>8) & 1;  continue;
    case 0xea: V=(V<<8)+(K>>8);
               K=((V>>1)<<8)+(K & 0xff);  V= V & 1;       continue;
    case 0xeb: V=V+((K & 0xff00)>>7);
               K=(V<<8)+(K & 0xff);       V= (V>>8) & 1;  continue;
    case 0xed: V=1-V; continue;
    case 0xee: V=0;   continue;
    case 0xec: V=1;   continue;
    case 0xef: V=V+((K & 0xff00)>>7); K=(V<<8)+(K & 0xff);
               V= (V>>8) & 1; if(K & 0x100) V=1-V; continue;
    case 0xf1: K=(K & 0xff00)+(255-(K & 0xff));    continue;
    case 0xf0: K= K & 0xff00;                      continue;
    case 0xf3: K=(K & 255)+(0xff00-(K & 0xff00));  continue;
    case 0xf2: K= K & 255;                         continue;
    case 0xf5: h= K>>8; h=  h-V; V= (h>>8) & 1; K=(K & 0xff)+(h<<8); continue;
    case 0xf4: h= K>>8; h=  h+V; V= (h>>8) & 1; K=(K & 0xff)+(h<<8); continue;
    case 0xf6: zeit++;     continue;
    case 0xf7: R=P;        continue;
    case 0xf8: K++;        continue;
    case 0xf9: K--;        continue;
    case 0xfb: K=0xffff-K; continue;
    case 0xfa: K=0;        continue;
    case 0xfc: K= K+256;   continue;
    case 0xfd: K= K-256;   continue;
    case 0xfe: K=Q;        continue;
    case 0xff: R=K; Q=P; P=R; K=Q; continue; }

 if(OP>0xbf) {
    if(OP== 0xc8) { P=R; continue; }
    if(OP== 0xc9) { if(S[0]) { S[0]--; P=R; } continue; }
    if(OP== 0xd8) { S[0]++; continue; }
    if(OP== 0xd9) { S[0]--; continue; }
    if((OP & 0xf9)==0xc8) { if(S[0])
                          { n= (OP>>1) & 3; S[n]++; S[0]--; P=R; }   continue;}
    if((OP & 0xf9)==0xc9) { if(S[0])
                          { n= (OP>>1) & 3; S[n]--; S[0]--; P=R; }   continue;}
    if((OP & 0xf9)==0xd8) { n= (OP>>1) & 3; S[n]++; K=(K>>8)+(K<<8); continue;}
    if((OP & 0xf9)==0xd9) { n= (OP>>1) & 3; S[n]--; K=(K>>8)+(K<<8); continue;}
    if((OP & 0xf9)==0xd0) { n= (OP>>1) & 3;
                            K= (K & 0xff)+(S[n] & 0xff00);           continue;}
    if((OP & 0xf9)==0xd1) { n= (OP>>1) & 3;
                            K= (K & 0xff)+(S[n]<<8      );           continue;}
    switch (OP) {
    case 0xc0: if(!V) P=R; V=0; continue;
    case 0xc1: if( V) P=R; V=0; continue;
    case 0xc2: if(!(K & 0x8000)) P=R; continue;
    case 0xc3: if(  K & 0x8000 ) P=R; continue;
    case 0xc4: if(!(K & 0xff00)) P=R; continue;
    case 0xc5: if(  K & 0xff00 ) P=R; continue;
    case 0xc6: if(!K) P=R; continue;
    case 0xc7: if( K) P=R; continue; }}

 if(OP>0x7f) {
    if( OP == 0x88 ) { K= K>>8; continue; }
    if((OP & 0xf8)==0x88) { n= OP & 7;    h= K>>8; h= (h<<n)+(h>>(8-n));
                                          K= (K & 0xff)+(h<<8);  continue; }
    if( OP == 0x90 ) {          continue; }
    if((OP & 0xf0)==0x90) { n= (OP & 15); K= (K<<n)+(K>>(16-n)); continue; }

    if((OP & 0xe7)==0xa7) { n= (OP>>3) & 3; K=K-S[n];              continue; }
    if((OP & 0xe7)==0xa6) { n= (OP>>3) & 3; K=K+S[n];              continue; }
    if((OP & 0xe7)==0xa5) { n= (OP>>3) & 3; K=S[n]-K;              continue; }
    if((OP & 0xe7)==0xa4) { n= (OP>>3) & 3; K=S[n];                continue; }
    if((OP & 0xe7)==0xa0) { n= (OP>>3) & 3; i=S[n]; S[n]=K; K=i;   continue; }
    if(OP== 0xa3) { sum=K-S[0]-V; K= (short) sum; V= (short) (sum>>16) & 1; continue; }
    if(OP== 0xa2) { sum=K+S[0]+V; K= (short) sum; V= (short) (sum>>16) & 1; continue; }
    if(OP== 0xa1) { sum=S[0]-K-V; K= (short) sum; V= (short) (sum>>16) & 1; continue; }
    if((OP & 0xe7)==0xa3) { n= (OP>>3) & 3; S[0]=S[n];                 continue; }
    if((OP & 0xe7)==0xa2) { n= (OP>>3) & 3; i=M[n]; M[n]=N[n]; N[n]=i; continue; }
    if((OP & 0xe7)==0xa1) { n= (OP>>3) & 3; i=S[n]; S[n]=S[0]; S[0]=i; continue; }

    h=K>>8; b= K & 255; switch (OP) {
    case 0x87: h= 255-(h | b);                   K= b+(h<<8); continue;
    case 0x86: h= ((255-h) & b) | (h & (255-b)); K= b+(h<<8); continue;
    case 0x85: h= h & b;                         K= b+(h<<8); continue;
    case 0x84: h= b;                             K= b+(h<<8); continue;
    case 0x83: h= h-b-V;          V= (h>>8) & 1; K= b+(h<<8); continue;
    case 0x82: h= h+b+V;          V= (h>>8) & 1; K= b+(h<<8); continue;
    case 0x81: h= b-h-V;          V= (h>>8) & 1; K= b+(h<<8); continue;
    case 0x80: K= h+(K & 0xff00); continue; }}

 zeit++;

 if(OP>0x67) { n=(OP>>3) & 3; i=M[n]; n=S[n]; if(i==1 && n>0x7fff) n=n ^ vram; b=mem[i][n]; h=K>>8;
    switch (OP & 7) {
    case 7: h= 255-(h | b);                   K= (h<<8)+(K & 255); continue;
    case 6: h= ((255-h) & b) | (h & (255-b)); K= (h<<8)+(K & 255); continue;
    case 5: h= h & b;                         K= (h<<8)+(K & 255); continue;
    case 4: h= b;                             K= (h<<8)+(K & 255); continue;
    case 3: h= h-b-V;          V= (h>>8) & 1; K= (h<<8)+(K & 255); continue;
    case 2: h= h+b+V;          V= (h>>8) & 1; K= (h<<8)+(K & 255); continue;
    case 1: h= b-h-V;          V= (h>>8) & 1; K= (h<<8)+(K & 255); continue;
    case 0: if(!((i==0) || ((i==1) && (n<0x8000)))) mem[i][n] = h; continue;}}

 i= M[0]; if(i==1 && P>0x7fff) b= mem[i][P ^ vram]; else b= mem[i][P];

 if(OP>0x5f) { P++; h=K>>8; switch (OP) {
    case 0x67: h= 255-(h | b);                   K= (h<<8)+(K & 255); continue;
    case 0x66: h= ((255-h) & b) | (h & (255-b)); K= (h<<8)+(K & 255); continue;
    case 0x65: h= h & b;                         K= (h<<8)+(K & 255); continue;
    case 0x64: h= b;                             K= (h<<8)+(K & 255); continue;
    case 0x63: h=h-b-V;           V= (h>>8) & 1; K= (h<<8)+(K & 255); continue;
    case 0x62: h=h+b+V;           V= (h>>8) & 1; K= (h<<8)+(K & 255); continue;
    case 0x61: h=b-h-V;           V= (h>>8) & 1; K= (h<<8)+(K & 255); continue;
    case 0x60: h=h+b;                            K= (h<<8)+(K & 255); continue;
 }}
     if(OP>0x59) { P++; n= (OP>>1) & 3; if(OP & 1) S[n]=S[n]-b-1;
     else S[n]=S[n]+b+1; continue; }

 if(OP) { P++; switch(OP) {

    case 0x59: K=K-b-1; continue;
    case 0x58: K=K+b+1; continue;
    case 0x57: if(!b) K=R; zeit=zeit+b; continue;
    case 0x56: K=b; continue;
    case 0x55: K=K+P+b+1; continue;
    case 0x54: K=P+b+1; continue;
    case 0x40: if(!V) { P=P+b+1; zeit++; } V=0; continue;
    case 0x41: if( V) { P=P+b+1; zeit++; } V=0; continue;
    case 0x42: if(!V) { P=P-b-3; zeit++; } V=0; continue;
    case 0x43: if( V) { P=P-b-3; zeit++; } V=0; continue;
    case 0x44: if(!(K & 0x8000)) { P=P+b+1; zeit++; } continue;
    case 0x45: if(  K & 0x8000 ) { P=P+b+1; zeit++; } continue;
    case 0x46: if(!(K & 0x8000)) { P=P-b-3; zeit++; } continue;
    case 0x47: if(  K & 0x8000 ) { P=P-b-3; zeit++; } continue;
    case 0x48: if(!(K & 0xff00)) { P=P+b+1; zeit++; } continue;
    case 0x49: if(  K & 0xff00 ) { P=P+b+1; zeit++; } continue;
    case 0x4a: if(!(K & 0xff00)) { P=P-b-3; zeit++; } continue;
    case 0x4b: if(  K & 0xff00 ) { P=P-b-3; zeit++; } continue;
    case 0x4c: if(!(K         )) { P=P+b+1; zeit++; } continue;
    case 0x4d: if(  K          ) { P=P+b+1; zeit++; } continue;
    case 0x4e: if(!(K         )) { P=P-b-3; zeit++; } continue;
    case 0x4f: if(  K          ) { P=P-b-3; zeit++; } continue;
    case 0x50: P=P+b+1; zeit++; continue;
    case 0x51: R=P; P=P+b+1; zeit++; continue;
    case 0x52: P=P-b-3; zeit++; continue;
    case 0x53: if(S[0]) { S[0]--; P=P-b-3; zeit++; } continue; }}

 if(b==255) { P++; Q=P; R=K; K=Q; P=R; M[0]=N[0]; N[0]=i; continue; }

 b= K & 255;
 if((b & 0xf0)==0x10) { n= (b>>2) & 3; N[n]= b & 3; K= K & 255; continue; }
 if((b & 0xf8)==0x08) { slt= b & 7; K= K | 0xff00; if(slt==1) K=K & 255;
                                                                continue; }

 if((b & 0xfc)==4) { n= b & 3; h= (slt<<4)+(M[n]<<2)+N[n]+dtast; dtast=0;
                                            K=(h<<8)+(K & 255); continue; }

 if(b==3) { vram=0x4000-vram; K=K & 255; continue; }

 if(b==1) { K=K & 255; continue; }

 if(!((b==2)||(b==0))) { modq=3; continue; }}

 if(ini){ ini=0; modq=0; modx=0; modn=0; modw=0; zei=0; count=0;

          while(1){ XNextEvent(disp, &xev); if(xev.type == Expose) break;

                    printf("\nevent\n"); count++; if(count>1){printf("\nFehler: kein Expose\n");

                    XFreeGC(disp,my); XDestroyWindow(disp,win); XCloseDisplay(disp); return(0);}}}

 printf("\nt:  %x\n", zeit); if(!(K & 255)) printf("RK\n");

 XSetForeground(disp,my,ye);

if(big>1){ XFillRectangle(disp,win,my,16,16,1024,512); XSetForeground(disp,my,sw);

 for (n=0;n<256;n++) {

   h=n*2+16; for(k=0;k<2048;k=k+4){

   punkt[k].y = h; punkt[k+1].y = h; punkt[k+2].y = h+1; punkt[k+3].y = h+1;}

 k=0; h=16;

 for (i=0;i<64;i++) { b=mem[1][i*256+n+(0xc000-vram)];

   punkt[k].x = h; punkt[k+1].x = h+1; punkt[k+2].x = h; punkt[k+3].x = h+1;
   h=h+2; if(b & 128) k=k+4;

   punkt[k].x = h; punkt[k+1].x = h+1; punkt[k+2].x = h; punkt[k+3].x = h+1;
   h=h+2; if(b &  64) k=k+4;

   punkt[k].x = h; punkt[k+1].x = h+1; punkt[k+2].x = h; punkt[k+3].x = h+1;
   h=h+2; if(b &  32) k=k+4;

   punkt[k].x = h; punkt[k+1].x = h+1; punkt[k+2].x = h; punkt[k+3].x = h+1;
   h=h+2; if(b &  16) k=k+4;

   punkt[k].x = h; punkt[k+1].x = h+1; punkt[k+2].x = h; punkt[k+3].x = h+1;
   h=h+2; if(b &   8) k=k+4;

   punkt[k].x = h; punkt[k+1].x = h+1; punkt[k+2].x = h; punkt[k+3].x = h+1;
   h=h+2; if(b &   4) k=k+4;

   punkt[k].x = h; punkt[k+1].x = h+1; punkt[k+2].x = h; punkt[k+3].x = h+1;
   h=h+2; if(b &   2) k=k+4;

   punkt[k].x = h; punkt[k+1].x = h+1; punkt[k+2].x = h; punkt[k+3].x = h+1;
   h=h+2; if(b &   1) k=k+4; }

 if(k) XDrawPoints(disp,win,my,punkt,k,CoordModeOrigin); }}

else { XFillRectangle(disp,win,my,8,8,512,256); XSetForeground(disp,my,sw);

 for (n=0;n<256;n++) {

   h=n+8; for(k=0;k<512;k++){ punkt[k].y = h; }

 k=0; h=8;

 for (i=0;i<64;i++) { b=mem[1][i*256+n+(0xc000-vram)];

   punkt[k].x = h; h++; if(b & 128) k++;

   punkt[k].x = h; h++; if(b &  64) k++;

   punkt[k].x = h; h++; if(b &  32) k++;

   punkt[k].x = h; h++; if(b &  16) k++;

   punkt[k].x = h; h++; if(b &   8) k++;

   punkt[k].x = h; h++; if(b &   4) k++;

   punkt[k].x = h; h++; if(b &   2) k++;

   punkt[k].x = h; h++; if(b &   1) k++; }

 if(k) XDrawPoints(disp,win,my,punkt,k,CoordModeOrigin); }}

XSync(disp,True);

while(1){ XNextEvent(disp, &xev);

 if(xev.type == ButtonRelease) { modq=2; break; }

 if(xev.type == KeyPress) {

 key = XLookupKeysym(&xev.xkey,0); XLookupString(&xev.xkey, buf, 1, &key, NULL);

 n=buf[0];

 if(n==81){modq=1; break;}

 if(n==89){modx=0; printf("\nhex off\n"); continue;}

 if(modx==1){if((n>47) && (n<56)){zeix=n; modx=2; printf("hex: %c\n",n);} continue;}

 if(modx==2){if(!(((n>47) && (n<58)) || ((n>96)&&(n<103)))) continue; printf("hex: %c%c\nhex off\n",zeix,n);

                 modx=0; if(n>96) n=(n-97+58); zei=(zeix-48)*16+(n-48)+128; if(zei==0xfc) dtast=128; break;}

 if(!n){ znam = XKeysymToString(key);

             if(znam[0]=='U' && znam[1]=='p' && znam[2]==0)

               {zei=0xb8; if(modw) zei=0xba; break;}

             if(znam[0]=='D' && znam[1]=='o' && znam[2]=='w' && znam[3]=='n' && znam[4]==0)

               {zei=0xb9; if(modw) zei=0xbb; break;}

             if(znam[0]=='L' && znam[1]=='e' && znam[2]=='f' && znam[3]=='t' && znam[4]==0)

               {zei=0xb0; if(modw) zei=0xb2; break;}

             if(znam[0]=='R' && znam[1]=='i' && znam[2]=='g' && znam[3]=='h' && znam[4]=='t' && znam[5]==0)

               {zei=0xb1; if(modw) zei=0xb3; break;}}

 if(n>31 && n<97){zei=tabelle[n-32]; if(zei) break;}

 if(n>96 && n<123){zei=n-97+0xc2; if(modn==1 && zei<0xc8) zei=zei+(0xea-0xc2); break;}

 if(n== 8){zei=0xf3; break;}
 if(n==13){zei=0xfc; break;}

 if(n==88){modx=1; printf("\nhex:\n");}

 if(n==78){modn=1-modn; printf("\nmodN =%x\n",modn);}

 if(n==87){modw=1-modw; printf("\nmodW =%x\n",modw);}}}

 if(zei) K=(zei<<8)+(K & 255); zei=0; zeit=0;}}
