X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Ffontgfx.c;h=89e2e2f563d3de2c976ca9a368b6d2b3079c0034;hb=54e80274a159f2c8f12bbb284403927616c686c5;hp=141845770635b4a0dacb79a7917a0b9d8677234e;hpb=a6b0748477dd54ae822c4204c848468bca230c2a;p=16.git diff --git a/src/fontgfx.c b/src/fontgfx.c old mode 100644 new mode 100755 index 14184577..89e2e2f5 --- 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-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * @@ -25,33 +25,131 @@ //#include "lib/16text.h" #include "lib/modex16.h" +#include +#include +#include +#include + +global_game_variables_t gvar; + void main(int argc, char near *argv[]) { + struct vga_mode_params cm; //JMOJI - byte e; - word chx, chy, colpee; + static byte e; + //word ri; + 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\ + III BBBBBBBBB MMMMMMM MMMMMMM\n\ + III BBBBBBBBB MMM MMMMMMM MMM\n\ + III BBB BBB MMM MMMMM MMM\n\ +IIIIIII BBBBBBBBBBB MMMM MMM MMMM\n\ +IIIIIII BBBBBBBBB MMMM M MMMM\n\ +"; + static byte rose[]=" :. ,..\n\ + .' :~.':_.,\n\ + .' ::.::'.'\n\ + : ::' .:\n\ + `.: .: .:/\n\ + `::--.:'.::'\n\ + |. _:===-'\n\ + / /\n\ + ,---.---. __,','\n\ + (~`. \ ) )','.,---..\n\ + `v`\ | ,' .-'.:,'_____ `.\n\ + )|/.-~.--~~--. ~~~-. \ \n\ + _/-'_.-~ ""---.._`.|\n\ + _.-~~_.-~ ""'\n\ + _..--~~_.(~~\n\ + __...---~~~_..--~~\n\ +,'___...---~~~\n\ +"; +// static byte *rosa; + static word chx, chy, colpee; + static word z; 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); +// __asm{ +// mov AH,12H +// mov BL,30h +// mov AL,04h +// int 10 +// mov ax,1123h +// int 10h +// ;mov ax,1112h ; load 8x8 character set into RAM +// ;int 10h +// } + /* setup camera and 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]); + vga_read_crtc_mode(&cm); + // 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=0; - for(e=' '; e<='~'; e++) - { - if(chx+8>(SCREEN_WIDTH/2)-1) - { - chx=0; - chy+=8; - modexprint(200, 200, 1, 47, 0, &e); - } - modexprint(chx, chy, 1, 0, colpee, &e); - chx+=9; + chy=0; +// colpee=32; +// bios_cls(); + /* position the cursor to home */ +// vga_moveto(0,0); +// vga_sync_bios_cursor(); + for(e=0x00, z=0; e<=0xFE; e++, z++) + { + //if(chx+8>(gvar.video.page[0].width/2)) + if((z)+1>16) + { + chx=0; + chy+=8; + sprintf(pee,"%u", colpee); + modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee, 1); + z=0; +// printf("\n"); + //getch(); + } + sprintf(pee, "%zc", e); + modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e, 1); + chx+=9; colpee++; - } - modexprint(100, 100, 1, 47, 0, "wwww"); +// if(colpee>=32+24) colpee=32; + } getch(); - modexLeave(); - printf("\n\n%u %c", ''); - printf("\n%c\n", e); + //modexprint(100, 100, 1, 47, 0, "wwww"); +// modexprint(0, 0, 1, 0, colpee, &rose); +//++++ 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(); + VGAmodeX(0, 1, &gvar); +// rosa=malloc(sizeof(ROSE)); +// (*rosa)=(byte)ROSE; + printf("\n%s\n", rose); + //printf("\nh=%d\n", '8'); +// printf("\n%c\n", e); + printf("cm.offset=%d\n", cm.offset); + printf("vga_state.vga_stride=%d\n", vga_state.vga_stride); }