From: sparky4 Date: Sat, 23 May 2015 22:12:32 +0000 (-0500) Subject: memory model HUGE GUTS!!! wwww X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=fa22c78a917561d4abf178f8c4f51b9526f665cf;p=16.git memory model HUGE GUTS!!! wwww modified: makefile modified: pcxtest.exe modified: scroll.exe modified: src/lib/bitmap.c modified: src/lib/bitmap.h modified: src/lib/exmm/emm.c modified: src/lib/exmm/memory.h modified: src/lib/mapread.c modified: src/lib/modex16.c modified: test.exe modified: test2.exe --- diff --git a/makefile b/makefile index 7fbfcac6..a5c9a375 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,4 @@ -FLAGS=-0 -d2 +FLAGS=-0 -d2 -mh SRC=src\ SRCLIB=$(SRC)lib\ all: test.exe pcxtest.exe test2.exe scroll.exe @@ -45,9 +45,9 @@ planar.obj: $(SRCLIB)planar.h $(SRCLIB)planar.c mapread.obj: $(SRCLIB)mapread.h $(SRCLIB)mapread.c jsmn.obj lib_head.obj wcl $(FLAGS) -c $(SRCLIB)mapread.c - + lib_head.obj: $(SRCLIB)lib_head.h $(SRCLIB)lib_head.c - wcl $(FLAGS) -c $(SRCLIB)lib_head.c + wcl $(FLAGS) -c $(SRCLIB)lib_head.c jsmn.obj: $(SRCLIB)jsmn\jsmn.h $(SRCLIB)jsmn\jsmn.c wcl $(FLAGS) -c $(SRCLIB)jsmn\jsmn.c diff --git a/pcxtest.exe b/pcxtest.exe index 988abb27..7855c2e4 100644 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/scroll.exe b/scroll.exe index 2724e750..66b51f7d 100644 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c index e6a0adb8..cc57552a 100644 --- a/src/lib/bitmap.c +++ b/src/lib/bitmap.c @@ -1,7 +1,7 @@ #include #include -#include "src\lib\bitmap.h" -#include "src\lib\modex16.h" +#include "src/lib/bitmap.h" +#include "src/lib/modex16.h" static struct pcxHeader { byte id; @@ -89,7 +89,7 @@ bitmapLoadPcx(char *filename) { /* allocate the buffer */ bufSize = result.width * result.height; - result.data = malloc(bufSize); //it breaks right here~ + result.data = _fmalloc(bufSize); //it breaks right here~ if(!result.data) { printf("Could not allocate memory for bitmap data."); fclose(file); @@ -147,12 +147,12 @@ bitmapLoadPcxTiles(char *filename, word twidth, word theight) { ts.palette = result.palette; /* allocate the pixel storage for the tiles */ - ts.data = malloc(sizeof(byte*) * ts.ntiles); - ts.data[0] = malloc(sizeof(byte) * ts.ntiles * twidth * theight); + ts.data = _fmalloc(sizeof(byte*) * ts.ntiles); + ts.data[0] = _fmalloc(sizeof(byte) * ts.ntiles * twidth * theight); for(i=1; i < ts.ntiles; i++) { ts.data[i] = ts.data[i-1] + twidth * theight; } - + /* finish off the file */ loadPcxPalette(file, &result); diff --git a/src/lib/bitmap.h b/src/lib/bitmap.h index 40ec9627..21009dcc 100644 --- a/src/lib/bitmap.h +++ b/src/lib/bitmap.h @@ -2,10 +2,11 @@ * Functions and types for loading and manipulating bitmaps. */ #ifndef BITMAP_H -#define BITMAP_H -#include "src\lib\types.h" +#define BITMAP_H +#include +#include "src/lib/types.h" typedef struct { - byte *data; + byte far *data; word width; word height; byte *palette; @@ -13,7 +14,7 @@ typedef struct { } bitmap_t; typedef struct { - byte **data; + byte far **data; word ntiles; /* the number of tiles */ word twidth; /* width of the tiles */ word theight; /* height of the tiles */ diff --git a/src/lib/exmm/emm.c b/src/lib/exmm/emm.c index aed6c3b7..c7ad3496 100644 --- a/src/lib/exmm/emm.c +++ b/src/lib/exmm/emm.c @@ -20,6 +20,7 @@ #include #include "memory.h" +#include "../types.h" #define PEMMDATAPAGENUM 4 diff --git a/src/lib/exmm/memory.h b/src/lib/exmm/memory.h index 3d35d472..249a5408 100644 --- a/src/lib/exmm/memory.h +++ b/src/lib/exmm/memory.h @@ -17,7 +17,6 @@ #include "emmret.h" #include "emmsize.h" -#include "../types.h" #define CMM 0 #define EMM 1 diff --git a/src/lib/mapread.c b/src/lib/mapread.c index c4cd191d..8f84071a 100644 --- a/src/lib/mapread.c +++ b/src/lib/mapread.c @@ -26,7 +26,7 @@ static int dump(const char *js, jsmntok_t *t, size_t count, int indent, /*char * FUCK well i am stuck.... wwww */ - map->data[q] = (byte)strtol(js+t->start, &(char *)t->end, 10); + map->data[q] = (byte)strtol(js+t->start, (char **)t->end, 10); // printf("%d[%d]", q, map->data[q]); } else diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 4ce84b8c..fc1456db 100644 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -4,7 +4,7 @@ #include #include #include -#include "src\lib\modex16.h" +#include "src/lib/modex16.h" byte far* VGA=(byte far*) 0xA0000000; /* this points to video memory. */ @@ -226,7 +226,7 @@ void modexDrawBmpRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp) { word poffset = (word) page->data + y*(page->width/4) + x/4; - byte *data = bmp->data;//+bmp->offset; + byte far *data = bmp->data;//+bmp->offset; word bmpOffset = (word) data + ry * bmp->width + rx; word width = rw; word height = rh; @@ -307,7 +307,7 @@ void modexDrawSpriteRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp) { word poffset = (word)page->data + y*(page->width/4) + x/4; - byte *data = bmp->data;//+bmp->offset; + byte far *data = bmp->data;//+bmp->offset; word bmpOffset = (word) data + ry * bmp->width + rx; word width = rw; word height = rh; diff --git a/test.exe b/test.exe index 736b224a..6ca0d627 100644 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index da9ec199..7f079f4f 100644 Binary files a/test2.exe and b/test2.exe differ