]> bicyclesonthemoon.info Git - cpied/commitdiff
- Optimised graphic procedures - everything works faster v1.1b
authorb <rowerynaksiezycu@gmail.com>
Sat, 6 Jul 2013 16:03:00 +0000 (18:03 +0200)
committerb <rowerynaksiezycu@gmail.com>
Sat, 6 Jul 2013 16:03:00 +0000 (18:03 +0200)
- Failed command line file load now closes the program without entering graphic mode
- Fixed a bug that crashed the program when loading a file from a long path

NAPISY.CPP
NAPISY.PRJ
readthis.txt

index 5b8f4dda08462130f15712d0a81b7c8f6a718ae9..4ccbf744ef7b10e75788cacb5e6895aae873734d 100644 (file)
@@ -7,8 +7,6 @@
 #include <dos.h>\r
 #include <bios.h>\r
 \r
-//#include <iostream.h>\r
-\r
 struct FontFileHeader\r
 {\r
        unsigned char id0;\r
@@ -84,7 +82,7 @@ struct ScreenFontBitmap8
 \r
        int status;\r
        char nazwap[256]="Nie_wybrano_pliku";\r
-       char err[51];\r
+       char err[256];\r
 \r
        int kart16=VGA;\r
 \r
@@ -106,8 +104,11 @@ struct ScreenFontBitmap8
        int wys=8;\r
        int cp=0;\r
        int lit=0x42;\r
+       int pre;\r
        int curx=2;\r
        int cury=2;\r
+       int prex;\r
+       int prey;\r
        int key;\r
        int tab=0;\r
        int any=0;\r
@@ -268,23 +269,14 @@ void deleteCPI(short st=6,short a=0,short b=0)
        }\r
 }\r
 \r
-/*t pot(int a,int n)\r
-{\r
- int y=1;\r
- for(int i=0;i<n;++i)\r
-       y*=a;\r
- return y;\r
-}*/\r
-\r
 void new8()\r
 {\r
-       //system("CLS");\r
        cleardevice();\r
        setcolor(GREEN);\r
-       //outtextxy(0,0,  "Edytor napis¢w±°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°");\r
-       outtextxy(0,0,  "Edytor napis¢w±                                                                 ");\r
+       \r
+       outtextxy(0,0,  "Edytor napis¢w±");\r
        outtextxy(0,8,  "±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±");\r
-       outtextxy(608,16,"v1.1");\r
+       outtextxy(600,16,"v1.1b");\r
 }\r
 void menu8()\r
 {\r
@@ -296,23 +288,24 @@ void menu8()
                outtextxy(0,472,"1.new°°2.save°°3.load°°4.use°°5.number°°6.newF°°7.newCP°°8.delF°°9.delCP°°10.end");\r
        else\r
                outtextxy(0,472,"1.new°°°°°°°°°°3.load°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°10.end");\r
-               \r
-       //outtextxy(280,466,".");\r
 }\r
 void cpwys()\r
 {\r
-       char cpw[90];\r
+       char cpw[256];\r
        setcolor(BLACK);\r
        outtextxy(0x78,0,"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");\r
        if(any)\r
-               sprintf(cpw,"°cp%03u°8x%02d°%s°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys,nazwap);\r
+       {\r
+               if(strlen(nazwap)<52)\r
+                       sprintf(cpw,"°cp%03u°8x%02d°%s°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys,nazwap);\r
+               else\r
+                       sprintf(cpw,"°cp%03u°8x%02d°path too long°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys);\r
+       }\r
        else\r
                strcpy(cpw, "°No CPI open°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°");\r
        setcolor(GREEN);\r
 \r
        outtextxy(0x78,0,cpw);\r
-       //sprintf(cpw,"%s°°°°°°°°°°°°°°°°°°°°°°°°°",nazwap);\r
-       //outtextxy(0xD8,0,nazwap);\r
 }\r
 \r
 void ramka8()\r
@@ -360,629 +353,727 @@ void ramka16()
                setcolor(RED);\r
        rectangle(495,110,624,367);\r
 }\r
-void lin14()\r
+void lin14(int mode=0)\r
 {\r
        if(!any)\r
                return;\r
+       if(mode==3)\r
+       {\r
+               if(SFB14[cp]->lit[lit].lin[cury]&(0x80>>curx))\r
+                       putpixel(176+curx+(lit%16)*8,223+cury+(lit/16)*14,GREEN);\r
+               else\r
+                       putpixel(176+curx+(lit%16)*8,223+cury+(lit/16)*14,BLACK);\r
+               return;\r
+       }\r
        char ab[2]="X";\r
-       setcolor(RED);\r
-       outtextxy(176,215,"0123456789ABCDEF");\r
-       outtextxy(168,226,"0");\r
-       outtextxy(168,240,"1");\r
-       outtextxy(168,254,"2");\r
-       outtextxy(168,268,"3");\r
-       outtextxy(168,282,"4");\r
-       outtextxy(168,296,"5");\r
-       outtextxy(168,310,"6");\r
-       outtextxy(168,324,"7");\r
-       outtextxy(168,338,"8");\r
-       outtextxy(168,352,"9");\r
-       outtextxy(168,366,"A");\r
-       outtextxy(168,380,"B");\r
-       outtextxy(168,394,"C");\r
-       outtextxy(168,408,"D");\r
-       outtextxy(168,422,"E");\r
-       outtextxy(168,436,"F");\r
-\r
+       int color1,color2;\r
        if(byo14[cp]==0)\r
        {\r
-               setcolor(RED);\r
-               setfillstyle(SOLID_FILL,BLACK);\r
-               rectangle(176,223,303,446);\r
-               floodfill(180,230,RED);\r
-               line(176,223,303,446);\r
-               line(303,223,176,446);\r
+               setfillstyle(WIDE_DOT_FILL,RED);\r
+               bar(176,223,303,446);\r
                return;\r
        }\r
-       \r
-       for(int l=0;l<256;++l)\r
+       if(wys==14)\r
        {\r
-               for(int a=0;a<14;++a)\r
+               color1=GREEN;\r
+               color2=GREEN;\r
+       }\r
+       else\r
+       {       \r
+               color1=BROWN;\r
+               color2=RED;\r
+       }\r
+       int a,b,l;\r
+       switch(mode)\r
+       {\r
+       case 2:\r
+               setcolor(RED);\r
+               if(pre%16!=lit%16)\r
                {\r
-                       for(int b=0;b<8;++b)\r
+                       ab[0]=abc[pre%16];\r
+                       outtextxy(176+8*(pre%16),215,ab);\r
+               }\r
+               if(pre/16!=lit/16)\r
+               {\r
+                       ab[0]=abc[pre/16];\r
+                       outtextxy(168,226+14*(pre/16),ab);\r
+               }\r
+               for(a=0;a<14;++a)\r
+               {\r
+                       for(b=0;b<8;++b)\r
                        {\r
-                               if (l==lit&&wys==14)\r
-                               {\r
-                                       setcolor(GREEN);\r
-                                       ab[0]=abc[lit%16];\r
-                                       outtextxy(176+8*(lit%16),215,ab);\r
-                                       ab[0]=abc[lit/16];\r
-                                       outtextxy(168,226+14*(lit/16),ab);\r
-\r
-                                       /*if(b>0)\r
-                                       {\r
-                                               if((SFB14[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                                       putpixel(176+b+(l%16)*8,223+a+(l/16)*14,GREEN);\r
-                                               else\r
-                                                       putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               if((SFB14[cp]->lit[l].lin[a]/0x80)==1)\r
-                                                       putpixel(176+b+(l%16)*8,223+a+(l/16)*14,GREEN);\r
-                                               else\r
-                                                       putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK);\r
-                                       }*/\r
-                                       if(SFB14[cp]->lit[l].lin[a]&(0x80>>b))\r
-                                               putpixel(176+b+(l%16)*8,223+a+(l/16)*14,GREEN);\r
-                                       else\r
-                                               putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK);\r
-                               }\r
+                               if(SFB14[cp]->lit[pre].lin[a]&(0x80>>b))\r
+                                       putpixel(176+b+(pre%16)*8,223+a+(pre/16)*14,BROWN);\r
+                               else\r
+                                       putpixel(176+b+(pre%16)*8,223+a+(pre/16)*14,BLACK);\r
+                       }\r
+               }\r
+       case 3:\r
+       case 1:\r
+               setcolor(color2);\r
+               ab[0]=abc[lit%16];\r
+               outtextxy(176+8*(lit%16),215,ab);\r
+               ab[0]=abc[lit/16];\r
+               outtextxy(168,226+14*(lit/16),ab);\r
+               for(a=0;a<14;++a)\r
+               {\r
+                       for(b=0;b<8;++b)\r
+                       {\r
+                               if(SFB14[cp]->lit[lit].lin[a]&(0x80>>b))\r
+                                       putpixel(176+b+(lit%16)*8,223+a+(lit/16)*14,color1);\r
                                else\r
+                                       putpixel(176+b+(lit%16)*8,223+a+(lit/16)*14,BLACK);\r
+                       }\r
+               }\r
+               break;\r
+       case 0:\r
+       default:\r
+               for(l=0;l<16;++l)\r
+               {\r
+                       ab[0]=abc[l];\r
+                       if(lit%16==l)\r
+                               setcolor(color2);\r
+                       else\r
+                               setcolor(RED);\r
+                       outtextxy(176+8*l,215,ab);\r
+                       if(lit/16==l)\r
+                               setcolor(color2);\r
+                       else\r
+                               setcolor(RED);\r
+                       outtextxy(168,226+14*l,ab);\r
+               }\r
+               for(l=0;l<256;++l)\r
+               {\r
+                       for(a=0;a<14;++a)\r
+                       {\r
+                               for(b=0;b<8;++b)\r
                                {\r
-\r
-                                       /*if(b>0)\r
+                                       if (l==lit)\r
                                        {\r
-                                               if((SFB14[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                                       putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BROWN);\r
+                                               if(SFB14[cp]->lit[l].lin[a]&(0x80>>b))\r
+                                                       putpixel(176+b+(l%16)*8,223+a+(l/16)*14,color1);\r
                                                else\r
                                                        putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK);\r
                                        }\r
                                        else\r
                                        {\r
-                                               if((SFB14[cp]->lit[l].lin[a]/0x80)==1)\r
+                                               if(SFB14[cp]->lit[l].lin[a]&(0x80>>b))\r
                                                        putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BROWN);\r
                                                else\r
                                                        putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK);\r
-                                       }*/\r
-                                       if(SFB14[cp]->lit[l].lin[a]&(0x80>>b))\r
-                                               putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BROWN);\r
-                                       else\r
-                                               putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK);\r
+                                       }\r
                                }\r
                        }\r
                }\r
+               break;\r
        }\r
 }\r
