X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Ffontgfx.c;h=dacd01e0d02b692f2347fb701157452a3245b4bb;hb=9540760f9429bfe71894c801e85cec95e3887f8c;hp=4fc08ee98b3b790a05a050578988751c5e2e5384;hpb=2170cf972950dffecd075a65d1f8d9a49eb82ce9;p=proj16%2F16.git diff --git a/src/fontgfx.c b/src/fontgfx.c old mode 100644 new mode 100755 index 4fc08ee9..dacd01e0 --- a/src/fontgfx.c +++ b/src/fontgfx.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2021 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * * This file is part of Project 16. * @@ -21,17 +21,21 @@ */ #include #include -#include "lib/types.h" +#include "src/lib/16_t.h" //#include "lib/16text.h" -#include "lib/modex16.h" +#include "src/lib/16_vl.h" + +#include +#include +#include void main(int argc, char near *argv[]) { + static global_game_variables_t gvar; //JMOJI static byte e; //word ri; - byte pee[2]; - page_t screen; + byte pee[6]; // must be large enough for sprintf("%zc",...) and sprintf("%u",(byte value)) static byte ibmlogo[]="IIIIIII BBBBBBBBB MMMMM MMMMM\n\ IIIIIII BBBBBBBBBBB MMMMMM MMMMMM\n\ III BBB BBB MMMMMM MMMMMM\n\ @@ -60,44 +64,70 @@ IIIIIII BBBBBBBBB MMMM M MMMM\n\ ,'___...---~~~\n\ "; // static byte *rosa; - static word chx, chy, colpee; + static word chx, chy, colpee, addr; textInit(); - modexEnter(); + + // DOSLIB: check our environment + probe_dos(); + + // DOSLIB: what CPU are we using? + // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. + // So this code by itself shouldn't care too much what CPU it's running on. Except that other + // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for + // the CPU to carry out tasks. --J.C. + cpu_probe(); + + // DOSLIB: check for VGA + if (!probe_vga()) { + printf("VGA probe failed\n"); + return; + } + // hardware must be VGA or higher! + if (!(vga_state.vga_flags & VGA_IS_VGA)) { + printf("This program requires VGA or higher graphics hardware\n"); + return; + } + VGAmodeX(1, 1, &gvar); /* setup camera and screen~ */ - screen = modexDefaultPage(); - //screen.width += (16*2); - //screen.height += (16*2); -//++++ modexShowPage(&screen); + gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); + gvar.video.page[0].width += (16*2); + gvar.video.page[0].height += (16*2); + modexShowPage(&gvar.video.page[0]); + // NTS: We're in Mode-X now. printf() is useless. Do not use printf(). Or INT 10h text printing. Or DOS console output. //modexprint(16, 16, 1, 15, "wwww"); //getch(); chx=0; chy=0; colpee=32; + /* position the cursor to home */ +// vga_moveto(0,0); +// vga_sync_bios_cursor(); for(e=0x00; e<=0xFE; e++) { - if(chx+8>(screen.width/2)) + if(chx+8>(gvar.video.page[0].width/2)) { chx=0; chy+=8; sprintf(pee,"%u", colpee); - modexprint(&screen, 200, 200, 1, 47, 0, &pee); + modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee); //getch(); } - modexprint(&screen, chx, chy, 1, 0, colpee, &e); - chx+=9; + sprintf(pee, "%zc", e); + modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e); + chx+=8; colpee++; if(colpee>=32+24) colpee=32; } - //modexprint(100, 100, 1, 47, 0, "wwww"); getch(); + modexprint(&gvar.video.page[0], gvar.video.page[0].width - (8*16)/*HACK: The rose ASCII is too wide for 320x240 so offset it to make sure the petals are visible*/, 8, 1, 45, 0, &rose); + getch(); + //modexprint(100, 100, 1, 47, 0, "wwww"); // modexprint(0, 0, 1, 0, colpee, &rose); -//++++ modexprint(&screen, 0, 0, 0, 0, colpee, &ibmlogo); - modexprintbig(&screen, 0, 0, 1, colpee, 0, "IBM"); +//++++ modexprint(&gvar.video.page[0], 0, 0, 0, 0, colpee, &ibmlogo); +// modexprintbig(&gvar.video.page[0], 0, 0, 1, colpee, 0, "IBM"); // modexprint(0, 0, 1, 0, colpee, ROSE); - getch(); - modexLeave(); -// rosa=malloc(sizeof(ROSE)); -// (*rosa)=(byte)ROSE; +//++++ getch(); + VGAmodeX(0, 1, &gvar); printf("\n%s\n", rose); //printf("\nh=%d\n", '8'); // printf("\n%c\n", e);