added tools for builds from configure

This commit is contained in:
Pawel Kolodziejski 2008-06-15 12:56:19 +00:00
parent d4df440d8d
commit 2a61ed0023
12 changed files with 129 additions and 603 deletions

View File

@ -7,7 +7,7 @@
srcdir ?= .
DEFINES := -DHAVE_CONFIG_H
DEFINES := -DHAVE_CONFIG_H -DLUA_ADD_CUSTOM_FOPEN
LDFLAGS :=
INCLUDES := -I. -I$(srcdir)
LIBS :=

View File

@ -15,7 +15,7 @@ all: $(EXECUTABLE)
# Module settings
######################################################################
MODULES := $(MODULES)
MODULES := tools $(MODULES)
# After the game specific modules follow the shared modules
MODULES += \

View File

@ -16,7 +16,7 @@
#include "luadebug.h"
#include "lualib.h"
#ifdef ADD_CUSTOM_FOPEN
#ifdef LUA_ADD_CUSTOM_FOPEN
#include "../resource.h"
#endif
@ -141,7 +141,7 @@ static void io_readfrom (void)
current = popen(s+1, "r");
else {
current = fopen(s, "r");
#ifdef ADD_CUSTOM_FOPEN
#ifdef LUA_ADD_CUSTOM_FOPEN
if (current == NULL)
current = g_resourceloader->openNewStream(s);
#endif

View File

@ -19,9 +19,6 @@
#define LUA_ANYTAG (-1)
#define ADD_CUSTOM_FOPEN
// this allow enable additionaly code in io_readfrom func
typedef void (*lua_CFunction) (void);
typedef unsigned int lua_Object;

View File

@ -1,31 +0,0 @@
CXX = g++
CXXFLAGS = $(CPPFLAGS) -g -O2 -Wall -I../lua -I..
CFLAGS = $(CPPFLAGS) -g -O2 -Wall
#LDFLAGS =
LIBS =
all: bmtoppm delua imc2wav int2flt mat2ppm set2fig unlab vima
bmtoppm: bmtoppm.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ bmtoppm.c -lppm -lpbm
mat2ppm: mat2ppm.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ mat2ppm.c -lppm
delua: delua.o ../localize.o ../registry.o ../debug.o
$(CXX) $(LDFLAGS) -o $@ delua.o ../localize.o ../registry.o \
../lua/lapi.o ../lua/lauxlib.o ../lua/lbuffer.o ../lua/lbuiltin.o \
../lua/ldo.o ../lua/lfunc.o ../lua/lgc.o ../lua/liolib.o \
../lua/llex.o ../lua/lmathlib.o ../lua/lmem.o ../lua/lobject.o \
../lua/lparser.o ../lua/lrestore.o ../lua/lsave.o ../lua/lstate.o \
../lua/lstring.o ../lua/lstrlib.o ../lua/ltable.o ../lua/ltask.o \
../lua/ltm.o ../lua/lundump.o ../lua/lvm.o ../lua/lzio.o $(LIBS)
unlab: unlab.o util.o
$(CC) $(LDFLAGS) -o $@ $+
.c.o:
$(CC) $(CXXFLAGS) -c $<
clean:
-rm -f *.o bmtoppm delua imc2wav int2flt mat2ppm set2fig unlab vima

View File

@ -20,10 +20,13 @@
*
*/
#include "lua.h"
#include "lundump.h"
#include "lopcodes.h"
#include "lzio.h"
#include <common/sys.h>
#include <lua.h>
#include <lundump.h>
#include <lopcodes.h>
#include <lzio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@ -36,7 +39,12 @@
#include <list>
#include <set>
#include "localize.h"
#include <engine/localize.h>
#include <engine/resource.h>
//hack below: shutup linker
int g_flags = 0;
ResourceLoader *g_resourceloader = 0;
std::FILE *ResourceLoader::openNewStream(const char *filename) const { return NULL; }
// Provide debug.cpp functions which don't call SDL_Quit.
void warning(const char *fmt, ...) {

View File

@ -24,8 +24,8 @@
#include <stdlib.h>
int main(int argc, char *argv[]) {
unsigned i = atoi(argv[1]);
float *f = &i;
printf("%g\n", *f);
return 0;
unsigned i = atoi(argv[1]);
float *f = (float *)&i;
printf("%g\n", *f);
return 0;
}

81
tools/module.mk Normal file
View File

@ -0,0 +1,81 @@
# $URL$
# $Id$
MODULE := tools
MODULE_DIRS += \
tools/
#######################################################################
# Tools directory
#######################################################################
TOOLS := \
tools/delua$(EXEEXT) \
tools/imc2wav$(EXEEXT) \
tools/int2flt$(EXEEXT) \
tools/set2fig$(EXEEXT) \
tools/unlab$(EXEEXT) \
tools/vima$(EXEEXT)
# below not added as it depends for ppm, bpm library
# tools/mat2ppm$(EXEEXT)
# tools/bm2ppm$(EXEEXT)
include $(srcdir)/tools/*/module.mk
# Make sure the 'all' / 'clean' targets build/clean the tools, too
#all:
clean: clean-tools
# Main target
tools: $(TOOLS)
clean-tools:
-$(RM) $(TOOLS)
#
# Build rules for the tools
#
tools/delua$(EXEEXT): $(srcdir)/tools/delua.cpp
$(MKDIR) tools/$(DEPDIR)
$(CXX) $(CFLAGS) $(DEFINES) -DHAVE_CONFIG_H -I. -Iengine -Iengine/lua -Wall \
engine/localize.o engine/registry.o \
engine/lua/lapi.o engine/lua/lauxlib.o engine/lua/lbuffer.o engine/lua/lbuiltin.o \
engine/lua/ldo.o engine/lua/lfunc.o engine/lua/lgc.o engine/lua/liolib.o \
engine/lua/llex.o engine/lua/lmathlib.o engine/lua/lmem.o engine/lua/lobject.o \
engine/lua/lparser.o engine/lua/lrestore.o engine/lua/lsave.o engine/lua/lstate.o \
engine/lua/lstring.o engine/lua/lstrlib.o engine/lua/ltable.o engine/lua/ltask.o \
engine/lua/ltm.o engine/lua/lundump.o engine/lua/lvm.o engine/lua/lzio.o -o $@ $<
tools/mat2ppm$(EXEEXT): $(srcdir)/tools/mat2ppm.cpp
$(MKDIR) tools/$(DEPDIR)
$(CXX) $(CFLAGS) -Wall -lppm -o $@ $<
tools/bmtoppm$(EXEEXT): $(srcdir)/tools/bmtoppm.cpp
$(MKDIR) tools/$(DEPDIR)
$(CXX) $(CFLAGS) -Wall -lppm -lpbm -o $@ $<
tools/imc2wav$(EXEEXT): $(srcdir)/tools/imc2wav.cpp
$(MKDIR) tools/$(DEPDIR)
$(CXX) $(CFLAGS) -Wall -o $@ $<
tools/int2flt$(EXEEXT): $(srcdir)/tools/int2flt.cpp
$(MKDIR) tools/$(DEPDIR)
$(CXX) $(CFLAGS) -Wall -o $@ $<
tools/set2fig$(EXEEXT): $(srcdir)/tools/set2fig.cpp
$(MKDIR) tools/$(DEPDIR)
$(CXX) $(CFLAGS) -Wall -o $@ $<
tools/unlab$(EXEEXT): $(srcdir)/tools/unlab.cpp
$(MKDIR) tools/$(DEPDIR)
$(CXX) $(CFLAGS) -Wall -o $@ $<
tools/vima$(EXEEXT): $(srcdir)/tools/vima.cpp
$(MKDIR) tools/$(DEPDIR)
$(CXX) $(CFLAGS) -Wall -o $@ $<
.PHONY: clean-tools tools

View File

@ -20,28 +20,31 @@
*
*/
#include "util.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
struct lab_header {
uint32 magic;
uint32 magic2;
uint32 num_entries;
uint32 string_table_size;
uint32_t magic;
uint32_t magic2;
uint32_t num_entries;
uint32_t string_table_size;
};
struct lab_entry {
uint32 fname_offset;
uint32 start;
uint32 size;
uint32 reserved;
uint32_t fname_offset;
uint32_t start;
uint32_t size;
uint32_t reserved;
};
uint16 READ_LE_UINT16(const void *ptr) {
const byte *b = (const byte *)ptr;
uint16_t READ_LE_UINT16(const void *ptr) {
const uint8_t *b = (const uint8_t *)ptr;
return (b[1] << 8) + b[0];
}
uint32 READ_LE_UINT32(const void *ptr) {
const byte *b = (const byte *)ptr;
uint32_t READ_LE_UINT32(const void *ptr) {
const uint8_t *b = (const uint8_t *)ptr;
return (b[3] << 24) + (b[2] << 16) + (b[1] << 8) + (b[0]);
}
@ -50,28 +53,33 @@ int main(int argc, char **argv) {
struct lab_header head;
struct lab_entry *entries;
char *str_table;
uint i;
uint32_t i;
off_t offset;
infile = fopen(argv[1], "rb");
if (infile == 0)
{
error("can't open source file: %s", argv[1]);
printf("can't open source file: %s\n", argv[1]);
exit(1);
}
fread(&head.magic, 1, 4, infile);
fread(&head.magic2, 1, 4, infile);
head.num_entries = readUint32LE(infile);
head.string_table_size = readUint32LE(infile);
uint32_t num, s_size;
fread(&num, 1, 4, infile);
fread(&s_size, 1, 4, infile);
head.num_entries = READ_LE_UINT32(&num);
head.string_table_size = READ_LE_UINT32(&s_size);
if (0 != memcmp(&head.magic, "LABN", 4))
{
error("There is no LABN header in source file");
printf("There is no LABN header in source file\n");
exit(1);
}
entries = (struct lab_entry *)malloc(head.num_entries * sizeof(struct lab_entry));
fread(entries, 1, head.num_entries * sizeof(struct lab_entry), infile);
str_table = (char *) malloc(head.string_table_size);
str_table = (char *)malloc(head.string_table_size);
fread(str_table, 1, head.string_table_size, infile);
for (i = 0; i < head.num_entries; i++) {

View File

@ -1,122 +0,0 @@
/* Scumm Tools
* Copyright (C) 2003-2006 The ScummVM Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $URL$
* $Id$
*
*/
#include "util.h"
#include <stdarg.h>
void error(const char *s, ...) {
char buf[1024];
va_list va;
va_start(va, s);
vsprintf(buf, s, va);
va_end(va);
fprintf(stderr, "ERROR: %s!\n", buf);
exit(1);
}
void warning(const char *s, ...) {
char buf[1024];
va_list va;
va_start(va, s);
vsprintf(buf, s, va);
va_end(va);
fprintf(stderr, "WARNING: %s!\n", buf);
}
uint8 readByte(FILE *fp) {
return fgetc(fp);
}
uint16 readUint16BE(FILE *fp) {
uint16 ret = 0;
ret |= fgetc(fp) << 8;
ret |= fgetc(fp);
return ret;
}
uint16 readUint16LE(FILE *fp) {
uint16 ret = 0;
ret |= fgetc(fp);
ret |= fgetc(fp) << 8;
return ret;
}
uint32 readUint32BE(FILE *fp) {
uint32 ret = 0;
ret |= fgetc(fp) << 24;
ret |= fgetc(fp) << 16;
ret |= fgetc(fp) << 8;
ret |= fgetc(fp);
return ret;
}
uint32 readUint32LE(FILE *fp) {
uint32 ret = 0;
ret |= fgetc(fp);
ret |= fgetc(fp) << 8;
ret |= fgetc(fp) << 16;
ret |= fgetc(fp) << 24;
return ret;
}
void writeByte(FILE *fp, uint8 b) {
fwrite(&b, 1, 1, fp);
}
void writeUint16BE(FILE *fp, uint16 value) {
writeByte(fp, (uint8)(value >> 8));
writeByte(fp, (uint8)(value));
}
void writeUint16LE(FILE *fp, uint16 value) {
writeByte(fp, (uint8)(value));
writeByte(fp, (uint8)(value >> 8));
}
void writeUint32BE(FILE *fp, uint32 value) {
writeByte(fp, (uint8)(value >> 24));
writeByte(fp, (uint8)(value >> 16));
writeByte(fp, (uint8)(value >> 8));
writeByte(fp, (uint8)(value));
}
void writeUint32LE(FILE *fp, uint32 value) {
writeByte(fp, (uint8)(value));
writeByte(fp, (uint8)(value >> 8));
writeByte(fp, (uint8)(value >> 16));
writeByte(fp, (uint8)(value >> 24));
}
uint32 fileSize(FILE *fp) {
uint32 sz;
uint32 pos = ftell(fp);
fseek(fp, 0, SEEK_END);
sz = ftell(fp);
fseek(fp, pos, SEEK_SET);
return sz;
}

View File

@ -1,132 +0,0 @@
/* Scumm Tools
* Copyright (C) 2002-2006 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $URL$
* $Id$
*
*/
#ifndef UTIL_H
#define UTIL_H
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#if !defined(_MSC_VER)
#include <unistd.h>
#endif
#ifdef WIN32
#include <io.h>
#include <process.h>
#endif
/*
* Some useful types
*/
typedef unsigned char byte;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
#if !defined(__cplusplus)
typedef enum { false = 0, true = 1 } bool;
/* If your C compiler doesn't support 'inline', please add a check for it. */
#if defined(_MSC_VER)
#define inline __inline
#endif
#endif
/*
* Various utility macros
*/
#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0])))
static inline uint32 SWAP_32(uint32 a) {
return ((a >> 24) & 0xFF) | ((a >> 8) & 0xFF00) | ((a << 8) & 0xFF0000) |
((a << 24) & 0xFF000000);
}
static inline uint16 SWAP_16(uint16 a) {
return ((a >> 8) & 0xFF) | ((a << 8) & 0xFF00);
}
#if defined(SYSTEM_BIG_ENDIAN)
#define TO_BE_32(a) (a)
#define TO_BE_16(a) (a)
#define TO_LE_32(a) SWAP_32(a)
#define TO_LE_16(a) SWAP_16(a)
#else
#define TO_BE_32(a) SWAP_32(a)
#define TO_BE_16(a) SWAP_16(a)
#define TO_LE_32(a) (a)
#define TO_LE_16(a) (a)
#endif
#define MKID(a) (((a&0xff) << 8) | ((a >> 8)&0xff))
#if defined(__GNUC__)
#define NORETURN_PRE
#define NORETURN_POST __attribute__((__noreturn__))
#elif defined(_MSC_VER)
#define NORETURN_PRE _declspec(noreturn)
#define NORETURN_POST
#else
#define NORETURN_PRE
#define NORETURN_POST
#endif
#if defined(__cplusplus)
extern "C" {
#endif
/* File I/O */
uint8 readByte(FILE *fp);
uint16 readUint16BE(FILE *fp);
uint16 readUint16LE(FILE *fp);
uint32 readUint32BE(FILE *fp);
uint32 readUint32LE(FILE *fp);
void writeByte(FILE *fp, uint8 b);
void writeUint16BE(FILE *fp, uint16 value);
void writeUint16LE(FILE *fp, uint16 value);
void writeUint32BE(FILE *fp, uint32 value);
void writeUint32LE(FILE *fp, uint32 value);
uint32 fileSize(FILE *fp);
/* Misc stuff */
void NORETURN_PRE error(const char *s, ...) NORETURN_POST;
void warning(const char *s, ...);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -134,289 +134,6 @@ void initVima() {
}
}
void decompressVima_asm() {
asm("\tpush %esp\n"
"\tpush %ebp\n"
"\tpush %ebx\n"
"\tpush %esi\n"
"\tpush %edi\n"
"\n"
"\tmov sourceBuffer,%ecx\n"
"\tmov $1,%esi\n"
"\tmov (%ecx),%al\n"
"\tinc %ecx\n"
"\ttest %al,%al\n"
"\tmov %al,sBytes\n"
"\tjge .readWords\n"
"\tnot %al\n"
"\tmov %al,sBytes\n"
"\tmov $2,%esi\n"
"\n"
".readWords:\n"
"\tmov (%ecx),%ax\n"
"\txor %edx,%edx\n"
"\tmov %al,%dh\n"
"\tadd $2,%ecx\n"
"\tmov %ah,%dl\n"
"\tcmp $1,%esi\n"
"\tmov %dx,sWords\n"
"\tjbe .oneWord\n"
"\tmov (%ecx),%al\n"
"\tinc %ecx\n"
"\tmov %al,sBytes+1\n"
"\txor %edx,%edx\n"
"\tmov (%ecx),%ax\n"
"\tadd $2,%ecx\n"
"\tmov %al,%dh\n"
"\tmov %ah,%dl\n"
"\tmov %dx,sWords+2\n"
"\n"
".oneWord:\n"
"\tmov decLength,%eax\n"
"\tmovl $1,currTablePos\n"
"\tmov %esi,entrySize\n"
"\tadd %esi,%esi\n"
"\txor %edx,%edx\n"
"\tdiv %esi\n"
"\tmov %eax,decsToDo\n"
"\tmov %ecx,sourcePos\n"
"\n"
"\txor %ebx,%ebx\n"
"\n"
"\tmov %eax,currTablePos\n"
"\txor %edi,%edi\n"
"\tcmp %edi,%eax\n"
"\tjnz .label1\n"
"\tmovb $0,sBytes+1\n"
"\tmovb $0,sBytes\n"
"\tmov %di,sWords+2\n"
"\tmov %di,sWords\n"
"\n"
".label1:\n"
"\tmov sourcePos,%esi\n"
"\tmov entrySize,%edx\n"
"\txor %ecx,%ecx\n"
"\tmov (%esi),%ch\n"
"\tlea 1(%esi),%eax\n"
"\txor %esi,%esi\n"
"\tmov (%eax),%cl\n"
"\tinc %eax\n"
"\tcmp %edi,%edx\n"
"\tmov %ecx,tableEntry\n"
"\tmov %eax,sourcePos\n"
"\tmov %esi,sBytesPos\n"
"\tjbe .exitMainDec\n"
"\tmov destOffs,%edi\n"
"\tlea sWords,%eax\n"
"\tsub %eax,%edi\n"
"\tmov %eax,sWordsPos\n"
"\tmov %edi,destPos_sWordsPos\n"
"\n"
".nextByte:\n"
"\tlea (%edi,%eax,1),%ecx\n"
"\tmov %ecx,destPos\n"
"\tmovsbl sBytes(%esi),%ecx\n"
"\tmov %ecx,currTablePos\n"
"\tmovswl (%eax),%ecx\n"
"\tmov %ecx,outputWord\n"
"\tmov decsToDo,%ecx\n"
"\ttest %ecx,%ecx\n"
"\tjz .done\n"
"\tadd %edx,%edx\n"
"\tmov %ecx,decsLeft\n"
"\tmov %edx,bytesToDec\n"
"\n"
".nextDec:\n"
"\tmov currTablePos,%eax\n"
"\tmov $1,%edx\n"
"\tmov imcTable2(%eax),%cl\n"
"\tmov %cl,currTableVal\n"
"\tmov currTableVal,%esi\n"
"\tand $0xff,%esi\n"
"\tadd %esi,%ebx\n"
"\tlea -1(%esi),%ecx\n"
"\tmov %ebx,destOffs\n"
"\tshl %cl,%edx\n"
"\tmov $0x10,%cl\n"
"\tsub %bl,%cl\n"
"\tmov %dl,%al\n"
"\tdec %al\n"
"\tmov %al,var40\n"
"\tmov tableEntry,%eax\n"
"\tmov var40,%edi\n"
"\tand $0xffff,%eax\n"
"\tshr %cl,%eax\n"
"\tand $0xff,%edi\n"
"\tmov %edx,%ecx\n"
"\tor %edi,%ecx\n"
"\tand %ecx,%eax\n"
"\tcmp $7,%ebx\n"
"\tjle .label2\n"
"\tmov sourcePos,%ebx\n"
"\txor %ecx,%ecx\n"
"\tmov tableEntry,%ch\n"
"\tmovzbw (%ebx),%bx\n"
"\tor %ebx,%ecx\n"
"\tmov sourcePos,%ebx\n"
"\tinc %ebx\n"
"\tmov %ecx,tableEntry\n"
"\tmov %ebx,sourcePos\n"
"\tmov destOffs,%ebx\n"
"\tsub $8,%ebx\n"
"\tmov %ebx,destOffs\n"
"\tjmp .label3\n"
"\n"
".label2:\n"
"\tmov tableEntry,%ecx\n"
"\n"
".label3:\n"
"\ttest %edx,%eax\n"
"\tjz .clearEDX\n"
"\txor %edx,%eax\n"
"\tjmp .noClear\n"
"\n"
".clearEDX:\n"
"\txor %edx,%edx\n"
"\n"
".noClear:\n"
"\tcmp %edi,%eax\n"
"\tjnz .label4\n"
"\tmov %ecx,%edx\n"
"\tmov %ebx,%ecx\n"
"\tshl %cl,%edx\n"
"\tmov sourcePos,%ecx\n"
"\tmovzbw (%ecx),%di\n"
"\tpush %ecx\n"
"\tmovswl %dx,%ecx\n"
"\txor %edx,%edx\n"
"\tand $0xffffff00,%ecx\n"
"\tmov %ecx,outputWord\n"
"\tpop %ecx\n"
"\tmov tableEntry,%dh\n"
"\tor %edi,%edx\n"
"\tinc %ecx\n"
"\tmov %ecx,sourcePos\n"
"\tmov $8,%cx\n"
"\tsub %bx,%cx\n"
"\tmov %edx,%edi\n"
"\tshr %cl,%di\n"
"\txor %ecx,%ecx\n"
"\tmov destOffs,%ebx\n"
"\tmov %dl,%ch\n"
"\tmov %ecx,%edx\n"
"\tmov sourcePos,%ecx\n"
"\tand $0xff,%edi\n"
"\tpush %ecx\n"
"\tmov outputWord,%ecx\n"
"\tor %edi,%ecx\n"
"\tmov %ecx,outputWord\n"
"\tpop %ecx\n"
"\tmovzbw (%ecx),%di\n"
"\n"
"\tor %edi,%edx\n"
"\tinc %ecx\n"
"\tmov %edx,tableEntry\n"
"\tmov %ecx,sourcePos\n"
"\tjmp .writeDec\n"
"\n"
".label4:\n"
"\tmov $7,%ecx\n"
"\tmov %eax,%edi\n"
"\tsub %esi,%ecx\n"
"\tshl %cl,%edi\n"
"\tmov currTablePos,%ecx\n"
"\tshl $6,%ecx\n"
"\tor %ecx,%edi\n"
"\txor %ecx,%ecx\n"
"\ttest %eax,%eax\n"
"\tmov destTable(,%edi,2),%cx\n"
"\tmov %ecx,destOffs\n"
"\tjz .label5\n"
"\tmov currTablePos,%edi\n"
"\txor %ecx,%ecx\n"
"\tmov imcTable1(,%edi,2),%cx\n"
"\tmov %ecx,%edi\n"
"\tlea -1(%esi),%ecx\n"
"\tshr %cl,%edi\n"
"\tmov destOffs,%ecx\n"
"\tadd %edi,%ecx\n"
"\n"
".label5:\n"
"\ttest %edx,%edx\n"
"\tjz .label6\n"
"\tneg %ecx\n"
"\n"
".label6:\n"
"\tmov outputWord,%edx\n"
"\tadd %ecx,%edx\n"
"\tcmp $-0x8000,%edx\n"
"\tjge .label7\n"
"\tmov $-0x8000,%edx\n"
"\tmov %edx,outputWord\n"
"\tjmp .writeDec\n"
"\n"
".label7:\n"
"\tcmp $0x7fff,%edx\n"
"\tmov %edx,outputWord\n"
"\tjle .writeDec\n"
"\tmov $0x7fff,%edx\n"
"\tmov %edx,outputWord\n"
"\n"
".writeDec:\n"
"\tmov destPos,%ecx\n"
"\tmov bytesToDec,%edx\n"
"\tpush %eax\n"
"\tmov outputWord,%eax\n"
"\tmov %ax,(%ecx)\n"
"\tadd %edx,%ecx\n"
"\tmov offsets(,%esi,4),%edx\n"
"\tmov %ecx,destPos\n"
"\tmov currTablePos,%ecx\n"
"\tpop %eax\n"
"\tmovsbl (%edx,%eax,1),%eax\n"
"\tadd %eax,%ecx\n"
"\tmov %ecx,currTablePos\n"
"\tjns .label8\n"
"\tmovl $0,currTablePos\n"
"\tjmp .done\n"
"\n"
".label8:\n"
"\tmov currTablePos,%ecx\n"
"\tmov $0x58,%eax\n"
"\tcmp %eax,%ecx\n"
"\tjle .done\n"
"\tmov %eax,currTablePos\n"
"\n"
".done:\n"
"\tmov decsLeft,%eax\n"
"\tdec %eax\n"
"\tmov %eax,decsLeft\n"
"\tjnz .nextDec\n"
"\tmov entrySize,%edx\n"
"\tmov sBytesPos,%esi\n"
"\tmov sWordsPos,%eax\n"
"\tmov destPos_sWordsPos,%edi\n"
"\tmov currTablePos,%cl\n"
"\tadd $2,%eax\n"
"\tmov %cl,sBytes(%esi)\n"
"\tpush %ebx\n"
"\tmov outputWord,%ebx\n"
"\tmov %bx,-2(%eax)\n"
"\tpop %ebx\n"
"\tinc %esi\n"
"\tmov %eax,sWordsPos\n"
"\tcmp %edx,%esi\n"
"\tmov %esi,sBytesPos\n"
"\tjb .nextByte\n"
"\n"
".exitMainDec:\n"
"\tpop %edi\n"
"\tpop %esi\n"
"\tpop %ebx\n"
"\tpop %ebp\n"
"\tpop %esp\n");
}
int eax, bit;
void decompressVima() {