From: sparky4 Date: Mon, 22 Jun 2015 19:07:10 +0000 (-0500) Subject: wwww X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=2b0d2cafcea89594a31a2993efd8766cc1017725;p=16.git wwww --- diff --git a/16.LIB b/16.LIB index bdf585c9..e9ec4544 100644 Binary files a/16.LIB and b/16.LIB differ diff --git a/16.exe b/16.exe index dc1c660c..f7659310 100644 Binary files a/16.exe and b/16.exe differ diff --git a/FTEST.EXE b/FTEST.EXE index 01188632..15bcc371 100644 Binary files a/FTEST.EXE and b/FTEST.EXE differ diff --git a/emmtest.exe b/emmtest.exe index 1afe9df7..fb51561f 100644 Binary files a/emmtest.exe and b/emmtest.exe differ diff --git a/emsdump.exe b/emsdump.exe index e19947ac..9dac2237 100644 Binary files a/emsdump.exe and b/emsdump.exe differ diff --git a/fmemtest.exe b/fmemtest.exe index 7904c7d6..951d2440 100644 Binary files a/fmemtest.exe and b/fmemtest.exe differ diff --git a/maptest.exe b/maptest.exe index 9d02cb1c..36d8c98a 100644 Binary files a/maptest.exe and b/maptest.exe differ diff --git a/maptest0.exe b/maptest0.exe index 815756c6..12dda10a 100644 Binary files a/maptest0.exe and b/maptest0.exe differ diff --git a/palettec.exe b/palettec.exe index 31612103..d86b26d5 100644 Binary files a/palettec.exe and b/palettec.exe differ diff --git a/pcxtest.exe b/pcxtest.exe index 947344db..b30c56fa 100644 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/scroll.exe b/scroll.exe index daf1175c..5d88dfcd 100644 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/FTEST.C b/src/FTEST.C index 5f7efa80..9641ba11 100644 --- a/src/FTEST.C +++ b/src/FTEST.C @@ -1,13 +1,36 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ #include +#include #include "lib/types.h" #include "lib/text.h" -main() { +void main(int argc, char *argv[]) +{ int i; int j; - char l[16]; + char l[16]; char c; - word s, o; + word s, o, t, w; word addr = (word) l; textInit(); @@ -20,8 +43,32 @@ main() { printf("Character: "); scanf("%c", &c); - s=romFonts[ROM_FONT_8x16].seg; - o=romFonts[ROM_FONT_8x16].off; + switch(*argv[1]) + { + case 0: + t=0; + w=14; + break; + case 1: + t=1; + w=8; + break; + case 2: + t=2; + w=8; + break; + case 3: + t=3; + w=16; + break; + default: + t=3; + w=16; + } + + + s=romFonts[t].seg; + o=romFonts[t].off; //load the letter 'A' __asm { @@ -35,7 +82,7 @@ main() { SHL BX, 1 SHL BX, 1 ADD SI, BX ;the address of A - MOV CX, 16 + MOV CX, w L1: MOV AX, ES:SI MOV DS:DI, AX INC SI @@ -45,7 +92,7 @@ main() { } //render the letter in ascii art - for(i=0; i<16; i++) { + for(i=0; i, or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include -#include +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include #include #include "src/lib/modex16.h" -#include "src/lib/bitmap.h" -#include "src/lib/planar.c" +#include "src/lib/bitmap.h" +#include "src/lib/planar.h" word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ -/* +/* void -DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite) +DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite) { byte plane; word px, py; @@ -42,33 +42,33 @@ DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite) modexSelectPlane(PLANE(plane+x)); for(px = plane; px < p->width; px+=4) { offset=px; - for(py=0; pyheight/2; py++) { + for(py=0; pyheight/2; py++) { SELECT_ALL_PLANES(); if(!sprite || p->plane[offset]) page->data = p->plane; - //offset+=p->width; + //offset+=p->width; //offset++; } } } } -*/ +*/ void main() { - bitmap_t bmp; + bitmap_t bmp; planar_buf_t *p; - int i; + int i; page_t page; - word start; + word start; int plane; float t1, t2; page=modexDefaultPage(); -//0000 bmp = bitmapLoadPcx("data/koishi~~.pcx"); -// bmp = bitmapLoadPcx("data/chikyuu.pcx"); - bmp = bitmapLoadPcx("data/koishi^^.pcx"); -// bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx"); +//0000 bmp = bitmapLoadPcx("data/koishi~~.pcx"); +// bmp = bitmapLoadPcx("data/chikyuu.pcx"); + bmp = bitmapLoadPcx("data/koishi^^.pcx"); +// bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx"); p = planar_buf_from_bitmap(&bmp); modexEnter(); @@ -78,7 +78,7 @@ void main() { /* clear and draw one sprite and one bitmap */ modexClearRegion(&page, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 1); - /* non sprite comparison */ + /* non sprite comparison */ start = *clockw; for(i=0; i<100 ;i++) { oldDrawBmp(VGA, 20, 20, &bmp, 0); @@ -86,14 +86,14 @@ void main() { start = *clockw; for(i=0; i<100 ;i++) { -//0000 modexDrawBmp(&page, 20, 20, &bmp); +//0000 modexDrawBmp(&page, 20, 20, &bmp); modexDrawBmp(&page, 0, 0, &bmp); } t1 = (*clockw-start) /18.2; start = *clockw; for(i=0; i<100; i++) { -//0000 modexCopyPageRegion(&page, &page, 20, 20, 128, 20, 64, 64); +//0000 modexCopyPageRegion(&page, &page, 20, 20, 128, 20, 64, 64); modexCopyPageRegion(&page, &page, 0, 0, 0, 0, 320, 240); } t2 = (*clockw-start)/18.2; @@ -107,24 +107,24 @@ void main() { start = *clockw; for(i=0; i<100 ;i++) { -//0000 modexDrawSprite(&page, 20, 20, &bmp); +//0000 modexDrawSprite(&page, 20, 20, &bmp); modexDrawSprite(&page, 0, 0, &bmp); - } - //_fmemset(MK_FP(0xA000, 0), (int)p->plane, SCREEN_WIDTH*(SCREEN_HEIGHT*2)); - modexDrawBmp(&page, 0, 0, &bmp); - while(!kbhit()) - { - //DrawPBuf(&page, 0, 0, p, 0); - } + } + //_fmemset(MK_FP(0xA000, 0), (int)p->plane, SCREEN_WIDTH*(SCREEN_HEIGHT*2)); + modexDrawBmp(&page, 0, 0, &bmp); + while(!kbhit()) + { + //DrawPBuf(&page, 0, 0, p, 0); + } modexLeave(); - - printf("\n%d\n", sizeof(p->plane)); - printf("%d\n", sizeof(bmp)); - - for(i=0; i<(320*240); i++) - { - fprintf(stdout, "%d", bmp.data[i]); - if(i%320==0) fprintf(stdout, "\n"); + + printf("\n%d\n", sizeof(p->plane)); + printf("%d\n", sizeof(bmp)); + + for(i=0; i<(320*240); i++) + { + fprintf(stdout, "%d", bmp.data[i]); + if(i%320==0) fprintf(stdout, "\n"); } printf("CPU to VGA: %f\n", t1); printf("VGA to VGA: %f\n", t2); diff --git a/src/text.c b/src/text.c new file mode 100644 index 00000000..5101c545 --- /dev/null +++ b/src/text.c @@ -0,0 +1,59 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include "text.h" + +/* this array holds the rom font descriptors */ +font_t romFonts[4]; + + +static void getRomFontAddr(char fontNum, int index) { + word fontSeg; + word fontOff; + + __asm { + PUSH BP + MOV AX, 0x1130 ;I can haz font info plz? + MOV BH, fontNum ; where ur fontNum + INT 0x10 ;kthxbae + MOV AX, ES ;save teh segmentz + MOV BX, BP ;and all the base! + POP BP ;u can haz ur frame back! + MOV fontSeg, AX ;Storage + MOV fontOff, BX ;Storage + } + romFonts[index].seg = fontSeg; + romFonts[index].off = fontOff; + +} + +/* This function initializes the text engine */ +void textInit() { + getRomFontAddr(0x02, ROM_FONT_8x14); + getRomFontAddr(0x03, ROM_FONT_8x8_LOW); + getRomFontAddr(0x04, ROM_FONT_8x8_HIGH); + getRomFontAddr(0x06, ROM_FONT_8x16); + romFonts[ROM_FONT_8x14].charSize=14; + romFonts[ROM_FONT_8x8_LOW].charSize=8; + romFonts[ROM_FONT_8x8_HIGH].charSize=8; + romFonts[ROM_FONT_8x16].charSize=16; +} diff --git a/src/text.h b/src/text.h new file mode 100644 index 00000000..edee47a9 --- /dev/null +++ b/src/text.h @@ -0,0 +1,49 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +/* + * This is the text subsystem for project 16. + * These functions provide for the rendering of text strings + * using the BIOS fonts. + * They copy the font characters directly to VGA. + */ +#ifndef TEXT_H +#define TEXT_H +#include "types.h" + +/* font information type */ +typedef struct font { + word seg; //segment for the font + word off; //offset in the segment for the font + byte charSize; //bytes in each character +} font_t; + +/* storage for the rom fonts */ +extern font_t romFonts[4]; +#define ROM_FONT_8x14 0 +#define ROM_FONT_8x8_LOW 1 +#define ROM_FONT_8x8_HIGH 2 +#define ROM_FONT_8x16 3 + +/* This function initializes the text engine */ +void textInit(); + +#endif diff --git a/test.exe b/test.exe index cf0005e2..ab205aac 100644 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index c19556ff..1b6619ae 100644 Binary files a/test2.exe and b/test2.exe differ