]> 4ch.mooo.com Git - 16.git/commitdiff
facking sega.exe added for learning
authorsparky4 <sparky4@cock.li>
Wed, 22 Jul 2015 19:33:53 +0000 (14:33 -0500)
committersparky4 <sparky4@cock.li>
Wed, 22 Jul 2015 19:33:53 +0000 (14:33 -0500)
modified:   16.hed
modified:   makefile
modified:   src/lib/16_mm.h
new file:   src/sega.c

16.hed
makefile
src/lib/16_mm.h
src/sega.c [new file with mode: 0644]

diff --git a/16.hed b/16.hed
index 5d24fc799adf30fdf729c555e7d05e48aa7be90e..4c83af5028091f993c232314049e5471fe8a1395 100644 (file)
Binary files a/16.hed and b/16.hed differ
index 7e24fab557578f3c20d016fb8e0b2569e1d9e183..68c74339bb019e52d80cd72d675c935da8bf42b2 100644 (file)
--- a/makefile
+++ b/makefile
@@ -42,6 +42,10 @@ scroll.exe: scroll.$(OBJ) 16.lib mapread.$(OBJ) jsmn.$(OBJ) dos_kb.$(OBJ)
        wcl $(FLAGS) scroll.$(OBJ) 16.lib mapread.$(OBJ) jsmn.$(OBJ) dos_kb.$(OBJ)
 scroll.$(OBJ): $(SRC)scroll.c
        wcl $(FLAGS) -c $(SRC)scroll.c
+sega.exe: sega.$(OBJ)
+       wcl $(FLAGS) -c sega.$(OBJ)
+sega.$(OBJ): $(SRC)sega.c
+       wcl $(FLAGS) -c $(SRC)sega.c
 test.exe: test.$(OBJ) gfx.lib
        wcl $(FLAGS) test.$(OBJ) gfx.lib
 
index ccf1a59b50495d07131a82260079e90a10ea506a..9daee338cbca893655db7902a6c49470eb076cfd 100644 (file)
 
 //==========================================================================
 //I hope this is correct!
-typedef void __based(void)* memptr;
+// void __segment(void)* memptr;
 //__segment            sega;
 //__self
-//typedef void __based( sega ) * memptr;
+typedef void __based(__self) * memptr;
 
 typedef struct
 {
diff --git a/src/sega.c b/src/sega.c
new file mode 100644 (file)
index 0000000..a460ff5
--- /dev/null
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <dos.h>
+#include <malloc.h>
+
+typedef struct {
+       struct a __based( __self ) *next;
+       int                         number;
+}a_t;
+
+void PrintLastTwo( a_t far *list );
+
+void
+main(int argc, char *argv[])
+{
+       a_t far *list;
+       PrintLastTwo(list);
+}
+
+     void PrintLastTwo( a_t far *list )
+     {
+       __segment                seg;
+       a_t __based( seg ) *aptr;
+
+       seg  = FP_SEG( list );
+       aptr = FP_OFF( list );
+       for( ; aptr != _NULLOFF; aptr = aptr->next ) {
+         if( aptr->next == _NULLOFF ) {
+           printf( "Last item is %d\n",
+                   aptr->number );
+         } else if( aptr->next->next == _NULLOFF ) {
+           printf( "Second last item is %d\n",
+                   aptr->number );
+         }
+       }
+     }
+     
\ No newline at end of file