From: sparky4 Date: Fri, 12 Dec 2014 19:57:49 +0000 (-0600) Subject: modified: scroll.exe X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=676e5f342c49b655bbc936225bf4524d1fbedc36;p=16.git modified: scroll.exe modified: src/lib/ems.c modified: src/lib/lib_head.h modified: src/scroll.c --- diff --git a/scroll.exe b/scroll.exe index c2c6c3fc..93b99f1f 100644 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/lib/ems.c b/src/lib/ems.c index 52658e56..9883f60c 100644 --- a/src/lib/ems.c +++ b/src/lib/ems.c @@ -287,33 +287,3 @@ int mem_emem(unsigned int *total, unsigned int *freeall) return( 1 ); } - -void emmmove(int page, short *str, int n) - { - /* - Move 'n' bytes from conventional memory to the specified - expanded memory - page - */ - - char far *ptr; - - ptr = pageframeEMS() + page * 16384; - while(n-- > 0) - *ptr++ = *str++; - } - - void emmget(int page, short *str, int n) - { - /* - Move 'n' bytes from the specified expanded memory page into - conventional - memory - */ - - char far *ptr; - - ptr = pageframeEMS() + page * 16384; - while(n-- > 0) - *str++ = *ptr++; - } diff --git a/src/lib/lib_head.h b/src/lib/lib_head.h index 19b59f18..560ea8ad 100644 --- a/src/lib/lib_head.h +++ b/src/lib/lib_head.h @@ -104,4 +104,7 @@ void wait(clock_t wait); +/* THIS FUNCTION CONVERTS A POINTER TO AN INTEL LONG */ +//int long ptr2long(char *p); + #endif/*_LIBHEAD_H_*/ diff --git a/src/scroll.c b/src/scroll.c index 68683202..fb0cde52 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -5,8 +5,10 @@ #include "src\lib\wtest\wtest.c" #include "src\lib\ems.c" -//word far *clock= (word far*) 0x046C; /* 18.2hz clock */ - +//word far *clock= (word far*) 0x046C; /* 18.2hz clock */ + +int emmhandle,ist; + typedef struct { bitmap_t *data; word tileHeight; @@ -43,11 +45,11 @@ typedef struct { int setx; //NOT USED YET! player sprite sheet set on the image x int sety; //NOT USED YET! player sprite sheet set on the image y word q; //loop variable - word d; //direction + word d; //direction + bitmap_t data; //supposively the sprite sheet data int hp; //hitpoints of the player } actor_t; - map_t allocMap(int w, int h); void initMap(map_t *map); void mapScrollRight(map_view_t *mv, byte offset); @@ -66,17 +68,15 @@ void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword //#define LOOPMAX (TILEWH/SPEED) //place holder definitions -#define MAPX 200 -#define MAPY 150 +#define MAPX 40 +#define MAPY 30 #define TRIGGX 10 -#define TRIGGY 9 - +#define TRIGGY 9 + void main() { bitmap_t ptmp;//, npctmp; // player sprite const char *cpus; static int persist_aniframe = 0; /* gonna be increased to 1 before being used, so 0 is ok for default */ - int emmhandle; - XMOVE mm; page_t screen, screen2, screen3; map_t map; map_view_t mv, mv2, mv3; @@ -84,21 +84,13 @@ void main() { byte *pal; byte *ptr; actor_t player; - //actor_t npc0; + //actor_t npc0; - if(isEMS()) printf("%d\n", coretotalEMS()); - if(isEMS()) - { - emmhandle = mallocEMS(coretotalEMS()); - mapEMS(emmhandle, 0, 0); - //halp! - //move_emem((XMOVE *)&map); - //printf("%d\n", emmhandle); - printf("%d\n", coretotalEMS()); - } + if(isEMS() || checkEMS()){ printf("%d\n", coretotalEMS()); emmhandle = mallocEMS(coretotalEMS()); } /* create the map */ map = allocMap(MAPX,MAPY); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly + //if(isEMS()) printf("%d tesuto\n", coretotalEMS()); initMap(&map); mv.map = ↦ mv2.map = ↦ @@ -107,10 +99,39 @@ void main() { /* draw the tiles */ ptr = map.data; /* data */ - ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite - //if(isEMS()) emmmove(emmhandle,ptmp,sizeof(ptmp)+ 1); - //npctmp = bitmapLoadPcx("ptmp1.pcx"); // load sprite - + ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite + //npctmp = bitmapLoadPcx("ptmp1.pcx"); // load sprite + + /*if(isEMS()) + { + XMOVE mm; + mm.length=sizeof(map); + mm.sourceH=0; + mm.sourceOff=(long)↦ + mm.destH=emmhandle; + mm.destOff=1; + //halp! + ist = move_emem(&mm); + printf("%d\n", coretotalEMS()); + if(!ist){ dealloc_emem(emmhandle); exit(5); } + //printf("%d\n", emmhandle); + } + + if(isEMS()) + { + XMOVE mm; + mm.length=emmhandle; + mm.sourceH=0; + mm.sourceOff=(long)&ptmp; + mm.destH=emmhandle; + mm.destOff=0; + //halp! + ist = move_emem(&mm); + printf("%d\n", coretotalEMS()); + if(!ist){ dealloc_emem(emmhandle); exit(5); } + //printf("%d\n", emmhandle); + } +*/ /* save the palette */ pal = modexNewPal(); modexPalSave(pal); @@ -171,7 +192,7 @@ void main() { modexClearRegion(bg->page, 5*16, 5*16, 16, 16, 255); modexShowPage(spri->page); - while(!keyp(1) && player.hp!=0) + while(!keyp(1) && player.hp>0) { //top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square //to stop scrolling and have the player position data move to the edge of the screen with respect to the direction @@ -474,7 +495,8 @@ void main() { modexFadeOff(4, ptmp.palette); modexPalBlack(); modexLeave(); - setkb(0); + setkb(0); + //system("mem /E /P"); printf("Project 16 scroll.exe\n"); printf("tx: %d\n", bg->tx); printf("ty: %d\n", bg->ty); @@ -498,11 +520,10 @@ void main() { //xmsreport(); if(isEMS()) { - printf("%d\n", get_emem()); - printf("%d\n", coretotalEMS()); - dealloc_emem(emmhandle); - //freeEMS(emmtotal); - printf("%d\n", coretotalEMS()); + printf("%d\n", get_emem()); + printf("%d\n", coretotalEMS()); + dealloc_emem(emmhandle); + printf("%d\n", coretotalEMS()); } switch(detectcpu()) { @@ -523,15 +544,25 @@ allocMap(int w, int h) { result.width =w; result.height=h; - //if(!isEMS() || !checkEMS()) - result.data = malloc(sizeof(byte) * w * h); - //else - // result.data = (byte *)alloc_emem(sizeof(byte) * w * h); + result.data = malloc(sizeof(byte) * w * h); + //result.data = (byte *)alloc_emem(((int)sizeof(byte) * w * h)/1024); + /*if(isEMS() || checkEMS()) + { + XMOVE mm; + //emmhandle = mallocEMS(coretotalEMS());//alloc_emem((int)sizeof(map)) + mm.length=sizeof(result); + mm.sourceH=0; + mm.sourceOff=ptr2long(&result); + mm.destH=emmhandle; + mm.destOff=0; + ist = move_emem(&mm); + if(!ist){ dealloc_emem(emmhandle); exit(5); } + printf("%d\n", coretotalEMS()); + }*/ return result; } - void initMap(map_t *map) { /* just a place holder to fill out an alternating pattern */ @@ -748,7 +779,7 @@ mapDrawCol(map_view_t *mv, int tx, int ty, word x) { /*void npcmove(map_view_t bg, map_view_t fg, ) { -}*/ +}*/ void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */sword d, short scrolloffsetswitch, int x, int y, int ls, int lp, bitmap_t *bmp)