-void lin8()\r
+void lin8(int mode=0)\r
 {\r
        if(!any)\r
                return;\r
+       if(mode==3)\r
+       {\r
+               if(SFB8[cp]->lit[lit].lin[cury]&(0x80>>curx))\r
+                       putpixel(176+curx+(lit%16)*8,32+cury+(lit/16)*8,GREEN);\r
+               else\r
+                       putpixel(176+curx+(lit%16)*8,32+cury+(lit/16)*8,BLACK);\r
+               return;\r
+       }\r
        char ab[2]="X";\r
-       setcolor(RED);\r
-       outtextxy(176,24,"0123456789ABCDEF");\r
-       outtextxy(168,32,"0");\r
-       outtextxy(168,40,"1");\r
-       outtextxy(168,48,"2");\r
-       outtextxy(168,56,"3");\r
-       outtextxy(168,64,"4");\r
-       outtextxy(168,72,"5");\r
-       outtextxy(168,80,"6");\r
-       outtextxy(168,88,"7");\r
-       outtextxy(168,96,"8");\r
-       outtextxy(168,104,"9");\r
-       outtextxy(168,112,"A");\r
-       outtextxy(168,120,"B");\r
-       outtextxy(168,128,"C");\r
-       outtextxy(168,136,"D");\r
-       outtextxy(168,144,"E");\r
-       outtextxy(168,152,"F");\r
+       int color1,color2;\r
        if(byo8[cp]==0)\r
        {\r
-               setcolor(RED);\r
-               setfillstyle(SOLID_FILL,BLACK);\r
-               rectangle(176,32,303,159);\r
-               floodfill(180,40,RED);\r
-               line(176,32,303,159);\r
-               line(303,32,176,159);\r
+               setfillstyle(WIDE_DOT_FILL,RED);\r
+               bar(176,32,303,159);\r
                return;\r
        }\r
-\r
-       for(int l=0;l<256;++l)\r
+       if(wys==8)\r
        {\r
-               for(int a=0;a<8;++a)\r
+               color1=GREEN;\r
+               color2=GREEN;\r
+       }\r
+       else\r
+       {       \r
+               color1=BROWN;\r
+               color2=RED;\r
+       }\r
+       int a,b,l;\r
+       switch(mode)\r
+       {\r
+       case 2:\r
+               setcolor(RED);\r
+               if(pre%16!=lit%16)\r
                {\r
-                       for(int b=0;b<8;++b)\r
+                       ab[0]=abc[pre%16];\r
+                       outtextxy(176+8*(pre%16),24,ab);\r
+               }\r
+               if(pre/16!=lit/16)\r
+               {\r
+                       ab[0]=abc[pre/16];\r
+                       outtextxy(168,32+8*(pre/16),ab);\r
+               }\r
+               for(a=0;a<8;++a)\r
+               {\r
+                       for(b=0;b<8;++b)\r
                        {\r
-                               if (l==lit&&wys==8)\r
-                               {\r
-                                       setcolor(GREEN);\r
-                                       ab[0]=abc[lit%16];\r
-                                       outtextxy(176+8*(lit%16),24,ab);\r
-                                       ab[0]=abc[lit/16];\r
-                                       outtextxy(168,32+8*(lit/16),ab);\r
-\r
-                                       /*if(b>0)\r
-                                       {\r
-                                               if((SFB8[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                                       putpixel(176+b+(l%16)*8,32+a+(l/16)*8,GREEN);\r
-                                               else\r
-                                                       putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               if((SFB8[cp]->lit[l].lin[a]/0x80)==1)\r
-                                                       putpixel(176+b+(l%16)*8,32+a+(l/16)*8,GREEN);\r
-                                               else\r
-                                                       putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK);\r
-                                       }*/\r
-                                       if(SFB8[cp]->lit[l].lin[a]&(0x80>>b))\r
-                                               putpixel(176+b+(l%16)*8,32+a+(l/16)*8,GREEN);\r
-                                       else\r
-                                               putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK);\r
-                               }\r
+                               if(SFB8[cp]->lit[pre].lin[a]&(0x80>>b))\r
+                                       putpixel(176+b+(pre%16)*8,32+a+(pre/16)*8,BROWN);\r
+                               else\r
+                                       putpixel(176+b+(pre%16)*8,32+a+(pre/16)*8,BLACK);\r
+                       }\r
+               }\r
+       case 3:\r
+       case 1:\r
+               setcolor(color2);\r
+               ab[0]=abc[lit%16];\r
+               outtextxy(176+8*(lit%16),24,ab);\r
+               ab[0]=abc[lit/16];\r
+               outtextxy(168,32+8*(lit/16),ab);\r
+               for(a=0;a<8;++a)\r
+               {\r
+                       for(b=0;b<8;++b)\r
+                       {\r
+                               if(SFB8[cp]->lit[lit].lin[a]&(0x80>>b))\r
+                                       putpixel(176+b+(lit%16)*8,32+a+(lit/16)*8,color1);\r
                                else\r
+                                       putpixel(176+b+(lit%16)*8,32+a+(lit/16)*8,BLACK);\r
+                       }\r
+               }\r
+               break;\r
+       case 0:\r
+       default:\r
+               for(l=0;l<16;++l)\r
+               {\r
+                       ab[0]=abc[l];\r
+                       if(lit%16==l)\r
+                               setcolor(color2);\r
+                       else\r
+                               setcolor(RED);\r
+                       outtextxy(176+8*l,24,ab);\r
+                       if(lit/16==l)\r
+                               setcolor(color2);\r
+                       else\r
+                               setcolor(RED);\r
+                       outtextxy(168,32+8*l,ab);\r
+               }\r
+               for(l=0;l<256;++l)\r
+               {\r
+                       for(a=0;a<8;++a)\r
+                       {\r
+                               for(b=0;b<8;++b)\r
                                {\r
-\r
-                                       /*if(b>0)\r
+                                       if (l==lit)\r
                                        {\r
-                                               if((SFB8[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                                       putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BROWN);\r
+                                               if(SFB8[cp]->lit[l].lin[a]&(0x80>>b))\r
+                                                       putpixel(176+b+(l%16)*8,32+a+(l/16)*8,color1);\r
                                                else\r
                                                        putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK);\r
                                        }\r
                                        else\r
                                        {\r
-                                               if((SFB8[cp]->lit[l].lin[a]/0x80)==1)\r
+                                               if(SFB8[cp]->lit[l].lin[a]&(0x80>>b))\r
                                                        putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BROWN);\r
                                                else\r
                                                        putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK);\r
-                                       }*/\r
-                                       if(SFB8[cp]->lit[l].lin[a]&(0x80>>b))\r
-                                               putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BROWN);\r
-                                       else\r
-                                               putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK);\r
+                                       }\r
                                }\r
                        }\r
                }\r
+               break;\r
        }\r
 }\r
-void lin16()\r
+void lin16(int mode=0)\r
 {\r
        if(!any)\r
                return;\r
+       if(mode==3)\r
+       {\r
+               if(SFB16[cp]->lit[lit].lin[cury]&(0x80>>curx))\r
+                       putpixel(496+curx+(lit%16)*8,111+cury+(lit/16)*16,GREEN);\r
+               else\r
+                       putpixel(496+curx+(lit%16)*8,111+cury+(lit/16)*16,BLACK);\r
+               return;\r
+       }\r
        char ab[2]="X";\r
-       setcolor(RED);\r
-       outtextxy(496,103,"0123456789ABCDEF");\r
-       outtextxy(488,115,"0");\r
-       outtextxy(488,131,"1");\r
-       outtextxy(488,147,"2");\r
-       outtextxy(488,163,"3");\r
-       outtextxy(488,179,"4");\r
-       outtextxy(488,195,"5");\r
-       outtextxy(488,211,"6");\r
-       outtextxy(488,227,"7");\r
-       outtextxy(488,243,"8");\r
-       outtextxy(488,259,"9");\r
-       outtextxy(488,275,"A");\r
-       outtextxy(488,291,"B");\r
-       outtextxy(488,307,"C");\r
-       outtextxy(488,323,"D");\r
-       outtextxy(488,339,"E");\r
-       outtextxy(488,355,"F");\r
-       \r
+       int color1,color2;\r
        if(byo16[cp]==0)\r
        {\r
-               setcolor(RED);\r
-               setfillstyle(SOLID_FILL,BLACK);\r
-               rectangle(496,111,623,366);\r
-               floodfill(500,120,RED);\r
-               line(496,111,623,366);\r
-               line(623,111,496,366);\r
+               setfillstyle(WIDE_DOT_FILL,RED);\r
+               bar(496,111,623,366);\r
                return;\r
        }\r
-\r
-       for(int l=0;l<256;++l)\r
+       if(wys==16)\r
        {\r
-               for(int a=0;a<16;++a)\r
+               color1=GREEN;\r
+               color2=GREEN;\r
+       }\r
+       else\r
+       {\r
+               color1=BROWN;\r
+               color2=RED;\r
+       }\r
+       int a,b,l;\r
+       switch(mode)\r
+       {\r
+       case 3:\r
+       case 2:\r
+               setcolor(RED);\r
+               if(pre%16!=lit%16)\r
                {\r
-                       for(int b=0;b<8;++b)\r
+                       ab[0]=abc[pre%16];\r
+                       outtextxy(496+8*(pre%16),103,ab);\r
+               }\r
+               if(pre/16!=lit/16)\r
+               {\r
+                       ab[0]=abc[pre/16];\r
+                       outtextxy(488,115+16*(pre/16),ab);\r
+               }\r
+               for(a=0;a<16;++a)\r
+               {\r
+                       for(b=0;b<8;++b)\r
+                       {\r
+                               if(SFB16[cp]->lit[pre].lin[a]&(0x80>>b))\r
+                                       putpixel(496+b+(pre%16)*8,111+a+(pre/16)*16,BROWN);\r
+                               else\r
+                                       putpixel(496+b+(pre%16)*8,111+a+(pre/16)*16,BLACK);\r
+                       }\r
+               }\r
+       case 1:\r
+               setcolor(color2);\r
+               ab[0]=abc[lit%16];\r
+               outtextxy(496+8*(lit%16),103,ab);\r
+               ab[0]=abc[lit/16];\r
+               outtextxy(488,115+16*(lit/16),ab);\r
+               for(a=0;a<16;++a)\r
+               {\r
+                       for(b=0;b<8;++b)\r
+                       {\r
+                               if(SFB16[cp]->lit[lit].lin[a]&(0x80>>b))\r
+                                       putpixel(496+b+(lit%16)*8,111+a+(lit/16)*16,color1);\r
+                               else\r
+                                       putpixel(496+b+(lit%16)*8,111+a+(lit/16)*16,BLACK);\r
+                       }\r
+               }\r
+               break;\r
+       case 0:\r
+       default:\r
+               for(l=0;l<16;++l)\r
+               {\r
+                       ab[0]=abc[l];\r
+                       if(lit%16==l)\r
+                               setcolor(color2);\r
+                       else\r
+                               setcolor(RED);\r
+                       outtextxy(496+8*l,103,ab);\r
+                       if(lit/16==l)\r
+                               setcolor(color2);\r
+                       else\r
+                               setcolor(RED);\r
+                       outtextxy(488,115+16*l,ab);\r
+               }\r
+               for(l=0;l<256;++l)\r
+               {\r
+                       for(a=0;a<16;++a)\r
                        {\r
-                               if (l==lit&&wys==16)\r
+                               for(b=0;b<8;++b)\r
                                {\r
-                                       setcolor(GREEN);\r
-                                       ab[0]=abc[lit%16];\r
-                                       outtextxy(496+8*(lit%16),103,ab);\r
-                                       ab[0]=abc[lit/16];\r
-                                       outtextxy(488,115+16*(lit/16),ab);\r
-\r
-                                       /*if(b>0)\r
-                                       {\r
-                                               if((SFB16[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                                       putpixel(496+b+(l%16)*8,111+a+(l/16)*16,GREEN);\r
-                                               else\r
-                                                       putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK);\r
-                                       }\r
-                                       else\r
+                                       if (l==lit)\r
                                        {\r
-                                               if((SFB16[cp]->lit[l].lin[a]/0x80)==1)\r
-                                                       putpixel(496+b+(l%16)*8,111+a+(l/16)*16,GREEN);\r
-                                               else\r
-                                                       putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK);\r
-                                       }*/\r
-                                       if(SFB16[cp]->lit[l].lin[a]&(0x80>>b))\r
-                                               putpixel(496+b+(l%16)*8,111+a+(l/16)*16,GREEN);\r
+                                               if(SFB16[cp]->lit[l].lin[a]&(0x80>>b))\r
+                                                       putpixel(496+b+(l%16)*8,111+a+(l/16)*16,color1);\r
                                        else\r
                                                putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK);\r
-                               }\r
-                               else\r
-                               {\r
-\r
-                                       /*if(b>0)\r
-                                       {\r
-                                               if((SFB16[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                                       putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BROWN);\r
-                                               else\r
-                                                       putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK);\r
                                        }\r
                                        else\r
                                        {\r
-                                               if((SFB16[cp]->lit[l].lin[a]/0x80)==1)\r
+                                               if(SFB16[cp]->lit[l].lin[a]&(0x80>>b))\r
                                                        putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BROWN);\r
                                                else\r
-                                                       putpixel(496+b+(l%16)*8,111+a+(l/16)*16,EGA_BLACK);\r
-                                       }*/\r
-                                       if(SFB16[cp]->lit[l].lin[a]&(0x80>>b))\r
-                                               putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BROWN);\r
-                                       else\r
-                                               putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK);\r
+                                                       putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK);\r
+                                       }\r
                                }\r
                        }\r
                }\r
+               break;\r
        }\r
 }\r
