*.LNK
*.zip
*.ZIP
+*.jpg
+*.JPG
+*.png
+*.PNG
+*.map
+*.MAP
warn = -w=3
dbg = -d3
def = -DNO_STDINT_H
+!ifdef __UNIX__
+inc = -Iimago/src
+libimago = imago/imago.lib
+!else
inc = -Iimago\src
+libimago = imago\imago.lib
+!endif
libdir = libpath imago
CC = wcc386
CFLAGS = $(warn) $(dbg) $(opt) $(def) -zq -bt=dos $(inc)
LDFLAGS = $(libdir) library { imago.lib }
-$(bin): $(obj)
+$(bin): $(obj) $(libimago)
%write objects.lnk $(obj)
%write ldflags.lnk $(LDFLAGS)
$(LD) debug all option map name $@ system dos4g file { @objects } @ldflags
.asm.obj:
nasm -f obj -o $@ $[*.asm
+$(libimago):
+ cd imago
+ wmake
+ cd ..
+
+!ifdef __UNIX__
+clean: .symbolic
+ rm -f $(obj)
+ rm -f objects.lnk ldflags.lnk
+ rm -f $(bin)
+!else
clean: .symbolic
del *.obj
del objects.lnk
del ldflags.lnk
del $(bin)
+!endif
+!ifdef __UNIX__
+libpng = libpng/png.obj libpng/pngerror.obj libpng/pngget.obj libpng/pngmem.obj &
+ libpng/pngpread.obj libpng/pngread.obj libpng/pngrio.obj libpng/pngrtran.obj &
+ libpng/pngrutil.obj libpng/pngset.obj libpng/pngtrans.obj libpng/pngwio.obj &
+ libpng/pngwrite.obj libpng/pngwtran.obj libpng/pngwutil.obj
+zlib = zlib/adler32.obj zlib/compress.obj zlib/crc32.obj zlib/deflate.obj &
+ zlib/gzio.obj zlib/infback.obj zlib/inffast.obj zlib/inflate.obj &
+ zlib/inftrees.obj zlib/trees.obj zlib/uncompr.obj zlib/zutil.obj
+jpeglib = jpeglib/jcapimin.obj jpeglib/jcapistd.obj jpeglib/jccoefct.obj &
+ jpeglib/jccolor.obj jpeglib/jcdctmgr.obj jpeglib/jchuff.obj jpeglib/jcinit.obj &
+ jpeglib/jcmainct.obj jpeglib/jcmarker.obj jpeglib/jcmaster.obj jpeglib/jcomapi.obj &
+ jpeglib/jcparam.obj jpeglib/jcphuff.obj jpeglib/jcprepct.obj jpeglib/jcsample.obj &
+ jpeglib/jctrans.obj jpeglib/jdapimin.obj jpeglib/jdapistd.obj jpeglib/jdatadst.obj &
+ jpeglib/jdatasrc.obj jpeglib/jdcoefct.obj jpeglib/jdcolor.obj jpeglib/jddctmgr.obj &
+ jpeglib/jdhuff.obj jpeglib/jdinput.obj jpeglib/jdmainct.obj jpeglib/jdmarker.obj &
+ jpeglib/jdmaster.obj jpeglib/jdmerge.obj jpeglib/jdphuff.obj jpeglib/jdpostct.obj &
+ jpeglib/jdsample.obj jpeglib/jdtrans.obj jpeglib/jerror.obj jpeglib/jfdctflt.obj &
+ jpeglib/jfdctfst.obj jpeglib/jfdctint.obj jpeglib/jidctflt.obj jpeglib/jidctfst.obj &
+ jpeglib/jidctint.obj jpeglib/jidctred.obj jpeglib/jmemmgr.obj jpeglib/jmemnobs.obj &
+ jpeglib/jquant1.obj jpeglib/jquant2.obj jpeglib/jutils.obj
+obj = src/conv.obj src/filejpeg.obj src/filepng.obj src/fileppm.obj src/filergbe.obj &
+ src/filetga.obj src/filelbm.obj src/ftmodule.obj src/imago2.obj src/imago_gl.obj &
+ src/byteord.obj src/modules.obj $(libpng) $(zlib) $(jpeglib)
+
+!else
+
libpng = libpng\png.obj libpng\pngerror.obj libpng\pngget.obj libpng\pngmem.obj &
libpng\pngpread.obj libpng\pngread.obj libpng\pngrio.obj libpng\pngrtran.obj &
libpng\pngrutil.obj libpng\pngset.obj libpng\pngtrans.obj libpng\pngwio.obj &
obj = src\conv.obj src\filejpeg.obj src\filepng.obj src\fileppm.obj src\filergbe.obj &
src\filetga.obj src\filelbm.obj src\ftmodule.obj src\imago2.obj src\imago_gl.obj &
src\byteord.obj src\modules.obj $(libpng) $(zlib) $(jpeglib)
+!endif
alib = imago.lib
.c.obj: .autodepend
$(CC) -fo=$@ $(CFLAGS) $[*
+!ifdef __UNIX__
+clean: .symbolic
+ rm -f $(obj)
+ rm -f objects.lbc
+ rm -f $(alib)
+!else
clean: .symbolic
del src\*.obj
del zlib\*.obj
del jpeglib\*.obj
del objects.lbc
del $(alib)
+!endif
#else
#include <sys/types.h>
#endif
-#if defined(__DOS__) || defined(DOS)
+
+#if defined(__WATCOMC__) && __WATCOMC__ < 1200
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
void *dpmi_mmap(uint32_t phys_addr, unsigned int size);
void dpmi_munmap(void *addr);
-#ifdef __WATCOMC__
-#pragma aux dpmi_alloc = \
- "mov ax, 0x100" \
- "int 0x31" \
- "mov [edi], dx" \
- "jnc alloc_skip_err" \
- "xor ax, ax" \
- "alloc_skip_err:" \
- value[ax] \
- parm[ebx][edi] \
- modify[dx];
-
-#pragma aux dpmi_free = \
- "mov ax, 0x101" \
- "int 0x31" \
- parm[dx] \
- modify[ax];
-
-#pragma aux dpmi_int = \
- "mov ax, 0x300" \
- "xor ecx, ecx" \
- "int 0x31" \
- parm[ebx][edi] \
- modify[ax ecx];
-
-#pragma aux dpmi_mmap = \
- "mov ax, 0x800" \
- "mov cx, bx" \
- "shr ebx, 16" \
- "mov di, si" \
- "shr esi, 16" \
- "int 0x31" \
- "jnc mmap_skip_err" \
- "xor bx, bx" \
- "xor cx, cx" \
- "mmap_skip_err:" \
- "mov ax, bx" \
- "shl eax, 16" \
- "mov ax, cx" \
- value[eax] \
- parm[ebx][esi] \
- modify[bx cx di esi];
-
-#pragma aux dpmi_munmap = \
- "mov ax, 0x801" \
- "mov cx, bx" \
- "shr ebx, 16" \
- "int 0x31" \
- parm[ebx] \
- modify[ax cx ebx];
-#endif /* __WATCOMC__ */
-
#ifdef __DJGPP__
#define dpmi_int(inum, regs) __dpmi_int((inum), (__dpmi_regs*)(regs))
#endif
#include "mouse.h"
#include "imago2.h"
+int switch_mode(int m);
+int find_best_mode(int minx, int miny);
+void drop_equiv_modes(void);
+
void display8(void);
void display16(void);
void display24(void);
#ifdef NO_STDINT_H
+
+#if __WATCOMC__ >= 1200
+#include <sys/types.h>
+#else
typedef char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
-typedef unsigned long intptr_t;
+typedef unsigned long uintptr_t;
+#endif
+
#else
#include <stdint.h>
#endif
#include <i86.h>
#include "cdpmi.h"
-void dpmi_real_int(int inum, struct dpmi_real_regs *regs)
+uint16_t dpmi_alloc(unsigned int par, uint16_t *sel)
{
- unsigned char int_num = (unsigned char)inum;
- __asm {
- mov eax, 0x300
- mov edi, regs
- mov bl, int_num
- mov bh, 0
- xor ecx, ecx
- int 0x31
+ union REGS regs = {0};
+
+ regs.w.ax = 0x100;
+ regs.w.bx = par;
+ int386(0x31, ®s, ®s);
+
+ if(regs.w.cflag) {
+ return 0;
}
+
+ *sel = regs.w.dx;
+ return regs.w.ax;
+}
+
+void dpmi_free(uint16_t sel)
+{
+ union REGS regs = {0};
+
+ regs.w.ax = 0x101;
+ regs.w.dx = sel;
+ int386(0x31, ®s, ®s);
+}
+
+void dpmi_int(int inum, struct dpmi_real_regs *dregs)
+{
+ union REGS regs = {0};
+
+ regs.x.eax = 0x300;
+ regs.x.edi = (uint32_t)dregs;
+ regs.x.ebx = inum & 0xff;
+ int386(0x31, ®s, ®s);
}
void *dpmi_mmap(uint32_t phys_addr, unsigned int size)
{
union REGS regs = {0};
- regs.x.eax = 0x800;
- regs.x.ebx = phys_addr >> 16;
- regs.x.ecx = phys_addr & 0xffff;
- regs.x.esi = size >> 16;
- regs.x.edi = size & 0xffff;
+ regs.w.ax = 0x800;
+ regs.w.bx = phys_addr >> 16;
+ regs.w.cx = phys_addr;
+ regs.w.si = size >> 16;
+ regs.w.di = size;
int386(0x31, ®s, ®s);
- if(regs.x.cflag) {
+ if(regs.w.cflag) {
return 0;
}
- return (void*)((regs.x.ebx << 16) | (regs.x.ecx & 0xffff));
+ return (void*)(((uint32_t)regs.w.bx << 16) | regs.w.cx);
}
void dpmi_munmap(void *addr)
{
union REGS regs = {0};
- regs.x.eax = 0x801;
- regs.x.ebx = (uint32_t)addr >> 16;
- regs.x.ecx = (uint32_t)addr & 0xffff;
+ regs.w.ax = 0x801;
+ regs.w.bx = (uint32_t)addr >> 16;
+ regs.w.cx = (uint32_t)addr;
int386(0x31, ®s, ®s);
}
#else