]> bicyclesonthemoon.info Git - cpied/commitdiff
- Full FONT flie format support v1.1a
authorb <rowerynaksiezycu@gmail.com>
Thu, 4 Jul 2013 19:19:00 +0000 (21:19 +0200)
committerb <rowerynaksiezycu@gmail.com>
Thu, 4 Jul 2013 19:19:00 +0000 (21:19 +0200)
- FONT.NT file format support (read only)
- Codepage limit set from 6 to 16
- Creating new CPI's
- Creating new codepages
- Creating new fonts
- Removing codepages
- Removing fonts
- Failed file load no longer closes the program
- Dynamic memory allocation
- Optimized functions
- Fixed bugs
- Language changed to English

NAPISY.CPP
NAPISY.PRJ
NAPISY.TXT [deleted file]
readthis.txt [new file with mode: 0644]

index 1dfc80a808d3011ee7fb52900087b3d8da022dca..5b8f4dda08462130f15712d0a81b7c8f6a718ae9 100644 (file)
@@ -1,7 +1,9 @@
 #include <graphics.h>\r
 #include <stdio.h>\r
 #include <conio.h>\r
+#include <string.h>\r
 #include <stdlib.h>\r
+#include <mem.h>\r
 #include <dos.h>\r
 #include <bios.h>\r
 \r
@@ -16,10 +18,12 @@ struct FontFileHeader
        unsigned char ptyp;\r
        long fih_offset;\r
 };\r
+\r
 struct FontInfoHeader\r
 {\r
        short num_codepages;\r
 };\r
+\r
 struct CodePageEntryHeader\r
 {\r
        short cpeh_size;\r
@@ -30,12 +34,14 @@ struct CodePageEntryHeader
        unsigned char reserved[6];\r
        long cpih_offset;\r
 };\r
+\r
 struct CodePageInfoHeader\r
 {\r
        short version;\r
        short num_fonts;\r
        short size;\r
 };\r
+\r
 struct ScreenFontHeader\r
 {\r
        unsigned char height;\r
@@ -44,18 +50,22 @@ struct ScreenFontHeader
        unsigned char xaspect;\r
        short num_chars;\r
 };\r
+\r
 struct char8\r
 {\r
        unsigned char lin[8];\r
 };\r
+\r
 struct char14\r
 {\r
        unsigned char lin[14];\r
 };\r
+\r
 struct char16\r
 {\r
        unsigned char lin[16];\r
 };\r