-void lit8()\r
+void lit8(int mode=0)\r
 {\r
        if(!any)\r
                return;\r
-       setcolor(BLACK);\r
-       for(int z=0;z<128;++z)\r
-               line(16,32+z,143,32+z);\r
+       int color;\r
        setcolor(RED);\r
-       outtextxy(20,24,"0 1 2 3 4 5 6 7");\r
-       outtextxy(8,36,"0");\r
-       outtextxy(8,52,"1");\r
-       outtextxy(8,68,"2");\r
-       outtextxy(8,84,"3");\r
-       outtextxy(8,100,"4");\r
-       outtextxy(8,116,"5");\r
-       outtextxy(8,132,"6");\r
-       outtextxy(8,148,"7");\r
-       \r
        if(byo8[cp]==0)\r
        {\r
-               setcolor(RED);\r
-               setfillstyle(SOLID_FILL,BLACK);\r
-               rectangle(16,32,143,159);\r
-               floodfill(20,40,RED);\r
-               line(16,32,143,159);\r
-               line(143,32,16,159);\r
+               setfillstyle(WIDE_DOT_FILL,RED);\r
+               bar(16,32,143,159);\r
                return;\r
        }\r
-\r
-       for(int a=0;a<8;++a)\r
+       char ab[2]="q";\r
+       if(wys==8)\r
+               color=GREEN;\r
+       else\r
+               color=RED;\r
+       switch(mode)\r
        {\r
-               char ab[2]="q";\r
-               setfillstyle(SOLID_FILL,BROWN);\r
-               for(int b=0;b<8;++b)\r
+       case 2:\r
+               setcolor(RED);\r
+               if(curx!=prex)\r
                {\r
-\r
-\r
-                       if (curx==b&&cury==a&&wys==8)\r
-                       {\r
-                               setcolor(GREEN);\r
-                               ab[0]=abc[curx];\r
-                               outtextxy(20+16*curx,24,ab);\r
-                               ab[0]=abc[cury];\r
-                               outtextxy(8,36+16*cury,ab);\r
-                               rectangle(0x10+b*0x10,0x20+a*0x10,0x1f+b*0x10,0x2f+a*0x10);\r
-                               /*if(b>0)\r
-                               {\r
-                                       if((SFB8[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                               floodfill(0x11+b*0x10,0x21+a*0x10,GREEN);\r
-                               }\r
-                               else\r
-                               {\r
-                                       if((SFB8[cp]->lit[lit].lin[a]/0x80)==1)\r
-                                               floodfill(0x11+b*0x10,0x21+a*0x10,GREEN);\r
-                               }*/\r
-                               if(SFB8[cp]->lit[lit].lin[a]&(0x80>>b))\r
-                                       floodfill(0x11+b*0x10,0x21+a*0x10,GREEN);\r
+                       ab[0]=abc[prex];\r
+                       outtextxy(20+16*prex,24,ab);\r
+               }\r
+               if(prey<8)\r
+               {\r
+                       if(cury!=prey)\r
+                       {\r
+                               ab[0]=abc[prey];\r
+                               outtextxy(8,36+16*prey,ab);\r
+                       }\r
+                       if(SFB8[cp]->lit[lit].lin[prey]&(0x80>>prex))\r
+                       {\r
+                               setcolor(BROWN);\r
+                               setfillstyle(SOLID_FILL,BROWN);\r
+                       }\r
+                       else\r
+                       {\r
                                setcolor(BLACK);\r
-                               rectangle(0x11+b*0x10,0x21+a*0x10,0x1e+b*0x10,0x2e+a*0x10);\r
+                               setfillstyle(SOLID_FILL,BLACK);\r
                        }\r
+                       bar(0x10+prex*0x10,0x20+prey*0x10,0x1f+prex*0x10,0x2f+prey*0x10);\r
+               }\r
+       case 1:\r
+               setcolor(color);\r
+               ab[0]=abc[curx];\r
+               outtextxy(20+16*curx,24,ab);\r
+               ab[0]=abc[cury];\r
+               outtextxy(8,36+16*cury,ab);\r
+               if(SFB8[cp]->lit[lit].lin[cury]&(0x80>>curx))\r
+               {\r
+                       setcolor(BROWN);\r
+                       setfillstyle(SOLID_FILL,BROWN);\r
+               }\r
+               else\r
+               {\r
+                       setcolor(BLACK);\r
+                       setfillstyle(SOLID_FILL,BLACK);\r
+               }\r
+               bar(0x10+curx*0x10,0x20+cury*0x10,0x1f+curx*0x10,0x2f+cury*0x10);\r
+               if(wys==8)\r
+               {\r
+                       setcolor(GREEN);\r
+                       rectangle(0x10 + curx*0x10, 0x20 + cury*0x10 ,0x1f + curx*0x10, 0x2f + cury*0x10);\r
+                       setcolor(BLACK);\r
+                       rectangle(0x11 + curx*0x10, 0x21 + cury*0x10, 0x1e + curx*0x10, 0x2e + cury*0x10);\r
+               }\r
+               break;\r
+       case 0:\r
+       default:\r
+               for(int l=0;l<8;++l)\r
+               {\r
+                       if(l==curx)\r
+                               setcolor(color);\r
+                       else\r
+                               setcolor(RED);\r
+                       ab[0]=abc[l];\r
+                       \r
+                       outtextxy(20+16*l,24,ab);\r
+                       if(l==cury)\r
+                               setcolor(color);\r
                        else\r
+                               setcolor(RED);\r
+                       ab[0]=abc[l];\r
+                       outtextxy(8,36+16*l,ab);\r
+               }\r
+               for(int a=0;a<8;++a)\r
+               {\r
+                       for(int b=0;b<8;++b)\r
                        {\r
-\r
-                               setcolor(BROWN);\r
-                               /*if(b>0)\r
+                               if(SFB8[cp]->lit[lit].lin[a]&(0x80>>b))\r
                                {\r
-                                       if((SFB8[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                       {\r
-                                               rectangle(0x10+b*0x10,0x20+a*0x10,0x1f+b*0x10,0x2f+a*0x10);\r
-                                               floodfill(0x11+b*0x10,0x21+a*0x10,BROWN);\r
-                                       }\r
+                                       setcolor(BROWN);\r
+                                       setfillstyle(SOLID_FILL,BROWN);\r
                                }\r
                                else\r
                                {\r
-                                       if((SFB8[cp]->lit[lit].lin[a]/0x80)==1)\r
-                                       {\r
-                                               rectangle(0x10+b*0x10,0x20+a*0x10,0x1f+b*0x10,0x2f+a*0x10);\r
-                                               floodfill(0x11+b*0x10,0x21+a*0x10,BROWN);\r
-                                       }\r
-                               }*/\r
-                               if(SFB8[cp]->lit[lit].lin[a]&(0x80>>b))\r
-                               {\r
-                                       rectangle(0x10+b*0x10,0x20+a*0x10,0x1f+b*0x10,0x2f+a*0x10);\r
-                                       floodfill(0x11+b*0x10,0x21+a*0x10,BROWN);\r
+                                       setcolor(BLACK);\r
+                                       setfillstyle(SOLID_FILL,BLACK);\r
                                }\r
+                               bar(0x10+b*0x10,0x20+a*0x10,0x1f+b*0x10,0x2f+a*0x10);\r
                        }\r
                }\r
+               if(wys==8)\r
+               {\r
+                       setcolor(GREEN);\r
+                       rectangle(0x10 + curx*0x10, 0x20 + cury*0x10 ,0x1f + curx*0x10, 0x2f + cury*0x10);\r
+                       setcolor(BLACK);\r
+                       rectangle(0x11 + curx*0x10, 0x21 + cury*0x10, 0x1e + curx*0x10, 0x2e + cury*0x10);\r
+               }\r
+               break;\r
        }\r
 }\r
-void lit14()\r
+void lit14(int mode=0)\r
 {\r
        if(!any)\r
                return;\r
-       setcolor(BLACK);\r
-       for(int z=0;z<224;++z)\r
-               line(16,223+z,143,223+z);\r
+       int color;\r
        setcolor(RED);\r
-       outtextxy(20,215,"0 1 2 3 4 5 6 7");\r
-       outtextxy(8,227,"0");\r
-       outtextxy(8,243,"1");\r
-       outtextxy(8,259,"2");\r
-       outtextxy(8,275,"3");\r
-       outtextxy(8,291,"4");\r
-       outtextxy(8,307,"5");\r
-       outtextxy(8,323,"6");\r
-       outtextxy(8,339,"7");\r
-       outtextxy(8,355,"8");\r
-       outtextxy(8,371,"9");\r
-       outtextxy(8,387,"A");\r
-       outtextxy(8,403,"B");\r
-       outtextxy(8,419,"C");\r
-       outtextxy(8,435,"D");\r
-\r
        if(byo14[cp]==0)\r
        {\r
-               setcolor(RED);\r
-               setfillstyle(SOLID_FILL,BLACK);\r
-               rectangle(16,223,143,446);\r
-               floodfill(20,230,RED);\r
-               line(16,223,143,446);\r
-               line(143,223,16,446);\r
+               setfillstyle(WIDE_DOT_FILL,RED);\r
+               bar(16,223,143,446);\r
                return;\r
        }\r
-       \r
-       for(int a=0;a<14;++a)\r
+       char ab[2]="q";\r
+       if(wys==14)\r
+               color=GREEN;\r
+       else\r
+               color=RED;\r
+       switch(mode)\r
        {\r
-               char ab[2]="q";\r
-               setfillstyle(SOLID_FILL,BROWN);\r
-               for(int b=0;b<8;++b)\r
+       case 2:\r
+               setcolor(RED);\r
+               if(curx!=prex)\r
                {\r
-\r
-\r
-                       if (curx==b&&cury==a&&wys==14)\r
-                       {\r
-                               setcolor(GREEN);\r
-                               ab[0]=abc[curx];\r
-                               outtextxy(20+16*curx,215,ab);\r
-                               ab[0]=abc[cury];\r
-                               outtextxy(8,227+16*cury,ab);\r
-                               rectangle(16+b*16,223+a*16,31+b*16,238+a*16);\r
-                               /*if(b>0)\r
-                               {\r
-                                       if((SFB14[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                               floodfill(17+b*16,224+a*16,GREEN);\r
-                               }\r
-                               else\r
-                               {\r
-                                       if((SFB14[cp]->lit[lit].lin[a]/0x80)==1)\r
-                                               floodfill(17+b*16,224+a*16,GREEN);\r
-                               }*/\r
-                               if(SFB14[cp]->lit[lit].lin[a]&(0x80>>b))\r
-                                       floodfill(17+b*16,224+a*16,GREEN);\r
-                               setcolor(BLACK);\r
-                               rectangle(17+b*16,224+a*16,30+b*16,237+a*16);\r
+                       ab[0]=abc[prex];\r
+                       outtextxy(20+16*prex,215,ab);\r
+               }\r
+               if(prey<14)\r
+               {\r
+                       if(cury!=prey)\r
+                       {\r
+                               ab[0]=abc[prey];\r
+                               outtextxy(8,227+16*prey,ab);\r
                        }\r
-                       else\r
+                       if(SFB14[cp]->lit[lit].lin[prey]&(0x80>>prex))\r
                        {\r
-\r
                                setcolor(BROWN);\r
-                               /*if(b>0)\r
-                               {\r
-                                       if((SFB14[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                       {\r
-                                               rectangle(16+b*16,223+a*16,31+b*16,238+a*16);\r
-                                               floodfill(17+b*16,224+a*16,BROWN);\r
-                                       }\r
+                               setfillstyle(SOLID_FILL,BROWN);\r
+                       }\r
+                       else\r
+                       {\r
+                               setcolor(BLACK);\r
+                               setfillstyle(SOLID_FILL,BLACK);\r
+                       }\r
+                       bar(16+prex*16,223+prey*16,31+prex*16,238+prey*16);\r
+               }\r
+       case 1:\r
+               setcolor(color);\r
+               ab[0]=abc[curx];\r
+               outtextxy(20+16*curx,215,ab);\r
+               ab[0]=abc[cury];\r
+               outtextxy(8,227+16*cury,ab);\r
+               if(SFB14[cp]->lit[lit].lin[cury]&(0x80>>curx))\r
+               {\r
+                       setcolor(BROWN);\r
+                       setfillstyle(SOLID_FILL,BROWN);\r
+               }\r
+               else\r
+               {\r
+                       setcolor(BLACK);\r
+                       setfillstyle(SOLID_FILL,BLACK);\r
+               }\r
+               bar(16+curx*16,223+cury*16,31+curx*16,238+cury*16);\r
+               if(wys==14)\r
+               {\r
+                       setcolor(GREEN);\r
+                       rectangle(16+curx*16,223+cury*16,31+curx*16,238+cury*16);\r
+                       setcolor(BLACK);\r
+                       rectangle(17+curx*16,224+cury*16,30+curx*16,237+cury*16);\r
+               }\r
+               break;\r
+       case 0:\r
+       default:\r
+               for(int l=0;l<14;++l)\r
+               {\r
+                       if(l==curx)\r
+                               setcolor(color);\r
+                       else\r
+                               setcolor(RED);\r
+                       ab[0]=abc[l];\r
+                       if(l<8)\r
+                               outtextxy(20+16*l,215,ab);\r
+                       if(l==cury)\r
+                               setcolor(color);\r
+                       else\r
+                               setcolor(RED);\r
+                       ab[0]=abc[l];\r
+                       outtextxy(8,227+16*l,ab);\r
+               }\r
+               for(int a=0;a<14;++a)\r
+               {\r
+                       for(int b=0;b<8;++b)\r
+                       {\r
+                               if(SFB14[cp]->lit[lit].lin[a]&(0x80>>b))\r
+                               {\r
+                                       setcolor(BROWN);\r
+                                       setfillstyle(SOLID_FILL,BROWN);\r
                                }\r
                                else\r
                                {\r
-                                       if((SFB14[cp]->lit[lit].lin[a]/0x80)==1)\r
-                                       {\r
-                                               rectangle(16+b*16,223+a*16,31+b*16,238+a*16);\r
-                                               floodfill(17+b*16,224+a*16,BROWN);\r
-                                       }\r
-                               }*/\r
-                               if(SFB14[cp]->lit[lit].lin[a]&(0x80>>b))\r
-                               {\r
-                                       rectangle(16+b*16,223+a*16,31+b*16,238+a*16);\r
-                                       floodfill(17+b*16,224+a*16,BROWN);\r
+                                       setcolor(BLACK);\r
+                                       setfillstyle(SOLID_FILL,BLACK);\r
                                }\r
+                               bar(16+b*16,223+a*16,31+b*16,238+a*16);\r
                        }\r
                }\r
+               if(wys==14)\r
+               {\r
+                       setcolor(GREEN);\r
+                       rectangle(16+curx*16,223+cury*16,31+curx*16,238+cury*16);\r
+                       setcolor(BLACK);\r
+                       rectangle(17+curx*16,224+cury*16,30+curx*16,237+cury*16);\r
+               }\r
+               break;\r
        }\r
 }\r
-void lit16()\r
+void lit16(int mode=0)\r
 {\r
        if(!any)\r
                return;\r
-       setcolor(BLACK);\r
-       for(int z=0;z<256;++z)\r
-               line(336,111+z,463,111+z);\r
+       int color;\r
        setcolor(RED);\r
-       outtextxy(340,103,"0 1 2 3 4 5 6 7");\r
-       outtextxy(328,115,"0");\r
-       outtextxy(328,131,"1");\r
-       outtextxy(328,147,"2");\r
-       outtextxy(328,163,"3");\r
-       outtextxy(328,179,"4");\r
-       outtextxy(328,195,"5");\r
-       outtextxy(328,211,"6");\r
-       outtextxy(328,227,"7");\r
-       outtextxy(328,243,"8");\r
-       outtextxy(328,259,"9");\r
-       outtextxy(328,275,"A");\r
-       outtextxy(328,291,"B");\r
-       outtextxy(328,307,"C");\r
-       outtextxy(328,323,"D");\r
-       outtextxy(328,339,"E");\r
-       outtextxy(328,355,"F");\r
-\r
        if(byo16[cp]==0)\r
        {\r
-               setcolor(RED);\r
-               setfillstyle(SOLID_FILL,BLACK);\r
-               rectangle(336,111,463,366);\r
-               floodfill(340,120,RED);\r
-               line(336,111,463,366);\r
-               line(463,111,336,366);\r
+               setfillstyle(WIDE_DOT_FILL,RED);\r
+               bar(336,111,463,366);\r
                return;\r
        }\r
-       \r
-       for(int a=0;a<16;++a)\r
+       char ab[2]="q";\r
+       if(wys==16)\r
+               color=GREEN;\r
+       else\r
+               color=RED;\r
+       switch(mode)\r
        {\r
-               char ab[2]="q";\r
-               setfillstyle(SOLID_FILL,BROWN);\r
-               for(int b=0;b<8;++b)\r
+       case 2:\r
+               setcolor(RED);\r
+               if(curx!=prex)\r
                {\r
-\r
-\r
-                       if (curx==b&&cury==a&&wys==16)\r
-                       {\r
-                               setcolor(GREEN);\r
-                               ab[0]=abc[curx];\r
-                               outtextxy(340+16*curx,103,ab);\r
-                               ab[0]=abc[cury];\r
-                               outtextxy(328,115+16*cury,ab);\r
-                               rectangle(336+b*16,111+a*16,351+b*16,126+a*16);\r
-                               /*if(b>0)\r
-                               {\r
-                                       if((SFB16[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                               floodfill(337+b*16,112+a*16,GREEN);\r
-                               }\r
-                               else\r
-                               {\r
-                                       if((SFB16[cp]->lit[lit].lin[a]/0x80)==1)\r
-                                               floodfill(337+b*16,112+a*16,GREEN);\r
-                               }*/\r
-                               if(SFB16[cp]->lit[lit].lin[a]&(0x80>>b))\r
-                                       floodfill(337+b*16,112+a*16,GREEN);\r
-                               setcolor(BLACK);\r
-                               rectangle(337+b*16,112+a*16,350+b*16,125+a*16);\r
-                       }\r
+                       ab[0]=abc[prex];\r
+                       outtextxy(340+16*prex,103,ab);\r
+               }\r
+               if(cury!=prey)\r
+               {\r
+                       ab[0]=abc[prey];\r
+                       outtextxy(328,115+16*prey,ab);\r
+               }\r
+               if(SFB16[cp]->lit[lit].lin[prey]&(0x80>>prex))\r
+               {\r
+                       setcolor(BROWN);\r
+                       setfillstyle(SOLID_FILL,BROWN);\r
+               }\r
+               else\r
+               {\r
+                       setcolor(BLACK);\r
+                       setfillstyle(SOLID_FILL,BLACK);\r
+               }\r
+               bar(336+prex*16,111+prey*16,351+prex*16,126+prey*16);\r
+       case 1:\r
+               setcolor(color);\r
+               ab[0]=abc[curx];\r
+               outtextxy(340+16*curx,103,ab);\r
+               ab[0]=abc[cury];\r
+               outtextxy(328,115+16*cury,ab);\r
+               if(SFB16[cp]->lit[lit].lin[cury]&(0x80>>curx))\r
+               {\r
+                       setcolor(BROWN);\r
+                       setfillstyle(SOLID_FILL,BROWN);\r
+               }\r
+               else\r
+               {\r
+                       setcolor(BLACK);\r
+                       setfillstyle(SOLID_FILL,BLACK);\r
+               }\r
+               bar(336+curx*16,111+cury*16,351+curx*16,126+cury*16);\r
+               if(wys==16)\r
+               {\r
+                       setcolor(GREEN);\r
+                       rectangle(336+curx*16,111+cury*16,351+curx*16,126+cury*16);\r
+                       setcolor(BLACK);\r
+                       rectangle(337+curx*16,112+cury*16,350+curx*16,125+cury*16);\r
+               }\r
+               break;\r
+       case 0:\r
+       default:\r
+               for(int l=0;l<16;++l)\r
+               {\r
+                       if(l==curx)\r
+                               setcolor(color);\r
                        else\r
+                               setcolor(RED);\r
+                       ab[0]=abc[l];\r
+                       if(l<8)\r
+                               outtextxy(340+16*l,103,ab);\r
+                       if(l==cury)\r
+                               setcolor(color);\r
+                       else\r
+                               setcolor(RED);\r
+                       ab[0]=abc[l];\r
+                       outtextxy(328,115+16*l,ab);\r
+               }\r
+               for(int a=0;a<16;++a)\r
+               {\r
+                       for(int b=0;b<8;++b)\r
                        {\r
-\r
-                               setcolor(BROWN);\r
-                               /*if(b>0)\r
+                               if(SFB16[cp]->lit[lit].lin[a]&(0x80>>b))\r
                                {\r
-                                       if((SFB16[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\r
-                                       {\r
-                                               rectangle(336+b*16,111+a*16,351+b*16,126+a*16);\r
-                                               floodfill(337+b*16,112+a*16,BROWN);\r
-                                       }\r
+                                       setcolor(BROWN);\r
+                                       setfillstyle(SOLID_FILL,BROWN);\r
                                }\r
                                else\r
                                {\r
-                                       if((SFB16[cp]->lit[lit].lin[a]/0x80)==1)\r
-                                       {\r
-                                               rectangle(336+b*16,111+a*16,351+b*16,126+a*16);\r
-                                               floodfill(337+b*16,112+a*16,BROWN);\r
-\r
-                                       }\r
-                               }*/\r
-                               if(SFB16[cp]->lit[lit].lin[a]&(0x80>>b))\r
-                               {\r
-                                       rectangle(336+b*16,111+a*16,351+b*16,126+a*16);\r
-                                       floodfill(337+b*16,112+a*16,BROWN);\r
+                                       setcolor(BLACK);\r
+                                       setfillstyle(SOLID_FILL,BLACK);\r
                                }\r
+                               bar(336+b*16,111+a*16,351+b*16,126+a*16);\r
                        }\r
                }\r
+               if(wys==16)\r
+               {\r
+                       setcolor(GREEN);\r
+                       rectangle(336+curx*16,111+cury*16,351+curx*16,126+cury*16);\r
+                       setcolor(BLACK);\r
+                       rectangle(337+curx*16,112+cury*16,350+curx*16,125+cury*16);\r
+               }\r
        }\r
 }\r
 \r
-\r
-void spc8()\r
+inline void spc8()\r
 {\r
-       //if(SFB8[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1)\r
-       //      SFB8[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx));\r
-       //else\r
-       //      SFB8[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx));\r
        SFB8[cp]->lit[lit].lin[cury]^=0x80>>curx;\r
 }\r
-void bsp8()\r
+inline void bsp8()\r
 {\r
-       //if(SFB8[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1)\r
-       //      SFB8[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx));\r
        SFB8[cp]->lit[lit].lin[cury]&=~(0x80>>curx);\r
 }\r
-void ent8()\r
+inline void ent8()\r
 {\r
-       //if(SFB8[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))!=1)\r
-       //      SFB8[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx));\r
        SFB8[cp]->lit[lit].lin[cury]|=0x80>>curx;\r
 }\r
-void spc14()\r
+inline void spc14()\r
 {\r
-       //if(SFB14[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1)\r
-       //      SFB14[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx));\r
-       //else\r
-       //      SFB14[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx));\r
        SFB14[cp]->lit[lit].lin[cury]^=0x80>>curx;\r
 }\r
-void bsp14()\r
+inline void bsp14()\r
 {\r
-       //if(SFB14[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1)\r
-       //      SFB14[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx));\r
        SFB14[cp]->lit[lit].lin[cury]&=~(0x80>>curx);\r
 }\r
-void ent14()\r
+inline void ent14()\r
 {\r
-       //if(SFB14[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))!=1)\r
-       //      SFB14[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx));\r
        SFB14[cp]->lit[lit].lin[cury]|=0x80>>curx;\r
 }\r
-void spc16()\r
+inline void spc16()\r
 {\r
-       //if(SFB16[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1)\r
-       //      SFB16[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx));\r
-       //else\r
-       //      SFB16[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx));\r
        SFB16[cp]->lit[lit].lin[cury]^=0x80>>curx;\r
 }\r
-void bsp16()\r
+inline void bsp16()\r
 {\r
-       //if(SFB16[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1)\r
-       //      SFB16[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx));\r
        SFB16[cp]->lit[lit].lin[cury]&=~(0x80>>curx);\r
 }\r
-void ent16()\r
+inline void ent16()\r
 {\r
-       //if(SFB16[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))!=1)\r
-       //      SFB16[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx));\r
        SFB16[cp]->lit[lit].lin[cury]|=0x80>>curx;\r
 }\r
 \r
@@ -1013,14 +1104,6 @@ int otw2()
                return 116;\r
        }\r
        fread(FFH,0x19,1,CPI);\r
-//     printf("FFH:\n");\r
-//     printf("id0=%2x\n",FFH.id0);\r
-//     printf("id=\"%c%c%c%c%c%c%c\"\n",FFH.id[0],FFH.id[1],FFH.id[2],FFH.id[3],FFH.id[4],FFH.id[5],FFH.id[6]);\r
-//     printf("reserved=%2x%2x%2x%2x%2x%2x%2x%2x\n",FFH.reserved[0],FFH.reserved[1],FFH.reserved[2],FFH.reserved[3],FFH.reserved[4],FFH.reserved[5],FFH.reserved[6],FFH.reserved[7]);\r
-//     printf("pnum=%d\n",FFH.pnum);\r
-//     printf("ptyp=%2x\n",FFH.ptyp);\r
-//     printf("fih_offset=%p\n\n",FFH.fih_offset);\r
-\r
        if(FFH->id0!=0xff)\r
        {\r
                sprintf(err,"101:Unsupported format, id0=0x%02x",(short)(FFH->id0&0xff));\r
@@ -1028,7 +1111,6 @@ int otw2()
                deleteCPI(0);\r
                return 101;\r
        }\r
-       //if(FFH->id[0]!='F' || FFH->id[1]!='O' != FFH->id[2] != 'N'||FFH->id[3]!='T' || FFH->id[4]!=' '||FFH->id[5]!=' '||FFH->id[6]!=' ')\r
        if(!strcmp("FONT   ",FFH->id))\r
                NT=0;\r
        else if(!strcmp("FONT.NT",FFH->id))\r
@@ -1069,11 +1151,8 @@ int otw2()
        }\r
        fseek(CPI,FFH->fih_offset,0);\r
        fread(FIH,0x2,1,CPI);\r
