]> 4ch.mooo.com Git - 16.git/commitdiff
i do not know how to allocate and move variables to EMS
authorsparky4 <sparky4@lappy4.4ch.mooo.com>
Thu, 11 Dec 2014 19:06:45 +0000 (13:06 -0600)
committersparky4 <sparky4@lappy4.4ch.mooo.com>
Thu, 11 Dec 2014 19:06:45 +0000 (13:06 -0600)
modified:   scroll.exe
modified:   src/lib/ems.c
modified:   src/lib/xms.c
modified:   src/scroll.c

scroll.exe
src/lib/ems.c
src/lib/xms.c
src/scroll.c

index c68134465168f82b1507acf11cd3953e075eb473..c2c6c3fc1ecbe1e9eef169b0f4d1fb3ea0adf0c8 100644 (file)
Binary files a/scroll.exe and b/scroll.exe differ
index 9883f60c4c173acab50af9748d3729bca00923ff..52658e56ef689c237e8e8a8257e6414abec2ae1a 100644 (file)
@@ -287,3 +287,33 @@ int mem_emem(unsigned int *total, unsigned int *freeall)
 \r
  return( 1 );\r
 }\r
+
+void emmmove(int page, short *str, int n)\r
+     {\r
+          /*\r
+          Move 'n' bytes from conventional memory to the specified\r
+     expanded memory\r
+          page\r
+          */\r
+     \r
+          char far *ptr;\r
+     \r
+          ptr = pageframeEMS() + page * 16384;\r
+          while(n-- > 0)\r
+               *ptr++ = *str++;\r
+     }\r
+     \r
+     void emmget(int page, short *str, int n)\r
+     {\r
+          /*\r
+          Move 'n' bytes from the specified expanded memory page into\r
+     conventional\r
+          memory\r
+          */\r
+     \r
+          char far *ptr;\r
+     \r
+          ptr = pageframeEMS() + page * 16384;\r
+          while(n-- > 0)\r
+               *str++ = *ptr++;\r
+     }
index 09797210f2ee5dadcd26398d2a3bd9159240a8f4..1781754f0c0e00c6f1f973e2578b0b71234208ab 100644 (file)
@@ -82,7 +82,7 @@ void huge * xmsmalloc(long unsigned int size)
                call [XMSControl]
                mov [XMSStatus], ax
 
-               mov word ptr [XMSPointer],  bx 
+               mov word ptr [XMSPointer],  bx
                mov word ptr [XMSPointer+2],dx
        }
 
index 45c705ee11f2b609b142aa33a24178716ee1ab74..6868320210a3922857fe022d45002a45adf10b76 100644 (file)
@@ -75,7 +75,8 @@ void main() {
        bitmap_t ptmp;//, npctmp; // player sprite\r
        const char *cpus;\r
        static int persist_aniframe = 0;    /* gonna be increased to 1 before being used, so 0 is ok for default */
-       int emmhandle;\r
+       int emmhandle;
+       XMOVE mm;\r
        page_t screen, screen2, screen3;\r
        map_t map;\r
        map_view_t mv, mv2, mv3;\r
@@ -88,10 +89,11 @@ void main() {
        if(isEMS()) printf("%d\n", coretotalEMS());
        if(isEMS())
        {
-               emmhandle = alloc_emem(1024);
+               emmhandle = mallocEMS(coretotalEMS());
                mapEMS(emmhandle, 0, 0);
-               move_emem((XMOVE *)&map);
-//             printf("%d\n", emmhandle);
+               //halp!
+               //move_emem((XMOVE *)&map);
+               //printf("%d\n", emmhandle);
                printf("%d\n", coretotalEMS());
        }\r
 \r
@@ -105,7 +107,8 @@ void main() {
        /* draw the tiles */\r
        ptr = map.data;\r
        /* data */\r
-       ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite\r
+       ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite
+       //if(isEMS()) emmmove(emmhandle,ptmp,sizeof(ptmp)+ 1);\r
        //npctmp = bitmapLoadPcx("ptmp1.pcx"); // load sprite\r
 \r
        /* save the palette */\r
@@ -495,8 +498,10 @@ void main() {
        //xmsreport();
        if(isEMS())
        {
+       printf("%d\n", get_emem());
        printf("%d\n", coretotalEMS());
        dealloc_emem(emmhandle);
+       //freeEMS(emmtotal);
        printf("%d\n", coretotalEMS());
        }\r
        switch(detectcpu())\r