#-zk0u = translate kanji to unicode... wwww\r
#-zk0 = kanji support~\r
#-zkl = current codepage\r
-
+\r
MFLAGS=-mh# -zm\r
CFLAGS=-zkl -wo -x#### -mc# -zdp# -zp16 -zq\r
OFLAGS=-ot -ox -ob -oh -or# -om -ol -ol+\r
16LIBOBJS = modex16.obj dos_kb.obj bitmap.obj planar.obj wcpu.obj lib_head.obj scroll16.obj
\r
-all: 16.exe test.exe pcxtest.exe test2.exe scroll.exe palettec.exe maptest.exe maptest0.exe emsdump.exe emmtest.exe fmemtest.exe \r
+all: 16.exe test.exe pcxtest.exe test2.exe scroll.exe palettec.exe maptest.exe maptest0.exe emsdump.exe emmtest.exe fmemtest.exe ftest.exe \r
#
#executables
test2.exe: test2.obj modex16.obj bitmap.obj planar.obj lib_head.obj\r
wcl $(FLAGS) test2.obj modex16.obj bitmap.obj planar.obj lib_head.obj\r
\r
+ftest.exe: text.obj ftest.obj\r
+ wcl $(FLAGS) ftest.obj text.obj\r
+\r
+text.obj: $(SRCLIB)text.c\r
+ wcl -c $(SRCLIB)text.c\r
+\r
+ftest.obj: $(SRC)ftest.c\r
+ wcl -c $(SRC)ftest.c\r
+\r
pcxtest.exe: pcxtest.obj modex16.obj bitmap.obj planar.obj lib_head.obj\r
- wcl $(FLAGS) pcxtest.obj modex16.obj bitmap.obj planar.obj lib_head.obj
-
+ wcl $(FLAGS) pcxtest.obj modex16.obj bitmap.obj planar.obj lib_head.obj\r
+\r
palettec.exe: palettec.obj modex16.obj\r
wcl $(FLAGS) palettec.obj modex16.obj\r
\r
maptest.exe: maptest.obj mapread.obj jsmn.obj modex16.obj bitmap.obj lib_head.obj\r
wcl $(FLAGS) maptest.obj mapread.obj jsmn.obj modex16.obj bitmap.obj lib_head.obj\r
-
+\r
maptest0.exe: maptest0.obj fmapread.obj farjsmn.obj# modex16.obj bitmap.obj lib_head.obj\r
- wcl $(FLAGS) $(MFLAGS) maptest0.obj fmapread.obj farjsmn.obj# modex16.obj bitmap.obj lib_head.obj
-
-emmtest.exe: emmtest.obj memory.obj
- wcl $(FLAGS) $(MFLAGS) emmtest.obj memory.obj
-
-emsdump.exe: emsdump.obj memory.obj
- wcl $(FLAGS) $(MFLAGS) emsdump.obj memory.obj
-
-fmemtest.exe: fmemtest.obj# memory.obj
- wcl $(FLAGS) $(MFLAGS) fmemtest.obj# memory.obj
-
-#
-#executable's objects
-#
+ wcl $(FLAGS) $(MFLAGS) maptest0.obj fmapread.obj farjsmn.obj# modex16.obj bitmap.obj lib_head.obj\r
+\r
+emmtest.exe: emmtest.obj memory.obj\r
+ wcl $(FLAGS) $(MFLAGS) emmtest.obj memory.obj\r
+\r
+emsdump.exe: emsdump.obj memory.obj\r
+ wcl $(FLAGS) $(MFLAGS) emsdump.obj memory.obj\r
+\r
+fmemtest.exe: fmemtest.obj# memory.obj\r
+ wcl $(FLAGS) $(MFLAGS) fmemtest.obj# memory.obj\r
+\r
+#\r
+#executable's objects\r
+#\r
16.obj: $(SRC)16.h $(SRC)16.c\r
- wcl $(FLAGS) -c $(SRC)16.c
+ wcl $(FLAGS) -c $(SRC)16.c\r
\r
test.obj: $(SRC)test.c $(SRCLIB)modex16.h\r
wcl $(FLAGS) -c $(SRC)test.c\r
wcl $(FLAGS) -c $(SRC)test2.c\r
\r
pcxtest.obj: $(SRC)pcxtest.c $(SRCLIB)modex16.h\r
- wcl $(FLAGS) -c $(SRC)pcxtest.c
-
+ wcl $(FLAGS) -c $(SRC)pcxtest.c\r
+\r
palettec.obj: $(SRC)palettec.c\r
- wcl $(FLAGS) -c $(SRC)palettec.c
+ wcl $(FLAGS) -c $(SRC)palettec.c\r
+\r
+maptest.obj: $(SRC)maptest.c $(SRCLIB)modex16.h\r
+ wcl $(FLAGS) -c $(SRC)maptest.c\r
\r
-maptest.obj: $(SRC)maptest.c $(SRCLIB)modex16.h
- wcl $(FLAGS) -c $(SRC)maptest.c
-
maptest0.obj: $(SRC)maptest0.c# $(SRCLIB)modex16.h\r
- wcl $(FLAGS) $(MFLAGS) -c $(SRC)maptest0.c
-
+ wcl $(FLAGS) $(MFLAGS) -c $(SRC)maptest0.c\r
+\r
emmtest.obj: $(SRC)emmtest.c\r
wcl $(FLAGS) $(MFLAGS) -c $(SRC)emmtest.c\r
-
+\r
emsdump.obj: $(SRC)emsdump.c\r
- wcl $(FLAGS) $(MFLAGS) -c $(SRC)emsdump.c
-
+ wcl $(FLAGS) $(MFLAGS) -c $(SRC)emsdump.c\r
+\r
fmemtest.obj: $(SRC)fmemtest.c\r
wcl $(FLAGS) $(MFLAGS) -c $(SRC)fmemtest.c
wcl $(FLAGS) -c $(SRCLIB)bitmap.c\r
\r
planar.obj: $(SRCLIB)planar.h $(SRCLIB)planar.c\r
- wcl $(FLAGS) -c $(SRCLIB)planar.c
-
+ wcl $(FLAGS) -c $(SRCLIB)planar.c\r
+\r
scroll16.obj: $(SRCLIB)scroll16.h $(SRCLIB)scroll16.c\r
- wcl $(FLAGS) -c $(SRCLIB)scroll16.c
-
+ wcl $(FLAGS) -c $(SRCLIB)scroll16.c\r
+\r
wcpu.obj: $(WCPULIB)wcpu.h $(WCPULIB)wcpu.c\r
- wcl $(FLAGS) -c $(WCPULIB)wcpu.c
+ wcl $(FLAGS) -c $(WCPULIB)wcpu.c\r
\r
mapread.obj: $(SRCLIB)mapread.h $(SRCLIB)mapread.c 16.lib\r
wcl $(FLAGS) -c $(SRCLIB)mapread.c 16.lib
wcl $(FLAGS) -c $(SRCLIB)lib_head.c\r
\r
jsmn.obj: $(JSMNLIB)jsmn.h $(JSMNLIB)jsmn.c\r
- wcl $(FLAGS) -c $(JSMNLIB)jsmn.c
-
+ wcl $(FLAGS) -c $(JSMNLIB)jsmn.c\r
+\r
farjsmn.obj: $(JSMNLIB)farjsmn.h $(JSMNLIB)farjsmn.c\r
wcl $(FLAGS) $(MFLAGS) -c $(JSMNLIB)farjsmn.c\r
-
+\r
memory.obj: $(EXMMLIB)memory.h $(EXMMLIB)memory.c\r
- wcl $(FLAGS) $(MFLAGS) -c $(EXMMLIB)memory.c
-
-#
-#other~
+ wcl $(FLAGS) $(MFLAGS) -c $(EXMMLIB)memory.c\r
+\r
+#\r
+#other~\r
#\r
clean: .symbolic\r
# @$(REMOVECOMMAND) *.obj\r
--- /dev/null
+#include <stdio.h>\r
+#include "lib/types.h"\r
+#include "lib/text.h"\r
+\r
+main() {\r
+ int i;\r
+ int j;\r
+ char l[16];\r
+ char c;\r
+ word s, o;\r
+ word addr = (word) l;\r
+ textInit();\r
+\r
+ //print the addresses of the fonts\r
+ printf("ROM FONT Addresses\n");\r
+ for(i=0; i<4; i++) {\r
+ printf("%d: %x:%x\n", i, romFonts[i].seg, romFonts[i].off);\r
+ }\r
+\r
+ printf("Character: ");\r
+ scanf("%c", &c);\r
+\r
+ s=romFonts[ROM_FONT_8x16].seg;\r
+ o=romFonts[ROM_FONT_8x16].off;\r
+\r
+ //load the letter 'A'\r
+ __asm {\r
+ MOV DI, addr\r
+ MOV SI, o\r
+ MOV ES, s\r
+ SUB BH, BH\r
+ MOV BL, c ; the letter\r
+ SHL BX, 1\r
+ SHL BX, 1\r
+ SHL BX, 1\r
+ SHL BX, 1\r
+ ADD SI, BX ;the address of A\r
+ MOV CX, 16\r
+ L1: MOV AX, ES:SI\r
+ MOV DS:DI, AX\r
+ INC SI\r
+ INC DI\r
+ DEC CX\r
+ JNZ L1\r
+ }\r
+\r
+ //render the letter in ascii art\r
+ for(i=0; i<16; i++) {\r
+ j=1<<8;\r
+ while(j) {\r
+ printf("%c", l[i] & j ? '*':' ');\r
+ j>>=1;\r
+ }\r
+ printf("\n");\r
+ }\r
+}\r
--- /dev/null
+#include "text.h"\r
+\r
+/* this array holds the rom font descriptors */\r
+font_t romFonts[4];\r
+\r
+\r
+static void getRomFontAddr(char fontNum, int index) {\r
+ word fontSeg;\r
+ word fontOff;\r
+\r
+ __asm {\r
+ PUSH BP\r
+ MOV AX, 0x1130 ;I can haz font info plz?\r
+ MOV BH, fontNum ; where ur fontNum\r
+ INT 0x10 ;kthxbae\r
+ MOV AX, ES ;save teh segmentz\r
+ MOV BX, BP ;and all the base!\r
+ POP BP ;u can haz ur frame back!\r
+ MOV fontSeg, AX ;Storage\r
+ MOV fontOff, BX ;Storage\r
+ }\r
+ romFonts[index].seg = fontSeg;\r
+ romFonts[index].off = fontOff;\r
+\r
+}\r
+\r
+/* This function initializes the text engine */\r
+void textInit() {\r
+ getRomFontAddr(0x02, ROM_FONT_8x14);\r
+ getRomFontAddr(0x03, ROM_FONT_8x8_LOW);\r
+ getRomFontAddr(0x04, ROM_FONT_8x8_HIGH);\r
+ getRomFontAddr(0x06, ROM_FONT_8x16);\r
+ romFonts[ROM_FONT_8x14].charSize=14;\r
+ romFonts[ROM_FONT_8x8_LOW].charSize=8;\r
+ romFonts[ROM_FONT_8x8_HIGH].charSize=8;\r
+ romFonts[ROM_FONT_8x16].charSize=16;\r
+}\r
--- /dev/null
+/*\r
+ * This is the text subsystem for project 16.\r
+ * These functions provide for the rendering of text strings\r
+ * using the BIOS fonts.\r
+ * They copy the font characters directly to VGA.\r
+ */\r
+#ifndef TEXT_H\r
+#define TEXT_H\r
+#include "types.h"\r
+\r
+/* font information type */\r
+typedef struct font {\r
+ word seg; //segment for the font\r
+ word off; //offset in the segment for the font\r
+ byte charSize; //bytes in each character\r
+} font_t;\r
+\r
+/* storage for the rom fonts */\r
+extern font_t romFonts[4];\r
+#define ROM_FONT_8x14 0\r
+#define ROM_FONT_8x8_LOW 1\r
+#define ROM_FONT_8x8_HIGH 2\r
+#define ROM_FONT_8x16 3\r
+\r
+/* This function initializes the text engine */\r
+void textInit();\r
+\r
+#endif\r
-/* 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 <http://www.gnu.org/licenses/>, or
- * write to the Free Software Foundation, Inc., 51 Franklin Street,
- * Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
/*\r
* Just some handy typedefs that make it easier to think about the low\r
* level code\r
- */
-
-#ifndef _TYPE_H_
-#define _TYPE_H_
+ */\r
+\r
+#ifndef _TYPE_H_\r
+#define _TYPE_H_\r
\r
typedef unsigned char byte;\r
typedef unsigned short word;\r
typedef unsigned long dword;\r
typedef signed char sbyte;\r
typedef signed short sword;\r
-typedef signed long sdword;
-
-#endif/*_TYPE_H_*/
+typedef signed long sdword;\r
+\r
+#endif/*_TYPE_H_*/\r