-//     printf("FFI:\n\n");\r
-//     printf("num_codepages=%d\n\n",FIH.num_codepages);\r
        if(FIH->num_codepages>16)\r
        {\r
-               //FIH.num_codepages=6;\r
                sprintf(err,"105:Too many codepages (%u)",FIH->num_codepages);\r
                fclose(CPI);\r
                deleteCPI(1);\r
@@ -1100,14 +1179,6 @@ int otw2()
                        return 116;\r
                }\r
                fread(CPEH[a],0x1c,1,CPI);\r
-//             printf("CPEH[%d]:\n",a);\r
-//             printf("cpeh_size=%x\n",CPEH[a].cpeh_size);\r
-//             printf("next_cpeh_offset=%p\n",CPEH[a].next_cpeh_offset);\r
-//             printf("device_type=%d\n",CPEH[a].device_type);\r
-//             printf("device name=\"%c%c%c%c%c%c%c%c\"\n",CPEH[a].device_name[0],CPEH[a].device_name[1],CPEH[a].device_name[2],CPEH[a].device_name[3],CPEH[a].device_name[4],CPEH[a].device_name[5],CPEH[a].device_name[6],CPEH[a].device_name[7]);\r
-//             printf("codepage=%d\n",CPEH[a].codepage);\r
-//             printf("reserved=%2x%2x%2x%2x%2x%2x\n",CPEH[a].reserved[0],CPEH[a].reserved[1],CPEH[a].reserved[2],CPEH[a].reserved[3],CPEH[a].reserved[4],CPEH[a].reserved[5]);\r
-//             printf("cpih_offset=%p\n\n",CPEH[a].cpih_offset);\r
                if(NT)\r
                {\r
                        CPEH[a]->next_cpeh_offset+=ftell(CPI)-sizeof(CodePageEntryHeader);\r
@@ -1147,11 +1218,6 @@ int otw2()
                        return 116;\r
                }\r
                fread(CPIH[a],0x6,1,CPI);\r