+\r
 struct ScreenFontBitmap16\r
 {\r
        char16 lit[256];\r
@@ -73,28 +83,26 @@ struct ScreenFontBitmap8
 \r
 \r
        int status;\r
-       char nazwap[40]="Nie_wybrano_pliku";\r
-       char err[40];\r
-//     int kart8=CGA;\r
-//     int kart14=EGA;\r
+       char nazwap[256]="Nie_wybrano_pliku";\r
+       char err[51];\r
+\r
        int kart16=VGA;\r
-//     int tryb8=CGAC2;\r
-//     int tryb14=EGAHI;\r
+\r
        int tryb16=VGAHI;\r
 \r
        FILE *CPI;\r
-       FontFileHeader FFH;\r
-       FontInfoHeader FIH;\r
-       CodePageEntryHeader CPEH[6];\r
-       CodePageInfoHeader CPIH[6];\r
-       ScreenFontHeader SFH[6][3];\r
-       ScreenFontBitmap16 SFB16[6];\r
-       ScreenFontBitmap14 SFB14[6];\r
-       ScreenFontBitmap8 SFB8[6];\r
-\r
-       int byo8[6];\r
-       int byo14[6];\r
-       int byo16[6];\r
+       FontFileHeader *FFH;\r
+       FontInfoHeader *FIH;\r
+       CodePageEntryHeader *CPEH[16];\r
+       CodePageInfoHeader *CPIH[16];\r
+       ScreenFontHeader *SFH[16][3];\r
+       ScreenFontBitmap16 *SFB16[16];\r
+       ScreenFontBitmap14 *SFB14[16];\r
+       ScreenFontBitmap8 *SFB8[16];\r
+\r
+       int byo8[16];\r
+       int byo14[16];\r
+       int byo16[16];\r
        int wys=8;\r
        int cp=0;\r
        int lit=0x42;\r
@@ -102,39 +110,204 @@ struct ScreenFontBitmap8
        int cury=2;\r
        int key;\r
        int tab=0;\r
-       char abc[16]="0123456789ABCDEF";\r
+       int any=0;\r
+       char abc[17]="0123456789ABCDEF";\r
+\r
+void nullpointers()\r
+{\r
+       short i,j;\r
+       CPI = NULL;\r
+       FFH = NULL;\r
+       FIH = NULL;\r
+       for(i=0;i<16;++i)\r
+       {\r
+               CPEH[i] = NULL;\r
+               CPIH[i] = NULL;\r
+               for(j=0;j<3;++j)\r
+               {\r
+                       SFH[i][j] = NULL;\r
+               }\r
+               SFB8[i] = NULL;\r
+               SFB16[i] = NULL;\r
+               SFB14[i] = NULL;\r
+               byo8[i]=0;\r
+               byo14[i]=0;\r
+               byo16[i]=0;\r
+       \r
+       }\r
+}\r
+void offset()\r
+{\r
+       long off=0;\r
+       short i,j,s;\r
+       off+=sizeof(FontFileHeader);\r
+       FFH->fih_offset=off;\r
+       off+=sizeof(FontInfoHeader);\r
+       for(i=0,s=0;i<FIH->num_codepages;++i,s=0)\r
+       {\r
+               off+=sizeof(CodePageEntryHeader);\r
+               CPEH[i]->cpih_offset=off;\r
+               off+=sizeof(CodePageInfoHeader);\r
+               for(j=0;j<CPIH[i]->num_fonts;++j)\r
+               {\r
+                       s+=sizeof(ScreenFontHeader);\r
+                       s+=SFH[i][j]->num_chars*SFH[i][j]->height*((SFH[i][j]->width+7)/8);\r
+               }\r
+               off+=s;\r
+               CPIH[i]->size=s;\r
+               if(i==FIH->num_codepages-1)\r
+                       CPEH[i]->next_cpeh_offset=0;\r
+               else\r
+                       CPEH[i]->next_cpeh_offset=off;\r
+       }\r
 \r
+}\r
+void deleteCPI(short st=6,short a=0,short b=0)\r
+{\r
+       short i,j;\r
+       switch(st)\r
+       {\r
+       case 6:\r
+               if(FIH==NULL)\r
+                       return;\r
+               a=FIH->num_codepages-1;\r
+               b=CPIH[a]->num_fonts-1;\r
+       case 5:\r
+               switch(SFH[a][b]->height)\r
+               {\r
+               case 8:\r
+                       delete SFB8[a];\r
+                       SFB8[a] = NULL;\r
+                       byo8[a] = 0;\r
+                       break;\r
+               case 14:\r
+                       delete SFB14[a];\r
+                       SFB14[a] = NULL;\r
+                       byo14[a] = 0;\r
+                       break;\r
+               case 16:\r
+                       delete SFB16[a];\r
+                       SFB16[a] = NULL;\r
+                       byo16[a] = 0;\r
+                       break;\r
+               //default:\r
+                       //totally unexpected;\r
+               }\r
+       case 4:\r
+               delete SFH[a][b];\r
+               SFH[a][b] = NULL;\r
+               for(j=0;j<b;++j)\r
+               {\r
+                       switch(SFH[a][j]->height)\r
+                       {\r
+                       case 8:\r
+                               delete SFB8[a];\r
+                               SFB8[a] = NULL;\r
+                               byo8[a] = 0;\r
+                               break;\r
+                       case 14:\r
+                               delete SFB14[a];\r
+                               SFB14[a] = NULL;\r
+                               byo14[a] = 0;\r
+                               break;\r
+                       case 16:\r
+                               delete SFB16[a];\r
+                               SFB16[a] = NULL;\r
+                               byo16[a] = 0;\r
+                               break;\r
+                       //default:\r
+                               //totally unexpected;\r
+                       }\r
+                       delete SFH[a][j];\r
+                       SFH[a][j] = NULL;\r
+               }\r
+       case 3:\r
+               delete CPIH[a];\r
+               CPIH[a] = NULL;\r
+       case 2:\r
+               delete CPEH[a];\r
+               CPEH[a] = NULL;\r
+               for(i=0;i<a;++i)\r
+               {\r
+                       for(j=0;j<CPIH[i]->num_fonts;++j)\r
+                       {\r
+                               switch(SFH[i][j]->height)\r
+                               {\r
+                               case 8:\r
+                                       delete SFB8[i];\r
+                                       SFB8[i] = NULL;\r
+                                       byo8[i] = 0;\r
+                                       break;\r
+                               case 14:\r
+                                       delete SFB14[i];\r
+                                       SFB14[i] = NULL;\r
+                                       byo14[i] = 0;\r
+                                       break;\r
+                               case 16:\r
+                                       delete SFB16[i];\r
+                                       SFB16[i] = NULL;\r
+                                       byo16[i] = 0;\r
+                                       break;\r
+                               //default:\r
+                                       //totally unexpected;\r
+                               }\r
+                               delete SFH[i][j];\r
+                               SFH[i][j] = NULL;\r
+                       }\r
+                       delete CPIH[i];\r
+                       delete CPEH[i];\r
+                       CPIH[i] = NULL;\r
+                       CPEH[i] = NULL;\r
+               }\r
+       case 1:\r
+               delete FIH;\r
+               FIH = NULL;\r
+       case 0:\r
+               delete FFH;\r
+               FFH = NULL;\r
+       }\r
+}\r
 \r
-int pot(int a,int n)\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
 \r
 void new8()\r
 {\r
-       system("CLS");\r
+       //system("CLS");\r
        cleardevice();\r
        setcolor(GREEN);\r
        //outtextxy(0,0,  "Edytor napis¢w±°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°");\r
        outtextxy(0,0,  "Edytor napis¢w±                                                                 ");\r
        outtextxy(0,8,  "±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±");\r
+       outtextxy(608,16,"v1.1");\r
 }\r
 void menu8()\r
 {\r
        setcolor(GREEN);\r
+       outtextxy(609,449,",");\r
+       outtextxy(472,456,"Balthasar Szczepanski");\r
        outtextxy(0,464,"±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±");\r
-       outtextxy(0,472,"F1.pomoc°°F2.zapis°°F3.odczyt°°F4.uzycie w systemie°°F5.zmiana numeru°°F6.koniec");\r
-       outtextxy(280,466,".");\r
+       if(any)\r
+               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
        setcolor(BLACK);\r
        outtextxy(0x78,0,"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");\r
-       sprintf(cpw,"°cp%03d°8x%02d°%s°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp].codepage,wys,nazwap);\r
+       if(any)\r
+               sprintf(cpw,"°cp%03u°8x%02d°%s°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys,nazwap);\r
+       else\r
+               strcpy(cpw, "°No CPI open°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°");\r
        setcolor(GREEN);\r
 \r
        outtextxy(0x78,0,cpw);\r
@@ -144,6 +317,8 @@ void cpwys()
 \r
 void ramka8()\r
 {\r
+       if(!any)\r
+               return;\r
        if(tab==0&&wys==8)\r
                setcolor(GREEN);\r
        else\r
@@ -157,6 +332,8 @@ void ramka8()
 }\r
 void ramka14()\r
 {\r
+       if(!any)\r
+               return;\r
        if(tab==0&&wys==14)\r
                setcolor(GREEN);\r
        else\r
@@ -170,6 +347,8 @@ void ramka14()
 }\r
 void ramka16()\r
 {\r
+       if(!any)\r
+               return;\r
        if(tab==0&&wys==16)\r
                setcolor(GREEN);\r
        else\r
@@ -183,6 +362,8 @@ void ramka16()
 }\r
 void lin14()\r
 {\r
+       if(!any)\r
+               return;\r
        char ab[2]="X";\r
        setcolor(RED);\r
        outtextxy(176,215,"0123456789ABCDEF");\r
@@ -203,6 +384,17 @@ void lin14()
        outtextxy(168,422,"E");\r
        outtextxy(168,436,"F");\r
 \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
+               return;\r
+       }\r
+       \r
        for(int l=0;l<256;++l)\r
        {\r
                for(int a=0;a<14;++a)\r
@@ -217,38 +409,46 @@ void lin14()
                                        ab[0]=abc[lit/16];\r
                                        outtextxy(168,226+14*(lit/16),ab);\r
 \r
-                                       if(b>0)\r
+                                       /*if(b>0)\r
                                        {\r
-                                               if((SFB14[cp].lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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
+                                               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
+                                       }*/\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
                                else\r
                                {\r
 \r
-                                       if(b>0)\r
+                                       /*if(b>0)\r
                                        {\r
-                                               if((SFB14[cp].lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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
                                                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)==1)\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
+                                       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
@@ -256,6 +456,8 @@ void lin14()
 }\r
 void lin8()\r
 {\r
+       if(!any)\r
+               return;\r
        char ab[2]="X";\r
        setcolor(RED);\r
        outtextxy(176,24,"0123456789ABCDEF");\r
@@ -275,6 +477,16 @@ void lin8()
        outtextxy(168,136,"D");\r
        outtextxy(168,144,"E");\r
        outtextxy(168,152,"F");\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
+               return;\r
+       }\r
 \r
        for(int l=0;l<256;++l)\r
        {\r
@@ -290,38 +502,46 @@ void lin8()
                                        ab[0]=abc[lit/16];\r
                                        outtextxy(168,32+8*(lit/16),ab);\r
 \r
-                                       if(b>0)\r
+                                       /*if(b>0)\r
                                        {\r
-                                               if((SFB8[cp].lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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
+                                               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
+                                       }*/\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
                                else\r
                                {\r
 \r
-                                       if(b>0)\r
+                                       /*if(b>0)\r
                                        {\r
-                                               if((SFB8[cp].lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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
                                                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)==1)\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
+                                       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
@@ -329,6 +549,8 @@ void lin8()
 }\r
 void lin16()\r
 {\r
+       if(!any)\r
+               return;\r
        char ab[2]="X";\r
        setcolor(RED);\r
        outtextxy(496,103,"0123456789ABCDEF");\r
@@ -348,6 +570,17 @@ void lin16()
        outtextxy(488,323,"D");\r
        outtextxy(488,339,"E");\r
        outtextxy(488,355,"F");\r
+       \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
+               return;\r
+       }\r
 \r
        for(int l=0;l<256;++l)\r
        {\r
@@ -363,38 +596,46 @@ void lin16()
                                        ab[0]=abc[lit/16];\r
                                        outtextxy(488,115+16*(lit/16),ab);\r
 \r
-                                       if(b>0)\r
+                                       /*if(b>0)\r
                                        {\r
-                                               if((SFB16[cp].lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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
                                        {\r
-                                               if((SFB16[cp].lit[l].lin[a]/0x80)==1)\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
+                                       }*/\r
+                                       if(SFB16[cp]->lit[l].lin[a]&(0x80>>b))\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
                                {\r
 \r
-                                       if(b>0)\r
+                                       /*if(b>0)\r
                                        {\r
-                                               if((SFB16[cp].lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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)==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,EGA_BLACK);\r
-                                       }\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
                                }\r
                        }\r
                }\r
@@ -402,6 +643,8 @@ void lin16()
 }\r
 void lit8()\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
@@ -415,6 +658,17 @@ void lit8()
        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
+               return;\r
+       }\r
 \r
        for(int a=0;a<8;++a)\r
        {\r
@@ -432,16 +686,18 @@ void lit8()
                                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
+                               /*if(b>0)\r
                                {\r
-                                       if((SFB8[cp].lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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
+                                       if((SFB8[cp]->lit[lit].lin[a]/0x80)==1)\r
                                                floodfill(0x11+b*0x10,0x21+a*0x10,GREEN);\r
-                               }\r
+                               }*/\r
+                               if(SFB8[cp]->lit[lit].lin[a]&(0x80>>b))\r
+                                       floodfill(0x11+b*0x10,0x21+a*0x10,GREEN);\r
                                setcolor(BLACK);\r
                                rectangle(0x11+b*0x10,0x21+a*0x10,0x1e+b*0x10,0x2e+a*0x10);\r
                        }\r
@@ -449,9 +705,9 @@ void lit8()
                        {\r
 \r
                                setcolor(BROWN);\r
-                               if(b>0)\r
+                               /*if(b>0)\r
                                {\r
-                                       if((SFB8[cp].lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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
@@ -459,11 +715,16 @@ void lit8()
                                }\r
                                else\r
                                {\r
-                                       if((SFB8[cp].lit[lit].lin[a]/0x80)==1)\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
                                }\r
                        }\r
                }\r
@@ -471,6 +732,8 @@ void lit8()
 }\r
 void lit14()\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
@@ -491,6 +754,17 @@ void lit14()
        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
+               return;\r
+       }\r
+       \r
        for(int a=0;a<14;++a)\r
        {\r
                char ab[2]="q";\r
@@ -507,16 +781,18 @@ void lit14()
                                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
+                               /*if(b>0)\r
                                {\r
-                                       if((SFB14[cp].lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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
+                                       if((SFB14[cp]->lit[lit].lin[a]/0x80)==1)\r
                                                floodfill(17+b*16,224+a*16,GREEN);\r
-                               }\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
                        }\r
@@ -524,9 +800,9 @@ void lit14()
                        {\r
 \r
                                setcolor(BROWN);\r
-                               if(b>0)\r
+                               /*if(b>0)\r
                                {\r
-                                       if((SFB14[cp].lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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
@@ -534,11 +810,16 @@ void lit14()
                                }\r
                                else\r
                                {\r
-                                       if((SFB14[cp].lit[lit].lin[a]/0x80)==1)\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
                                }\r
                        }\r
                }\r
@@ -546,6 +827,8 @@ void lit14()
 }\r
 void lit16()\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
@@ -568,6 +851,17 @@ void lit16()
        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
+               return;\r
+       }\r
+       \r
        for(int a=0;a<16;++a)\r
        {\r
                char ab[2]="q";\r
@@ -584,16 +878,18 @@ void lit16()
                                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
+                               /*if(b>0)\r
                                {\r
-                                       if((SFB16[cp].lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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
+                                       if((SFB16[cp]->lit[lit].lin[a]/0x80)==1)\r
                                                floodfill(337+b*16,112+a*16,GREEN);\r
-                               }\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
@@ -601,9 +897,9 @@ void lit16()
                        {\r
 \r
                                setcolor(BROWN);\r
-                               if(b>0)\r
+                               /*if(b>0)\r
                                {\r
-                                       if((SFB16[cp].lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1)\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
@@ -611,12 +907,17 @@ void lit16()
                                }\r
                                else\r
                                {\r
-                                       if((SFB16[cp].lit[lit].lin[a]/0x80)==1)\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
                                }\r
                        }\r
                }\r
@@ -626,77 +927,92 @@ void lit16()
 \r
 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
+       //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
 {\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
+       //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
 {\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
+       //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
 {\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
+       //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
 {\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
+       //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
 {\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
+       //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
 {\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
+       //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
 {\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
+       //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
 {\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
+       //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
+\r
 int otw2()\r
 {\r
        int a;\r
        int b;\r
        int c;\r
        int d;\r
-       for(int z=0;z<6;++z)\r
-       {\r
-               byo8[z]=0;\r
-               byo14[z]=0;\r
-               byo16[z]=0;\r
-       }\r
+       int NT;\r
+       \r
+       \r
        CPI=fopen(nazwap,"rb");\r
 \r
        if(CPI==NULL)\r
        {\r
-               sprintf(err,"100: B\88¥d otwarcia pliku");\r
-               return 1;\r
+               sprintf(err,"100:No valid file at this path");\r
+               return 100;\r
        }\r
        else\r
                sprintf(err,"OK");\r
-       fread(&FFH,0x19,1,CPI);\r
+       FFH=new FontFileHeader;\r
+       if(!FFH)\r
+       {\r
+               sprintf(err,"116:Not enough memory for FFH");\r
+               fclose(CPI);\r
+               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
@@ -705,47 +1021,85 @@ int otw2()
 //     printf("ptyp=%2x\n",FFH.ptyp);\r
 //     printf("fih_offset=%p\n\n",FFH.fih_offset);\r
 \r
-       if(FFH.id0!=0xff)\r
+       if(FFH->id0!=0xff)\r
        {\r
-               sprintf(err,"101: FFH.id0!=0xff");\r
+               sprintf(err,"101:Unsupported format, id0=0x%02x",(short)(FFH->id0&0xff));\r
                fclose(CPI);\r
+               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(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
        {\r
-               sprintf(err,"102: FFH.id!=\"FONT   \"");\r
+               NT=1;\r
+               FFH->id[4]=' ';\r
+               FFH->id[5]=' ';\r
+               FFH->id[6]=' ';\r
+       }\r
+       else\r
+       {\r
+               sprintf(err,"102:Unsupported format, id=\"%c%c%c%c%c%c%c\"",FFH->id[0],FFH->id[1],FFH->id[2],FFH->id[3],FFH->id[4],FFH->id[5],FFH->id[6]);\r
                fclose(CPI);\r
+               deleteCPI(0);\r
                return 102;\r
        }\r
-       if(FFH.pnum!=1)\r
+       if(FFH->pnum!=1)\r
        {\r
-               sprintf(err,"103: FFH.pnum!=1\n");\r
+               sprintf(err,"103:Wrong no. of pointers (%u)",FFH->pnum);\r
                fclose(CPI);\r
+               deleteCPI(0);\r
                return 103;\r
        }\r
-       if(FFH.ptyp!=1)\r
+       if(FFH->ptyp!=1)\r
        {\r
-               sprintf(err,"104: FFH.ptyp!=1\n");\r
+               sprintf(err,"104:Wrong pointer type, (%u)",(short)(FFH->ptyp&0xff));\r
                fclose(CPI);\r
+               deleteCPI(0);\r
                return 104;\r
        }\r
-       fseek(CPI,FFH.fih_offset,0);\r
-       fread(&FIH,0x2,1,CPI);\r
+       FIH=new FontInfoHeader;\r
+       if(!FIH)\r
+       {\r
+               sprintf(err,"116:Not enough memory for FIH");\r
+               fclose(CPI);\r
+               deleteCPI(0);\r
+               return 116;\r
+       }\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>6)\r
+       if(FIH->num_codepages>16)\r
        {\r
                //FIH.num_codepages=6;\r
-               sprintf(err,"105: FIH.num_codepages>6\n");\r
+               sprintf(err,"105:Too many codepages (%u)",FIH->num_codepages);\r
                fclose(CPI);\r
+               deleteCPI(1);\r
                return 105;\r
        }\r
+       \r
+       if(FIH->num_codepages==0)\r
+       {\r
+               sprintf(err,"117:No codepages");\r
+               fclose(CPI);\r
+               deleteCPI(1);\r
+               return 117;\r
+       }\r
 \r
-       for(a=0; a<FIH.num_codepages;++a)\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
-               fread(&CPEH[a],0x1c,1,CPI);\r
+                       fseek(CPI,CPEH[a-1]->next_cpeh_offset,0);\r
+               CPEH[a] = new CodePageEntryHeader;\r
+               if(!CPEH[a])\r
+               {\r
+                       sprintf(err,"116:Not enough memory for CPEH[%d]",a);\r
+                       deleteCPI(1);\r
+                       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
@@ -754,101 +1108,194 @@ int otw2()
 //             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
+               if(NT)\r
                {\r
-                       sprintf(err,"106: CPEH.cpeh_size!=0x1c\n");\r
+                       CPEH[a]->next_cpeh_offset+=ftell(CPI)-sizeof(CodePageEntryHeader);\r
+                       CPEH[a]->cpih_offset+=ftell(CPI)-sizeof(CodePageEntryHeader);\r
+               }\r
+               if(CPEH[a]->cpeh_size!=0x1c)\r
+               {\r
+                       sprintf(err,"106:Wrong CPEH[%u] size (0x%x)",a,CPEH[a]->cpeh_size);\r
                        fclose(CPI);\r
+                       deleteCPI(2,a);\r
                        return 106;\r
                }\r
-               if(CPEH[a].device_type!=1)\r
+               if(CPEH[a]->device_type!=1)\r
                {\r
-                       sprintf(err,"107: CPEH.device_type!=1\n");\r
+                       sprintf(err,"107:Wrong device type(%u) in CPEH[%u]",CPEH[a]->device_type,a);\r
                        fclose(CPI);\r
+                       deleteCPI(2,a);\r
                        return 107;\r
                }\r
-\r
-               fseek(CPI,CPEH[a].cpih_offset,0);\r
-               fread(&CPIH[a],0x6,1,CPI);\r
+               for(short i=0;i<a;++i)\r
+               {\r
+                       if(CPEH[a]->codepage==CPEH[i]->codepage)\r
+                       {\r
+                               sprintf(err,"114:cp%03u (%u) already in CPEH[%u]",CPEH[a]->codepage,a,i);\r
+                               fclose(CPI);\r
+                               deleteCPI(2,a);\r
+                               return 114;\r
+                       }\r
+               }\r
+               fseek(CPI,CPEH[a]->cpih_offset,0);\r
+               CPIH[a] = new CodePageInfoHeader;\r
+               if(!CPIH[a])\r
+               {\r
+                       sprintf(err,"116:Not enough memory for CPIH[%d]",a);\r
+                       fclose(CPI);\r
+                       deleteCPI(2,a);\r
+                       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
+               if(CPIH[a]->version!=1)\r
                {\r
-                       sprintf(err,"108: CPIH.version!=1\n");\r
+                       sprintf(err,"108:Wrong version of CPIH[%u] (%u)",a,CPIH[a]->version);\r
                        fclose(CPI);\r
+                       deleteCPI(3,a);\r
                        return 108;\r
                }\r
-               if(CPIH[a].num_fonts>3)\r
+               if(CPIH[a]->num_fonts>3)\r
                {\r
-                       sprintf(err,"109: CPIH.numfonts>3\n");\r
+                       sprintf(err,"109:Too many fonts in CPIH[%u] (%u)",a,CPIH[a]->num_fonts);\r
                        fclose(CPI);\r
+                       deleteCPI(3,a);\r
                        return 109;\r
                }\r
-               for(b=0;b<CPIH[a].num_fonts;++b)\r
+               if(CPIH[a]->num_fonts==0)\r
                {\r
-                       fread(&SFH[a][b],0x6,1,CPI);\r
+                       sprintf(err,"115:No fonts in CPIH[%u])",a);\r
+                       fclose(CPI);\r
+                       deleteCPI(3,a);\r
+                       return 115;\r
+               }\r
+               for(b=0;b<CPIH[a]->num_fonts;++b)\r
+               {\r
+                       SFH[a][b] = new ScreenFontHeader;\r
+                       if(!SFH[a][b])\r
+                       {\r
+                               sprintf(err,"116:Not enough memory for SFH[%d][%d]",a);\r
+                               fclose(CPI);\r
+                               if(b==0)\r
+                                       deleteCPI(3,a);\r
+                               else\r
+                                       deleteCPI(5,a,b-1);\r
+                               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
+                       //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
+                                       sprintf(err,"113:Height 8 already in cp%03u (%u;%u)",CPEH[a]->codepage,a,b);\r
                                        fclose(CPI);\r
+                                       deleteCPI(4,a,b);\r
                                        return 113;\r
                                }\r
                                byo8[a]=1;\r
                        }\r
-                       if(SFH[a][b].height==14)\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
+                                       sprintf(err,"113:Height 14 already in cp%03u (%u;%u)",CPEH[a]->codepage,a,b);\r
                                        fclose(CPI);\r
-                                       return 114;\r
+                                       deleteCPI(4,a,b);\r
+                                       return 113;\r
                                }\r
                                byo14[a]=1;\r
                        }\r
-                       if(SFH[a][b].height==16)\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
+                                       sprintf(err,"113:Height 16 already in cp%03u (%u;%u)",CPEH[a]->codepage,a,b);\r
                                        fclose(CPI);\r
-                                       return 115;\r
+                                       deleteCPI(4,a,b);\r
+                                       return 113;\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
+                       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
+                               sprintf(err,"110:Wrong height (%u) in SFH[%u][%u]",(short)(SFH[a][b]->height&0xff),a,b);\r
                                fclose(CPI);\r
+                               deleteCPI(4,a,b);\r
                                return 110;\r
                        }\r
-                       if(SFH[a][b].width!=8)\r
+                       if(SFH[a][b]->width!=8)\r
                        {\r
-                               sprintf(err,"111: SFH.width!=8\n");\r
+                               sprintf(err,"111:Wrong width (%u) in SFH[%u][%u]",(short)(SFH[a][b]->width&0xff),a,b);\r
                                fclose(CPI);\r
+                               deleteCPI(4,a,b);\r
                                return 111;\r
                        }\r
-                       if(SFH[a][b].num_chars!=256)\r
+                       if(SFH[a][b]->num_chars!=256)\r
                        {\r
-                               sprintf(err,"112: SFH.num_chars!=256\n");\r
+                               sprintf(err,"112:Wrong no.of chars(%u)in SFH[%u][%u]",SFH[a][b]->num_chars,a,b);\r
                                fclose(CPI);\r
+                               deleteCPI(4,a,b);\r
                                return 112;\r
                        }\r
+\r
+                       if(SFH[a][b]->height==16)\r
+                       {\r
+                               SFB16[a] = new ScreenFontBitmap16;\r
+                               if(!SFB16[a])\r
+                               {\r
+                                       sprintf(err,"116:Not enough memory for SFB16[%d] (%d)",a,b);\r
+                                       fclose(CPI);\r
+                                       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
+                       {\r
+                               SFB14[a] = new ScreenFontBitmap14;\r
+                               if(!SFB14[a])\r
+                               {\r
+                                       sprintf(err,"116:Not enough memory for SFB14[%d] (%d)",a,b);\r
+                                       fclose(CPI);\r
+                                       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
+                       {\r
+                               SFB8[a] = new ScreenFontBitmap8;\r
+                               if(!SFB8[a])\r
+                               {\r
+                                       sprintf(err,"116:Not enough memory for SFB8[%d] (%d)",a,b);\r
+                                       fclose(CPI);\r
+                                       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
+               /*for(b=0;b<CPIH[a].num_fonts;++b)\r
                {\r
                        fseek(CPI,CPEH[a].cpih_offset+0xc,0);\r
                        if(b>0)\r
@@ -871,10 +1318,11 @@ int otw2()
                                for(c=0;c<256;++c)\r
                                        fread(&SFB8[a].lit[c],0x08,1,CPI);\r
                        }\r
-               }\r
+               }*/\r
        }\r
 \r
        fclose(CPI);\r
+       offset();\r
        return 0;\r
 }\r
 int zap2()\r
@@ -888,12 +1336,12 @@ int zap2()
 \r
        if(CPI==NULL)\r
        {\r
-               sprintf(err,"200: B\88¥d utworzenia pliku:");\r
+               sprintf(err,"200:Cannot create file at this path");\r
                return 200;\r
        }\r
        else\r
                sprintf(err,"OK");\r
-       fwrite(&FFH,0x19,1,CPI);\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
@@ -926,8 +1374,8 @@ int zap2()
                fclose(CPI);\r
                return 104;\r
        }*/\r
-       fseek(CPI,FFH.fih_offset,0);\r
-       fwrite(&FIH,0x2,1,CPI);\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
@@ -938,11 +1386,11 @@ int zap2()
                return 105;\r
        }*/\r
 \r
-       for(a=0; a<FIH.num_codepages;++a)\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
+                       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
@@ -965,8 +1413,8 @@ int zap2()
                        return 107;\r
                }*/\r
 \r
-               fseek(CPI,CPEH[a].cpih_offset,0);\r
-               fwrite(&CPIH[a],0x6,1,CPI);\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
@@ -984,16 +1432,16 @@ int zap2()
                        fclose(CPI);\r
                        return 109;\r
                }*/\r
-               for(b=0;b<CPIH[a].num_fonts;++b)\r
+               for(b=0;b<CPIH[a]->num_fonts;++b)\r
                {\r
-                       fwrite(&SFH[a][b],0x6,1,CPI);\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
+                       //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
@@ -1044,8 +1492,27 @@ int zap2()
                                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
+               /*for(b=0;b<CPIH[a]->num_fonts;++b)\r
                {\r
                        fseek(CPI,CPEH[a].cpih_offset+0xc,0);\r
                        if(b>0)\r
@@ -1068,84 +1535,770 @@ int zap2()
                                for(c=0;c<256;++c)\r
                                        fwrite(&SFB8[a].lit[c],0x08,1,CPI);\r
                        }\r
-               }\r
+               }*/\r
        }\r
 \r
-       fprintf(CPI,"\nTen plik zosta\88 wygenerowany za pomoc¥ Edytora napis¢w, wersja 1.0\n autor programu:  Balthasar Szczepaäski%c",0x1a);\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
 \r
        fclose(CPI);\r
        return 0;\r
 }\r
 \r
-int otw()\r
+int newF8(short CP)\r
 {\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
+       if(byo8[CP])\r
+       {\r
+               sprintf(err,"313:Height 8 already in cp%03u",CPEH[CP]->codepage);\r
+               return 313;\r
+       }\r
+       if(!(SFH[CP][CPIH[CP]->num_fonts]=new ScreenFontHeader))\r
+       {\r
+               sprintf(err,"316:Not enough memory for SFH[%d][%d]",CP,CPIH[CP]->num_fonts);\r
+               return 316;\r
+       }\r
+       if(!(SFB8[CP]=new ScreenFontBitmap8))\r
+       {\r
+               sprintf(err,"316:Not enough memory for SFB8[%d]",CP);\r
+               delete SFH[CP][CPIH[CP]->num_fonts];\r
+               SFH[CP][CPIH[CP]->num_fonts] = NULL;\r
+               return 316;\r
+       }\r
+       memset(SFB8[CP],0,0x800);\r
+       byo8[CP]=1;\r
+       SFH[CP][CPIH[CP]->num_fonts]->height=8;\r
+       SFH[CP][CPIH[CP]->num_fonts]->width=8;\r
+       SFH[CP][CPIH[CP]->num_fonts]->yaspect=0;\r
+       SFH[CP][CPIH[CP]->num_fonts]->xaspect=0;\r
+       SFH[CP][CPIH[CP]->num_fonts]->num_chars=256;\r
+       ++(CPIH[CP]->num_fonts);\r
+       offset();\r
+       sprintf(err,"0:OK");\r
+       return 0;\r
+}\r
 \r
-       setcolor(GREEN);\r
+int newF14(short CP)\r
+{\r
+       if(byo14[CP])\r
+       {\r
+               sprintf(err,"313:Height 14 already in cp%03u",CPEH[CP]->codepage);\r
+               return 313;\r
+       }\r
+       if(!(SFH[CP][CPIH[CP]->num_fonts]=new ScreenFontHeader))\r
+       {\r
+               sprintf(err,"316:Not enough memory for SFH[%d][%d]",CP,CPIH[CP]->num_fonts);\r
+               return 316;\r
+       }\r
+       if(!(SFB14[CP]=new ScreenFontBitmap14))\r
+       {\r
+               sprintf(err,"316:Not enough memory for SFB14[%d]",CP);\r
+               delete SFH[CP][CPIH[CP]->num_fonts];\r
+               SFH[CP][CPIH[CP]->num_fonts] = NULL;\r
+               return 316;\r
+       }\r
+       memset(SFB14[CP],0,0xe00);\r
+       byo14[CP]=1;\r
+       SFH[CP][CPIH[CP]->num_fonts]->height=14;\r
+       SFH[CP][CPIH[CP]->num_fonts]->width=8;\r
+       SFH[CP][CPIH[CP]->num_fonts]->yaspect=0;\r
+       SFH[CP][CPIH[CP]->num_fonts]->xaspect=0;\r
+       SFH[CP][CPIH[CP]->num_fonts]->num_chars=256;\r
+       ++(CPIH[CP]->num_fonts);\r
+       offset();\r
+       sprintf(err,"0:OK");\r
+       return 0;\r
+}\r
 \r
-       outtextxy(144,184," ±Nazwa pliku:±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       outtextxy(144,192," ±                                        ± ");\r
-       outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
-       scanf("%s",nazwap);\r
+int newF16(short CP)\r
+{\r
+       if(byo16[CP])\r
+       {\r
+               sprintf(err,"313:Height 16 already in cp%03u",CPEH[CP]->codepage);\r
+               return 313;\r
+       }\r
+       if(!(SFH[CP][CPIH[CP]->num_fonts]=new ScreenFontHeader))\r
+       {\r
+               sprintf(err,"316:Not enough memory for SFH[%d][%d]",CP,CPIH[CP]->num_fonts);\r
+               return 316;\r
+       }\r
+       if(!(SFB16[CP]=new ScreenFontBitmap16))\r
+       {\r
+               sprintf(err,"316:Not enough memory for SFB16[%d]",CP);\r
+               delete SFH[CP][CPIH[CP]->num_fonts];\r
+               SFH[CP][CPIH[CP]->num_fonts] = NULL;\r
+               return 316;\r
+       }\r
+       memset(SFB16[CP],0,0x1000);\r
+       byo16[CP]=1;\r
+       SFH[CP][CPIH[CP]->num_fonts]->height=16;\r
+       SFH[CP][CPIH[CP]->num_fonts]->width=8;\r
+       SFH[CP][CPIH[CP]->num_fonts]->yaspect=0;\r
+       SFH[CP][CPIH[CP]->num_fonts]->xaspect=0;\r
+       SFH[CP][CPIH[CP]->num_fonts]->num_chars=256;\r
+       ++(CPIH[CP]->num_fonts);\r
+       sprintf(err,"0:OK");\r
+       return 0;\r
+}\r
 \r
-       closegraph();\r
-       initgraph(&kart16,&tryb16,"");\r
-       return otw2();\r
+int newF2(short h)\r
+{\r
+       switch(h)\r
+       {\r
+       case 8:\r
+               return newF8(cp);\r
+       case 14:\r
+               return newF14(cp);\r
+       case 16:\r
+               return newF16(cp);\r
+       default:\r
+               sprintf(err,"310:Wrong height (%u)",h);\r
+               return 310;\r
+       }\r
 }\r
-int zap()\r
+int delF8(short h)\r
 {\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," ±Nazwa pliku:±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\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 zap2();\r
+       short i;\r
+       delete SFB8[cp];\r
+       delete SFH[cp][h];\r
+       byo8[cp]=0;\r
+       --(CPIH[cp]->num_fonts);\r
+       for(i=h;i<CPIH[cp]->num_fonts;++i)\r
+       {\r
+               SFH[cp][i] = SFH[cp][i+1];\r
+       }\r
+       SFH[cp][CPIH[cp]->num_fonts] = NULL;\r
+       sprintf(err,"0:OK");\r
+       return 0;\r
 }\r
-int zmn()\r
+int delF14(short h)\r
 {\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," ±Numer strony kodowej:±±±±±±±±±±±±±±±±±±±± ");\r
+       short i;\r
+       delete SFB14[cp];\r
+       delete SFH[cp][h];\r
+       byo14[cp]=0;\r
+       --(CPIH[cp]->num_fonts);\r
+       for(i=h;i<CPIH[cp]->num_fonts;++i)\r
+       {\r
+               SFH[cp][i] = SFH[cp][i+1];\r
+       }\r
+       SFH[cp][CPIH[cp]->num_fonts] = NULL;\r
+       sprintf(err,"0:OK");\r
+       return 0;\r
+}\r
+int delF16(short h)\r
+{\r
+       short i;\r
+       delete SFB16[cp];\r
+       delete SFH[cp][h];\r
+       byo16[cp]=0;\r
+       --(CPIH[cp]->num_fonts);\r
+       for(i=h;i<CPIH[cp]->num_fonts;++i)\r
+       {\r
+               SFH[cp][i] = SFH[cp][i+1];\r
+       }\r
+       SFH[cp][CPIH[cp]->num_fonts] = NULL;\r
+       sprintf(err,"0:OK");\r
+       return 0;\r
+}\r
+\r
+int delCP()\r
+{\r
+       short i;\r
+       if(FIH->num_codepages<=1)\r
+       {\r
+               sprintf(err,"317:Last codepage");\r
+               return 317;\r
+       }\r
+       for(i=0;i<CPIH[cp]->num_fonts;++i)\r
+       {\r
+               switch(SFH[cp][i]->height)\r
+               {\r
+               case 16:\r
+                       delete SFB16[cp];\r
+                       break;\r
+               case 14:\r
+                       delete SFB14[cp];\r
+                       break;\r
+               case 8:\r
+                       delete SFB8[cp];\r
+                       break;\r
+               //unxh!\r
+               }\r
+               delete SFH[cp][i];\r
+       }\r
+       delete CPIH[cp];\r
+       delete CPEH[cp];\r
+       \r
+       --(FIH->num_codepages);\r
+       for(i=cp;i<FIH->num_codepages;++i)\r
+       {\r
+               CPEH[i] = CPEH[i+1];\r
+               CPIH[i] = CPIH[i+1];\r
+               SFH[i][0] = SFH[i+1][0];\r
+               SFH[i][1] = SFH[i+1][1];\r
+               SFH[i][2] = SFH[i+1][2];\r
+               SFB16[i] = SFB16[i+1];\r
+               SFB14[i] = SFB14[i+1];\r
+               SFB8[i] = SFB8[i+1];\r
+               byo16[i] = byo16[i+1];\r
+               byo14[i] = byo14[i+1];\r
+               byo8[i] = byo8[i+1];\r
+       }\r
+       CPEH[FIH->num_codepages] = NULL;\r
+       CPIH[FIH->num_codepages] = NULL;\r
+       SFH[FIH->num_codepages][0] = NULL;\r
+       SFH[FIH->num_codepages][1] = NULL;\r
+       SFH[FIH->num_codepages][2] = NULL;\r
+       SFB16[FIH->num_codepages] = NULL;\r
+       SFB14[FIH->num_codepages] = NULL;\r
+       SFB8[FIH->num_codepages] = NULL;\r
+       byo16[FIH->num_codepages] = 0;\r
+       byo14[FIH->num_codepages] = 0;\r
+       byo8[FIH->num_codepages] = 0;\r
+       \r
+       sprintf(err,"0:OK");\r
+       return 0;\r
+}\r
+       \r
+int delF()\r
+{\r
+       short h;\r
+       if(CPIH[cp]->num_fonts<=1)\r
+       {\r
+               sprintf(err,"315:Last font in CPIH[%u]",cp);\r
+               return 315;\r
+       }\r
+       for(short i=0;i<CPIH[cp]->num_fonts;++i)\r
+       {\r
+               if(SFH[cp][i]->height==wys)\r
+               {\r
+                       h=i;\r
+                       break;\r
+               }\r
+       }\r
+       switch(wys)\r
+       {\r
+       case 8:\r
+               return delF8(h);\r
+       case 14:\r
+               return delF14(h);\r
+       case 16:\r
+               return delF16(h);\r
+       default:\r
+               sprintf(err,"510:%u WT*?",h);\r
+               return 510;\r
+       }\r
+}\r
+int newCP2(short CP,short h)\r
+{\r
+       int t;\r
+       if(!(CPEH[FIH->num_codepages] = new CodePageEntryHeader))\r
+       {\r
+               sprintf(err,"316:Not enough memory for CPEH[%d]",FIH->num_codepages);\r
+               return 316;\r
+       }\r
+       if(!(CPIH[FIH->num_codepages] = new CodePageInfoHeader))\r
+       {\r
+               delete CPEH[FIH->num_codepages];\r
+               CPEH[FIH->num_codepages] = NULL;\r
+               sprintf(err,"316:Not enough memory for CPIH[%d]",FIH->num_codepages);\r
+               return 316;\r
+       }\r
+       CPEH[FIH->num_codepages]->cpeh_size=0x1c;\r
+       CPEH[FIH->num_codepages]->device_type=1;\r
+       strcpy(CPEH[FIH->num_codepages]->device_name,"EGA    ");\r
+       CPEH[FIH->num_codepages]->device_name[7]=' ';\r
+       CPEH[FIH->num_codepages]->codepage=CP;\r
+       strcpy(CPEH[FIH->num_codepages]->reserved,"\0\0\0\0\0");\r
+       CPIH[FIH->num_codepages]->version=1;\r
+       CPIH[FIH->num_codepages]->num_fonts=0;\r
+       switch(h)\r
+       {\r
+       case 8:\r
+               t= newF8(FIH->num_codepages);\r
+               break;\r
+       case 14:\r
+               t= newF14(FIH->num_codepages);\r
+               break;\r
+       case 16:\r
+               t = newF16(FIH->num_codepages);\r
+               break;\r
+       case 0:\r
+               t= newF16(FIH->num_codepages);\r
+               if(t!=0)\r
+                       break;\r
+               t= newF14(FIH->num_codepages);\r
+               if(t!=0)\r
+               {\r
+                       delete SFB16[FIH->num_codepages];\r
+                       delete SFH[FIH->num_codepages][0];\r
+                       SFB16[FIH->num_codepages] = NULL;\r
+                       SFH[FIH->num_codepages][0] = NULL;\r
+                       byo16[FIH->num_codepages] = 0;\r
+                       break;\r
+               }\r
+               t= newF8(FIH->num_codepages);\r
+               if(t!=0)\r
+               {\r
+                       delete SFB16[FIH->num_codepages];\r
+                       delete SFB14[FIH->num_codepages];\r
+                       delete SFH[FIH->num_codepages][0];\r
+                       delete SFH[FIH->num_codepages][1];\r
+                       SFB16[FIH->num_codepages] = NULL;\r
+                       SFB14[FIH->num_codepages] = NULL;\r
+                       SFH[FIH->num_codepages][0] = NULL;\r
+                       SFH[FIH->num_codepages][1] = NULL;\r
+                       byo16[FIH->num_codepages] = 0;\r
+                       byo14[FIH->num_codepages] = 0;\r
+                       break;\r
+               }\r
+               break;\r
+       default:\r
+               sprintf(err,"510:%u WT*?",h);\r
+               t = 510;\r
+       }\r
+       if(t!=0)\r
+       {\r
+               delete CPIH[FIH->num_codepages];\r
+               delete CPEH[FIH->num_codepages];\r
+               CPEH[FIH->num_codepages] = NULL;\r
+               CPEH[FIH->num_codepages] = NULL;\r
+               return t;\r
+       }\r
+       ++(FIH->num_codepages);\r
+       sprintf(err,"0:OK");\r
+       return 0;\r
+}\r
+       \r
+int newCPI2(short CP, short h)\r
+{\r
+       int t;\r
+       FFH=new FontFileHeader;\r
+       if(!FFH)\r
+       {\r
+               sprintf(err,"316:Not enough memory for FFH");\r
+               return 316;\r
+       }\r
+       FFH->id0=0xFF;\r
+       strcpy(FFH->id,"FONT   ");\r
+       strcpy(FFH->reserved,"\0\0\0\0\0\0\0");\r
+       FFH->pnum=1;\r
+       FFH->ptyp=1;\r
+       FIH=new FontInfoHeader;\r
+       if(!FIH)\r
+       {\r
+               sprintf(err,"316:Not enough memory for FIH");\r
+               deleteCPI(0);\r
+               return 316;\r
+       }\r
+       FIH->num_codepages=0;\r
+       t = newCP2(CP,h);\r
+       if (t!=0)\r
+       {\r
+               deleteCPI(1);\r
+               return t;\r
+       }\r
+       sprintf(err,"0:Ok");\r
+       return 0;\r
+}\r
+       \r
+int newCPI()\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
+       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," ±First codepage number:±±±±±±±±±±±±±±±±±±± ");\r
        outtextxy(144,192," ±                                        ± ");\r
        outtextxy(144,200," ±                                        ± ");\r
        outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
 \r
