Phar Lap 汇编程序:如果可能的话,我需要信息/文档和二进制文件
我继承了一个最初针对MSDOS的程序的一个相当旧的、庞大而复杂的代码库。 事实证明,该程序的某些部分是用 x86 汇编程序的一种不起眼的方言编写的,称为“Phar Lap 汇编程序”,以生产该汇编程序的公司和产品命名。 我已经进行了相当深入的谷歌搜索,但无法找到原始的汇编程序或有关它的任何信息或文档。 (尽管我在专家交流中发现了一些相当令人沮丧的页面,人们提出了类似的问题)。
所以基本上,我无法编译这个东西,直到我找到 PharLap Assembler (386asm.exe) 的副本,或者找到有关该方言的足够信息以将其转换为更“标准”的 MASM(如方言) 。 或者,或者尝试通过阅读来弄清楚它。
或者,如果这一切都不可能,那么我只需要一些帮助来解决这个问题,并且我至少应该能够编译程序的一部分。
.c 文件中有一个如下所示的结构体声明:
//static struct bhash *bhash;
typedef struct bhash_control {
void *cachedata;
Rgb3 *ctab;
int rederr;
int grnerr;
int bluerr;
ULONG drgb; // temp var used by dithering, blackbox to us here
#ifdef SHOW_STATS
int calls, hits1, hits2, fhits, misses;
#endif
} BhashCtl;
BhashCtl bhashctl; // global so assembler code can see it.
然后有一些如下所示的汇编器,它可能试图进行相同的类型声明,以便某些汇编器代码可以使用相同的类型:
BhashCtl struct
cachedata dd ? ; pointer to alloc'd cache data area
ctab dd ? ; contains vb.pencel->cmap->ctab
rederr dd ? ; error diffusion dithering variables...
grnerr dd ?
bluerr dd ?
drgb dd ? ; rgb value with dithering rolled in
;calls dd ? ; cache stats...
;hits1 dd ? ; to use these, you also need to
;hits2 dd ? ; uncomment a few lines below.
;fhits dd ? ; search for 'bhashctl.' to find them.
;misses dd ?
BhashCtl ends
extern bhashctl:BhashCtl ; the one-and-only lives in bhash.c
编译时会出现错误最后一行看起来像这样(watcom 汇编程序):
Error! E518: External definition different from previous one
所以基本上,我认为这意味着这个结构体的汇编程序版本与这个结构体的 C 版本不匹配。 我已经尝试了多种不同的 WORD 和 DWORD 组合来代替汇编器中的 dd,但我无法克服这个小问题。 也许如果我能找到一种方法让这两个声明完美匹配,我对 pharlap 信息的需求就会减少。
另外,如果有人能为这个庞大的问题想出一个更好的标题,我愿意接受想法。
编辑:好吧,事实证明我浏览了一些重要信息。 这是一个最初为 Phar Lap 汇编器(我没有)编写的文件,我正在尝试使用 watcom 汇编器(wasm)进行汇编。 事实证明,该特定错误的问题在于 Phar Lap 似乎区分大小写,而 watcom 则不区分大小写。 所以它认为 bhashctl 与 BhashCtl 相同。 在我姐夫的帮助下解决了这个问题。 我从来没有想到不区分大小写是造成这种情况的原因。
I've inherited a rather old big and complex codebase for a program originally targeted at MSDOS. It turns out that some sections of this program are written in an obscure dialect of x86 assembler called "Phar Lap assembler", after the company and product that produced the assembler program. I've done a fairly deep google search and I'm unable to find either the original assembler program, or any information or documentation about it. (Though I have found some rather frustrating pages on Experts Exchange of people asking similar questions).
So basically, I won't be able to get this thing to compile until I can either find a copy of PharLap Assembler (386asm.exe), or find enough information about the dialect to translate it to a more "standard" MASM like dialect. Either that, or try to muscle through just figuring it out by reading it.
Alternatively, if none of this is possible, then I just need some help with this problem, and I should at least be able to get one section of the program to compile.
There's a struct declaration in a .c file that looks like this:
//static struct bhash *bhash;
typedef struct bhash_control {
void *cachedata;
Rgb3 *ctab;
int rederr;
int grnerr;
int bluerr;
ULONG drgb; // temp var used by dithering, blackbox to us here
#ifdef SHOW_STATS
int calls, hits1, hits2, fhits, misses;
#endif
} BhashCtl;
BhashCtl bhashctl; // global so assembler code can see it.
and then there's some assembler that looks like this, which is presumably trying to make the same type declaration so that some assembler code can use the same type:
BhashCtl struct
cachedata dd ? ; pointer to alloc'd cache data area
ctab dd ? ; contains vb.pencel->cmap->ctab
rederr dd ? ; error diffusion dithering variables...
grnerr dd ?
bluerr dd ?
drgb dd ? ; rgb value with dithering rolled in
;calls dd ? ; cache stats...
;hits1 dd ? ; to use these, you also need to
;hits2 dd ? ; uncomment a few lines below.
;fhits dd ? ; search for 'bhashctl.' to find them.
;misses dd ?
BhashCtl ends
extern bhashctl:BhashCtl ; the one-and-only lives in bhash.c
this compiles with an error on the last line which looks like this (watcom assembler):
Error! E518: External definition different from previous one
So basically, I think what this is saying is that the assembler version of this struct doesn't match the C version of this struct. I've tried a number of different combinations of WORD and DWORD in place of dd in the assembler, but I can't get past this little thing. Maybe if I could find a way to get these two declarations to match perfectly, my need for information about pharlap would be diminished.
Also, if anyone can think of a better title for this sprawling question, I'm open to ideas.
Edit: Okay it turns out I skimmed over some important info. This is a file originally written for a Phar Lap assembler (which I don't have), that I'm trying to assemble using the watcom assember (wasm). The problem with that particular error, it turns out, is it seems Phar Lap is case sensitive, while watcom isn't. So it sees bhashctl as the same as BhashCtl. Figured this out with the help of my brother in law. I never would have thought of case insensitivity being the cause of that one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一些 Phar Lap 手册(包括 386|ASM 手册)的 ZIP 位于:
http://www.dinigroup。 com/pharlap.php
ZIP of some Phar Lap manuals (including a 386|ASM one) at:
http://www.dinigroup.com/pharlap.php
这可能不是您需要的答案,但无论如何我都会尝试:将汇编部分移植到 C 中有多难? 我知道有些东西 C 无法做到,但也许您可以使用内联汇编来完成该任务。
This may not be the answer you need, but I'll try anyway: how hard is it to port your assembly sections into C? I know there is stuff that C can't do, but perhaps you can use inline assembly to accomplish that.