-//             printf("CPIH[%d]:\n",a);\r
-//             printf("version=%d\n",CPIH[a].version);\r
-//             printf("num_fonts=%d\n",CPIH[a].num_fonts);\r
-//             printf("size=%x\n\n",CPIH[a].size);\r
-\r
                if(CPIH[a]->version!=1)\r
                {\r
                        sprintf(err,"108:Wrong version of CPIH[%u] (%u)",a,CPIH[a]->version);\r
@@ -1187,13 +1253,6 @@ int otw2()
                                return 116;\r
                        }\r
                        fread(SFH[a][b],0x6,1,CPI);\r
-//                     printf("SFH[%d][%d]:\n",a,b);\r
-//                     printf("height=%d\n",SFH[a][b].height);\r
-//                     printf("width=%d\n",SFH[a][b].width);\r
-//                     printf("yaspect=%2x\n",SFH[a][b].yaspect);\r
-//                     printf("xaspect=%2x\n",SFH[a][b].xaspect);\r
-//                     printf("num_chars=%d\n\n",SFH[a][b].num_chars);\r
-                       //fseek(CPI,SFH[a][b].num_chars*SFH[a][b].height*((SFH[a][b].width+7)/8),1);\r
                        if(SFH[a][b]->height==8)\r
                        {\r
                                if (byo8[a]!=0)\r
@@ -1261,8 +1320,6 @@ int otw2()
                                        deleteCPI(4,a,b);\r
                                        return 116;\r
                                }\r
-                               //for(c=0;c<256;++c)\r
-                               //      fread(&SFB16[a].lit[c],0x10,1,CPI);\r
                                fread(SFB16[a],0x10,256,CPI);\r
                        }\r
                        if(SFH[a][b]->height==14)\r
@@ -1275,8 +1332,6 @@ int otw2()
                                        deleteCPI(4,a,b);\r
                                        return 116;\r
                                }\r
-                               //for(c=0;c<256;++c)\r
-                               //      fread(&SFB14[a].lit[c],0x0e,1,CPI);\r
                                fread(SFB14[a],0x0e,256,CPI);\r
                        }\r
                        if(SFH[a][b]->height==8)\r
@@ -1289,38 +1344,10 @@ int otw2()
                                        deleteCPI(4,a,b);\r
                                        return 116;\r
                                }\r
-                               //for(c=0;c<256;++c)\r
-                               //      fread(&SFB8[a].lit[c],0x08,1,CPI);\r
                                fread(SFB8[a],0x08,256,CPI);\r
                        }\r
-                       //fseek(CPI,SFH[a][b]->num_chars*SFH[a][b]->height*((SFH[a][b]->width+7)/8),1);\r
                }\r
-               /*for(b=0;b<CPIH[a].num_fonts;++b)\r
-               {\r
-                       fseek(CPI,CPEH[a].cpih_offset+0xc,0);\r
-                       if(b>0)\r
-                               fseek(CPI,SFH[a][0].height*256+0x6,1);\r
-                       if(b>1)\r
-                               fseek(CPI,SFH[a][1].height*256+0x6,1);\r
-\r
-                       if(SFH[a][b].height==16)\r
-                       {\r
-                               for(c=0;c<256;++c)\r
-                                       fread(&SFB16[a].lit[c],0x10,1,CPI);\r
-                       }\r
-                       if(SFH[a][b].height==14)\r
-                       {\r
-                               for(c=0;c<256;++c)\r
-                                       fread(&SFB14[a].lit[c],0x0e,1,CPI);\r
-                       }\r
-                       if(SFH[a][b].height==8)\r
-                       {\r
-                               for(c=0;c<256;++c)\r
-                                       fread(&SFB8[a].lit[c],0x08,1,CPI);\r
-                       }\r
-               }*/\r
        }\r
-\r
        fclose(CPI);\r
        offset();\r
        return 0;\r
@@ -1342,203 +1369,33 @@ int zap2()
        else\r
                sprintf(err,"OK");\r
        fwrite(FFH,0x19,1,CPI);\r
-//     printf("FFH:\n");\r
-//     printf("id0=%2x\n",FFH.id0);\r
-//     printf("id=\"%c%c%c%c%c%c%c\"\n",FFH.id[0],FFH.id[1],FFH.id[2],FFH.id[3],FFH.id[4],FFH.id[5],FFH.id[6]);\r
-//     printf("reserved=%2x%2x%2x%2x%2x%2x%2x%2x\n",FFH.reserved[0],FFH.reserved[1],FFH.reserved[2],FFH.reserved[3],FFH.reserved[4],FFH.reserved[5],FFH.reserved[6],FFH.reserved[7]);\r
-//     printf("pnum=%d\n",FFH.pnum);\r
-//     printf("ptyp=%2x\n",FFH.ptyp);\r
-//     printf("fih_offset=%p\n\n",FFH.fih_offset);\r
-\r
-       /*if(FFH.id0!=0xff)\r
-       {\r
-               sprintf(err,"101: FFH.id0!=0xff");\r
-               fclose(CPI);\r
-               return 101;\r
-       }\r
-       if(FFH.id[0]!='F'||FFH.id[1]!='O'||FFH.id[2]!='N'||FFH.id[3]!='T'||FFH.id[4]!=' '||FFH.id[5]!=' '||FFH.id[6]!=' ')\r
-       {\r
-               sprintf(err,"102: FFH.id!=\"FONT   \"");\r
-               fclose(CPI);\r
-               return 102;\r
-       }\r
-       if(FFH.pnum!=1)\r
-       {\r
-               sprintf(err,"103: FFH.pnum!=1\n");\r
-               fclose(CPI);\r
-               return 103;\r
-       }\r
-       if(FFH.ptyp!=1)\r
-       {\r
-               sprintf(err,"104: FFH.ptyp!=1\n");\r
-               fclose(CPI);\r
-               return 104;\r
-       }*/\r
        fseek(CPI,FFH->fih_offset,0);\r
        fwrite(FIH,0x2,1,CPI);\r
-//     printf("FFI:\n\n");\r
-//     printf("num_codepages=%d\n\n",FIH.num_codepages);\r
-       /*if(FIH.num_codepages>6)\r
-       {\r
-               //FIH.num_codepages=6;\r
-               sprintf(err,"105: FIH.num_codepages>6\n");\r
-               fclose(CPI);\r
-               return 105;\r
-       }*/\r
-\r
        for(a=0; a<FIH->num_codepages;++a)\r
        {\r
                if (a!=0)\r
                        fseek(CPI,CPEH[a-1]->next_cpeh_offset,0);\r
                fwrite(CPEH[a],0x1c,1,CPI);\r
-//             printf("CPEH[%d]:\n",a);\r
-//             printf("cpeh_size=%x\n",CPEH[a].cpeh_size);\r
-//             printf("next_cpeh_offset=%p\n",CPEH[a].next_cpeh_offset);\r
-//             printf("device_type=%d\n",CPEH[a].device_type);\r
-//             printf("device name=\"%c%c%c%c%c%c%c%c\"\n",CPEH[a].device_name[0],CPEH[a].device_name[1],CPEH[a].device_name[2],CPEH[a].device_name[3],CPEH[a].device_name[4],CPEH[a].device_name[5],CPEH[a].device_name[6],CPEH[a].device_name[7]);\r
-//             printf("codepage=%d\n",CPEH[a].codepage);\r
-//             printf("reserved=%2x%2x%2x%2x%2x%2x\n",CPEH[a].reserved[0],CPEH[a].reserved[1],CPEH[a].reserved[2],CPEH[a].reserved[3],CPEH[a].reserved[4],CPEH[a].reserved[5]);\r
-//             printf("cpih_offset=%p\n\n",CPEH[a].cpih_offset);\r
-\r
-               /*if(CPEH[a].cpeh_size!=0x1c)\r
-               {\r
-                       sprintf(err,"106: CPEH.cpeh_size!=0x1c\n");\r
-                       fclose(CPI);\r
-                       return 106;\r
-               }\r
-               if(CPEH[a].device_type!=1)\r
-               {\r
-                       sprintf(err,"107: CPEH.device_type!=1\n");\r
-                       fclose(CPI);\r
-                       return 107;\r
-               }*/\r
 \r
                fseek(CPI,CPEH[a]->cpih_offset,0);\r
                fwrite(CPIH[a],0x6,1,CPI);\r
-//             printf("CPIH[%d]:\n",a);\r
-//             printf("version=%d\n",CPIH[a].version);\r
-//             printf("num_fonts=%d\n",CPIH[a].num_fonts);\r
-//             printf("size=%x\n\n",CPIH[a].size);\r
-\r
-               /*if(CPIH[a].version!=1)\r
-               {\r
-                       sprintf(err,"108: CPIH.version!=1\n");\r
-                       fclose(CPI);\r
-                       return 108;\r
-               }\r
-               if(CPIH[a].num_fonts>3)\r
-               {\r
-                       sprintf(err,"109: CPIH.numfonts>3\n");\r
-                       fclose(CPI);\r
-                       return 109;\r
-               }*/\r
                for(b=0;b<CPIH[a]->num_fonts;++b)\r
                {\r
                        fwrite(SFH[a][b],0x6,1,CPI);\r
-//                     printf("SFH[%d][%d]:\n",a,b);\r
-//                     printf("height=%d\n",SFH[a][b].height);\r
-//                     printf("width=%d\n",SFH[a][b].width);\r
-//                     printf("yaspect=%2x\n",SFH[a][b].yaspect);\r
-//                     printf("xaspect=%2x\n",SFH[a][b].xaspect);\r
-//                     printf("num_chars=%d\n\n",SFH[a][b].num_chars);\r
-                       //fseek(CPI,SFH[a][b]->num_chars*SFH[a][b]->height*((SFH[a][b]->width+7)/8),1);\r
-                       /*if(SFH[a][b].height==8)\r
-                       {\r
-                               if (byo8[a]!=0)\r
-                               {\r
-                                       sprintf(err,"113: SFH.height==8 ju¾ by\88o");\r
-                                       fclose(CPI);\r
-                                       return 113;\r
-                               }\r
-                               byo8[a]=1;\r
-                       }\r
-                       if(SFH[a][b].height==14)\r
-                       {\r
-                               if (byo14[a]!=0)\r
-                               {\r
-                                       sprintf(err,"114: SFH.height==14 ju¾ by\88o");\r
-                                       fclose(CPI);\r
-                                       return 114;\r
-                               }\r
-                               byo14[a]=1;\r
-                       }\r
-                       if(SFH[a][b].height==16)\r
-                       {\r
-                               if (byo16[a]!=0)\r
-                               {\r
-                                       sprintf(err,"115: SFH.height==16 ju¾ by\88o");\r
-                                       fclose(CPI);\r
-                                       return 115;\r
-                               }\r
-                               byo16[a]=1;\r
-                       }\r
-\r
-\r
-                       if(SFH[a][b].height!=8&&SFH[a][b].height!=14&&SFH[a][b].height!=16)\r
-                       {\r
-                               sprintf(err,"110: SFH.height!=(8 || 14 || 16)\n");\r
-                               fclose(CPI);\r
-                               return 110;\r
-                       }\r
-                       if(SFH[a][b].width!=8)\r
-                       {\r
-                               sprintf(err,"111: SFH.width!=8\n");\r
-                               fclose(CPI);\r
-                               return 111;\r
-                       }\r
-                       if(SFH[a][b].num_chars!=256)\r
-                       {\r
-                               sprintf(err,"112: SFH.num_chars!=256\n");\r
-                               fclose(CPI);\r
-                               return 112;\r
-                       }*/\r
                        if(SFH[a][b]->height==16)\r
-                       {\r
-                               //for(c=0;c<256;++c)\r
-                               //      fread(&SFB16[a].lit[c],0x10,1,CPI);\r
                                fwrite(SFB16[a],0x10,256,CPI);\r
-                       }\r
                        if(SFH[a][b]->height==14)\r
                        {\r
-                               //for(c=0;c<256;++c)\r
-                               //      fread(&SFB14[a].lit[c],0x0e,1,CPI);\r
                                fwrite(SFB14[a],0x0e,256,CPI);\r
                        }\r
                        if(SFH[a][b]->height==8)\r
                        {\r
-                               //for(c=0;c<256;++c)\r
-                               //      fread(&SFB8[a].lit[c],0x08,1,CPI);\r
                                fwrite(SFB8[a],0x08,256,CPI);\r
                        }\r
-                       //fseek(CPI,SFH[a][b]->num_chars*SFH[a][b]->height*((SFH[a][b]->width+7)/8),1);\r
                }\r
-               /*for(b=0;b<CPIH[a]->num_fonts;++b)\r
-               {\r
-                       fseek(CPI,CPEH[a].cpih_offset+0xc,0);\r
-                       if(b>0)\r
-                               fseek(CPI,SFH[a][0].height*256+0x6,1);\r
-                       if(b>1)\r
-                               fseek(CPI,SFH[a][1].height*256+0x6,1);\r
-\r
-                       if(SFH[a][b].height==16)\r
-                       {\r
-                               for(c=0;c<256;++c)\r
-                                       fwrite(&SFB16[a].lit[c],0x10,1,CPI);\r
-                       }\r
-                       if(SFH[a][b].height==14)\r
-                       {\r
-                               for(c=0;c<256;++c)\r
-                                       fwrite(&SFB14[a].lit[c],0x0e,1,CPI);\r
-                       }\r
-                       if(SFH[a][b].height==8)\r
-                       {\r
-                               for(c=0;c<256;++c)\r
-                                       fwrite(&SFB8[a].lit[c],0x08,1,CPI);\r
-                       }\r
-               }*/\r
        }\r
 \r