-       scanf("%d",&CPEH[cp].codepage);\r
-       closegraph();\r
-       initgraph(&kart16,&tryb16,"");\r
-       return  CPEH[cp].codepage;\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
+\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
+       if(h!=0&&h!=8&&h!=14&&h!=16)\r
+       {\r
+               sprintf(err,"310:Wrong height (%u)",h);\r
+               return 310;\r
+       }\r
+       return newCPI2(CP,h);\r
+}\r
+\r
+\r
+       \r
+int newCP()\r
+{\r
+       short CP,h;\r
+       char temp[51];\r
+       if(FIH->num_codepages>=16)\r
+       {\r
+               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
+       for(short i=0;i<FIH->num_codepages;++i)\r
+       {\r
+               if(CP==CPEH[i]->codepage)\r
+               {\r
+                       sprintf(err,"314:cp%03u already in CPEH[%u]",CP,i);\r
+                       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
+       if(h!=0&&h!=8&&h!=14&&h!=16)\r
+       {\r
+               sprintf(err,"310:Wrong height (%u)",h);\r
+               return 310;\r
+       }\r
+       return newCP2(CP,h);\r
+}\r
+int newF()\r
+{\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
+       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
+\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
+       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
+       for(short i=0;i<FIH->num_codepages;++i)\r
+       {\r
+               if(CP==CPEH[i]->codepage&&i!=cp)\r
+               {\r
+                       sprintf(err,"314:cp%03u already in CPEH[%u]",CP,i);\r
+                       return 314;\r
+               }\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
-int bnd()\r
+\r
+int bnd4()\r
 {\r
-       printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\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
@@ -1155,36 +2308,22 @@ int bnd()
 \r
        setcolor(BROWN);\r
 \r
-       outtextxy(144,184," ±Nie wczytano pliku CPI±±±±±±±±±±±±±±±±±±± ");\r
+       outtextxy(144,184," ±Font not deleted±±±±±±±±±±±±±±±±±±±±±±±±± ");\r
        outtextxy(144,192," ±                                        ± ");\r
        outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±jeszcze raz?(t/n)± ");\r
+       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± ");\r
 \r
        printf("%s",err);\r
-       int a;\r
-       for(;;)\r
-       {\r
-               a=bioskey(_KEYBRD_READ);\r
-               if(a/0x100==0x14)\r
-               {\r
-                       closegraph();\r
-                       initgraph(&kart16,&tryb16,"");\r
-                       return 0;\r
-               }\r
-               if(a/0x100==0x31)\r
-               {\r
-                       closegraph();\r
-                       initgraph(&kart16,&tryb16,"");\r
-                       return 1;\r
-               }\r
-\r
-       }\r
-\r
-\r
+       bioskey(_KEYBRD_READ);\r
+//     closegraph();\r
+//     initgraph(&kart16,&tryb16,"");\r
+       return 0;\r
 }\r
-int bnd2()\r
+\r
+int bnd7()\r
 {\r
-       printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\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
@@ -1194,36 +2333,48 @@ int bnd2()
 \r
        setcolor(BROWN);\r
 \r
-       outtextxy(144,184," ±Nie zapisano pliku CPI±±±±±±±±±±±±±±±±±±± ");\r
+       outtextxy(144,184," ±Codepage not deleted±±±±±±±±±±±±±±±±±±±±± ");\r
        outtextxy(144,192," ±                                        ± ");\r
        outtextxy(144,200," ±                                        ± ");\r
-       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±jeszcze raz?(t/n)± ");\r
+       outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± ");\r
 \r
        printf("%s",err);\r
-       int a;\r
-       for(;;)\r
-       {\r
-               a=bioskey(_KEYBRD_READ);\r
-               if(a/0x100==0x14)\r
-               {\r
-                       closegraph();\r
-                       initgraph(&kart16,&tryb16,"");\r
-                       return 0;\r
-               }\r
-               if(a/0x100==0x31)\r
-               {\r
-                       closegraph();\r
-                       initgraph(&kart16,&tryb16,"");\r
-                       return 1;\r
-               }\r
+       bioskey(_KEYBRD_READ);\r
+//     closegraph();\r
+//     initgraph(&kart16,&tryb16,"");\r
+       return 0;\r
+}\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
-       printf("\n\n\n\n\n\n\n\n\n\n\n\n                    ");\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
@@ -1240,8 +2391,8 @@ int pmc()
 \r
        printf("%s",err);\r
        bioskey(_KEYBRD_READ);\r
-       closegraph();\r
-       initgraph(&kart16,&tryb16,"");\r
+//     closegraph();\r
+//     initgraph(&kart16,&tryb16,"");\r
        return 0;\r
 \r
 \r
@@ -1252,48 +2403,51 @@ int pmc()
 \r
 int main(int argc,char* argv[])\r
 {\r
-\r
-\r
-\r
-\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
-       ramka8();\r
-       ramka14();\r
-       ramka16();\r
-       lit8();\r
-       lit14();\r
-       lit16();\r
-       lin8();\r
-       lin14();\r
-       lin16();\r
+       //new8();\r
+       //menu8();\r
+       //cpwys();\r
        setcolor(RED);\r
-       outtextxy(184,472,"odczyt");\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
+               {\r
+                       if (bnd()==0)\r
+                               status=otw();\r
+                       else\r
+                       {\r
+                               break;\r
+                               //closegraph();\r
+                               //deleteCPI();\r
+                               //return status;\r
+                       }\r
+               }\r
+               any=!status;\r
        }\r
        else\r
-               status=otw();\r
-       while(status!=0)\r
-       {\r
-               if (bnd()==0)\r
-                       status=otw();\r
-               else\r
-                       return status;\r
-       }\r
-\r
-\r
-\r
+               any=0;\r
+       \r
+       \r
+       if(byo8[0])\r
+               wys=8;\r
+       else if(byo16[0])\r
+               wys=16;\r
+       else if(byo14[0])\r
+               wys=14;\r
+       \r
 \r
        new8();\r
        menu8();\r
@@ -1313,13 +2467,15 @@ int main(int argc,char* argv[])
                key=bioskey(_KEYBRD_READ);\r
                if(tab==0)\r
                {\r
-                       if(key/0x100==0x48)\r
+                       if((key&0xFF00)==0x4800&&any)\r
                        {\r
                                //w g¢r©\r
-                               if(cury==0)\r
-                                       cury=wys-1;\r
-                               else\r
-                                       --cury;\r
+                               //if(cury==0)\r
+                               //      cury=wys-1;\r
+                               //else\r
+                               //      --cury;\r
+                               cury+=wys-1;\r
+                               cury%=wys;\r
                                if(wys==8)\r
                                        lit8();\r
                                if(wys==14)\r
@@ -1327,13 +2483,15 @@ int main(int argc,char* argv[])
                                if(wys==16)\r
                                        lit16();\r
                        }\r
-                       if(key/0x100==0x50)\r
+                       if((key&0xFF00)==0x5000&&any)\r
                        {\r
                                //w d¢\88\r
-                               if(cury==wys-1)\r
-                                       cury=0;\r
-                               else\r
-                                       ++cury;\r
+                               //if(cury==wys-1)\r
+                               //      cury=0;\r
+                               //else\r
+                               //      ++cury;\r
+                               ++cury;\r
+                               cury%=wys;\r
                                if(wys==8)\r
                                        lit8();\r
                                if(wys==14)\r
@@ -1342,13 +2500,15 @@ int main(int argc,char* argv[])
                                        lit16();\r
 \r
                        }\r
-                       if(key/0x100==0x4b)\r
+                       if((key&0xFF00)==0x4b00&&any)\r
                        {\r
                                //w lewo\r
-                               if(curx==0)\r
-                                       curx=7;\r
-                               else\r
-                                       --curx;\r
+                               //if(curx==0)\r
+                               //      curx=7;\r
+                               //else\r
+                               //      --curx;\r
+                               --curx;\r
+                               curx&=0x7;\r
                                if(wys==8)\r
                                        lit8();\r
                                if(wys==14)\r
@@ -1356,13 +2516,15 @@ int main(int argc,char* argv[])
                                if(wys==16)\r
                                        lit16();\r
                        }\r
-                       if(key/0x100==0x4d)\r
+                       if((key&0xFF00)==0x4d00&&any)\r
                        {\r
                                //w prawo\r
-                               if(curx==7)\r
-                                       curx=0;\r
-                               else\r
-                                       ++curx;\r
+                               //if(curx==7)\r
+                               //      curx=0;\r
+                               //else\r
+                               //      ++curx;\r
+                               ++curx;\r
+                               curx&=0x7;\r
                                if(wys==8)\r
                                        lit8();\r
                                if(wys==14)\r
@@ -1370,7 +2532,7 @@ int main(int argc,char* argv[])
                                if(wys==16)\r
                                        lit16();\r
                        }\r
-                       if (key/0x100==0x39)\r
+                       if ((key&0xFF00)==0x3900&&any)\r
                        {\r
                                //spacja\r
                                if(wys==8)\r
@@ -1392,7 +2554,7 @@ int main(int argc,char* argv[])
                                        lin16();\r
                                }\r
                        }\r
-                       if (key/0x100==0x0e)\r
+                       if ((key&0xFF00)==0x0e00&&any)\r
                        {\r
                                //backspace\r
                                if(wys==8)\r
@@ -1414,7 +2576,7 @@ int main(int argc,char* argv[])
                                        lin16();\r
                                }\r
                        }\r
-                       if (key/0x100==0x1c)\r
+                       if ((key&0xFF00)==0x1c00&&any)\r
                        {\r
                                //enter\r
                                if(wys==8)\r
@@ -1441,13 +2603,15 @@ int main(int argc,char* argv[])
                }\r
                else\r
                {\r
-                       if(key/0x100==0x48)\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
+                               //if(lit<16)\r
+                               //      lit=(0xf0+lit%16);\r
+                               //else\r
+                               //      lit=((lit/16-1)*16+lit%16);\r
+                               lit-=16;\r
+                               lit&=0xFF;\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
@@ -1459,13 +2623,15 @@ int main(int argc,char* argv[])
                                        lin16();\r
 \r
                        }\r
-                       if(key/0x100==0x50)\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
+                               //if(lit>=0xf0)\r
+                               //      lit=(0+lit%16);\r
+                               //else\r
+                               //      lit=((lit/16+1)*16+lit%16);\r
+                               lit+=16;\r
+                               lit&=0xFF;\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
@@ -1476,13 +2642,15 @@ int main(int argc,char* argv[])
                                if (wys==16)\r
                                        lin16();\r
                        }\r
-                       if(key/0x100==0x4b)\r
+                       if((key&0xFF00)==0x4b00&&any)\r
                        {\r
                                //w lewo l\r
-                               if(lit%16==0)\r
-                                       lit+=15;\r
-                               else\r
-                                       --lit;\r
+                               //if(lit%16==0)\r
+                               //      lit+=15;\r
+                               //else\r
+                               //      --lit;\r
+                               --lit;\r
+                               lit&=0xFF;\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
@@ -1493,14 +2661,16 @@ int main(int argc,char* argv[])
                                if (wys==16)\r
                                        lin16();\r
                        }\r
-                       if(key/0x100==0x4d)\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
+                               //if(lit%16==15)\r
+                               //      lit-=15;\r
+                               //else\r
+                               //      ++lit;\r
+                               ++lit;\r
+                               lit&=0xFF;\r
                                lit8();\r
                                lit14();\r
                                lit16();\r
@@ -1512,7 +2682,7 @@ int main(int argc,char* argv[])
                                        lin16();\r
                        }\r
                }\r
-               if (key/0x100==0x0f)\r
+               if ((key&0xFF00)==0x0f00&&any)\r
                {\r
                        //tab\r
                        if(tab==0)\r
@@ -1523,13 +2693,43 @@ int main(int argc,char* argv[])
                        ramka14();\r
                        ramka16();\r
                }\r
-               if (key/0x100==0x51)\r
+               if ((key&0xFF00)==0x5100&&any)\r
                {\r
                        //cp++\r
-                       if(cp==FIH.num_codepages-1)\r
-                               cp=0;\r
-                       else\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
+                       if(wys==8&&byo8[cp]==0)\r
+                       {\r
+                               if(byo14[cp]!=0)\r
+                                       wys=14;\r
+                               else if(byo16[cp]!=0)\r
+                                       wys=16;\r
+                       }\r
+                       \r
+                       else if(wys==14&&byo14[cp]==0)\r
+                       {\r
+                               if(byo16[cp]!=0)\r
+                                       wys=16;\r
+                               else if(byo8[cp]!=0)\r
+                                       wys=8;\r
+                       }\r
+                       \r
+                       else if(wys==16&&byo16[cp]==0)\r
+                       {\r
+                               if(byo8[cp]!=0)\r
+                                       wys=8;\r
+                               else if(byo14[cp]!=0)\r
+                                       wys=14;\r
+                       }\r
+                       cury&=0x7;\r
+                       ramka8();\r
+                       ramka14();\r
+                       ramka16();\r
                        cpwys();\r
                        lin8();\r
                        lin14();\r
@@ -1537,15 +2737,45 @@ int main(int argc,char* argv[])
                        lit8();\r
                        lit14();\r
                        lit16();\r
-\r
+                       \r
                }\r
-               if (key/0x100==0x49)\r
+               if ((key&0xFF00)==0x4900&&any)\r
                {\r
                        //cp--\r
-                       if(cp==0)\r
-                               cp=FIH.num_codepages-1;\r
-                       else\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
+                       if(wys==8&&byo8[cp]==0)\r
+                       {\r
+                               if(byo14[cp]!=0)\r
+                                       wys=14;\r
+                               else if(byo16[cp]!=0)\r
+                                       wys=16;\r
+                       }\r
+                       \r
+                       else if(wys==14&&byo14[cp]==0)\r
+                       {\r
+                               if(byo16[cp]!=0)\r
+                                       wys=16;\r
+                               else if(byo8[cp]!=0)\r
+                                       wys=8;\r
+                       }\r
+                       \r
+                       else if(wys==16&&byo16[cp]==0)\r
+                       {\r
+                               if(byo8[cp]!=0)\r
+                                       wys=8;\r
+                               else if(byo14[cp]!=0)\r
+                                       wys=14;\r
+                       }\r
+                       cury&=0x7;\r
+                       ramka8();\r
+                       ramka14();\r
+                       ramka16();\r
                        cpwys();\r
                        lin8();\r
                        lin14();\r
@@ -1555,7 +2785,7 @@ int main(int argc,char* argv[])
                        lit16();\r
 \r
                }\r
-               if (key/0x100==0x52)\r
+               if ((key&0xFF00)==0x4700&&any)\r
                {\r
                        //wys--\r
                        if(wys==8)\r
@@ -1619,8 +2849,11 @@ int main(int argc,char* argv[])
                        lit8();\r
                        lit14();\r
                        lit16();\r
+                       lin8();\r
+                       lin14();\r
+                       lin16();\r
                }\r
-               if (key/0x100==0x53)\r
+               if ((key&0xFF00)==0x4f00&&any)\r
                {\r
                        //wys++\r
                        if(wys==8)\r
@@ -1684,14 +2917,43 @@ int main(int argc,char* argv[])
                        lit8();\r
                        lit14();\r
                        lit16();\r
+                       lin8();\r
+                       lin14();\r
+                       lin16();\r
                }\r
-               if (key/0x100==0x3b)\r
+               \r
+               if ((key&0xFF00)==0x3b00)\r
                {\r
-                       //pomoc\r
+                       //new CPI\r
                        setcolor(RED);\r
-                       outtextxy(24,472,"pomoc");\r
-                       sprintf(err,"Przeczytaj plik \"napisy.txt\"");\r
-                       pmc();\r
+                       outtextxy(16,472,"new");\r
+                       deleteCPI();\r
+                       status=newCPI();\r
+                       while(status!=0)\r
+                       {\r
+                               if (bnd8()==0)\r
+                                       status=newCPI();\r
+                               else\r
+                               {\r
+                                       break;\r
+                                       //closegraph();\r
+                                       //deleteCPI();\r
+                                       //return status;\r
+                               }\r
+                       }\r
+                       any=!status;\r
+                       if(any)\r
+                       {\r
+                               strcpy(nazwap,"new CPI");\r
+                               cp=0;\r
+                               if(byo8[0])\r
+                                       wys=8;\r
+                               else if(byo16[0])\r
+                                       wys=16;\r
+                               else if(byo14[0])\r
+                                       wys=14;\r
+                               cury%=8;\r
+                       }\r
                        new8();\r
                        menu8();\r
                        cpwys();\r
@@ -1704,15 +2966,13 @@ int main(int argc,char* argv[])
                        lit8();\r
                        lit14();\r
                        lit16();\r
-                       cury%=8;\r
-\r
-\r
+                       \r
                }\r
-               if (key/0x100==0x3c)\r
+               if ((key&0xFF00)==0x3c00&&any)\r
                {\r
                        //zapisz\r
                        setcolor(RED);\r
-                       outtextxy(104,472,"zapis");\r
+                       outtextxy(72,472,"save");\r
                        status=zap();\r
                        while(status!=0)\r
                        {\r
@@ -1739,19 +2999,35 @@ int main(int argc,char* argv[])
                }\r
 \r
 \r
-               if (key/0x100==0x3d)\r
+               if ((key&0xFF00)==0x3d00)\r
                {\r
                        //wczytaj\r
                        setcolor(RED);\r
-                       outtextxy(184,472,"odczyt");\r
+                       outtextxy(136,472,"load");\r
+                       deleteCPI();\r
                        status=otw();\r
                        while(status!=0)\r
                        {\r
                                if (bnd()==0)\r
                                        status=otw();\r
                                else\r
-                                       return status;\r
+                               {\r
+                                       break;\r
+                                       //closegraph();\r
+                                       //deleteCPI();\r
+                                       //return status;\r
+                               }\r
                        }\r
+                       any=!status;\r
+                       cp=0;\r
+                       if(byo8[0])\r
+                               wys=8;\r
+                       else if(byo16[0])\r
+                               wys=16;\r
+                       else if(byo14[0])\r
+                               wys=14;\r
+                       cury%=8;\r
+\r
                        new8();\r
                        menu8();\r
                        cpwys();\r
@@ -1764,17 +3040,14 @@ int main(int argc,char* argv[])
                        lit8();\r
                        lit14();\r
                        lit16();\r
-                       cp=0;\r
-                       cury%=8;\r
-\r
 \r
                }\r
-               if(key/0x100==0x3e)\r
+               if((key&0xFF00)==0x3e00&&any)\r
                {\r
                        {\r
                        //zapisz+system\r
                        setcolor(RED);\r
-                       outtextxy(104,472,"zapis                u¾ycie w systemie");\r
+                       outtextxy(72,472,"save            use");\r
                        status=zap();\r
                        while(status!=0)\r
                        {\r
@@ -1785,10 +3058,15 @@ int main(int argc,char* argv[])
                        }\r
                        if(status==0)\r
                        {\r
-                               sprintf(err,"mode con:cp prep=((%d) %s )",CPEH[cp].codepage,nazwap);\r
+                               sprintf(err,"mode con:cp prep=((%u) %s)",CPEH[cp]->codepage,nazwap);\r
+                               puts(err);\r
                                system(err);\r
-                               sprintf(err,"mode con:cp sel=%d",CPEH[cp].codepage);\r
+                               sprintf(err,"mode con:cp sel=%u",CPEH[cp]->codepage);\r
+                               puts(err);\r
                                system(err);\r
+                               delay(5000);\r
+                               closegraph();\r
+                               initgraph(&kart16,&tryb16,"");\r
 \r
                        }\r
                        new8();\r
@@ -1811,13 +3089,14 @@ int main(int argc,char* argv[])
 \r
 \r
                }\r
-               if (key/0x100==0x3f)\r
+               if ((key&0xFF00)==0x3f00&&any)\r
                {\r
                        //zmiana numeru\r
                        setcolor(RED);\r
-                       outtextxy(448,472,"zmiana numeru");\r
-                       zmn();\r
-\r
+                       outtextxy(256,472,"number");\r
+                       status=zmn();\r
+                       if(status!=0)\r
+                               bnd5();\r
                        new8();\r
                        menu8();\r
                        cpwys();\r
@@ -1830,21 +3109,191 @@ int main(int argc,char* argv[])
                        lit8();\r
                        lit14();\r
                        lit16();\r
-                       cury%=8;\r
-\r
-\r
                }\r
-               if (key/0x100==0x40)\r
+               if ((key&0xFF00)==0x4000&&any)\r
+               {\r
+                       //new font\r
+                       setcolor(RED);\r
+                       outtextxy(336,472,"newF");\r
+                       status=newF();\r
+                       if(status!=0)\r
+                               bnd3();\r
+                       offset();\r
+                       new8();\r
+                       menu8();\r
+                       cpwys();\r
+                       ramka8();\r
+                       ramka14();\r
+                       ramka16();\r
+                       lin8();\r
+                       lin14();\r
+                       lin16();\r
+                       lit8();\r
+                       lit14();\r
+                       lit16();\r
+                       \r
+               }\r
+               if ((key&0xFF00)==0x4100&&any)\r
+               {\r
+                       //new CP\r
+                       setcolor(RED);\r
+                       outtextxy(400,472,"newCP");\r
+                       status=newCP();\r
+                       if(status!=0)\r
+                               bnd6();\r
+                       else\r
+                               cp=FIH->num_codepages-1;\r
+                       if(wys==8&&byo8[cp]==0)\r
+                       {\r
+                               if(byo14[cp]!=0)\r
+                                       wys=14;\r
+                               else if(byo16[cp]!=0)\r
+                                       wys=16;\r
+                       }\r
+                       \r
+                       else if(wys==14&&byo14[cp]==0)\r
+                       {\r
+                               if(byo16[cp]!=0)\r
+                                       wys=16;\r
+                               else if(byo8[cp]!=0)\r
+                                       wys=8;\r
+                       }\r
+                       \r
+                       else if(wys==16&&byo16[cp]==0)\r
+                       {\r
+                               if(byo8[cp]!=0)\r
+                                       wys=8;\r
+                               else if(byo14[cp]!=0)\r
+                                       wys=14;\r
+                       }\r
+                       cury&=0x7;\r
+                       offset();\r
+                       new8();\r
+                       menu8();\r
+                       cpwys();\r
+                       ramka8();\r
+                       ramka14();\r
+                       ramka16();\r
+                       lin8();\r
+                       lin14();\r
+                       lin16();\r
+                       lit8();\r
+                       lit14();\r
+                       lit16();\r
+                       \r
+               }\r
+               if ((key&0xFF00)==0x4200&&any)\r
+               {\r
+                       //delete font\r
+                       setcolor(RED);\r
+                       outtextxy(472,472,"delF");\r
+                       status=delF();\r
+                       if(status!=0)\r
+                               bnd4();\r
+                       offset();\r
+                       \r
+                       if(wys==8&&byo8[cp]==0)\r
+                       {\r
+                               if(byo14[cp]!=0)\r
+                                       wys=14;\r
+                               else if(byo16[cp]!=0)\r
+                                       wys=16;\r
+                       }\r
+                       \r
+                       else if(wys==14&&byo14[cp]==0)\r
+                       {\r
+                               if(byo16[cp]!=0)\r
+                                       wys=16;\r
+                               else if(byo8[cp]!=0)\r
+                                       wys=8;\r
+                       }\r
+                       \r
+                       else if(wys==16&&byo16[cp]==0)\r
+                       {\r
+                               if(byo8[cp]!=0)\r
+                                       wys=8;\r
+                               else if(byo14[cp]!=0)\r
+                                       wys=14;\r
+                       }\r
+                       cury&=0x7;\r
+                       new8();\r
+                       menu8();\r
+                       cpwys();\r
+                       ramka8();\r
+                       ramka14();\r
+                       ramka16();\r
+                       lin8();\r
+                       lin14();\r
+                       lin16();\r
+                       lit8();\r
+                       lit14();\r
+                       lit16();\r
+                       \r
+               }\r
+               if ((key&0xFF00)==0x4300&&any)\r
+               {\r
+                       //delete CP\r
+                       setcolor(RED);\r
+                       outtextxy(536,472,"delCP");\r
+                       status=delCP();\r
+                       if(status!=0)\r
+                               bnd7();\r
+                       offset();\r
+                       \r
+                       cp%=FIH->num_codepages;\r
+                       \r
+                       if(wys==8&&byo8[cp]==0)\r
+                       {\r
+                               if(byo14[cp]!=0)\r
+                                       wys=14;\r
+                               else if(byo16[cp]!=0)\r
+                                       wys=16;\r
+                       }\r
+                       \r
+                       else if(wys==14&&byo14[cp]==0)\r
+                       {\r
+                               if(byo16[cp]!=0)\r
+                                       wys=16;\r
+                               else if(byo8[cp]!=0)\r
+                                       wys=8;\r
+                       }\r
+                       \r
+                       else if(wys==16&&byo16[cp]==0)\r
+                       {\r
+                               if(byo8[cp]!=0)\r
+                                       wys=8;\r
+                               else if(byo14[cp]!=0)\r
+                                       wys=14;\r
+                       }\r
+                       cury&=0x7;\r
+                       new8();\r
+                       menu8();\r
+                       cpwys();\r
+                       ramka8();\r
+                       ramka14();\r
+                       ramka16();\r
+                       lin8();\r
+                       lin14();\r
+                       lin16();\r
+                       lit8();\r
+                       lit14();\r
+                       lit16();\r
+                       \r
+               }\r
+               if ((key&0xFF00)==0x4400)\r
                {\r
                        //koniec\r
                        setcolor(RED);\r
-                       outtextxy(592,472,"koniec");\r
-                       delay(1000);\r
+                       outtextxy(616,472,"end");\r
                        break;\r
                }\r
+               while(bioskey(_KEYBRD_READY))\r
+               {\r
+                       bioskey(_KEYBRD_READ);\r
+               }\r
        }\r
 \r
-\r
+       deleteCPI();\r
        closegraph();\r
        return 0;\r
 }
\ No newline at end of file
index 7e450b1e16e06f92fbb5324b3563942beecf1b6c..8db5208dbaa19f940f9620535d42ab44194f9104 100644 (file)
Binary files a/NAPISY.PRJ and b/NAPISY.PRJ differ
diff --git a/NAPISY.TXT b/NAPISY.TXT
deleted file mode 100644 (file)
index c3e00a3..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-        Edytor napis¢w. wersja 1.0 Balthasar Szczepaäski\r
-\r
-        1.opis programu\r
-        2.sterowanie\r
-        3.zmiany\r
-        4.co nie dzia\88a\r
-        5.wyja\98nienie b\88©d¢w\r
-        6.kontakt\r
-        7.lista plik¢w\r
-\r
-        ==============================================================\r
-\r
-        1.Opis programu\r
-\r
-        Program "Edytor napis¢w" s\88u¾y do edycji plik¢w .cpi, w\r
-        kt¢rych s¥ zapisane informacje o stronach kodowych i kszta\88cie\r
-        liter na ekranie w trybie tekstowym. Za pomoc¥ tego programu\r
-        mo¾na wczytywa\86 i zapisywa\86 pliki cpi, zmienia\86 kszta\88t liter,\r
-        i numer strony kodowej, oraz za\88adowa\86 czcionk© do systemu.\r
-        Program zosta\88 skompilowany za pomoc¥ Turbo C++ 3.0.\r
-\r
-        Program potrafi obs\88u¾y\86 format "FONT   " wyst©puj¥cy w\r
-        systemach MS-DOS, IBM PC-DOS, Microsoft Windows 1.x, 2.x, 3.x,\r
-        9x, ME i innych. Nie potrafi obs\88u¾y\86 formatu "DRFONT "\r
-        wyst©puj¥cego w systemie DR-DOS, ani "FONT.NT" wyst©puj¥cego w\r
-        systemach Microsoft Windows NT, 2000, XP, Vista, 7. Natomiast\r
-        w tych systemach b©d¥ dzia\88a\88y pliki w formacie "FONT   ",\r
-        tak¾e te utworzone za pomoc¥ tego programu. Liczba stron\r
-        kodowych w pliku nie mo¾e przekroczy\86 6, szeroko\98\86 liter musi\r
-        wynosi\86 8, wysoko\98\86 liter nie mo¾e mie\86 innych warto\98ci ni¾\r
-        8,14,albo 16,przy czym wysoko\98ci nie mog¥ si© powtarza\86 w\r
-        obr©bie jednej strony kodowej, liczba znak¢w musi wynosi\86 256.\r
-\r
-        Program powinien dzia\88a\86 w systemach DOS* i Windows** na\r
-        komputerze z kart¥ graficzn¥ VGA lub p¢«niejsz¥. Mo¾e dzia\88a\86\r
-        na emulatorze.***\r
-\r
-        *Nie wiem, czy zadzia\88a w DOSie starszym ni¾ 3.3, zreszt¥ nie\r
-        ma sensu u¾ywa\86 Edytora napis¢w w starszych wersjach DOSa,\r
-        poniewa¾ nie obs\88uguj¥ stron kodowych.\r
-\r
-        **W systemie Windows 98 i poprzednich nie by\88o ¾adnych\r
-        problem¢w.\r
-\r
-        W systemie Windows XP, przy niekt¢rych kartach graficznych\r
-        program wy\88¥cza\88 si© natychmiast po w\88¥czeniu, ale to by\88o w\r
-        wersji beta w trybie CGA, w tej wersji powinno dzia\88a\86. Je¾eli\r
-        nie dzia\88a trzeba uruchomi\86 system w trybie awaryjnym.\r
-\r
-        W systemie Windows Vista program mo¾e zosta\86 zamkni©ty przez\r
-        system z komentarzem "Ten system nie obs\88uguje trybu\r
-        pe\88noekranowego.OK". W takim razie nale¾y zast¥pi\86 sterownik\r
-        karty graficzej na wersj© przeznaczon¥ dla Windowsa XP, albo\r
-        u¾ywa\86 programu przy systemie w\88¥czonym w trybie awaryjnym.\r
-        Je¾eli system nie pozwala zainstalowa\86 sterownika, trzeba\r
-        w\88¥czy\86 system w trybie awaryjnym i zalogowa\86 si© jako\r
-        Administraktor, a dopiero wtedy instalowa\86 sterownik. Czasami\r
-        system potrafi podmieni\86 sterownik spowrotem na poprzedni¥,\r
-        je\98li ta jest jeszcze na dysku.\r
-\r
-        W systemie Windows 7 sytuacja jest identyczna jak w Windowsie\r
-        Vista.\r
-\r
-        ***Jedynym emulatorem, w kt¢rym pr¢bowa\88em uruchomi\86 program,\r
-        jest DOSBox w wersji 0.63. Program zawiesza si© w nim chwil©\r
-        po uruchomieniu, przed narysowaniem ekranu. Nie wiem czy i jak\r
-        dzia\88a w innych wersjach DOSBoxa/innych emulatorach.\r
-\r
-        ==============================================================\r
-\r
-        2.Sterowanie\r
-\r
-        kursor w g¢re:                          strza\88ka w g¢r©\r
-        kursor w d¢\88:                           strza\88ka w d¢\88\r
-        kursor w lewo:                          strza\88ka w lewo\r
-        kursor w prawo:                         strza\88ka w prawo\r
-        prze\88¥cznik rysowania i wybierania:     tabulator\r
-        zamalowanie kratki:                     enter\r
-        zmazanie kratki:                        backspace\r
-        zmiana stanu kratki:                    spacja\r
-        prze\88¥czanie stron kodowych:            page up/page down\r
-        prze\88¥czanie wysoko\98ci liter:           insert/delete\r
-\r
-        klawisze F:\r
-\r
-        F1: pomoc, w tej wersji nie dzia\88a.\r
-\r
-        F2: zapis pliku pod podan¥ nazw¥, w razie b\88©du zapisu mo¾na\r
-            spr¢bowa\86 kolejny raz pod inn¥ nazw¥.\r
-\r
-        F3: wczytanie pliku z podanej nazwy, w razie b\88¥du odczyt\r
-            mo¾na spr¢bowa\86 odczyta\86 inny plik. Je¾eli ¾aden plik nie\r
-            b©dzie wszytany,program zostanie zamkni©ty.\r
-\r
-        F4: zapis pliku tak, jak przy F2 i wczytanie do systemu przy\r
-            u¾yciu polecenia systemowego MODE. Je¾eli zostanie\r
-            nadpisany plik u¾uwany domy\98lnie przez system do \88adowania\r
-            liter zmiany w systemie b©d¥ trwa\88e, nawet przy zapisie za\r
-            pomoc¥ F2. w przeciwnym razie zmiany b©d¥ chwilowe. Na\r
-            przyk\88ad je¾eli program jest uruchomiony w DOSie, zmiany\r
-            b©d¥ widoczne do ponownego uruchomienia systemu. Je\98l\r
-            program zosta\88 uruchomiony w Windowsie z wiersza poleceä,\r
-            zmiany b©d¥ widoczne a¾ do zamkni©cia tego wiersza poleceä\r
-            i tylko w trybie pe\88noekranowym. Je¾eli program zosta\88\r
-            uruchomiony przez klikni©cie na jego ikon©, albo na ikon©\r
-            pliku CPI, zmiany w systemie b©d¥ widoczne tylko do\r
-            wy\88¥czenia programu. W emulatorze najprawdopodobniej nie\r
-            b©dzie wida\86 ¾adnych zmian.\r
-\r
-        F5: zmiana numeru aktualnie wybranej strony kodowej. Numery\r
-            wi©ksze ni¾ trzycyfrowe mog¥ nie dzia\88a\86 w niekt¢rych\r
-            systemach.\r
-\r
-        F6: koniec programu.\r
-\r
-        ==============================================================\r
-       \r
-        3. Zmiany\r
-\r
-        beta:\r
-            To jest pierwsza dzia\88¥j¥ca wersja.\r
-        1.0:\r
-            -zmiana trybu CGA na VGA\r
-            -dzia\88a wysoko\98\86 14 i 16\r
-            -wszystkie wysoko\98ci s¥ widoczne na jednym ekranie\r
-            -mo¾na zapisywa\86 pliki i za\88adowa\86 stron© do systemu\r
-            -mo¾na otworzy\86 poda\86 plik do otwarcia jako argument w\r
-             wierszu poleceä\r
-            -wczytywane dane nie s¥ ju¾ wypisywane na ekranie\r
-            -Funkcje klawiszy F zgadzaj¥ si© z opisem na dole ekranu\r
-\r
-        ==============================================================\r
-\r
-        4. Co nie dzia\88a\r
-\r
-            -przy prze\88¥czaniu rozmiaru czcionki okna z zestawem\r
-             znak¢w nie s¥ aktualizowane\r
-            -nie ma pomocy wewn¥trz programu\r
-            -po wy\88¥czeniu z powodu b\88©du otwarcia pliku nie jest\r
-             wy\88¥czany tryb graficzny\r
-\r
-        ==============================================================\r
-\r
-        5. Wyja\98nienie b\88©d¢w\r
-\r
-        100: b\88¥d otwarcia pliku:\r
-            Nie da si© otworzy\86 pliku o podanej nazwie. \r
-\r
-        101: FFH.id0!=0xff\r
-            Identyfikator id0 ma inn¥ warto\98\86 ni¾ 0xff. Plik jest w\r
-            formacie "DRFONT " lub nie jest plikiem cpi.\r
-\r
-        102: FFH.id !="FONT   "\r
-            Plik jest w formacie "FONT.NT" lub "DRFONT ", albo innym,\r
-            nieznanym formacie.\r
-\r
-        103: FFH.pnum!=1\r
-            Jest wi©cej wska«nik¢w na FontInfoHeader -  plik jest w\r
-            nowym, nieznanym formacie lub nie ma ¾adnego wska«nika -\r
-            plik nie zawiera danych.\r
-\r
-        104: FFH.ptyp!=1\r
-            FontInfoHeader jest w nieznanym formacie.\r
-\r
-        105: FIH.num_codepages>6\r
-            Plik zawiera wi©cej ni¾ 6 stron kodowych.\r
-\r
-        106: CPEH.cpeh_size!=0x1c\r
-            CodePageEntryHeader ma nieprawid\88ow¥ d\88ugo\98\86.\r
-\r
-        107: CPEH.cpeh_device_type!=1\r
-            Czcionka nie jest czcionk¥ ekranow¥, jest przeznaczona na\r
-            drukark© lub inne urz¥dzenie.\r
-\r
-        108: CPIH.version!=1\r
-            W pliku w formacie "FONT   " umieszczono czcionk© w\r
-            formacie "FONT.NT", "DRFONT ", albo innym, nieznanym\r
-            formacie.\r
-\r
-        109: CPIH.num_fonts>3\r
-            Strona kodowa zawiera wi©cej ni¾ 3 czczionki.\r
-\r
-        110: SFH.height!=(8 || 14 || 16)\r
-            Czcionka ma nieodpowiedni¥ wysoko\98\86 znak¢w.\r
-\r
-        111: SFH.width!=8\r
-            Czcionka ma nieodpowiedni¥ szeroko\98\86 znak¢w.\r
-\r
-        112: SFH.num_chars!=256\r
-            Czcionka ma nieodpowiedni¥ ilo\98\86 znak¢w.\r
-\r
-        113: SFH.height==8 ju¾ by\88o\r
-            Wysoko\98\86 znak¢w==8 wyst©puje w tej stronie kodowej wi©cej\r
-            ni¾ raz\r
-\r
-        114: SFH.height==14 ju¾ by\88o\r
-            Wysoko\98\86 znak¢w==14 wyst©puje w tej stronie kodowej wi©cej\r
-            ni¾ raz.\r
-\r
-        115: SFH.height==16 ju¾ by\88o\r
-            Wysoko\98\86 znak¢w==16 wyst©puje w tej stronie kodowej wi©cej\r
-            ni¾ raz.\r
-\r
-        200: B\88¥d utworzenia pliku:\r
-            Nie da si© utworzy\86/zmodyfikowa\86 pliku o podanej nazwie.\r
-\r
-        Przeczytaj plik "napisy.txt"\r
-            Pomoc wewn¥trz programu nie dzia\88a, nale¾y przeczyta\86 ten\r
-            plik.\r
-\r
-        ==============================================================\r
-\r
-        6. Kontakt\r
-\r
-        e-mali:   balthasar_s@interia.pl\r
-        telefon:  +48664641394\r
-        www:      http://www.baltixy.w.interia.pl\r
-\r
-        ==============================================================\r
-\r
-        7. Lista plik¢w\r
-        \r
-        nazwa     |rozmiar\r
-        ----------+-------\r
-        EGAVGA.OBJ|   5658\r
-        NAPISY.TXT|   9388\r
-        NAPISY.EXE| 137623\r
-        NAPISY.CPP|  37801\r
-        NAPISY.PRJ|   4540\r
-\r
-        ==============================================================\r
diff --git a/readthis.txt b/readthis.txt
new file mode 100644 (file)
index 0000000..15e1089
--- /dev/null
@@ -0,0 +1,214 @@
+####    #       #\r
+#       #       #\r
+###   ### #  # ####  ##  ###     \r
+#    #  # #  #  #   #  # #        \r
+####  ###  ###  ##   ##  #                  \r
+             #                               #\r
+           ##  #  #   ##   ###   #   ###   ##   #   #\r
+               ## #  #  #  #  #  #  #__   #  #  #   #\r
+               # ##  ####  ###   #     #  #  #  # # #\r
+               #  #  #  #  #     #  ###    ##    # #   \r
+                                       Balthasar Szczepaäski\r
+Edytor napis¢w 1.1 - the cpi editor\r
+\r
+============================================================\r
+\r
+1. Description\r
+2. System requirements\r
+3. Features and limitations\r
+4. Controls\r
+5. Changes\r
+6. Planned features\r
+7. Known bugs\r
+8. Files\r
+9. Contact information\r
+\r
+============================================================\r
+\r
+1. Description\r
+\r
+This program is a CPI file editor. It can edit CPI files\r
+which are used by DOS to store codepage information.\r
+Compiled with Turbo C++ 3.0\r
+\r
+============================================================\r
+\r
+2. System requirements\r
+\r
+The program should be able to run on any IBM-PC compatible\r
+computer* with an IBM-VGA compatible video card and DOS** or\r
+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 5.0 - no problems\r
+ MS-DOS 7.1 - no problems\r
+ FreeDOS 1.0 - no problems\r
+ PTS-DOS - a small display error in dialog boxes\r
+\r
+***The program should run  without problems on any DOS-based\r
+version of Windows. It was tested on following systems:\r
+ Windows 3.11 for workgroups - no problems\r
+ Windows 98 SE - no problems\r
\r
+There can be problems in NT-based versions of windows:\r
+\r
+ On windows XP there can be display errors with some video\r
+ cards. It was tested on two computers with Windows XP SP3\r
+ and on one there were display errors. Propably, the video\r
+ card drivers are responsible for this.\r
+\r
+ On Windows Vista and 7, the system may refuse to launch\r
+ this program (or any other fullscreen DOS program) or not.\r
+ It depends on the video card driver.\r
+\r
+ On 64 bit systems the program will not run.\r
+\r
+****The program was tested only on DOSBox 0.63 and there\r
+were no problems. The previous version of the program (1.0)\r
+did not run on DOSBox 0.63. No other emulators were tested.\r
+\r
+============================================================\r
+\r
+3. Features and limitations\r
+\r
+The following file formats are supported:\r
+\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, 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
+3.DRFONT - used by DR-DOS\r
+4.CPX - used by FreeDOS. FreeDOS also supports the FONT\r
+  file format.\r
+\r
+Loaded files must meet the following restrictions:\r
+1.Number of all codepages cannot be 0 or bigger than 16.\r
+2.Codepages must have different numbers.\r
+3.Codepages cannot contain 0 or more than 3 fonts.\r
+4.Width of characters in a font must be equal to 8.\r
+5.Height of characters in font must be equal to 8, 14 or 16\r
+6.Fonts in a codepage must have different heights\r
+7.Fonts must contain exactly 256 characters\r
+8.All fonts must be screen fonts, not printer fonts.\r
+\r
+The following actions can be performed:\r
+ 1.creating a new CPI\r
+ 2.loading a CPI file\r
+ 3.saving a CPI file\r
+ 4.loading a codepage into VGAmemory using the mode command*\r
+ 5.editing the appearance of characters\r
+ 6.creating a new codepage\r
+ 7.changing a number of an existing codepage\r
+ 8.deleting an existing codepage\r
+ 9.creating a new font\r
+10.deleting an existing font\r
+\r
+*4 a CPI file is saved and used as a parameter to the DOS\r
+   "mode" command which loads a codepage into the video card\r
+   memory. This will not work if mode.com or display.sys are\r
+   not installed on the system. It will also not work on\r
+   Windows XP or newer. DOS will not be able to load the\r
+   codepage if the CPI file is bigger than 64KB. Do not use\r
+   this option if the codepage is not finished because you\r
+   will not be able to read anything you type anymore.\r
+   \r
+============================================================\r
+\r
+4. Controls\r
+\r
+create a new CPI - F1\r
+save a CPI file    F2\r
+load a CPI file    F3\r
+CP into VGA memory F4\r
+change CP number   F5\r
+new font           F6\r
+new codepage       F7\r
+delete a font      F8\r
+delete a codepage  F9\r
+close the program  F10\r
+\r
+move the cursor    arrow keys\r
+set a pixel        Enter\r
+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
+previous font      Home\r
+\r
+A file can also be opened using it's name as a command line\r
+parameter or by clicking its icon in Windows GUI.\r
+\r
+============================================================\r
+\r
+5. Changes\r
+\r
+beta:\r
+       First working version.\r
+1.0\r
+ - Change from CGA to VGA screen mode\r
+ - Support for character heights 14 and 16.\r
+ - Almost full FONT file format support\r
+ - Saving CPI files\r
+ - Command line parameter support\r
+ - Debug information removed from screen\r
+ - Fixed Function keys\r
+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
+ - Creating new CPI's\r
+ - Creating new codepages\r
+ - Creating new fonts\r
+ - Removing codepages\r
+ - Removing fonts\r
+ - Failed file load no longer closes the program\r
+ - Dynamic memory allocation\r
+ - Optimized functions\r
+ - Fixed bugs\r
+ - Language changed to English\r
+\r
+============================================================\r
+\r
+6. Planned features\r
+\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
+============================================================\r
\r
+7. Known bugs\r
\r
+none.\r
+\r
+============================================================\r
+\r
+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
+\r
+============================================================\r
+\r
+9. Contact information\r
+\r
+e-mali:   balthasar_s@interia.pl\r
+telefon:  +48502745442\r
+www:      http://www.baltixy.w.interia.pl\r
+\r
+============================================================\r