summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2009-06-16 15:30:37 +0200
committerLuc Verhaegen <libv@skynet.be>2009-06-17 14:47:05 +0200
commit1315850342e43fe80810fbd735a14f0aa2d377a3 (patch)
tree0ca14405f4b9288fb54525ad39dfc1894f569a76
parent6af9ecf70616287f0799dbb2219926da89806629 (diff)
Phnxdeco: clean up warnings.
-rw-r--r--phnxdeco/Makefile8
-rw-r--r--phnxdeco/kernel.c60
-rw-r--r--phnxdeco/phnxdeco.c79
-rw-r--r--phnxdeco/phnxdeco.h54
-rw-r--r--phnxdeco/phnxfunc.c175
5 files changed, 126 insertions, 250 deletions
diff --git a/phnxdeco/Makefile b/phnxdeco/Makefile
index 206e6c6..e5c9f85 100644
--- a/phnxdeco/Makefile
+++ b/phnxdeco/Makefile
@@ -1,11 +1,13 @@
CFLAGS = -g -fpack-struct -Wall
CC = gcc
+OBJS= phnxfunc.o kernel.o phnxdeco.o
+
all: phnxdeco
clean:
rm -f *.o
- rm phnxdeco
+ rm -f phnxdeco
-phnxdeco: phnxdeco.c phnxfunc.o kernel.o
- $(CC) $(CFLAGS) phnxfunc.o kernel.o phnxdeco.c -o phnxdeco
+phnxdeco: $(OBJS)
+ $(CC) $(CFLAGS) $(OBJS) -o phnxdeco
diff --git a/phnxdeco/kernel.c b/phnxdeco/kernel.c
index f77073a..9add380 100644
--- a/phnxdeco/kernel.c
+++ b/phnxdeco/kernel.c
@@ -7,9 +7,11 @@
***
***********************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+
+#include "phnxdeco.h"
#define UCHAR_MAX ((1<<(sizeof(unsigned char)*8))-1)
#define CHAR_BIT 8
@@ -30,39 +32,25 @@
#define TBIT 5
#define NPT 0x80
-unsigned long origsize, compsize;
-unsigned short dicbit;
-unsigned short maxmatch;
-unsigned long count;
-unsigned short loc;
-unsigned char *text;
+static unsigned long origsize, compsize;
+static unsigned short dicbit;
+static unsigned long count;
+static unsigned short loc;
+static unsigned char *text;
static unsigned short dicsiz;
static unsigned char subbitbuf, bitcount;
-unsigned short crc, bitbuf;
-int prev_char;
-long reading_size;
+static unsigned short crc, bitbuf;
+static int prev_char;
-unsigned short left[2 * NC - 1], right[2 * NC - 1];
-unsigned char c_len[NC], pt_len[NPT];
-unsigned short c_table[4096], c_code[NC], pt_table[256], pt_code[NPT];
-static unsigned char *buf;
-static unsigned short bufsiz;
+static unsigned short left[2 * NC - 1], right[2 * NC - 1];
+static unsigned char c_len[NC], pt_len[NPT];
+static unsigned short c_table[4096], pt_table[256];
static unsigned short blocksize;
-FILE *infile, *outfile;
-
-typedef struct {
- FILE *infile;
- FILE *outfile;
- unsigned long original;
- unsigned long packed;
- int dicbit;
- int method;
-} interfacing;
-
+static FILE *infile, *outfile;
static short c, n, tblsiz, len, depth, maxdepth, avail;
static unsigned short codeword, bit, *tbl;
@@ -122,7 +110,7 @@ static short mktbl(void)
/****************************************/
/* make_table() */
/****************************************/
-void make_table(short nchar, unsigned char bitlen[], short tablebits, unsigned short table[])
+static void make_table(short nchar, unsigned char bitlen[], short tablebits, unsigned short table[])
{
n = avail = nchar;
blen = bitlen;
@@ -146,7 +134,7 @@ void make_table(short nchar, unsigned char bitlen[], short tablebits, unsigned s
/****************************************/
/* fillbif() */
/****************************************/
-void fillbuf(unsigned char n)
+static void fillbuf(unsigned char n)
{ /* Shift bitbuf n bits left, read n bits */
while (n > bitcount) {
n -= bitcount;
@@ -167,7 +155,7 @@ void fillbuf(unsigned char n)
/****************************************/
/* getbits() */
/****************************************/
-unsigned short getbits(unsigned char n)
+static unsigned short getbits(unsigned char n)
{
unsigned short x;
@@ -179,7 +167,7 @@ unsigned short getbits(unsigned char n)
/****************************************/
/* fwrite_crc() */
/****************************************/
-void fwrite_crc(unsigned char *p, int n, FILE * fp)
+static void fwrite_crc(unsigned char *p, int n, FILE * fp)
{
if (fp) {
@@ -193,7 +181,7 @@ void fwrite_crc(unsigned char *p, int n, FILE * fp)
/****************************************/
/* init_getbits() */
/****************************************/
-void init_getbits(void)
+static void init_getbits(void)
{
bitbuf = 0;
subbitbuf = 0;
@@ -285,7 +273,7 @@ static void read_c_len(void)
}
}
-unsigned short decode_c_st1(void)
+static unsigned short decode_c_st1(void)
{
unsigned short j, mask;
@@ -314,7 +302,7 @@ unsigned short decode_c_st1(void)
return j;
}
-unsigned short decode_p_st1(void)
+static unsigned short decode_p_st1(void)
{
unsigned short j, mask;
@@ -338,7 +326,7 @@ unsigned short decode_p_st1(void)
return j;
}
-void decode_start_st1(void)
+static void decode_start_st1(void)
{
init_getbits();
blocksize = 0;
diff --git a/phnxdeco/phnxdeco.c b/phnxdeco/phnxdeco.c
index 43f1e9d..5f9e856 100644
--- a/phnxdeco/phnxdeco.c
+++ b/phnxdeco/phnxdeco.c
@@ -29,16 +29,16 @@
#define SftName "PhoenixDeco"
#define SftEMail "Anton Borisov, anton.borisov@gmail.com"
-byte SoftName[] = "-=" SftName ", version " SftVersion "=-";
-byte CopyRights[] = "\n(C) Anton Borisov, 2000, 2002-2004, Portions (C) 1999-2000";
-byte Url[] = "Bug-reports direct to " SftEMail;
+static char SoftName[] = "-=" SftName ", version " SftVersion "=-";
+static char CopyRights[] = "\n(C) Anton Borisov, 2000, 2002-2004, Portions (C) 1999-2000";
+static char Url[] = "Bug-reports direct to " SftEMail;
-byte HelpSystem(byte argc, byte * argv[])
+static unsigned char HelpSystem(int argc, char *argv[])
{
- byte x = 0, retcode = 0;
+ unsigned char x = 0, retcode = 0;
for (x = 1; x < argc; x++) {
- if (StrCmp(argv[x], "-h") == 0) {
+ if (strcmp(argv[x], "-h") == 0) {
printf("\n" SftName " HelpSystem Starting Now!\n");
printf("\nThis Program Version Number %s", SftVersion);
printf("\n" SftName " - Decompressor for PhoenixBIOSes only.\n" "\tSupported formats: Phoenix BIOS 4.0, Phoenix FirstBIOS\n\n" "" SftName
@@ -50,29 +50,29 @@ byte HelpSystem(byte argc, byte * argv[])
}
- if (StrCmp(argv[x], "-xs") == 0)
+ if (strcmp(argv[x], "-xs") == 0)
retcode = 0x20;
- if (StrCmp(argv[x], "-ls") == 0)
+ if (strcmp(argv[x], "-ls") == 0)
retcode = 0x21;
- if (StrCmp(argv[x], "-x") == 0)
+ if (strcmp(argv[x], "-x") == 0)
retcode = 0x10;
- if (StrCmp(argv[x], "-l") == 0)
+ if (strcmp(argv[x], "-l") == 0)
retcode = 0x11;
- if (StrCmp(argv[x], "-c") == 0)
+ if (strcmp(argv[x], "-c") == 0)
retcode += 0x40;
}
return (retcode);
}
-void PrintHeader(byte * EOL)
+static void PrintHeader(char * EOL)
{
printf("\n%c%s%c%s", 0x4, SoftName, 0x4, EOL);
}
-void PrintUsage()
+static void PrintUsage()
{
PrintHeader("");
@@ -84,21 +84,21 @@ void PrintUsage()
}
-int main(byte argc, byte * argv[])
+int main(int argc, char *argv[])
{
FILE *ptx;
- byte *Buf;
- dword CurPos, fLen, Start, Offset;
- word i, Len, FirstBLK, BBsz, BANKsz;
- dword POSTOff, SYSOff, FCPOff, FirstBLKf;
- byte PhBIOS[] = "Phoenix FirstBIOS", PhVersion[3], PhRelease[3], phtime[8];
- byte BCPSEGMENT[] = "BCPSEGMENT";
- byte BCPFCP[] = "BCPFCP";
- AMIDATE phdate;
- byte TotalSections = 0, Action, Mods = 0;
+ unsigned char *Buf;
+ unsigned int CurPos, fLen, Start, Offset;
+ word i, FirstBLK, BBsz, BANKsz;
+ unsigned int POSTOff, SYSOff, FCPOff, FirstBLKf;
+ unsigned char phtime[8];
+ char BCPSEGMENT[] = "BCPSEGMENT";
+ char BCPFCP[] = "BCPFCP";
+ char phdate[9]; /* XX/XX/XX\0 */
+ unsigned char TotalSections = 0, Action, Mods = 0;
PHNXID IDMod;
- byte __COPY__ = 0;
+ unsigned char __COPY__ = 0;
switch (HelpSystem(argc, argv)) {
case 0x80:
@@ -136,7 +136,7 @@ int main(byte argc, byte * argv[])
return 0;
};
- Buf = (byte *) calloc(BLOCK, 1);
+ Buf = (unsigned char *) calloc(BLOCK, 1);
if (!Buf) {
printf("Memory Error..\n");
return 0;
@@ -151,7 +151,7 @@ int main(byte argc, byte * argv[])
fseek(ptx, 0, 2);
fLen = ftell(ptx);
rewind(ptx);
- printf("Filelength\t: %lX (%lu bytes)\n", fLen, fLen);
+ printf("Filelength\t: %X (%u bytes)\n", fLen, fLen);
printf("Filename\t: %s\n", argv[1]);
@@ -169,9 +169,9 @@ int main(byte argc, byte * argv[])
exit(1);
}
- printf("PhoenixBIOS hook found at\t: %lX\n", CurPos);
+ printf("PhoenixBIOS hook found at\t: %X\n", CurPos);
CurPos += 10;
- fseek(ptx, (dword) (CurPos), 0);
+ fseek(ptx, (unsigned int) (CurPos), 0);
while (IDMod.Name[0] != 0x0 && IDMod.Len != 0x0) {
fread(&IDMod, 1, sizeof(IDMod), ptx);
@@ -191,7 +191,7 @@ int main(byte argc, byte * argv[])
if (memcmp(IDMod.Name, "BCPSYS", 6) == 0)
SYSOff = CurPos;
CurPos += IDMod.Len;
- fseek(ptx, (dword) (CurPos), 0);
+ fseek(ptx, (unsigned int) (CurPos), 0);
if (IDMod.Name[0] == 0x0 || IDMod.Name[0] < 0x41)
break;
else
@@ -210,7 +210,7 @@ int main(byte argc, byte * argv[])
}
FCPOff = CurPos;
- printf("System Information at\t\t: %lX\n", SYSOff);
+ printf("System Information at\t\t: %X\n", SYSOff);
fseek(ptx, SYSOff + 0x7E, 0);
fread(&BBsz, 1, sizeof(BBsz), ptx);
@@ -219,7 +219,8 @@ int main(byte argc, byte * argv[])
fread(&BANKsz, 1, sizeof(BANKsz), ptx);
fseek(ptx, SYSOff + 15, 0);
- fread(&phdate, 1, sizeof(phdate), ptx);
+ fread(&phdate, 1, 8, ptx);
+ phdate[8] = 0;
fread(Buf, 1, 1, ptx);
fread(&phtime, 1, 8, ptx);
@@ -233,20 +234,20 @@ int main(byte argc, byte * argv[])
fseek(ptx, SYSOff + 0x37, 0);
fread(Buf, 1, 8, ptx);
- printf("BootBlock\t: %lX bytes\n", (BBsz == 0x0) ? (0x10000) : (BBsz));
- printf("BankSize\t: %li KB\n", BANKsz);
+ printf("BootBlock\t: %X bytes\n", (BBsz == 0x0) ? (0x10000) : (BBsz));
+ printf("BankSize\t: %i KB\n", BANKsz);
printf("Version\t\t: %8.8s\n", Buf);
- printf("Start\t\t: %lX\n", Start);
- printf("Offset\t\t: %lX\n", 0xFFFF0000 - Offset);
+ printf("Start\t\t: %X\n", Start);
+ printf("Offset\t\t: %X\n", 0xFFFF0000 - Offset);
printf("BCP Modules\t: %i\n", Mods);
- printf("BCPFCP\t\t: %lX\n", FCPOff);
+ printf("BCPFCP\t\t: %X\n", FCPOff);
fseek(ptx, FCPOff + 0x18, 0);
fread(&FirstBLK, 1, sizeof(FirstBLK), ptx);
FirstBLKf = (ftell(ptx) & 0xF0000) + FirstBLK;
- printf("FCP 1st module\t: %lX (%lX)\n", FirstBLK, FirstBLKf);
+ printf("FCP 1st module\t: %X (%X)\n", FirstBLK, FirstBLKf);
- printf("Released\t: %s at %8.8s\n", GetFullDate(phdate.Month, phdate.Day, phdate.Year), phtime);
+ printf("Released\t: %s at %8.8s\n", phdate, phtime);
printf("/* Copyrighted Information */\n");
@@ -261,7 +262,7 @@ int main(byte argc, byte * argv[])
CurPos = IsPhoenixBIOS(ptx, Buf);
- fseek(ptx, (dword) (CurPos), 0);
+ fseek(ptx, (unsigned int) (CurPos), 0);
};
fread(Buf, 1, 0x100, ptx);
diff --git a/phnxdeco/phnxdeco.h b/phnxdeco/phnxdeco.h
index fc6150b..55d7934 100644
--- a/phnxdeco/phnxdeco.h
+++ b/phnxdeco/phnxdeco.h
@@ -10,10 +10,7 @@
** New Name Conventions
* ------------------------- */
-#include <stdio.h>
-
-typedef unsigned char byte;
-typedef unsigned long dword;
+//typedef unsigned long dword;
typedef unsigned short word;
#define BLOCK 0x8000
@@ -35,47 +32,34 @@ typedef struct {
} interfacing;
typedef struct {
- byte Month[2];
- byte rsrv1;
- byte Day[2];
- byte rsrv2;
- byte Year[2];
-} AMIDATE;
-
-typedef struct {
- dword Prev;
- byte Sig[3];
- byte ID_HI;
- byte ID_LO;
- byte HeadLen;
- byte isPacked;
+ unsigned int Prev;
+ unsigned char Sig[3];
+ unsigned char ID_HI;
+ unsigned char ID_LO;
+ unsigned char HeadLen;
+ unsigned char isPacked;
word Offset;
word Segment;
- dword ExpLen1;
- dword Packed1;
- dword Packed2;
- dword ExpLen2;
+ unsigned int ExpLen1;
+ unsigned int Packed1;
+ unsigned int Packed2;
+ unsigned int ExpLen2;
} PHOENIXHEAD;
typedef struct {
- byte Name[6];
+ unsigned char Name[6];
word Flags;
word Len;
} PHNXID;
-byte StrLen(byte * Str);
-byte StrCmp(byte * Dst, byte * Src);
+unsigned int FoundAt(FILE * ptx, unsigned char * Buf, char *Pattern, unsigned int BLOCK_LEN);
-dword FoundAt(FILE * ptx, byte * Buf, byte * Pattern, dword BLOCK_LEN);
-byte *GetFullDate(byte * mon, byte * day, byte * year);
-
-byte *GetModuleName(byte ID);
-byte *GetCompressionName(byte ID);
-void decodeM3(interfacing interface);
-
-byte TotalSec(FILE * ptx, byte * Buf, byte Action, dword BankSize);
+unsigned char TotalSec(FILE * ptx, unsigned char * Buf, unsigned char Action, unsigned int BankSize);
/* Modified Module Detection & Manipulating According to BCPSYS block */
-byte TotalSecM(FILE * ptx, byte * Buf, byte Action, dword Start, dword ConstOff, dword SYSOff);
+unsigned char TotalSecM(FILE * ptx, unsigned char * Buf, unsigned char Action, unsigned int Start, unsigned int ConstOff, unsigned int SYSOff);
+
+unsigned int IsPhoenixBIOS(FILE * ptx, unsigned char * Buf);
-dword IsPhoenixBIOS(FILE * ptx, byte * Buf);
+/* kernel.c */
+void decode(interfacing interface);
diff --git a/phnxdeco/phnxfunc.c b/phnxdeco/phnxfunc.c
index 9631b23..8e70603 100644
--- a/phnxdeco/phnxfunc.c
+++ b/phnxdeco/phnxfunc.c
@@ -10,81 +10,18 @@
** New Name Conventions
* ------------------------- */
-#include <stdio.h>
-
-typedef unsigned char byte;
-typedef unsigned long dword;
-typedef unsigned short word;
-
-#define BLOCK 0x8000
-#define Xtract 0x10
-#define List 0x11
-#define XtractM 0x20
-#define ListM 0x21
-
-#define IDSign "+"
-
-typedef struct {
- FILE *infile;
- FILE *outfile;
- unsigned long original;
- unsigned long packed;
- int dicbit;
- int method;
-} interfacing;
-
-typedef struct {
- byte Month[2];
- byte rsrv1;
- byte Day[2];
- byte rsrv2;
- byte Year[2];
-} AMIDATE;
-
-typedef struct {
- dword Prev;
- byte Sig[3];
- byte ID_HI;
- byte ID_LO;
- byte HeadLen;
- byte isPacked;
- word Offset;
- word Segment;
- dword ExpLen1;
- dword Packed1;
- dword Packed2;
- dword ExpLen2;
-} PHOENIXHEAD;
-typedef struct {
- byte Name[6];
- word Flags;
- word Len;
-} PHNXID;
-
-byte StrLen(byte * Str)
-{
- int i = 0;
- while (*(Str + i) != 0x0)
- i++;
- return (i);
-};
-
-byte StrCmp(byte * Dst, byte * Src)
-{
- byte i;
- for (i = 0; i <= StrLen(Src); i++)
- if (Dst[i] != Src[i])
- return (1);
- return (0);
-}
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "phnxdeco.h"
-dword FoundAt(FILE * ptx, byte * Buf, byte * Pattern, dword BLOCK_LEN)
+unsigned int FoundAt(FILE * ptx, unsigned char *Buf, char *Pattern, unsigned int BLOCK_LEN)
{
- dword i, Ret;
+ unsigned int i, Ret;
word Len;
- Len = StrLen(Pattern);
+ Len = strlen(Pattern);
for (i = 0; i < BLOCK_LEN - 0x80; i++) {
if (memcmp(Buf + i, Pattern, Len) == 0) {
Ret = ftell(ptx) - (BLOCK_LEN - i);
@@ -94,33 +31,7 @@ dword FoundAt(FILE * ptx, byte * Buf, byte * Pattern, dword BLOCK_LEN)
return 0;
}
-byte *GetFullDate(byte * mon, byte * day, byte * year)
-{
- byte *Months[] = { "",
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
- };
- byte Buf[20];
-
- if ((atoi(year) >= 0) && (atoi(year) < 70))
- sprintf(Buf, "%.2s %s %s%.2s", day, Months[atoi(mon)], "20", year);
- else
- sprintf(Buf, "%.2s %s %s%.2s", day, Months[atoi(mon)], "19", year);
-
- return (Buf);
-}
-
-byte *GetModuleName(byte ID)
+static char *GetModuleName(char ID)
{
switch (ID) {
case 'A':
@@ -180,16 +91,12 @@ byte *GetModuleName(byte ID)
default:
return ("User-Defined");
-
-
-
}
}
-byte *GetCompressionName(byte ID)
+static char *GetCompressionName(unsigned char ID)
{
switch (ID) {
-
case 0x0:
return ("NONE");
case 0x2:
@@ -202,22 +109,21 @@ byte *GetCompressionName(byte ID)
return ("LZINT");
default:
return ("RSRV!");
-
}
}
-void decodeM3(interfacing interface)
+static void decodeM3(interfacing interface)
{
FILE *ptx, *bmx;
word Index, Index2, DX, Loop, XorOp, i;
- byte *Buffer, tmp;
- dword RealLen, Now;
+ unsigned char *Buffer, tmp;
+ unsigned int RealLen, Now;
ptx = interface.infile;
bmx = interface.outfile;
RealLen = interface.original;
- Buffer = (byte *) calloc(4096, 1);
+ Buffer = (unsigned char *) calloc(4096, 1);
if (!Buffer)
return;
@@ -279,18 +185,18 @@ void decodeM3(interfacing interface)
}
-byte TotalSec(FILE * ptx, byte * Buf, byte Action, dword BankSize)
+unsigned char TotalSec(FILE * ptx, unsigned char * Buf, unsigned char Action, unsigned int BankSize)
{
FILE *pto;
interfacing interface;
- byte Buffer[12];
+ char Buffer[12];
- dword CurPos = 0;
- dword RealRead = 0, i, TotalRead = 0, Tmp;
- byte Head[] = { '\x31', '\x31', '\x0' };
+ unsigned int CurPos = 0;
+ unsigned int RealRead = 0, i, TotalRead = 0, Tmp;
+ char Head[] = { '\x31', '\x31', '\x0' };
PHOENIXHEAD phhead;
- dword End = 0xFFFFFFFF;
- byte TotalSec = 0;
+ unsigned int End = 0xFFFFFFFF;
+ unsigned char TotalSec = 0;
switch (Action) {
@@ -324,16 +230,16 @@ byte TotalSec(FILE * ptx, byte * Buf, byte Action, dword BankSize)
case List:
- printf("\n %c.%.2X (%12.12s) %5.5lX (%5.5lu) => %5.5lX (%6.3lu) %5.5s (%3.1i%%) %5.2lXh", phhead.ID_LO, phhead.ID_HI,
+ printf("\n %c.%.2X (%12.12s) %5.5X (%5.5u) => %5.5X (%6.3u) %5.5s (%3.1i%%) %5.2Xh", phhead.ID_LO, phhead.ID_HI,
GetModuleName(phhead.ID_LO), phhead.Packed1, phhead.Packed1, phhead.ExpLen1, phhead.ExpLen1, GetCompressionName(phhead.isPacked),
- (dword) 100 * (dword) phhead.Packed1 / (dword) phhead.ExpLen1, CurPos);
+ (unsigned int) 100 * (unsigned int) phhead.Packed1 / (unsigned int) phhead.ExpLen1, CurPos);
break;
case Xtract:
if (phhead.isPacked == 0)
- sprintf(Buffer, "phoenix0.%1.1C%.1X", phhead.ID_LO, phhead.ID_HI);
+ sprintf(Buffer, "phoenix0.%C%.1X", phhead.ID_LO, phhead.ID_HI);
else
- sprintf(Buffer, "phoenix_.%1.1C%.1X", phhead.ID_LO, phhead.ID_HI);
+ sprintf(Buffer, "phoenix_.%C%.1X", phhead.ID_LO, phhead.ID_HI);
printf("%C.%.2X :: Saving %s ...", phhead.ID_LO, phhead.ID_HI, Buffer);
if ((pto = fopen(Buffer, "wb")) == NULL) {
@@ -393,22 +299,17 @@ byte TotalSec(FILE * ptx, byte * Buf, byte Action, dword BankSize)
* Modified Module Detection & Manipulating
* According to BCPSYS block
*/
-byte TotalSecM(FILE * ptx, byte * Buf, byte Action, dword Start, dword ConstOff, dword SYSOff)
+unsigned char TotalSecM(FILE * ptx, unsigned char * Buf, unsigned char Action, unsigned int Start, unsigned int ConstOff, unsigned int SYSOff)
{
- FILE *pto, *scr;
+ FILE *pto;
interfacing interface;
- byte Buffer[12], Magic[4] = { 0x42, 0x43, 0xD6, 0xF1 };
+ char Buffer[12];
- dword CurPos = 0, i;
- dword blkend = 0, blkstart = 0;
+ unsigned int i;
+ unsigned int blkend = 0, blkstart = 0;
PHOENIXHEAD phhead;
- byte TotalSec = 0;
- dword Offset = Start;
-
- word BBsz, BANKsz;
- dword BBROMsz;
- extern byte SoftName[];
- extern byte Url[];
+ unsigned char TotalSec = 0;
+ unsigned int Offset = Start;
phhead.Prev = 0xFFFF0000;
fseek(ptx, 0, 2);
@@ -436,9 +337,9 @@ byte TotalSecM(FILE * ptx, byte * Buf, byte Action, dword Start, dword ConstOff,
switch (Action) {
case ListM:
- printf("\n%.c %.1X %5.5s %4.4lX %4.4lX %4.4lX %4.4lX %5.lX %3.1i%% %4.4lX %4.4lX %5.2lXh", phhead.ID_LO, phhead.ID_HI,
+ printf("\n%c %.1X %5.5s %4.4X %4.4X %4.4X %4.4X %5.X %3.1i%% %4.4X %4.4X %5.2Xh", phhead.ID_LO, phhead.ID_HI,
GetCompressionName(phhead.isPacked), blkstart >> 0x10, blkstart & 0xFFFF, (blkend + phhead.Packed1) >> 0x10,
- (blkend + phhead.Packed1) & 0xFFFF, phhead.Packed1, (dword) 100 * (dword) phhead.Packed1 / (dword) phhead.ExpLen1, phhead.Prev >> 0x10,
+ (blkend + phhead.Packed1) & 0xFFFF, phhead.Packed1, (unsigned int) 100 * (unsigned int) phhead.Packed1 / (unsigned int) phhead.ExpLen1, phhead.Prev >> 0x10,
phhead.Prev & 0xFFFF, Start);
@@ -449,7 +350,7 @@ byte TotalSecM(FILE * ptx, byte * Buf, byte Action, dword Start, dword ConstOff,
printf("\n%c.%1.1X", phhead.ID_LO, phhead.ID_HI);
sprintf(Buffer, "%s", GetModuleName(phhead.ID_LO));
- if (StrLen(Buffer) > 7)
+ if (strlen(Buffer) > 7)
sprintf(Buffer, "%7.7s%1.1X.rom", GetModuleName(phhead.ID_LO), phhead.ID_HI);
else {
sprintf(Buffer, "%s%1.1X.rom", GetModuleName(phhead.ID_LO), phhead.ID_HI);
@@ -495,12 +396,12 @@ byte TotalSecM(FILE * ptx, byte * Buf, byte Action, dword Start, dword ConstOff,
}
-dword IsPhoenixBIOS(FILE * ptx, byte * Buf)
+unsigned int IsPhoenixBIOS(FILE * ptx, unsigned char * Buf)
{
- dword CurPos = 0;
- byte FirstPattern[] = "Phoenix FirstBIOS";
- byte PhoenixPattern[] = "PhoenixBIOS 4.0";
+ unsigned int CurPos = 0;
+ char FirstPattern[] = "Phoenix FirstBIOS";
+ char PhoenixPattern[] = "PhoenixBIOS 4.0";
rewind(ptx);
while (!feof(ptx)) {