-       fprintf(CPI,"\nTen plik zosta\88 wygenerowany za pomoc¥ Edytora napis¢w, wersja 1.1\n autor programu:  Balthasar Szczepaäski%c",0x1a);\r
+       fprintf(CPI,"\r\nTen plik zosta\88 wygenerowany za pomoc¥ Edytora napis¢w, wersja 1.1b\r\n autor programu:  Balthasar Szczepaäski%c",0x1a);\r
 \r
        fclose(CPI);\r
        return 0;\r
@@ -1900,48 +1757,81 @@ int newCPI2(short CP, short h)
        sprintf(err,"0:Ok");\r
        return 0;\r
 }\r
-       \r
-int newCPI()\r
+\r
+void displayDialog(int color,char *text,int type=0)\r
 {\r
-       short CP,h;\r
-       char temp[51];\r
-       \r
        gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
+       char t1[43]="±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±";\r
+       strcpy(t1+1,text);\r
+       t1[strlen(t1)]='±';\r
        setcolor(BLACK);\r
+       outtextxy(152,184,"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");\r
+       outtextxy(152,192,"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");\r
+       outtextxy(152,200,"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");\r
+       outtextxy(152,208,"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");\r
+       setcolor(color);\r
+       outtextxy(152,184,t1);\r
+       outtextxy(152,192,"±                                        ±");\r
+       outtextxy(152,200,"±                                        ±");\r
+       switch(type)\r
+       {\r
+       case 2:\r
+               outtextxy(152,208,"±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±again?(y/n)±");\r
+               break;\r
+       case 1:\r
+               outtextxy(152,208,"±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey±");\r
+               break;\r
+       case 0:\r
+       default:\r
+               outtextxy(152,208,"±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±");\r
+               break;\r
+       }\r
+}\r
 \r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(GREEN);\r
