From 7f253f725f4c1627d114b986fd2d01915bf530fe Mon Sep 17 00:00:00 2001 From: b Date: Sat, 6 Jul 2013 18:03:00 +0200 Subject: [PATCH] - Optimised graphic procedures - everything works faster - Failed command line file load now closes the program without entering graphic mode - Fixed a bug that crashed the program when loading a file from a long path --- NAPISY.CPP | 2365 ++++++++++++++++++++------------------------------ NAPISY.PRJ | Bin 4607 -> 4605 bytes readthis.txt | 46 +- 3 files changed, 966 insertions(+), 1445 deletions(-) diff --git a/NAPISY.CPP b/NAPISY.CPP index 5b8f4dd..4ccbf74 100644 --- a/NAPISY.CPP +++ b/NAPISY.CPP @@ -7,8 +7,6 @@ #include #include -//#include - struct FontFileHeader { unsigned char id0; @@ -84,7 +82,7 @@ struct ScreenFontBitmap8 int status; char nazwap[256]="Nie_wybrano_pliku"; - char err[51]; + char err[256]; int kart16=VGA; @@ -106,8 +104,11 @@ struct ScreenFontBitmap8 int wys=8; int cp=0; int lit=0x42; + int pre; int curx=2; int cury=2; + int prex; + int prey; int key; int tab=0; int any=0; @@ -268,23 +269,14 @@ void deleteCPI(short st=6,short a=0,short b=0) } } -/*t pot(int a,int n) -{ - int y=1; - for(int i=0;icodepage,wys,nazwap); + { + if(strlen(nazwap)<52) + sprintf(cpw,"°cp%03u°8x%02d°%s°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys,nazwap); + else + sprintf(cpw,"°cp%03u°8x%02d°path too long°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°",CPEH[cp]->codepage,wys); + } else strcpy(cpw, "°No CPI open°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°"); setcolor(GREEN); outtextxy(0x78,0,cpw); - //sprintf(cpw,"%s°°°°°°°°°°°°°°°°°°°°°°°°°",nazwap); - //outtextxy(0xD8,0,nazwap); } void ramka8() @@ -360,629 +353,727 @@ void ramka16() setcolor(RED); rectangle(495,110,624,367); } -void lin14() +void lin14(int mode=0) { if(!any) return; + if(mode==3) + { + if(SFB14[cp]->lit[lit].lin[cury]&(0x80>>curx)) + putpixel(176+curx+(lit%16)*8,223+cury+(lit/16)*14,GREEN); + else + putpixel(176+curx+(lit%16)*8,223+cury+(lit/16)*14,BLACK); + return; + } char ab[2]="X"; - setcolor(RED); - outtextxy(176,215,"0123456789ABCDEF"); - outtextxy(168,226,"0"); - outtextxy(168,240,"1"); - outtextxy(168,254,"2"); - outtextxy(168,268,"3"); - outtextxy(168,282,"4"); - outtextxy(168,296,"5"); - outtextxy(168,310,"6"); - outtextxy(168,324,"7"); - outtextxy(168,338,"8"); - outtextxy(168,352,"9"); - outtextxy(168,366,"A"); - outtextxy(168,380,"B"); - outtextxy(168,394,"C"); - outtextxy(168,408,"D"); - outtextxy(168,422,"E"); - outtextxy(168,436,"F"); - + int color1,color2; if(byo14[cp]==0) { - setcolor(RED); - setfillstyle(SOLID_FILL,BLACK); - rectangle(176,223,303,446); - floodfill(180,230,RED); - line(176,223,303,446); - line(303,223,176,446); + setfillstyle(WIDE_DOT_FILL,RED); + bar(176,223,303,446); return; } - - for(int l=0;l<256;++l) + if(wys==14) { - for(int a=0;a<14;++a) + color1=GREEN; + color2=GREEN; + } + else + { + color1=BROWN; + color2=RED; + } + int a,b,l; + switch(mode) + { + case 2: + setcolor(RED); + if(pre%16!=lit%16) { - for(int b=0;b<8;++b) + ab[0]=abc[pre%16]; + outtextxy(176+8*(pre%16),215,ab); + } + if(pre/16!=lit/16) + { + ab[0]=abc[pre/16]; + outtextxy(168,226+14*(pre/16),ab); + } + for(a=0;a<14;++a) + { + for(b=0;b<8;++b) { - if (l==lit&&wys==14) - { - setcolor(GREEN); - ab[0]=abc[lit%16]; - outtextxy(176+8*(lit%16),215,ab); - ab[0]=abc[lit/16]; - outtextxy(168,226+14*(lit/16),ab); - - /*if(b>0) - { - if((SFB14[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - putpixel(176+b+(l%16)*8,223+a+(l/16)*14,GREEN); - else - putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK); - } - else - { - if((SFB14[cp]->lit[l].lin[a]/0x80)==1) - putpixel(176+b+(l%16)*8,223+a+(l/16)*14,GREEN); - else - putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK); - }*/ - if(SFB14[cp]->lit[l].lin[a]&(0x80>>b)) - putpixel(176+b+(l%16)*8,223+a+(l/16)*14,GREEN); - else - putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK); - } + if(SFB14[cp]->lit[pre].lin[a]&(0x80>>b)) + putpixel(176+b+(pre%16)*8,223+a+(pre/16)*14,BROWN); + else + putpixel(176+b+(pre%16)*8,223+a+(pre/16)*14,BLACK); + } + } + case 3: + case 1: + setcolor(color2); + ab[0]=abc[lit%16]; + outtextxy(176+8*(lit%16),215,ab); + ab[0]=abc[lit/16]; + outtextxy(168,226+14*(lit/16),ab); + for(a=0;a<14;++a) + { + for(b=0;b<8;++b) + { + if(SFB14[cp]->lit[lit].lin[a]&(0x80>>b)) + putpixel(176+b+(lit%16)*8,223+a+(lit/16)*14,color1); else + putpixel(176+b+(lit%16)*8,223+a+(lit/16)*14,BLACK); + } + } + break; + case 0: + default: + for(l=0;l<16;++l) + { + ab[0]=abc[l]; + if(lit%16==l) + setcolor(color2); + else + setcolor(RED); + outtextxy(176+8*l,215,ab); + if(lit/16==l) + setcolor(color2); + else + setcolor(RED); + outtextxy(168,226+14*l,ab); + } + for(l=0;l<256;++l) + { + for(a=0;a<14;++a) + { + for(b=0;b<8;++b) { - - /*if(b>0) + if (l==lit) { - if((SFB14[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BROWN); + if(SFB14[cp]->lit[l].lin[a]&(0x80>>b)) + putpixel(176+b+(l%16)*8,223+a+(l/16)*14,color1); else putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK); } else { - if((SFB14[cp]->lit[l].lin[a]/0x80)==1) + if(SFB14[cp]->lit[l].lin[a]&(0x80>>b)) putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BROWN); else putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK); - }*/ - if(SFB14[cp]->lit[l].lin[a]&(0x80>>b)) - putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BROWN); - else - putpixel(176+b+(l%16)*8,223+a+(l/16)*14,BLACK); + } } } } + break; } } -void lin8() +void lin8(int mode=0) { if(!any) return; + if(mode==3) + { + if(SFB8[cp]->lit[lit].lin[cury]&(0x80>>curx)) + putpixel(176+curx+(lit%16)*8,32+cury+(lit/16)*8,GREEN); + else + putpixel(176+curx+(lit%16)*8,32+cury+(lit/16)*8,BLACK); + return; + } char ab[2]="X"; - setcolor(RED); - outtextxy(176,24,"0123456789ABCDEF"); - outtextxy(168,32,"0"); - outtextxy(168,40,"1"); - outtextxy(168,48,"2"); - outtextxy(168,56,"3"); - outtextxy(168,64,"4"); - outtextxy(168,72,"5"); - outtextxy(168,80,"6"); - outtextxy(168,88,"7"); - outtextxy(168,96,"8"); - outtextxy(168,104,"9"); - outtextxy(168,112,"A"); - outtextxy(168,120,"B"); - outtextxy(168,128,"C"); - outtextxy(168,136,"D"); - outtextxy(168,144,"E"); - outtextxy(168,152,"F"); + int color1,color2; if(byo8[cp]==0) { - setcolor(RED); - setfillstyle(SOLID_FILL,BLACK); - rectangle(176,32,303,159); - floodfill(180,40,RED); - line(176,32,303,159); - line(303,32,176,159); + setfillstyle(WIDE_DOT_FILL,RED); + bar(176,32,303,159); return; } - - for(int l=0;l<256;++l) + if(wys==8) { - for(int a=0;a<8;++a) + color1=GREEN; + color2=GREEN; + } + else + { + color1=BROWN; + color2=RED; + } + int a,b,l; + switch(mode) + { + case 2: + setcolor(RED); + if(pre%16!=lit%16) { - for(int b=0;b<8;++b) + ab[0]=abc[pre%16]; + outtextxy(176+8*(pre%16),24,ab); + } + if(pre/16!=lit/16) + { + ab[0]=abc[pre/16]; + outtextxy(168,32+8*(pre/16),ab); + } + for(a=0;a<8;++a) + { + for(b=0;b<8;++b) { - if (l==lit&&wys==8) - { - setcolor(GREEN); - ab[0]=abc[lit%16]; - outtextxy(176+8*(lit%16),24,ab); - ab[0]=abc[lit/16]; - outtextxy(168,32+8*(lit/16),ab); - - /*if(b>0) - { - if((SFB8[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - putpixel(176+b+(l%16)*8,32+a+(l/16)*8,GREEN); - else - putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK); - } - else - { - if((SFB8[cp]->lit[l].lin[a]/0x80)==1) - putpixel(176+b+(l%16)*8,32+a+(l/16)*8,GREEN); - else - putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK); - }*/ - if(SFB8[cp]->lit[l].lin[a]&(0x80>>b)) - putpixel(176+b+(l%16)*8,32+a+(l/16)*8,GREEN); - else - putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK); - } + if(SFB8[cp]->lit[pre].lin[a]&(0x80>>b)) + putpixel(176+b+(pre%16)*8,32+a+(pre/16)*8,BROWN); + else + putpixel(176+b+(pre%16)*8,32+a+(pre/16)*8,BLACK); + } + } + case 3: + case 1: + setcolor(color2); + ab[0]=abc[lit%16]; + outtextxy(176+8*(lit%16),24,ab); + ab[0]=abc[lit/16]; + outtextxy(168,32+8*(lit/16),ab); + for(a=0;a<8;++a) + { + for(b=0;b<8;++b) + { + if(SFB8[cp]->lit[lit].lin[a]&(0x80>>b)) + putpixel(176+b+(lit%16)*8,32+a+(lit/16)*8,color1); else + putpixel(176+b+(lit%16)*8,32+a+(lit/16)*8,BLACK); + } + } + break; + case 0: + default: + for(l=0;l<16;++l) + { + ab[0]=abc[l]; + if(lit%16==l) + setcolor(color2); + else + setcolor(RED); + outtextxy(176+8*l,24,ab); + if(lit/16==l) + setcolor(color2); + else + setcolor(RED); + outtextxy(168,32+8*l,ab); + } + for(l=0;l<256;++l) + { + for(a=0;a<8;++a) + { + for(b=0;b<8;++b) { - - /*if(b>0) + if (l==lit) { - if((SFB8[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BROWN); + if(SFB8[cp]->lit[l].lin[a]&(0x80>>b)) + putpixel(176+b+(l%16)*8,32+a+(l/16)*8,color1); else putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK); } else { - if((SFB8[cp]->lit[l].lin[a]/0x80)==1) + if(SFB8[cp]->lit[l].lin[a]&(0x80>>b)) putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BROWN); else putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK); - }*/ - if(SFB8[cp]->lit[l].lin[a]&(0x80>>b)) - putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BROWN); - else - putpixel(176+b+(l%16)*8,32+a+(l/16)*8,BLACK); + } } } } + break; } } -void lin16() +void lin16(int mode=0) { if(!any) return; + if(mode==3) + { + if(SFB16[cp]->lit[lit].lin[cury]&(0x80>>curx)) + putpixel(496+curx+(lit%16)*8,111+cury+(lit/16)*16,GREEN); + else + putpixel(496+curx+(lit%16)*8,111+cury+(lit/16)*16,BLACK); + return; + } char ab[2]="X"; - setcolor(RED); - outtextxy(496,103,"0123456789ABCDEF"); - outtextxy(488,115,"0"); - outtextxy(488,131,"1"); - outtextxy(488,147,"2"); - outtextxy(488,163,"3"); - outtextxy(488,179,"4"); - outtextxy(488,195,"5"); - outtextxy(488,211,"6"); - outtextxy(488,227,"7"); - outtextxy(488,243,"8"); - outtextxy(488,259,"9"); - outtextxy(488,275,"A"); - outtextxy(488,291,"B"); - outtextxy(488,307,"C"); - outtextxy(488,323,"D"); - outtextxy(488,339,"E"); - outtextxy(488,355,"F"); - + int color1,color2; if(byo16[cp]==0) { - setcolor(RED); - setfillstyle(SOLID_FILL,BLACK); - rectangle(496,111,623,366); - floodfill(500,120,RED); - line(496,111,623,366); - line(623,111,496,366); + setfillstyle(WIDE_DOT_FILL,RED); + bar(496,111,623,366); return; } - - for(int l=0;l<256;++l) + if(wys==16) { - for(int a=0;a<16;++a) + color1=GREEN; + color2=GREEN; + } + else + { + color1=BROWN; + color2=RED; + } + int a,b,l; + switch(mode) + { + case 3: + case 2: + setcolor(RED); + if(pre%16!=lit%16) { - for(int b=0;b<8;++b) + ab[0]=abc[pre%16]; + outtextxy(496+8*(pre%16),103,ab); + } + if(pre/16!=lit/16) + { + ab[0]=abc[pre/16]; + outtextxy(488,115+16*(pre/16),ab); + } + for(a=0;a<16;++a) + { + for(b=0;b<8;++b) + { + if(SFB16[cp]->lit[pre].lin[a]&(0x80>>b)) + putpixel(496+b+(pre%16)*8,111+a+(pre/16)*16,BROWN); + else + putpixel(496+b+(pre%16)*8,111+a+(pre/16)*16,BLACK); + } + } + case 1: + setcolor(color2); + ab[0]=abc[lit%16]; + outtextxy(496+8*(lit%16),103,ab); + ab[0]=abc[lit/16]; + outtextxy(488,115+16*(lit/16),ab); + for(a=0;a<16;++a) + { + for(b=0;b<8;++b) + { + if(SFB16[cp]->lit[lit].lin[a]&(0x80>>b)) + putpixel(496+b+(lit%16)*8,111+a+(lit/16)*16,color1); + else + putpixel(496+b+(lit%16)*8,111+a+(lit/16)*16,BLACK); + } + } + break; + case 0: + default: + for(l=0;l<16;++l) + { + ab[0]=abc[l]; + if(lit%16==l) + setcolor(color2); + else + setcolor(RED); + outtextxy(496+8*l,103,ab); + if(lit/16==l) + setcolor(color2); + else + setcolor(RED); + outtextxy(488,115+16*l,ab); + } + for(l=0;l<256;++l) + { + for(a=0;a<16;++a) { - if (l==lit&&wys==16) + for(b=0;b<8;++b) { - setcolor(GREEN); - ab[0]=abc[lit%16]; - outtextxy(496+8*(lit%16),103,ab); - ab[0]=abc[lit/16]; - outtextxy(488,115+16*(lit/16),ab); - - /*if(b>0) - { - if((SFB16[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - putpixel(496+b+(l%16)*8,111+a+(l/16)*16,GREEN); - else - putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK); - } - else + if (l==lit) { - if((SFB16[cp]->lit[l].lin[a]/0x80)==1) - putpixel(496+b+(l%16)*8,111+a+(l/16)*16,GREEN); - else - putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK); - }*/ - if(SFB16[cp]->lit[l].lin[a]&(0x80>>b)) - putpixel(496+b+(l%16)*8,111+a+(l/16)*16,GREEN); + if(SFB16[cp]->lit[l].lin[a]&(0x80>>b)) + putpixel(496+b+(l%16)*8,111+a+(l/16)*16,color1); else putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK); - } - else - { - - /*if(b>0) - { - if((SFB16[cp]->lit[l].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BROWN); - else - putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK); } else { - if((SFB16[cp]->lit[l].lin[a]/0x80)==1) + if(SFB16[cp]->lit[l].lin[a]&(0x80>>b)) putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BROWN); else - putpixel(496+b+(l%16)*8,111+a+(l/16)*16,EGA_BLACK); - }*/ - if(SFB16[cp]->lit[l].lin[a]&(0x80>>b)) - putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BROWN); - else - putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK); + putpixel(496+b+(l%16)*8,111+a+(l/16)*16,BLACK); + } } } } + break; } } -void lit8() +void lit8(int mode=0) { if(!any) return; - setcolor(BLACK); - for(int z=0;z<128;++z) - line(16,32+z,143,32+z); + int color; setcolor(RED); - outtextxy(20,24,"0 1 2 3 4 5 6 7"); - outtextxy(8,36,"0"); - outtextxy(8,52,"1"); - outtextxy(8,68,"2"); - outtextxy(8,84,"3"); - outtextxy(8,100,"4"); - outtextxy(8,116,"5"); - outtextxy(8,132,"6"); - outtextxy(8,148,"7"); - if(byo8[cp]==0) { - setcolor(RED); - setfillstyle(SOLID_FILL,BLACK); - rectangle(16,32,143,159); - floodfill(20,40,RED); - line(16,32,143,159); - line(143,32,16,159); + setfillstyle(WIDE_DOT_FILL,RED); + bar(16,32,143,159); return; } - - for(int a=0;a<8;++a) + char ab[2]="q"; + if(wys==8) + color=GREEN; + else + color=RED; + switch(mode) { - char ab[2]="q"; - setfillstyle(SOLID_FILL,BROWN); - for(int b=0;b<8;++b) + case 2: + setcolor(RED); + if(curx!=prex) { - - - if (curx==b&&cury==a&&wys==8) - { - setcolor(GREEN); - ab[0]=abc[curx]; - outtextxy(20+16*curx,24,ab); - ab[0]=abc[cury]; - outtextxy(8,36+16*cury,ab); - rectangle(0x10+b*0x10,0x20+a*0x10,0x1f+b*0x10,0x2f+a*0x10); - /*if(b>0) - { - if((SFB8[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - floodfill(0x11+b*0x10,0x21+a*0x10,GREEN); - } - else - { - if((SFB8[cp]->lit[lit].lin[a]/0x80)==1) - floodfill(0x11+b*0x10,0x21+a*0x10,GREEN); - }*/ - if(SFB8[cp]->lit[lit].lin[a]&(0x80>>b)) - floodfill(0x11+b*0x10,0x21+a*0x10,GREEN); + ab[0]=abc[prex]; + outtextxy(20+16*prex,24,ab); + } + if(prey<8) + { + if(cury!=prey) + { + ab[0]=abc[prey]; + outtextxy(8,36+16*prey,ab); + } + if(SFB8[cp]->lit[lit].lin[prey]&(0x80>>prex)) + { + setcolor(BROWN); + setfillstyle(SOLID_FILL,BROWN); + } + else + { setcolor(BLACK); - rectangle(0x11+b*0x10,0x21+a*0x10,0x1e+b*0x10,0x2e+a*0x10); + setfillstyle(SOLID_FILL,BLACK); } + bar(0x10+prex*0x10,0x20+prey*0x10,0x1f+prex*0x10,0x2f+prey*0x10); + } + case 1: + setcolor(color); + ab[0]=abc[curx]; + outtextxy(20+16*curx,24,ab); + ab[0]=abc[cury]; + outtextxy(8,36+16*cury,ab); + if(SFB8[cp]->lit[lit].lin[cury]&(0x80>>curx)) + { + setcolor(BROWN); + setfillstyle(SOLID_FILL,BROWN); + } + else + { + setcolor(BLACK); + setfillstyle(SOLID_FILL,BLACK); + } + bar(0x10+curx*0x10,0x20+cury*0x10,0x1f+curx*0x10,0x2f+cury*0x10); + if(wys==8) + { + setcolor(GREEN); + rectangle(0x10 + curx*0x10, 0x20 + cury*0x10 ,0x1f + curx*0x10, 0x2f + cury*0x10); + setcolor(BLACK); + rectangle(0x11 + curx*0x10, 0x21 + cury*0x10, 0x1e + curx*0x10, 0x2e + cury*0x10); + } + break; + case 0: + default: + for(int l=0;l<8;++l) + { + if(l==curx) + setcolor(color); + else + setcolor(RED); + ab[0]=abc[l]; + + outtextxy(20+16*l,24,ab); + if(l==cury) + setcolor(color); else + setcolor(RED); + ab[0]=abc[l]; + outtextxy(8,36+16*l,ab); + } + for(int a=0;a<8;++a) + { + for(int b=0;b<8;++b) { - - setcolor(BROWN); - /*if(b>0) + if(SFB8[cp]->lit[lit].lin[a]&(0x80>>b)) { - if((SFB8[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - { - rectangle(0x10+b*0x10,0x20+a*0x10,0x1f+b*0x10,0x2f+a*0x10); - floodfill(0x11+b*0x10,0x21+a*0x10,BROWN); - } + setcolor(BROWN); + setfillstyle(SOLID_FILL,BROWN); } else { - if((SFB8[cp]->lit[lit].lin[a]/0x80)==1) - { - rectangle(0x10+b*0x10,0x20+a*0x10,0x1f+b*0x10,0x2f+a*0x10); - floodfill(0x11+b*0x10,0x21+a*0x10,BROWN); - } - }*/ - if(SFB8[cp]->lit[lit].lin[a]&(0x80>>b)) - { - rectangle(0x10+b*0x10,0x20+a*0x10,0x1f+b*0x10,0x2f+a*0x10); - floodfill(0x11+b*0x10,0x21+a*0x10,BROWN); + setcolor(BLACK); + setfillstyle(SOLID_FILL,BLACK); } + bar(0x10+b*0x10,0x20+a*0x10,0x1f+b*0x10,0x2f+a*0x10); } } + if(wys==8) + { + setcolor(GREEN); + rectangle(0x10 + curx*0x10, 0x20 + cury*0x10 ,0x1f + curx*0x10, 0x2f + cury*0x10); + setcolor(BLACK); + rectangle(0x11 + curx*0x10, 0x21 + cury*0x10, 0x1e + curx*0x10, 0x2e + cury*0x10); + } + break; } } -void lit14() +void lit14(int mode=0) { if(!any) return; - setcolor(BLACK); - for(int z=0;z<224;++z) - line(16,223+z,143,223+z); + int color; setcolor(RED); - outtextxy(20,215,"0 1 2 3 4 5 6 7"); - outtextxy(8,227,"0"); - outtextxy(8,243,"1"); - outtextxy(8,259,"2"); - outtextxy(8,275,"3"); - outtextxy(8,291,"4"); - outtextxy(8,307,"5"); - outtextxy(8,323,"6"); - outtextxy(8,339,"7"); - outtextxy(8,355,"8"); - outtextxy(8,371,"9"); - outtextxy(8,387,"A"); - outtextxy(8,403,"B"); - outtextxy(8,419,"C"); - outtextxy(8,435,"D"); - if(byo14[cp]==0) { - setcolor(RED); - setfillstyle(SOLID_FILL,BLACK); - rectangle(16,223,143,446); - floodfill(20,230,RED); - line(16,223,143,446); - line(143,223,16,446); + setfillstyle(WIDE_DOT_FILL,RED); + bar(16,223,143,446); return; } - - for(int a=0;a<14;++a) + char ab[2]="q"; + if(wys==14) + color=GREEN; + else + color=RED; + switch(mode) { - char ab[2]="q"; - setfillstyle(SOLID_FILL,BROWN); - for(int b=0;b<8;++b) + case 2: + setcolor(RED); + if(curx!=prex) { - - - if (curx==b&&cury==a&&wys==14) - { - setcolor(GREEN); - ab[0]=abc[curx]; - outtextxy(20+16*curx,215,ab); - ab[0]=abc[cury]; - outtextxy(8,227+16*cury,ab); - rectangle(16+b*16,223+a*16,31+b*16,238+a*16); - /*if(b>0) - { - if((SFB14[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - floodfill(17+b*16,224+a*16,GREEN); - } - else - { - if((SFB14[cp]->lit[lit].lin[a]/0x80)==1) - floodfill(17+b*16,224+a*16,GREEN); - }*/ - if(SFB14[cp]->lit[lit].lin[a]&(0x80>>b)) - floodfill(17+b*16,224+a*16,GREEN); - setcolor(BLACK); - rectangle(17+b*16,224+a*16,30+b*16,237+a*16); + ab[0]=abc[prex]; + outtextxy(20+16*prex,215,ab); + } + if(prey<14) + { + if(cury!=prey) + { + ab[0]=abc[prey]; + outtextxy(8,227+16*prey,ab); } - else + if(SFB14[cp]->lit[lit].lin[prey]&(0x80>>prex)) { - setcolor(BROWN); - /*if(b>0) - { - if((SFB14[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - { - rectangle(16+b*16,223+a*16,31+b*16,238+a*16); - floodfill(17+b*16,224+a*16,BROWN); - } + setfillstyle(SOLID_FILL,BROWN); + } + else + { + setcolor(BLACK); + setfillstyle(SOLID_FILL,BLACK); + } + bar(16+prex*16,223+prey*16,31+prex*16,238+prey*16); + } + case 1: + setcolor(color); + ab[0]=abc[curx]; + outtextxy(20+16*curx,215,ab); + ab[0]=abc[cury]; + outtextxy(8,227+16*cury,ab); + if(SFB14[cp]->lit[lit].lin[cury]&(0x80>>curx)) + { + setcolor(BROWN); + setfillstyle(SOLID_FILL,BROWN); + } + else + { + setcolor(BLACK); + setfillstyle(SOLID_FILL,BLACK); + } + bar(16+curx*16,223+cury*16,31+curx*16,238+cury*16); + if(wys==14) + { + setcolor(GREEN); + rectangle(16+curx*16,223+cury*16,31+curx*16,238+cury*16); + setcolor(BLACK); + rectangle(17+curx*16,224+cury*16,30+curx*16,237+cury*16); + } + break; + case 0: + default: + for(int l=0;l<14;++l) + { + if(l==curx) + setcolor(color); + else + setcolor(RED); + ab[0]=abc[l]; + if(l<8) + outtextxy(20+16*l,215,ab); + if(l==cury) + setcolor(color); + else + setcolor(RED); + ab[0]=abc[l]; + outtextxy(8,227+16*l,ab); + } + for(int a=0;a<14;++a) + { + for(int b=0;b<8;++b) + { + if(SFB14[cp]->lit[lit].lin[a]&(0x80>>b)) + { + setcolor(BROWN); + setfillstyle(SOLID_FILL,BROWN); } else { - if((SFB14[cp]->lit[lit].lin[a]/0x80)==1) - { - rectangle(16+b*16,223+a*16,31+b*16,238+a*16); - floodfill(17+b*16,224+a*16,BROWN); - } - }*/ - if(SFB14[cp]->lit[lit].lin[a]&(0x80>>b)) - { - rectangle(16+b*16,223+a*16,31+b*16,238+a*16); - floodfill(17+b*16,224+a*16,BROWN); + setcolor(BLACK); + setfillstyle(SOLID_FILL,BLACK); } + bar(16+b*16,223+a*16,31+b*16,238+a*16); } } + if(wys==14) + { + setcolor(GREEN); + rectangle(16+curx*16,223+cury*16,31+curx*16,238+cury*16); + setcolor(BLACK); + rectangle(17+curx*16,224+cury*16,30+curx*16,237+cury*16); + } + break; } } -void lit16() +void lit16(int mode=0) { if(!any) return; - setcolor(BLACK); - for(int z=0;z<256;++z) - line(336,111+z,463,111+z); + int color; setcolor(RED); - outtextxy(340,103,"0 1 2 3 4 5 6 7"); - outtextxy(328,115,"0"); - outtextxy(328,131,"1"); - outtextxy(328,147,"2"); - outtextxy(328,163,"3"); - outtextxy(328,179,"4"); - outtextxy(328,195,"5"); - outtextxy(328,211,"6"); - outtextxy(328,227,"7"); - outtextxy(328,243,"8"); - outtextxy(328,259,"9"); - outtextxy(328,275,"A"); - outtextxy(328,291,"B"); - outtextxy(328,307,"C"); - outtextxy(328,323,"D"); - outtextxy(328,339,"E"); - outtextxy(328,355,"F"); - if(byo16[cp]==0) { - setcolor(RED); - setfillstyle(SOLID_FILL,BLACK); - rectangle(336,111,463,366); - floodfill(340,120,RED); - line(336,111,463,366); - line(463,111,336,366); + setfillstyle(WIDE_DOT_FILL,RED); + bar(336,111,463,366); return; } - - for(int a=0;a<16;++a) + char ab[2]="q"; + if(wys==16) + color=GREEN; + else + color=RED; + switch(mode) { - char ab[2]="q"; - setfillstyle(SOLID_FILL,BROWN); - for(int b=0;b<8;++b) + case 2: + setcolor(RED); + if(curx!=prex) { - - - if (curx==b&&cury==a&&wys==16) - { - setcolor(GREEN); - ab[0]=abc[curx]; - outtextxy(340+16*curx,103,ab); - ab[0]=abc[cury]; - outtextxy(328,115+16*cury,ab); - rectangle(336+b*16,111+a*16,351+b*16,126+a*16); - /*if(b>0) - { - if((SFB16[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - floodfill(337+b*16,112+a*16,GREEN); - } - else - { - if((SFB16[cp]->lit[lit].lin[a]/0x80)==1) - floodfill(337+b*16,112+a*16,GREEN); - }*/ - if(SFB16[cp]->lit[lit].lin[a]&(0x80>>b)) - floodfill(337+b*16,112+a*16,GREEN); - setcolor(BLACK); - rectangle(337+b*16,112+a*16,350+b*16,125+a*16); - } + ab[0]=abc[prex]; + outtextxy(340+16*prex,103,ab); + } + if(cury!=prey) + { + ab[0]=abc[prey]; + outtextxy(328,115+16*prey,ab); + } + if(SFB16[cp]->lit[lit].lin[prey]&(0x80>>prex)) + { + setcolor(BROWN); + setfillstyle(SOLID_FILL,BROWN); + } + else + { + setcolor(BLACK); + setfillstyle(SOLID_FILL,BLACK); + } + bar(336+prex*16,111+prey*16,351+prex*16,126+prey*16); + case 1: + setcolor(color); + ab[0]=abc[curx]; + outtextxy(340+16*curx,103,ab); + ab[0]=abc[cury]; + outtextxy(328,115+16*cury,ab); + if(SFB16[cp]->lit[lit].lin[cury]&(0x80>>curx)) + { + setcolor(BROWN); + setfillstyle(SOLID_FILL,BROWN); + } + else + { + setcolor(BLACK); + setfillstyle(SOLID_FILL,BLACK); + } + bar(336+curx*16,111+cury*16,351+curx*16,126+cury*16); + if(wys==16) + { + setcolor(GREEN); + rectangle(336+curx*16,111+cury*16,351+curx*16,126+cury*16); + setcolor(BLACK); + rectangle(337+curx*16,112+cury*16,350+curx*16,125+cury*16); + } + break; + case 0: + default: + for(int l=0;l<16;++l) + { + if(l==curx) + setcolor(color); else + setcolor(RED); + ab[0]=abc[l]; + if(l<8) + outtextxy(340+16*l,103,ab); + if(l==cury) + setcolor(color); + else + setcolor(RED); + ab[0]=abc[l]; + outtextxy(328,115+16*l,ab); + } + for(int a=0;a<16;++a) + { + for(int b=0;b<8;++b) { - - setcolor(BROWN); - /*if(b>0) + if(SFB16[cp]->lit[lit].lin[a]&(0x80>>b)) { - if((SFB16[cp]->lit[lit].lin[a]%(0x80/pot(2,b)*2))/(0x80/pot(2,b))==1) - { - rectangle(336+b*16,111+a*16,351+b*16,126+a*16); - floodfill(337+b*16,112+a*16,BROWN); - } + setcolor(BROWN); + setfillstyle(SOLID_FILL,BROWN); } else { - if((SFB16[cp]->lit[lit].lin[a]/0x80)==1) - { - rectangle(336+b*16,111+a*16,351+b*16,126+a*16); - floodfill(337+b*16,112+a*16,BROWN); - - } - }*/ - if(SFB16[cp]->lit[lit].lin[a]&(0x80>>b)) - { - rectangle(336+b*16,111+a*16,351+b*16,126+a*16); - floodfill(337+b*16,112+a*16,BROWN); + setcolor(BLACK); + setfillstyle(SOLID_FILL,BLACK); } + bar(336+b*16,111+a*16,351+b*16,126+a*16); } } + if(wys==16) + { + setcolor(GREEN); + rectangle(336+curx*16,111+cury*16,351+curx*16,126+cury*16); + setcolor(BLACK); + rectangle(337+curx*16,112+cury*16,350+curx*16,125+cury*16); + } } } - -void spc8() +inline void spc8() { - //if(SFB8[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1) - // SFB8[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx)); - //else - // SFB8[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx)); SFB8[cp]->lit[lit].lin[cury]^=0x80>>curx; } -void bsp8() +inline void bsp8() { - //if(SFB8[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1) - // SFB8[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx)); SFB8[cp]->lit[lit].lin[cury]&=~(0x80>>curx); } -void ent8() +inline void ent8() { - //if(SFB8[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))!=1) - // SFB8[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx)); SFB8[cp]->lit[lit].lin[cury]|=0x80>>curx; } -void spc14() +inline void spc14() { - //if(SFB14[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1) - // SFB14[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx)); - //else - // SFB14[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx)); SFB14[cp]->lit[lit].lin[cury]^=0x80>>curx; } -void bsp14() +inline void bsp14() { - //if(SFB14[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1) - // SFB14[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx)); SFB14[cp]->lit[lit].lin[cury]&=~(0x80>>curx); } -void ent14() +inline void ent14() { - //if(SFB14[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))!=1) - // SFB14[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx)); SFB14[cp]->lit[lit].lin[cury]|=0x80>>curx; } -void spc16() +inline void spc16() { - //if(SFB16[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1) - // SFB16[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx)); - //else - // SFB16[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx)); SFB16[cp]->lit[lit].lin[cury]^=0x80>>curx; } -void bsp16() +inline void bsp16() { - //if(SFB16[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))==1) - // SFB16[cp]->lit[lit].lin[cury]-=(0x80/pot(2,curx)); SFB16[cp]->lit[lit].lin[cury]&=~(0x80>>curx); } -void ent16() +inline void ent16() { - //if(SFB16[cp]->lit[lit].lin[cury]%(0x100/pot(2,curx))/(0x80/pot(2,curx))!=1) - // SFB16[cp]->lit[lit].lin[cury]+=(0x80/pot(2,curx)); SFB16[cp]->lit[lit].lin[cury]|=0x80>>curx; } @@ -1013,14 +1104,6 @@ int otw2() return 116; } fread(FFH,0x19,1,CPI); -// printf("FFH:\n"); -// printf("id0=%2x\n",FFH.id0); -// 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]); -// printf("reserved=%2x%2x%2x%2x%2x%2x%2x%2x\n",FFH.reserved[0],FFH.reserved[1],FFH.reserved[2],FFH.reserved[3],FFH.reserved[4],FFH.reserved[5],FFH.reserved[6],FFH.reserved[7]); -// printf("pnum=%d\n",FFH.pnum); -// printf("ptyp=%2x\n",FFH.ptyp); -// printf("fih_offset=%p\n\n",FFH.fih_offset); - if(FFH->id0!=0xff) { sprintf(err,"101:Unsupported format, id0=0x%02x",(short)(FFH->id0&0xff)); @@ -1028,7 +1111,6 @@ int otw2() deleteCPI(0); return 101; } - //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]!=' ') if(!strcmp("FONT ",FFH->id)) NT=0; else if(!strcmp("FONT.NT",FFH->id)) @@ -1069,11 +1151,8 @@ int otw2() } fseek(CPI,FFH->fih_offset,0); fread(FIH,0x2,1,CPI); -// printf("FFI:\n\n"); -// printf("num_codepages=%d\n\n",FIH.num_codepages); if(FIH->num_codepages>16) { - //FIH.num_codepages=6; sprintf(err,"105:Too many codepages (%u)",FIH->num_codepages); fclose(CPI); deleteCPI(1); @@ -1100,14 +1179,6 @@ int otw2() return 116; } fread(CPEH[a],0x1c,1,CPI); -// printf("CPEH[%d]:\n",a); -// printf("cpeh_size=%x\n",CPEH[a].cpeh_size); -// printf("next_cpeh_offset=%p\n",CPEH[a].next_cpeh_offset); -// printf("device_type=%d\n",CPEH[a].device_type); -// printf("device name=\"%c%c%c%c%c%c%c%c\"\n",CPEH[a].device_name[0],CPEH[a].device_name[1],CPEH[a].device_name[2],CPEH[a].device_name[3],CPEH[a].device_name[4],CPEH[a].device_name[5],CPEH[a].device_name[6],CPEH[a].device_name[7]); -// printf("codepage=%d\n",CPEH[a].codepage); -// 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]); -// printf("cpih_offset=%p\n\n",CPEH[a].cpih_offset); if(NT) { CPEH[a]->next_cpeh_offset+=ftell(CPI)-sizeof(CodePageEntryHeader); @@ -1147,11 +1218,6 @@ int otw2() return 116; } fread(CPIH[a],0x6,1,CPI); -// printf("CPIH[%d]:\n",a); -// printf("version=%d\n",CPIH[a].version); -// printf("num_fonts=%d\n",CPIH[a].num_fonts); -// printf("size=%x\n\n",CPIH[a].size); - if(CPIH[a]->version!=1) { sprintf(err,"108:Wrong version of CPIH[%u] (%u)",a,CPIH[a]->version); @@ -1187,13 +1253,6 @@ int otw2() return 116; } fread(SFH[a][b],0x6,1,CPI); -// printf("SFH[%d][%d]:\n",a,b); -// printf("height=%d\n",SFH[a][b].height); -// printf("width=%d\n",SFH[a][b].width); -// printf("yaspect=%2x\n",SFH[a][b].yaspect); -// printf("xaspect=%2x\n",SFH[a][b].xaspect); -// printf("num_chars=%d\n\n",SFH[a][b].num_chars); - //fseek(CPI,SFH[a][b].num_chars*SFH[a][b].height*((SFH[a][b].width+7)/8),1); if(SFH[a][b]->height==8) { if (byo8[a]!=0) @@ -1261,8 +1320,6 @@ int otw2() deleteCPI(4,a,b); return 116; } - //for(c=0;c<256;++c) - // fread(&SFB16[a].lit[c],0x10,1,CPI); fread(SFB16[a],0x10,256,CPI); } if(SFH[a][b]->height==14) @@ -1275,8 +1332,6 @@ int otw2() deleteCPI(4,a,b); return 116; } - //for(c=0;c<256;++c) - // fread(&SFB14[a].lit[c],0x0e,1,CPI); fread(SFB14[a],0x0e,256,CPI); } if(SFH[a][b]->height==8) @@ -1289,38 +1344,10 @@ int otw2() deleteCPI(4,a,b); return 116; } - //for(c=0;c<256;++c) - // fread(&SFB8[a].lit[c],0x08,1,CPI); fread(SFB8[a],0x08,256,CPI); } - //fseek(CPI,SFH[a][b]->num_chars*SFH[a][b]->height*((SFH[a][b]->width+7)/8),1); } - /*for(b=0;b0) - fseek(CPI,SFH[a][0].height*256+0x6,1); - if(b>1) - fseek(CPI,SFH[a][1].height*256+0x6,1); - - if(SFH[a][b].height==16) - { - for(c=0;c<256;++c) - fread(&SFB16[a].lit[c],0x10,1,CPI); - } - if(SFH[a][b].height==14) - { - for(c=0;c<256;++c) - fread(&SFB14[a].lit[c],0x0e,1,CPI); - } - if(SFH[a][b].height==8) - { - for(c=0;c<256;++c) - fread(&SFB8[a].lit[c],0x08,1,CPI); - } - }*/ } - fclose(CPI); offset(); return 0; @@ -1342,203 +1369,33 @@ int zap2() else sprintf(err,"OK"); fwrite(FFH,0x19,1,CPI); -// printf("FFH:\n"); -// printf("id0=%2x\n",FFH.id0); -// 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]); -// printf("reserved=%2x%2x%2x%2x%2x%2x%2x%2x\n",FFH.reserved[0],FFH.reserved[1],FFH.reserved[2],FFH.reserved[3],FFH.reserved[4],FFH.reserved[5],FFH.reserved[6],FFH.reserved[7]); -// printf("pnum=%d\n",FFH.pnum); -// printf("ptyp=%2x\n",FFH.ptyp); -// printf("fih_offset=%p\n\n",FFH.fih_offset); - - /*if(FFH.id0!=0xff) - { - sprintf(err,"101: FFH.id0!=0xff"); - fclose(CPI); - return 101; - } - 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]!=' ') - { - sprintf(err,"102: FFH.id!=\"FONT \""); - fclose(CPI); - return 102; - } - if(FFH.pnum!=1) - { - sprintf(err,"103: FFH.pnum!=1\n"); - fclose(CPI); - return 103; - } - if(FFH.ptyp!=1) - { - sprintf(err,"104: FFH.ptyp!=1\n"); - fclose(CPI); - return 104; - }*/ fseek(CPI,FFH->fih_offset,0); fwrite(FIH,0x2,1,CPI); -// printf("FFI:\n\n"); -// printf("num_codepages=%d\n\n",FIH.num_codepages); - /*if(FIH.num_codepages>6) - { - //FIH.num_codepages=6; - sprintf(err,"105: FIH.num_codepages>6\n"); - fclose(CPI); - return 105; - }*/ - for(a=0; anum_codepages;++a) { if (a!=0) fseek(CPI,CPEH[a-1]->next_cpeh_offset,0); fwrite(CPEH[a],0x1c,1,CPI); -// printf("CPEH[%d]:\n",a); -// printf("cpeh_size=%x\n",CPEH[a].cpeh_size); -// printf("next_cpeh_offset=%p\n",CPEH[a].next_cpeh_offset); -// printf("device_type=%d\n",CPEH[a].device_type); -// printf("device name=\"%c%c%c%c%c%c%c%c\"\n",CPEH[a].device_name[0],CPEH[a].device_name[1],CPEH[a].device_name[2],CPEH[a].device_name[3],CPEH[a].device_name[4],CPEH[a].device_name[5],CPEH[a].device_name[6],CPEH[a].device_name[7]); -// printf("codepage=%d\n",CPEH[a].codepage); -// 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]); -// printf("cpih_offset=%p\n\n",CPEH[a].cpih_offset); - - /*if(CPEH[a].cpeh_size!=0x1c) - { - sprintf(err,"106: CPEH.cpeh_size!=0x1c\n"); - fclose(CPI); - return 106; - } - if(CPEH[a].device_type!=1) - { - sprintf(err,"107: CPEH.device_type!=1\n"); - fclose(CPI); - return 107; - }*/ fseek(CPI,CPEH[a]->cpih_offset,0); fwrite(CPIH[a],0x6,1,CPI); -// printf("CPIH[%d]:\n",a); -// printf("version=%d\n",CPIH[a].version); -// printf("num_fonts=%d\n",CPIH[a].num_fonts); -// printf("size=%x\n\n",CPIH[a].size); - - /*if(CPIH[a].version!=1) - { - sprintf(err,"108: CPIH.version!=1\n"); - fclose(CPI); - return 108; - } - if(CPIH[a].num_fonts>3) - { - sprintf(err,"109: CPIH.numfonts>3\n"); - fclose(CPI); - return 109; - }*/ for(b=0;bnum_fonts;++b) { fwrite(SFH[a][b],0x6,1,CPI); -// printf("SFH[%d][%d]:\n",a,b); -// printf("height=%d\n",SFH[a][b].height); -// printf("width=%d\n",SFH[a][b].width); -// printf("yaspect=%2x\n",SFH[a][b].yaspect); -// printf("xaspect=%2x\n",SFH[a][b].xaspect); -// printf("num_chars=%d\n\n",SFH[a][b].num_chars); - //fseek(CPI,SFH[a][b]->num_chars*SFH[a][b]->height*((SFH[a][b]->width+7)/8),1); - /*if(SFH[a][b].height==8) - { - if (byo8[a]!=0) - { - sprintf(err,"113: SFH.height==8 ju¾ byˆo"); - fclose(CPI); - return 113; - } - byo8[a]=1; - } - if(SFH[a][b].height==14) - { - if (byo14[a]!=0) - { - sprintf(err,"114: SFH.height==14 ju¾ byˆo"); - fclose(CPI); - return 114; - } - byo14[a]=1; - } - if(SFH[a][b].height==16) - { - if (byo16[a]!=0) - { - sprintf(err,"115: SFH.height==16 ju¾ byˆo"); - fclose(CPI); - return 115; - } - byo16[a]=1; - } - - - if(SFH[a][b].height!=8&&SFH[a][b].height!=14&&SFH[a][b].height!=16) - { - sprintf(err,"110: SFH.height!=(8 || 14 || 16)\n"); - fclose(CPI); - return 110; - } - if(SFH[a][b].width!=8) - { - sprintf(err,"111: SFH.width!=8\n"); - fclose(CPI); - return 111; - } - if(SFH[a][b].num_chars!=256) - { - sprintf(err,"112: SFH.num_chars!=256\n"); - fclose(CPI); - return 112; - }*/ if(SFH[a][b]->height==16) - { - //for(c=0;c<256;++c) - // fread(&SFB16[a].lit[c],0x10,1,CPI); fwrite(SFB16[a],0x10,256,CPI); - } if(SFH[a][b]->height==14) { - //for(c=0;c<256;++c) - // fread(&SFB14[a].lit[c],0x0e,1,CPI); fwrite(SFB14[a],0x0e,256,CPI); } if(SFH[a][b]->height==8) { - //for(c=0;c<256;++c) - // fread(&SFB8[a].lit[c],0x08,1,CPI); fwrite(SFB8[a],0x08,256,CPI); } - //fseek(CPI,SFH[a][b]->num_chars*SFH[a][b]->height*((SFH[a][b]->width+7)/8),1); } - /*for(b=0;bnum_fonts;++b) - { - fseek(CPI,CPEH[a].cpih_offset+0xc,0); - if(b>0) - fseek(CPI,SFH[a][0].height*256+0x6,1); - if(b>1) - fseek(CPI,SFH[a][1].height*256+0x6,1); - - if(SFH[a][b].height==16) - { - for(c=0;c<256;++c) - fwrite(&SFB16[a].lit[c],0x10,1,CPI); - } - if(SFH[a][b].height==14) - { - for(c=0;c<256;++c) - fwrite(&SFB14[a].lit[c],0x0e,1,CPI); - } - if(SFH[a][b].height==8) - { - for(c=0;c<256;++c) - fwrite(&SFB8[a].lit[c],0x08,1,CPI); - } - }*/ } - fprintf(CPI,"\nTen plik zostaˆ wygenerowany za pomoc¥ Edytora napis¢w, wersja 1.1\n autor programu: Balthasar Szczepaäski%c",0x1a); + fprintf(CPI,"\r\nTen plik zostaˆ wygenerowany za pomoc¥ Edytora napis¢w, wersja 1.1b\r\n autor programu: Balthasar Szczepaäski%c",0x1a); fclose(CPI); return 0; @@ -1900,48 +1757,81 @@ int newCPI2(short CP, short h) sprintf(err,"0:Ok"); return 0; } - -int newCPI() + +void displayDialog(int color,char *text,int type=0) { - short CP,h; - char temp[51]; - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); + char t1[43]="±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±"; + strcpy(t1+1,text); + t1[strlen(t1)]='±'; setcolor(BLACK); + outtextxy(152,184,"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"); + outtextxy(152,192,"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"); + outtextxy(152,200,"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"); + outtextxy(152,208,"ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ"); + setcolor(color); + outtextxy(152,184,t1); + outtextxy(152,192,"± ±"); + outtextxy(152,200,"± ±"); + switch(type) + { + case 2: + outtextxy(152,208,"±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±again?(y/n)±"); + break; + case 1: + outtextxy(152,208,"±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey±"); + break; + case 0: + default: + outtextxy(152,208,"±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±"); + break; + } +} - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(GREEN); - - outtextxy(144,184," ±First codepage number:±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± "); - - scanf("%u",&CP); - - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); +int message(char *text, char *value, int type=1) +{ + if (type!=2) + { + displayDialog(BROWN,text,1); + printf("%s",value); + bioskey(_KEYBRD_READ); + return 0; + } + else + { + displayDialog(BROWN,text,2); + printf("%s",value); + int a; + for(;;) + { + a=bioskey(_KEYBRD_READ); + if((a&0xFF)==0x59||(a&0xFF)==0x79) + return 0; + if((a&0xFF)==0x4e||(a&0xff)==0x6e) + return 1; + } + } +} - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); +inline void question(char *text, char *result) +{ + displayDialog(GREEN,text); + scanf("%s",result); +} - setcolor(GREEN); +inline unsigned question(char *text) +{ + char temp[256]; + question(text,temp); + return atoi(temp); +} - outtextxy(144,184," ±Initial font Height(8,14,16,all)±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± "); - - scanf("%s",temp); - h=atoi(temp); +int newCPI() +{ + short CP,h; + char temp[51]; + CP=question("First codepage number:"); + h=question("Initial font height(8,14,16,all)"); if(h!=0&&h!=8&&h!=14&&h!=16) { sprintf(err,"310:Wrong height (%u)",h); @@ -1949,8 +1839,6 @@ int newCPI() } return newCPI2(CP,h); } - - int newCP() { @@ -1961,23 +1849,7 @@ int newCP() sprintf(err,"305:Already 16 codepages in CPI"); return 305; } - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(GREEN); - - outtextxy(144,184," ±Codepage number:±±±±±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± "); - - scanf("%u",&CP); + CP=question("Codepage number:"); for(short i=0;inum_codepages;++i) { if(CP==CPEH[i]->codepage) @@ -1986,25 +1858,7 @@ int newCP() return 314; } } - - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(GREEN); - - outtextxy(144,184," ±Initial font Height(8,14,16,all)±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± "); - - scanf("%s",temp); - h=atoi(temp); + h=question("Initial font height(8,14,16,all)"); if(h!=0&&h!=8&&h!=14&&h!=16) { sprintf(err,"310:Wrong height (%u)",h); @@ -2014,103 +1868,31 @@ int newCP() } int newF() { + short h; if(CPIH[cp]->num_fonts>=3) { sprintf(err,"309:Already 3 fonts in CPIH[%u]",cp); return 309; } - - short h; - - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(GREEN); - - outtextxy(144,184," ±Font Height(8,14,16)±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± "); - scanf("%u",&h); - - //closegraph(); - //initgraph(&kart16,&tryb16,""); + h=question("Font height(8,14,16)"); return newF2(h); } int otw() { - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(GREEN); - - outtextxy(144,184," ±Filename:±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± "); - scanf("%s",nazwap); - - //closegraph(); - //initgraph(&kart16,&tryb16,""); - return otw2(); -} + question("Filename",nazwap); + return otw2(); +} int zap() { - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(GREEN); - - outtextxy(144,184," ±Filename:±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± "); - scanf("%s",nazwap); - - //closegraph(); - //initgraph(&kart16,&tryb16,""); + question("Filename",nazwap); return zap2(); } int zmn() { short CP; - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(GREEN); - - outtextxy(144,184," ±Codepage number:±±±±±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± "); - - scanf("%u",&CP); + CP=question("Codepage number"); for(short i=0;inum_codepages;++i) { if(CP==CPEH[i]->codepage&&i!=cp) @@ -2120,327 +1902,41 @@ int zmn() } } CPEH[cp]->codepage=CP; - //closegraph(); - //initgraph(&kart16,&tryb16,""); return 0; } -int bnd() -{ - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(BROWN); - - outtextxy(144,184," ±CPI file not loaded±±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±again?(y/n)± "); - - printf("%s",err); - int a; - for(;;) - { - a=bioskey(_KEYBRD_READ); - if((a&0xFF)==0x59||(a&0xFF)==0x79) - { - //closegraph(); - //initgraph(&kart16,&tryb16,""); - return 0; - } - if((a&0xFF)==0x4e||(a&0xff)==0x6e) - { - //closegraph(); - //initgraph(&kart16,&tryb16,""); - return 1; - } - - } - - -} -int bnd2() -{ - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(BROWN); - - outtextxy(144,184," ±CPI file not saved±±±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±again?(y/n)± "); - - printf("%s",err); - int a; - for(;;) - { - a=bioskey(_KEYBRD_READ); - if((a&0xFF)==0x59||(a&0xFF)==0x79) - { - //closegraph(); - //initgraph(&kart16,&tryb16,""); - return 0; - } - if((a&0xFF)==0x4e||(a&0xff)==0x6e) - { - //closegraph(); - //initgraph(&kart16,&tryb16,""); - return 1; - } - - } -} - -int bnd8() -{ - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(BROWN); - - outtextxy(144,184," ±CPI not created±±±±±±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±again?(y/n)± "); - - printf("%s",err); - int a; - for(;;) - { - a=bioskey(_KEYBRD_READ); - if((a&0xFF)==0x59||(a&0xFF)==0x79) - { - //closegraph(); - //initgraph(&kart16,&tryb16,""); - return 0; - } - if((a&0xFF)==0x4e||(a&0xff)==0x6e) - { - //closegraph(); - //initgraph(&kart16,&tryb16,""); - return 1; - } - - } -} - -int bnd3() -{ - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(BROWN); - - outtextxy(144,184," ±Font not created±±±±±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± "); - - printf("%s",err); - bioskey(_KEYBRD_READ); -// closegraph(); -// initgraph(&kart16,&tryb16,""); - return 0; - - - -} - -int bnd6() -{ - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(BROWN); - - outtextxy(144,184," ±Codepage not created±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± "); - - printf("%s",err); - bioskey(_KEYBRD_READ); -// closegraph(); -// initgraph(&kart16,&tryb16,""); - return 0; -} - -int bnd4() -{ - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(BROWN); - - outtextxy(144,184," ±Font not deleted±±±±±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± "); - - printf("%s",err); - bioskey(_KEYBRD_READ); -// closegraph(); -// initgraph(&kart16,&tryb16,""); - return 0; -} - -int bnd7() -{ - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(BROWN); - - outtextxy(144,184," ±Codepage not deleted±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± "); - - printf("%s",err); - bioskey(_KEYBRD_READ); -// closegraph(); -// initgraph(&kart16,&tryb16,""); - return 0; -} - - -int bnd5() -{ - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(BROWN); - - outtextxy(144,184," ±Number not changed±±±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± "); - - printf("%s",err); - bioskey(_KEYBRD_READ); -// closegraph(); -// initgraph(&kart16,&tryb16,""); - return 0; -} - -int pmc() -{ - gotoxy(21,13); - //printf("\n\n\n\n\n\n\n\n\n\n\n\n "); - setcolor(BLACK); - - outtextxy(144,184," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,192," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,200," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - outtextxy(144,208," ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ "); - - setcolor(BROWN); - - outtextxy(144,184," ±Pomoc niedost©pna±±±±±±±±±±±±±±±±±±±±±±±± "); - outtextxy(144,192," ± ± "); - outtextxy(144,200," ± ± "); - outtextxy(144,208," ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±anykey± "); - - printf("%s",err); - bioskey(_KEYBRD_READ); -// closegraph(); -// initgraph(&kart16,&tryb16,""); - return 0; - - - -} - - int main(int argc,char* argv[]) { nullpointers(); -// registerbgidriver(CGA_driver); - registerbgidriver(EGAVGA_driver); - initgraph(&kart16,&tryb16,""); - wys=8; - - //new8(); - //menu8(); - //cpwys(); - setcolor(RED); - outtextxy(136,472,"load"); if(argc>1) { - new8(); - menu8(); - cpwys(); sprintf(nazwap,"%s",argv[1]); status=otw2(); - - while(status!=0) + if(status) { - if (bnd()==0) - status=otw(); - else - { - break; - //closegraph(); - //deleteCPI(); - //return status; - } + puts(err); + return status; } - any=!status; + any=1; } else any=0; - + status=registerbgidriver(EGAVGA_driver); + if (status < 0) + { + printf("g%d:%s\n",status,grapherrormsg(status)); + return status; + } + initgraph(&kart16,&tryb16,""); + status=graphresult(); + if (status != grOk) + { + printf("g%d:%s\n",status,grapherrormsg(status)); + return status; + } + if(byo8[0]) wys=8; else if(byo16[0]) @@ -2470,239 +1966,268 @@ int main(int argc,char* argv[]) if((key&0xFF00)==0x4800&&any) { //w g¢r© - //if(cury==0) - // cury=wys-1; - //else - // --cury; + prey=cury; + prex=curx; cury+=wys-1; cury%=wys; - if(wys==8) - lit8(); - if(wys==14) - lit14(); - if(wys==16) - lit16(); + switch(wys) + { + case 8: + lit8(2); + break; + case 14: + lit14(2); + break; + case 16: + lit16(2); + break; + } } if((key&0xFF00)==0x5000&&any) { //w d¢ˆ - //if(cury==wys-1) - // cury=0; - //else - // ++cury; + prey=cury; + prex=curx; ++cury; cury%=wys; - if(wys==8) - lit8(); - if(wys==14) - lit14(); - if(wys==16) - lit16(); - + switch(wys) + { + case 8: + lit8(2); + break; + case 14: + lit14(2); + break; + case 16: + lit16(2); + break; + } } if((key&0xFF00)==0x4b00&&any) { //w lewo - //if(curx==0) - // curx=7; - //else - // --curx; + prey=cury; + prex=curx; --curx; curx&=0x7; - if(wys==8) - lit8(); - if(wys==14) - lit14(); - if(wys==16) - lit16(); + switch(wys) + { + case 8: + lit8(2); + break; + case 14: + lit14(2); + break; + case 16: + lit16(2); + break; + } } if((key&0xFF00)==0x4d00&&any) { //w prawo - //if(curx==7) - // curx=0; - //else - // ++curx; + prey=cury; + prex=curx; ++curx; curx&=0x7; - if(wys==8) - lit8(); - if(wys==14) - lit14(); - if(wys==16) - lit16(); + switch(wys) + { + case 8: + lit8(2); + break; + case 14: + lit14(2); + break; + case 16: + lit16(2); + break; + } } if ((key&0xFF00)==0x3900&&any) { //spacja - if(wys==8) + switch(wys) { + case 8: spc8(); - lit8(); - lin8(); - } - if(wys==14) - { + lit8(1); + lin8(3); + break; + case 14: spc14(); - lit14(); - lin14(); - } - if(wys==16) - { + lit14(1); + lin14(3); + break; + case 16: spc16(); - lit16(); - lin16(); + lit16(1); + lin16(3); + break; } } if ((key&0xFF00)==0x0e00&&any) { //backspace - if(wys==8) + switch(wys) { + case 8: bsp8(); - lit8(); - lin8(); - } - if(wys==14) - { + lit8(1); + lin8(3); + break; + case 14: bsp14(); - lit14(); - lin14(); - } - if(wys==16) - { + lit14(1); + lin14(3); + break; + case 16: bsp16(); - lit16(); - lin16(); + lit16(1); + lin16(3); + break; } } if ((key&0xFF00)==0x1c00&&any) { //enter - if(wys==8) + switch(wys) { + case 8: ent8(); - lit8(); - lin8(); - } - if(wys==14) - { + lit8(1); + lin8(3); + break; + case 14: ent14(); - lit14(); - lin14(); - } - if(wys==16) - { + lit14(1); + lin14(3); + break; + case 16: ent16(); - lit16(); - lin16(); + lit16(1); + lin16(3); + break; } } - - } else { if((key&0xFF00)==0x4800&&any) { //w g¢r© l - //if(lit<16) - // lit=(0xf0+lit%16); - //else - // lit=((lit/16-1)*16+lit%16); + pre=lit; lit-=16; lit&=0xFF; lit8(); lit14(); lit16(); - if (wys==8) - lin8(); - if (wys==14) - lin14(); - if (wys==16) - lin16(); - + switch(wys) + { + case 8: + lin8(2); + break; + case 14: + lin14(2); + break; + case 16: + lin16(2); + break; + } } if((key&0xFF00)==0x5000&&any) { //w d¢ˆ l - //if(lit>=0xf0) - // lit=(0+lit%16); - //else - // lit=((lit/16+1)*16+lit%16); + pre=lit; lit+=16; lit&=0xFF; lit8(); lit14(); lit16(); - if (wys==8) - lin8(); - if (wys==14) - lin14(); - if (wys==16) - lin16(); + switch(wys) + { + case 8: + lin8(2); + break; + case 14: + lin14(2); + break; + case 16: + lin16(2); + break; + } } if((key&0xFF00)==0x4b00&&any) { //w lewo l - //if(lit%16==0) - // lit+=15; - //else - // --lit; + pre=lit; --lit; lit&=0xFF; lit8(); lit14(); lit16(); - if (wys==8) - lin8(); - if (wys==14) - lin14(); - if (wys==16) - lin16(); + switch(wys) + { + case 8: + lin8(2); + break; + case 14: + lin14(2); + break; + case 16: + lin16(2); + break; + } } if((key&0xFF00)==0x4d00&&any) { - //w prawo l - //if(lit%16==15) - // lit-=15; - //else - // ++lit; + pre=lit; ++lit; lit&=0xFF; lit8(); lit14(); lit16(); - if (wys==8) - lin8(); - if (wys==14) - lin14(); - if (wys==16) - lin16(); + switch(wys) + { + case 8: + lin8(2); + break; + case 14: + lin14(2); + break; + case 16: + lin16(2); + break; + } } } if ((key&0xFF00)==0x0f00&&any) { //tab - if(tab==0) + if(!tab) tab=1; else tab=0; - ramka8(); - ramka14(); - ramka16(); + switch(wys) + { + case 8: + ramka8(); + break; + case 14: + ramka14(); + break; + case 16: + ramka16(); + break; + } } if ((key&0xFF00)==0x5100&&any) { //cp++ - //if(cp==FIH->num_codepages-1) - // cp=0; - //else - // ++cp; ++cp; cp%=FIH->num_codepages; - + prex=curx; + prey=cury; if(wys==8&&byo8[cp]==0) { if(byo14[cp]!=0) @@ -2742,10 +2267,6 @@ int main(int argc,char* argv[]) if ((key&0xFF00)==0x4900&&any) { //cp-- - //if(cp==0) - // cp=FIH->num_codepages-1; - //else - // --cp; cp+=FIH->num_codepages-1; cp%=FIH->num_codepages; @@ -2788,138 +2309,142 @@ int main(int argc,char* argv[]) if ((key&0xFF00)==0x4700&&any) { //wys-- - if(wys==8) + prex=curx; + prey=cury; + switch(wys) { + case 8: if (byo16[cp]!=0) { wys=16; - cury%=16; + lin16(1); + lit16(1); + ramka16(); } - else + else if(byo14[cp]!=0) { - if(byo14[cp]!=0) - { - wys=14; - cury%=14; - } + wys=14; + lin14(1); + lit14(1); + ramka14(); } - } - else - { - if(wys==14) + lin8(1); + lit8(1); + ramka8(); + break; + case 14: + if (byo8[cp]!=0) { - if (byo8[cp]!=0) - { - wys=8; - cury%=8; - } - else - { - if(byo16[cp]!=0) - { - wys=16; - cury%=16; - } - } + wys=8; + cury%=8; + lin8(1); + lit8(2); + ramka8(); } - else + else if(byo16[cp]!=0) { - if(wys==16) - { - if (byo14[cp]!=0) - { - wys=14; - cury%=14; - } - else - { - if(byo8[cp]!=0) - { - wys=8; - cury%=8; - } - } - } + wys=16; + lin16(1); + lit16(1); + ramka16(); + } + lin14(1); + lit14(2); + ramka14(); + break; + case 16: + if (byo14[cp]!=0) + { + wys=14; + cury%=14; + lin14(1); + lit14(2); + ramka14(); + } + else if(byo8[cp]!=0) + { + wys=8; + cury%=8; + lin8(1); + lit8(2); + ramka8(); } + lin16(1); + lit16(2); + ramka16(); + break; } - ramka8(); - ramka14(); - ramka16(); cpwys(); - lit8(); - lit14(); - lit16(); - lin8(); - lin14(); - lin16(); } if ((key&0xFF00)==0x4f00&&any) { //wys++ - if(wys==8) + prex=curx; + prey=cury; + switch(wys) { - if (byo14[cp]!=0) + case 8: + if(byo14[cp]!=0) { wys=14; - cury%=14; + lin14(1); + lit14(1); + ramka14(); } - else + else if (byo16[cp]!=0) { - if(byo16[cp]!=0) - { - wys=16; - cury%=16; - } + wys=16; + lin16(1); + lit16(1); + ramka16(); } - } - else - { - if(wys==14) + lin8(1); + lit8(1); + ramka8(); + break; + case 14: + if(byo16[cp]!=0) { - if (byo16[cp]!=0) - { - wys=16; - cury%=16; - } - else - { - if(byo8[cp]!=0) - { - wys=8; - cury%=8; - } - } + wys=16; + lin16(1); + lit16(1); + ramka16(); } - else + else if (byo8[cp]!=0) { - if(wys==16) - { - if (byo8[cp]!=0) - { - wys=8; - cury%=8; - } - else - { - if(byo14[cp]!=0) - { - wys=14; - cury%=14; - } - } - } + wys=8; + cury%=8; + lin8(1); + lit8(2); + ramka8(); + } + lin14(1); + lit14(2); + ramka14(); + break; + case 16: + if(byo8[cp]!=0) + { + wys=8; + cury%=8; + lin8(1); + lit8(2); + ramka8(); + } + else if (byo14[cp]!=0) + { + wys=14; + cury%=14; + lin14(1); + lit14(2); + ramka14(); } + lin16(1); + lit16(2); + ramka16(); + break; } - ramka8(); - ramka14(); - ramka16(); cpwys(); - lit8(); - lit14(); - lit16(); - lin8(); - lin14(); - lin16(); } if ((key&0xFF00)==0x3b00) @@ -2931,7 +2456,7 @@ int main(int argc,char* argv[]) status=newCPI(); while(status!=0) { - if (bnd8()==0) + if (message("CPI not created",err,2)==0) status=newCPI(); else { @@ -2976,7 +2501,7 @@ int main(int argc,char* argv[]) status=zap(); while(status!=0) { - if (bnd2()==0) + if (message("CPI file not saved",err,2)==0) status=zap(); else break; @@ -3008,15 +2533,10 @@ int main(int argc,char* argv[]) status=otw(); while(status!=0) { - if (bnd()==0) + if (message("CPI file not loaded",err,2)==0) status=otw(); else - { break; - //closegraph(); - //deleteCPI(); - //return status; - } } any=!status; cp=0; @@ -3044,14 +2564,14 @@ int main(int argc,char* argv[]) } if((key&0xFF00)==0x3e00&&any) { - { + //zapisz+system setcolor(RED); outtextxy(72,472,"save use"); status=zap(); while(status!=0) { - if (bnd2()==0) + if (message("CPI file not saved",err,2)==0) status=zap(); else break; @@ -3083,11 +2603,6 @@ int main(int argc,char* argv[]) lit16(); cury%=8; - - } - - - } if ((key&0xFF00)==0x3f00&&any) { @@ -3096,7 +2611,7 @@ int main(int argc,char* argv[]) outtextxy(256,472,"number"); status=zmn(); if(status!=0) - bnd5(); + message("Number not changed",err); new8(); menu8(); cpwys(); @@ -3117,7 +2632,7 @@ int main(int argc,char* argv[]) outtextxy(336,472,"newF"); status=newF(); if(status!=0) - bnd3(); + message("Fonr not created",err); offset(); new8(); menu8(); @@ -3140,7 +2655,7 @@ int main(int argc,char* argv[]) outtextxy(400,472,"newCP"); status=newCP(); if(status!=0) - bnd6(); + message("Codepage not created",err); else cp=FIH->num_codepages-1; if(wys==8&&byo8[cp]==0) @@ -3189,7 +2704,7 @@ int main(int argc,char* argv[]) outtextxy(472,472,"delF"); status=delF(); if(status!=0) - bnd4(); + message("Font not deleted",err); offset(); if(wys==8&&byo8[cp]==0) @@ -3237,7 +2752,7 @@ int main(int argc,char* argv[]) outtextxy(536,472,"delCP"); status=delCP(); if(status!=0) - bnd7(); + message("Codepage not deleted",err); offset(); cp%=FIH->num_codepages; diff --git a/NAPISY.PRJ b/NAPISY.PRJ index 8db5208dbaa19f940f9620535d42ab44194f9104..708586841cef40ba555d0d33b014ae2de5dd4268 100644 GIT binary patch delta 441 zcmeyb{8xFxS5fA_42%p6|3Jil5W&C*Bqnn)dNDF?4rNSbRkDgHD9TSSO3Ve(S*h72 zl`(mV1)0T_F{$Z^MtaEwnUfV+VmDi|n=|sQ?tJFN#o*7zQ0E@x8Zgr7^H-NmT^t?