-\r
-       outtextxy(144,184," ±First codepage number:±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-\r
-       scanf("%u",&CP);\r
-               \r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
+int message(char *text, char *value, int type=1)\r
+{\r
+       if (type!=2)\r
+       {\r
+               displayDialog(BROWN,text,1);\r
+               printf("%s",value);\r
+               bioskey(_KEYBRD_READ);\r
+               return 0;\r
+       }\r
+       else\r
+       {\r
+               displayDialog(BROWN,text,2);\r
+               printf("%s",value);\r
+               int a;\r
+               for(;;)\r
+               {\r
+                       a=bioskey(_KEYBRD_READ);\r
+                       if((a&0xFF)==0x59||(a&0xFF)==0x79)\r
+                               return 0;\r
+                       if((a&0xFF)==0x4e||(a&0xff)==0x6e)\r
+                               return 1;\r
+               }\r
+       }\r
+}\r
 \r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
+inline void question(char *text, char *result)\r
+{\r
+       displayDialog(GREEN,text);\r
+       scanf("%s",result);\r
+}\r
 \r
-       setcolor(GREEN);\r
+inline unsigned question(char *text)\r
+{\r
+       char temp[256];\r
+       question(text,temp);\r
+       return atoi(temp);\r
+}\r
 \r
-       outtextxy(144,184," ±Initial font Height(8,14,16,all)±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       \r
-       scanf("%s",temp);\r
-       h=atoi(temp);\r
+int newCPI()\r
+{\r
+       short CP,h;\r
+       char temp[51];\r
+       CP=question("First codepage number:");\r
+       h=question("Initial font height(8,14,16,all)");\r
        if(h!=0&&h!=8&&h!=14&&h!=16)\r
        {\r
                sprintf(err,"310:Wrong height (%u)",h);\r
@@ -1949,8 +1839,6 @@ int newCPI()
        }\r
        return newCPI2(CP,h);\r
 }\r
-\r
-\r
        \r
 int newCP()\r
 {\r
@@ -1961,23 +1849,7 @@ int newCP()
                sprintf(err,"305:Already 16 codepages in CPI");\r
                return 305;\r
        }\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(GREEN);\r
-\r
-       outtextxy(144,184," ±Codepage number:±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-\r
-       scanf("%u",&CP);\r
+       CP=question("Codepage number:");\r
        for(short i=0;i<FIH->num_codepages;++i)\r
        {\r
                if(CP==CPEH[i]->codepage)\r
@@ -1986,25 +1858,7 @@ int newCP()
                        return 314;\r
                }\r
        }\r
-       \r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(GREEN);\r
-\r
-       outtextxy(144,184," ±Initial font Height(8,14,16,all)±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       \r
-       scanf("%s",temp);\r
-       h=atoi(temp);\r
+       h=question("Initial font height(8,14,16,all)");\r
        if(h!=0&&h!=8&&h!=14&&h!=16)\r
        {\r
                sprintf(err,"310:Wrong height (%u)",h);\r
@@ -2014,103 +1868,31 @@ int newCP()
 }\r
 int newF()\r
 {\r
+       short h;\r
        if(CPIH[cp]->num_fonts>=3)\r
        {\r
                sprintf(err,"309:Already 3 fonts in CPIH[%u]",cp);\r
                return 309;\r
        }\r
-       \r
-       short h;\r
-       \r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(GREEN);\r
-\r
-       outtextxy(144,184," ±Font Height(8,14,16)±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       scanf("%u",&h);\r
-\r
-       //closegraph();\r
-       //initgraph(&kart16,&tryb16,"");\r
+       h=question("Font height(8,14,16)");\r
        return newF2(h);\r
 }\r
 \r
 int otw()\r
 {\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(GREEN);\r
-\r
-       outtextxy(144,184," ±Filename:±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       scanf("%s",nazwap);\r
-\r
-       //closegraph();\r
-       //initgraph(&kart16,&tryb16,"");\r
-       return otw2();\r
-}\r
+       question("Filename",nazwap);\r
+       return otw2();\r
+}\r
 \r
 int zap()\r
 {\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(GREEN);\r
-\r
-       outtextxy(144,184," ±Filename:±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       scanf("%s",nazwap);\r
-\r
-       //closegraph();\r
-       //initgraph(&kart16,&tryb16,"");\r
+       question("Filename",nazwap);\r
        return zap2();\r
 }\r
 int zmn()\r
 {\r
        short CP;\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(GREEN);\r
-\r
-       outtextxy(144,184," ±Codepage number:±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-\r
-       scanf("%u",&CP);\r
+       CP=question("Codepage number");\r
        for(short i=0;i<FIH->num_codepages;++i)\r
        {\r
                if(CP==CPEH[i]->codepage&&i!=cp)\r
@@ -2120,327 +1902,41 @@ int zmn()
                }\r
        }\r
        CPEH[cp]->codepage=CP;\r
-       //closegraph();\r
-       //initgraph(&kart16,&tryb16,"");\r
        return  0;\r
 }\r
-int bnd()\r
-{\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(BROWN);\r
-\r
-       outtextxy(144,184," ±CPI file not loaded±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±again?(y/n)± ");\r
-\r
-       printf("%s",err);\r
-       int a;\r
-       for(;;)\r
-       {\r
-               a=bioskey(_KEYBRD_READ);\r
-               if((a&0xFF)==0x59||(a&0xFF)==0x79)\r
-               {\r
-                       //closegraph();\r
-                       //initgraph(&kart16,&tryb16,"");\r
-                       return 0;\r
-               }\r
-               if((a&0xFF)==0x4e||(a&0xff)==0x6e)\r
-               {\r
-                       //closegraph();\r
-                       //initgraph(&kart16,&tryb16,"");\r
-                       return 1;\r
-               }\r
-\r
-       }\r
-\r
-\r
-}\r
-int bnd2()\r
-{\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(BROWN);\r
-\r
-       outtextxy(144,184," ±CPI file not saved±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±again?(y/n)± ");\r
-\r
-       printf("%s",err);\r
-       int a;\r
-       for(;;)\r
-       {\r
-               a=bioskey(_KEYBRD_READ);\r
-               if((a&0xFF)==0x59||(a&0xFF)==0x79)\r
-               {\r
-                       //closegraph();\r
-                       //initgraph(&kart16,&tryb16,"");\r
-                       return 0;\r
-               }\r
-               if((a&0xFF)==0x4e||(a&0xff)==0x6e)\r
-               {\r
-                       //closegraph();\r
-                       //initgraph(&kart16,&tryb16,"");\r
-                       return 1;\r
-               }\r
-\r
-       }\r
-}\r
-\r
-int bnd8()\r
-{\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(BROWN);\r
-\r
-       outtextxy(144,184," ±CPI not created±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±again?(y/n)± ");\r
-\r
-       printf("%s",err);\r
-       int a;\r
-       for(;;)\r
-       {\r
-               a=bioskey(_KEYBRD_READ);\r
-               if((a&0xFF)==0x59||(a&0xFF)==0x79)\r
-               {\r
-                       //closegraph();\r
-                       //initgraph(&kart16,&tryb16,"");\r
-                       return 0;\r
-               }\r
-               if((a&0xFF)==0x4e||(a&0xff)==0x6e)\r
-               {\r
-                       //closegraph();\r
-                       //initgraph(&kart16,&tryb16,"");\r
-                       return 1;\r
-               }\r
-\r
-       }\r
-}\r
-\r
-int bnd3()\r
-{\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(BROWN);\r
-\r
-       outtextxy(144,184," ±Font not created±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± ");\r
-\r
-       printf("%s",err);\r
-       bioskey(_KEYBRD_READ);\r
-//     closegraph();\r
-//     initgraph(&kart16,&tryb16,"");\r
-       return 0;\r
-\r
-\r
-\r
-}\r
-\r
-int bnd6()\r
-{\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(BROWN);\r
-\r
-       outtextxy(144,184," ±Codepage not created±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± ");\r
-\r
-       printf("%s",err);\r
-       bioskey(_KEYBRD_READ);\r
-//     closegraph();\r
-//     initgraph(&kart16,&tryb16,"");\r
-       return 0;\r
-}\r
-\r
-int bnd4()\r
-{\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(BROWN);\r
-\r
-       outtextxy(144,184," ±Font not deleted±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± ");\r
-\r
-       printf("%s",err);\r
-       bioskey(_KEYBRD_READ);\r
-//     closegraph();\r
-//     initgraph(&kart16,&tryb16,"");\r
-       return 0;\r
-}\r
-\r
-int bnd7()\r
-{\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(BROWN);\r
-\r
-       outtextxy(144,184," ±Codepage not deleted±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± ");\r
-\r
-       printf("%s",err);\r
-       bioskey(_KEYBRD_READ);\r
-//     closegraph();\r
-//     initgraph(&kart16,&tryb16,"");\r
-       return 0;\r
-}\r
-\r
-\r
-int bnd5()\r
-{\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(BROWN);\r
-\r
-       outtextxy(144,184," ±Number not changed±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± ");\r
-\r
-       printf("%s",err);\r
-       bioskey(_KEYBRD_READ);\r
-//     closegraph();\r
-//     initgraph(&kart16,&tryb16,"");\r
-       return 0;\r
-}\r
-\r
-int pmc()\r
-{\r
-       gotoxy(21,13);\r
-       //printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\r
-       setcolor(BLACK);\r
-\r
-       outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-       outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ");\r
-\r
-       setcolor(BROWN);\r
-\r
-       outtextxy(144,184," ±Pomoc niedost©pna±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± ");\r
-\r
-       printf("%s",err);\r
-       bioskey(_KEYBRD_READ);\r
-//     closegraph();\r
-//     initgraph(&kart16,&tryb16,"");\r
-       return 0;\r
-\r
-\r
-\r
-}\r
-\r
-\r
 \r
 int main(int argc,char* argv[])\r
 {\r
        nullpointers();\r
-//     registerbgidriver(CGA_driver);\r
-       registerbgidriver(EGAVGA_driver);\r
-       initgraph(&kart16,&tryb16,"");\r
-       wys=8;\r
-\r
-       //new8();\r
-       //menu8();\r
-       //cpwys();\r
-       setcolor(RED);\r
-       outtextxy(136,472,"load");\r
 \r
        if(argc>1)\r
        {\r
-               new8();\r
-               menu8();\r
-               cpwys();\r
                sprintf(nazwap,"%s",argv[1]);\r
                status=otw2();\r
-       \r
-               while(status!=0)\r
+               if(status)\r
                {\r
-                       if (bnd()==0)\r
-                               status=otw();\r
-                       else\r
-                       {\r
-                               break;\r
-                               //closegraph();\r
-                               //deleteCPI();\r
-                               //return status;\r
-                       }\r
+                       puts(err);\r
+                       return status;\r
                }\r
-               any=!status;\r
+               any=1;\r
        }\r
        else\r
                any=0;\r
        \r
-       \r
+       status=registerbgidriver(EGAVGA_driver);\r
+       if (status < 0)\r
+       {\r
+               printf("g%d:%s\n",status,grapherrormsg(status));\r
+               return status;\r
+       }\r
+       initgraph(&kart16,&tryb16,"");\r
+       status=graphresult();\r
+       if (status != grOk)\r
+       {\r
+               printf("g%d:%s\n",status,grapherrormsg(status));\r
+               return status;\r
+       }\r
+\r
        if(byo8[0])\r
                wys=8;\r
        else if(byo16[0])\r
@@ -2470,239 +1966,268 @@ int main(int argc,char* argv[])
                        if((key&0xFF00)==0x4800&&any)\r
                        {\r
                                //w g¢r©\r
-                               //if(cury==0)\r
-                               //      cury=wys-1;\r
-                               //else\r
-                               //      --cury;\r
+                               prey=cury;\r
+                               prex=curx;\r
                                cury+=wys-1;\r
                                cury%=wys;\r
-                               if(wys==8)\r
-                                       lit8();\r
-                               if(wys==14)\r
-                                       lit14();\r
-                               if(wys==16)\r
-                                       lit16();\r
+                               switch(wys)\r
+                               {\r
+                               case 8:\r
+                                       lit8(2);\r
+                                       break;\r
+                               case 14:\r
+                                       lit14(2);\r
+                                       break;\r
+                               case 16:\r
+                                       lit16(2);\r
+                                       break;\r
+                               }\r
                        }\r
                        if((key&0xFF00)==0x5000&&any)\r
                        {\r
                                //w d¢\88\r
-                               //if(cury==wys-1)\r
-                               //      cury=0;\r
-                               //else\r
-                               //      ++cury;\r
+                               prey=cury;\r
+                               prex=curx;\r
                                ++cury;\r
                                cury%=wys;\r
-                               if(wys==8)\r
-                                       lit8();\r
-                               if(wys==14)\r
-                                       lit14();\r
-                               if(wys==16)\r
-                                       lit16();\r
-\r
+                               switch(wys)\r
+                               {\r
+                               case 8:\r
+                                       lit8(2);\r
+                                       break;\r
+                               case 14:\r
+                                       lit14(2);\r
+                                       break;\r
+                               case 16:\r
+                                       lit16(2);\r
+                                       break;\r
+                               }\r
                        }\r
                        if((key&0xFF00)==0x4b00&&any)\r
                        {\r
                                //w lewo\r
-                               //if(curx==0)\r
-                               //      curx=7;\r
-                               //else\r
-                               //      --curx;\r
+                               prey=cury;\r
+                               prex=curx;\r
                                --curx;\r
                                curx&=0x7;\r
-                               if(wys==8)\r
-                                       lit8();\r
-                               if(wys==14)\r
-                                       lit14();\r
-                               if(wys==16)\r
-                                       lit16();\r
+                               switch(wys)\r
+                               {\r
+                               case 8:\r
+                                       lit8(2);\r
+                                       break;\r
+                               case 14:\r
+                                       lit14(2);\r
+                                       break;\r
+                               case 16:\r
+                                       lit16(2);\r
+                                       break;\r
+                               }\r
                        }\r
                        if((key&0xFF00)==0x4d00&&any)\r
                        {\r
                                //w prawo\r
-                               //if(curx==7)\r
-                               //      curx=0;\r
-                               //else\r
-                               //      ++curx;\r
+                               prey=cury;\r
+                               prex=curx;\r
                                ++curx;\r
                                curx&=0x7;\r
-                               if(wys==8)\r
-                                       lit8();\r
-                               if(wys==14)\r
-                                       lit14();\r
-                               if(wys==16)\r
-                                       lit16();\r
+                               switch(wys)\r
+                               {\r
+                               case 8:\r
+                                       lit8(2);\r
+                                       break;\r
+                               case 14:\r
+                                       lit14(2);\r
+                                       break;\r
+                               case 16:\r
+                                       lit16(2);\r
+                                       break;\r
+                               }\r
                        }\r
                        if ((key&0xFF00)==0x3900&&any)\r
                        {\r
                                //spacja\r
-                               if(wys==8)\r
+                               switch(wys)\r
                                {\r
+                               case 8:                         \r
                                        spc8();\r
-                                       lit8();\r
-                                       lin8();\r
-                               }\r
-                               if(wys==14)\r
-                               {\r
+                                       lit8(1);\r
+                                       lin8(3);\r
+                                       break;\r
+                               case 14:\r
                                        spc14();\r
-                                       lit14();\r
-                                       lin14();\r
-                               }\r
-                               if(wys==16)\r
-                               {\r
+                                       lit14(1);\r
+                                       lin14(3);\r
+                                       break;\r
+                               case 16:\r
                                        spc16();\r
-                                       lit16();\r
-                                       lin16();\r
+                                       lit16(1);\r
+                                       lin16(3);\r
+                                       break;\r
                                }\r
                        }\r
                        if ((key&0xFF00)==0x0e00&&any)\r
                        {\r
                                //backspace\r
-                               if(wys==8)\r
+                               switch(wys)\r
                                {\r
+                               case 8:                         \r
                                        bsp8();\r
-                                       lit8();\r
-                                       lin8();\r
-                               }\r
-                               if(wys==14)\r
-                               {\r
+                                       lit8(1);\r
+                                       lin8(3);\r
+                                       break;\r
+                               case 14:\r
                                        bsp14();\r
-                                       lit14();\r
-                                       lin14();\r
-                               }\r
-                               if(wys==16)\r
-                               {\r
+                                       lit14(1);\r
+                                       lin14(3);\r
+                                       break;\r
+                               case 16:\r
                                        bsp16();\r
-                                       lit16();\r
-                                       lin16();\r
+                                       lit16(1);\r
+                                       lin16(3);\r
+                                       break;\r
                                }\r
                        }\r
                        if ((key&0xFF00)==0x1c00&&any)\r
                        {\r
                                //enter\r
-                               if(wys==8)\r
+                               switch(wys)\r
                                {\r
+                               case 8:                         \r
                                        ent8();\r
-                                       lit8();\r
-                                       lin8();\r
-                               }\r
-                               if(wys==14)\r
-                               {\r
+                                       lit8(1);\r
+                                       lin8(3);\r
+                                       break;\r
+                               case 14:\r
                                        ent14();\r
-                                       lit14();\r
-                                       lin14();\r
-                               }\r
-                               if(wys==16)\r
-                               {\r
+                                       lit14(1);\r
+                                       lin14(3);\r
+                                       break;\r
+                               case 16:\r
                                        ent16();\r
-                                       lit16();\r
-                                       lin16();\r
+                                       lit16(1);\r
+                                       lin16(3);\r
+                                       break;\r
                                }\r
                        }\r
-\r
-\r
                }\r
                else\r
                {\r
                        if((key&0xFF00)==0x4800&&any)\r
                        {\r
                                //w g¢r© l\r
-                               //if(lit<16)\r
-                               //      lit=(0xf0+lit%16);\r
-                               //else\r
-                               //      lit=((lit/16-1)*16+lit%16);\r
+                               pre=lit;\r
                                lit-=16;\r
                                lit&=0xFF;\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
-                               if (wys==8)\r
-                                       lin8();\r
-                               if (wys==14)\r
-                                       lin14();\r
-                               if (wys==16)\r
-                                       lin16();\r
-\r
+                               switch(wys)\r
+                               {\r
+                               case 8:\r
+                                       lin8(2);\r
+                                       break;\r
+                               case 14:\r
+                                       lin14(2);\r
+                                       break;\r
+                               case 16:\r
+                                       lin16(2);\r
+                                       break;\r
+                               }\r
                        }\r
                        if((key&0xFF00)==0x5000&&any)\r
                        {\r
                                //w d¢\88 l\r
-                               //if(lit>=0xf0)\r
-                               //      lit=(0+lit%16);\r
-                               //else\r
-                               //      lit=((lit/16+1)*16+lit%16);\r
+                               pre=lit;\r
                                lit+=16;\r
                                lit&=0xFF;\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
-                               if (wys==8)\r
-                                       lin8();\r
-                               if (wys==14)\r
-                                       lin14();\r
-                               if (wys==16)\r
-                                       lin16();\r
+                               switch(wys)\r
+                               {\r
+                               case 8:\r
+                                       lin8(2);\r
+                                       break;\r
+                               case 14:\r
+                                       lin14(2);\r
+                                       break;\r
+                               case 16:\r
+                                       lin16(2);\r
+                                       break;\r
+                               }\r
                        }\r
                        if((key&0xFF00)==0x4b00&&any)\r
                        {\r
                                //w lewo l\r
-                               //if(lit%16==0)\r
-                               //      lit+=15;\r
-                               //else\r
-                               //      --lit;\r
+                               pre=lit;\r
                                --lit;\r
                                lit&=0xFF;\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
-                               if (wys==8)\r
-                                       lin8();\r
-                               if (wys==14)\r
-                                       lin14();\r
-                               if (wys==16)\r
-                                       lin16();\r
+                               switch(wys)\r
+                               {\r
+                               case 8:\r
+                                       lin8(2);\r
+                                       break;\r
+                               case 14:\r
+                                       lin14(2);\r
+                                       break;\r
+                               case 16:\r
+                                       lin16(2);\r
+                                       break;\r
+                               }\r
                        }\r
                        if((key&0xFF00)==0x4d00&&any)\r
                        {\r
-\r
                                //w prawo l\r
-                               //if(lit%16==15)\r
-                               //      lit-=15;\r
-                               //else\r
-                               //      ++lit;\r
+                               pre=lit;\r
                                ++lit;\r
                                lit&=0xFF;\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
-                               if (wys==8)\r
-                                       lin8();\r
-                               if (wys==14)\r
-                                       lin14();\r
-                               if (wys==16)\r
-                                       lin16();\r
+                               switch(wys)\r
+                               {\r
+                               case 8:\r
+                                       lin8(2);\r
+                                       break;\r
+                               case 14:\r
+                                       lin14(2);\r
+                                       break;\r
+                               case 16:\r
+                                       lin16(2);\r
+                                       break;\r
+                               }\r
                        }\r
                }\r
                if ((key&0xFF00)==0x0f00&&any)\r
                {\r
                        //tab\r
-                       if(tab==0)\r
+                       if(!tab)\r
                                tab=1;\r
                        else\r
                                tab=0;\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
+                       switch(wys)\r
+                       {\r
+                       case 8:\r
+                               ramka8();\r
+                               break;\r
+                       case 14:\r
+                               ramka14();\r
+                               break;\r
+                       case 16:\r
+                               ramka16();\r
+                               break;\r
+                       }\r
                }\r
                if ((key&0xFF00)==0x5100&&any)\r
                {\r
                        //cp++\r
-                       //if(cp==FIH->num_codepages-1)\r
-                       //      cp=0;\r
-                       //else\r
-                       //      ++cp;\r
                        ++cp;\r
                        cp%=FIH->num_codepages;\r
-                       \r
+                       prex=curx;\r
+                       prey=cury;\r
                        if(wys==8&&byo8[cp]==0)\r
                        {\r
                                if(byo14[cp]!=0)\r
@@ -2742,10 +2267,6 @@ int main(int argc,char* argv[])
                if ((key&0xFF00)==0x4900&&any)\r
                {\r
                        //cp--\r
-                       //if(cp==0)\r
-                       //      cp=FIH->num_codepages-1;\r
-                       //else\r
-                       //      --cp;\r
                        cp+=FIH->num_codepages-1;\r
                        cp%=FIH->num_codepages;\r
                        \r
@@ -2788,138 +2309,142 @@ int main(int argc,char* argv[])
                if ((key&0xFF00)==0x4700&&any)\r
                {\r
                        //wys--\r
-                       if(wys==8)\r
+                       prex=curx;\r
+                       prey=cury;\r
+                       switch(wys)\r
                        {\r
+                       case 8:\r
                                if (byo16[cp]!=0)\r
                                {\r
                                        wys=16;\r
-                                       cury%=16;\r
+                                       lin16(1);\r
+                                       lit16(1);\r
+                                       ramka16();\r
                                }\r
-                               else\r
+                               else if(byo14[cp]!=0)\r
                                {\r
-                                       if(byo14[cp]!=0)\r
-                                       {\r
-                                               wys=14;\r
-                                               cury%=14;\r
-                                       }\r
+                                       wys=14;\r
+                                       lin14(1);\r
+                                       lit14(1);\r
+                                       ramka14();\r
                                }\r
-                       }\r
-                       else\r
-                       {\r
-                               if(wys==14)\r
+                               lin8(1);\r
+                               lit8(1);\r
+                               ramka8();\r
+                               break;\r
+                       case 14:\r
+                               if (byo8[cp]!=0)\r
                                {\r
-                                       if (byo8[cp]!=0)\r
-                                       {\r
-                                               wys=8;\r
-                                               cury%=8;\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               if(byo16[cp]!=0)\r
-                                               {\r
-                                                       wys=16;\r
-                                                       cury%=16;\r
-                                               }\r
-                                       }\r
+                                       wys=8;\r
+                                       cury%=8;\r
+                                       lin8(1);\r
+                                       lit8(2);\r
+                                       ramka8();\r
                                }\r
-                               else\r
+                               else if(byo16[cp]!=0)\r
                                {\r
-                                       if(wys==16)\r
-                                       {\r
-                                               if (byo14[cp]!=0)\r
-                                               {\r
-                                                       wys=14;\r
-                                                       cury%=14;\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       if(byo8[cp]!=0)\r
-                                                       {\r
-                                                               wys=8;\r
-                                                               cury%=8;\r
-                                                       }\r
-                                               }\r
-                                       }\r
+                                       wys=16;\r
+                                       lin16(1);\r
+                                       lit16(1);\r
+                                       ramka16();\r
+                               }\r
+                               lin14(1);\r
+                               lit14(2);\r
+                               ramka14();\r
+                               break;\r
+                       case 16:\r
+                               if (byo14[cp]!=0)\r
+                               {\r
+                                       wys=14;\r
+                                       cury%=14;\r
+                                       lin14(1);\r
+                                       lit14(2);\r
+                                       ramka14();\r
+                               }\r
+                               else if(byo8[cp]!=0)\r
+                               {\r
+                                       wys=8;\r
+                                       cury%=8;\r
+                                       lin8(1);\r
+                                       lit8(2);\r
+                                       ramka8();\r
                                }\r
+                               lin16(1);\r
+                               lit16(2);\r
+                               ramka16();\r
+                               break;\r
                        }\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
                        cpwys();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
                }\r
                if ((key&0xFF00)==0x4f00&&any)\r
                {\r
                        //wys++\r
-                       if(wys==8)\r
+                       prex=curx;\r
+                       prey=cury;\r
+                       switch(wys)\r
                        {\r
-                               if (byo14[cp]!=0)\r
+                       case 8:\r
+                               if(byo14[cp]!=0)\r
                                {\r
                                        wys=14;\r
-                                       cury%=14;\r
+                                       lin14(1);\r
+                                       lit14(1);\r
+                                       ramka14();\r
                                }\r
-                               else\r
+                               else if (byo16[cp]!=0)\r
                                {\r
-                                       if(byo16[cp]!=0)\r
-                                       {\r
-                                               wys=16;\r
-                                               cury%=16;\r
-                                       }\r
+                                       wys=16;\r
+                                       lin16(1);\r
+                                       lit16(1);\r
+                                       ramka16();\r
                                }\r
-                       }\r
-                       else\r
-                       {\r
-                               if(wys==14)\r
+                               lin8(1);\r
+                               lit8(1);\r
+                               ramka8();\r
+                               break;\r
+                       case 14:\r
+                               if(byo16[cp]!=0)\r
                                {\r
-                                       if (byo16[cp]!=0)\r
-                                       {\r
-                                               wys=16;\r
-                                               cury%=16;\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               if(byo8[cp]!=0)\r
-                                               {\r
-                                                       wys=8;\r
-                                                       cury%=8;\r
-                                               }\r
-                                       }\r
+                                       wys=16;\r
+                                       lin16(1);\r
+                                       lit16(1);\r
+                                       ramka16();\r
                                }\r
-                               else\r
+                               else if (byo8[cp]!=0)\r
                                {\r
-                                       if(wys==16)\r
-                                       {\r
-                                               if (byo8[cp]!=0)\r
-                                               {\r
-                                                       wys=8;\r
-                                                       cury%=8;\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       if(byo14[cp]!=0)\r
-                                                       {\r
-                                                               wys=14;\r
-                                                               cury%=14;\r
-                                                       }\r
-                                               }\r
-                                       }\r
+                                       wys=8;\r
+                                       cury%=8;\r
+                                       lin8(1);\r
+                                       lit8(2);\r
+                                       ramka8();\r
+                               }\r
+                               lin14(1);\r
+                               lit14(2);\r
+                               ramka14();\r
+                               break;\r
+                       case 16:\r
+                               if(byo8[cp]!=0)\r
+                               {\r
+                                       wys=8;\r
+                                       cury%=8;\r
+                                       lin8(1);\r
+                                       lit8(2);\r
+                                       ramka8();\r
+                               }\r
+                               else if (byo14[cp]!=0)\r
+                               {\r
+                                       wys=14;\r
+                                       cury%=14;\r
+                                       lin14(1);\r
+                                       lit14(2);\r
+                                       ramka14();\r
                                }\r
+                               lin16(1);\r
+                               lit16(2);\r
+                               ramka16();\r
+                               break;\r
                        }\r
-                       ramka8();\r
-                       ramka14();\r
-                       ramka16();\r
                        cpwys();\r
-                       lit8();\r
-                       lit14();\r
-                       lit16();\r
-                       lin8();\r
-                       lin14();\r
-                       lin16();\r
                }\r
                \r
                if ((key&0xFF00)==0x3b00)\r
@@ -2931,7 +2456,7 @@ int main(int argc,char* argv[])
                        status=newCPI();\r
                        while(status!=0)\r
                        {\r
-                               if (bnd8()==0)\r
+                               if (message("CPI not created",err,2)==0)\r
                                        status=newCPI();\r
                                else\r
                                {\r
@@ -2976,7 +2501,7 @@ int main(int argc,char* argv[])
                        status=zap();\r
                        while(status!=0)\r
                        {\r
-                               if (bnd2()==0)\r
+                               if (message("CPI file not saved",err,2)==0)\r
                                        status=zap();\r
                                else\r
                                        break;\r
@@ -3008,15 +2533,10 @@ int main(int argc,char* argv[])
                        status=otw();\r
                        while(status!=0)\r
                        {\r
-                               if (bnd()==0)\r
+                               if (message("CPI file not loaded",err,2)==0)\r
                                        status=otw();\r
                                else\r
-                               {\r
                                        break;\r
-                                       //closegraph();\r
-                                       //deleteCPI();\r
-                                       //return status;\r
-                               }\r
                        }\r
                        any=!status;\r
                        cp=0;\r
@@ -3044,14 +2564,14 @@ int main(int argc,char* argv[])
                }\r
                if((key&0xFF00)==0x3e00&&any)\r
                {\r
-                       {\r
+                       \r
                        //zapisz+system\r
                        setcolor(RED);\r
                        outtextxy(72,472,"save            use");\r
                        status=zap();\r
                        while(status!=0)\r
                        {\r
-                               if (bnd2()==0)\r
+                               if (message("CPI file not saved",err,2)==0)\r
                                        status=zap();\r
                                else\r
                                        break;\r
@@ -3083,11 +2603,6 @@ int main(int argc,char* argv[])
                        lit16();\r
                        cury%=8;\r
 \r
-\r
-               }\r
-\r
-\r
-\r
                }\r
                if ((key&0xFF00)==0x3f00&&any)\r
                {\r
@@ -3096,7 +2611,7 @@ int main(int argc,char* argv[])
                        outtextxy(256,472,"number");\r
                        status=zmn();\r
                        if(status!=0)\r
-                               bnd5();\r
+                               message("Number not changed",err);\r
                        new8();\r
                        menu8();\r
                        cpwys();\r
@@ -3117,7 +2632,7 @@ int main(int argc,char* argv[])
                        outtextxy(336,472,"newF");\r
                        status=newF();\r
                        if(status!=0)\r
-                               bnd3();\r
+                               message("Fonr not created",err);\r
                        offset();\r
                        new8();\r
                        menu8();\r
@@ -3140,7 +2655,7 @@ int main(int argc,char* argv[])
                        outtextxy(400,472,"newCP");\r
                        status=newCP();\r
                        if(status!=0)\r
-                               bnd6();\r
+                               message("Codepage not created",err);\r
                        else\r
                                cp=FIH->num_codepages-1;\r
                        if(wys==8&&byo8[cp]==0)\r
@@ -3189,7 +2704,7 @@ int main(int argc,char* argv[])
                        outtextxy(472,472,"delF");\r
                        status=delF();\r
                        if(status!=0)\r
-                               bnd4();\r
+                               message("Font not deleted",err);\r
                        offset();\r
                        \r
                        if(wys==8&&byo8[cp]==0)\r
@@ -3237,7 +2752,7 @@ int main(int argc,char* argv[])
                        outtextxy(536,472,"delCP");\r
                        status=delCP();\r
                        if(status!=0)\r
-                               bnd7();\r
+                               message("Codepage not deleted",err);\r
                        offset();\r
                        \r
                        cp%=FIH->num_codepages;\r
index 8db5208dbaa19f940f9620535d42ab44194f9104..708586841cef40ba555d0d33b014ae2de5dd4268 100644 (file)
Binary files a/NAPISY.PRJ and b/NAPISY.PRJ differ
index 15e1089555ec6457f05e209db897fea1321b328e..5992ee781a67e256808e1c93cfd70f83ad0203c3 100644 (file)
@@ -9,7 +9,7 @@
                # ##  ####  ###   #     #  #  #  # # #\r
                #  #  #  #  #     #  ###    ##    # #   \r
                                        Balthasar Szczepaäski\r
-Edytor napis¢w 1.1 - the cpi editor\r
+Edytor napis¢w 1.1b - the cpi editor\r
 \r
 ============================================================\r
 \r
@@ -40,7 +40,7 @@ computer* with an IBM-VGA compatible video card and DOS** or
 Windows*** operating system or a DOS emulator****.\r
 \r
 **The program should run on any DOS that is not older than\r
-MS-DOS-3.3. It was tested on following systems:\r
+ MS-DOS-3.3. It was tested on following systems:\r
  MS-DOS 5.0 - no problems\r
  MS-DOS 7.1 - no problems\r
  FreeDOS 1.0 - no problems\r
@@ -76,11 +76,11 @@ The following file formats are supported:
 \r
 1.FONT - used by MS-DOS, PC-DOS, Windows 1.x, 2.x, 3.x.\r
 2.FONT.NT - used by Windows NT, 2000, XP, Vista, 7.\r
-       This format is not fully supported. Files can be loaded in\r
+  This format is not fully supported. Files can be loaded in\r
   this format, but can only be saved in FONT format.\r
   Windows supports both formats, so this is not a problem.\r
-       \r
-The    following file formats are not supported:\r
+\r
+The following file formats are not supported:\r
 \r
 3.DRFONT - used by DR-DOS\r
 4.CPX - used by FreeDOS. FreeDOS also supports the FONT\r
@@ -137,7 +137,6 @@ set a pixel        Enter
 unset a pixel      Backspace\r
 change a pixel     Space\r
 switch edit/select Tab\r
-drawing and selecting\r
 next codepage      PageDown\r
 previous codepage  PageUp\r
 next font          End\r
@@ -151,7 +150,7 @@ parameter or by clicking its icon in Windows GUI.
 5. Changes\r
 \r
 beta:\r
      First working version.\r
- First working version.\r
 1.0\r
  - Change from CGA to VGA screen mode\r
  - Support for character heights 14 and 16.\r
@@ -163,7 +162,7 @@ beta:
 1.1\r
  - Full FONT flie format support\r
  - FONT.NT file format support (read only)\r
- - Codepage limit set from 6 to 16 \r
+ - Codepage limit set from 6 to 16\r
  - Creating new CPI's\r
  - Creating new codepages\r
  - Creating new fonts\r
@@ -174,6 +173,12 @@ beta:
  - Optimized functions\r
  - Fixed bugs\r
  - Language changed to English\r
+1.1b\r
+ - Optimised graphic procedures - everything works faster\r
+ - Failed command line file load now closes the program\r
+   without entering graphic mode\r
+ - Fixed a bug that crashed the program when loading a file\r
+   from a long path\r
 \r
 ============================================================\r
 \r
@@ -181,14 +186,15 @@ beta:
 \r
  - Full FONT.NT file format support\r
  - CPX file format support\r
- - exporting codepages to CP files\r
- - importing codepages from CP flies\r
- - exporting fonts to bitmaps\r
- - importing fonts from bitmaps\r
- - warnings\r
\r
+ - Exporting codepages to CP files\r
+ - Importing codepages from CP flies\r
+ - Exporting fonts to bitmaps\r
+ - Importing fonts from bitmaps\r
+ - Warnings\r
+ - Mouse support\r
+\r
 ============================================================\r
\r
+\r
 7. Known bugs\r
  \r
 none.\r
@@ -198,16 +204,16 @@ none.
 8. Files\r
 \r
 EGAVGA  .OBJ   5658 BGI driver compiled to OBJ\r
-NAPISY  .EXE 103140 The program\r
-NAPISY  .CPP  71108 Source for the program\r
-NAPISY  .PRJ   4607 Turbo C++ 3.0 project file\r
-READTHIS.TXT   6641 This file\r
+NAPISY  .EXE  94468 The program\r
+NAPISY  .CPP  50905 Source for the program\r
+NAPISY  .PRJ   4605 Turbo C++ 3.0 project file\r
+READTHIS.TXT   6875 This file\r
 \r
 ============================================================\r
 \r
 9. Contact information\r
 \r
-e-mali:   balthasar_s@interia.pl\r
+e-mail:   balthasar_s@interia.pl\r
 telefon:  +48502745442\r
 www:      http://www.baltixy.w.interia.pl\r
 \r