Conversion of MASM 5.1 Assembly Code (1994) To MASM32 Assembly Code (2006)

Started by cparke15033, November 16, 2006, 02:07:23 AM

Previous topic - Next topic

cparke15033

Dear Friends,

Perhaps someone here can help me?

I came to this site after finding the MASM32 project through several
Google searches to try to solve my problem.

I have been in microcomputers since 1980 (before DOS in the early CP/M
days!) but never learned x86 assembly language programming.

I worked for many years programming in the various xBase dialects of
the 1980's and 1990's until WIN32 based development systems and modern
relational databases began to take over. My greatest expertise was
programming in Clipper during those original 16 bit 80286 DOS days.

Now I am working in Java and MySQL in the WIN32 development world like
many others.

But a situation has come up where I could use some of my old Clipper
functions in a current critical complex data scrubbing project where a
simple flat file data scrubbing solution would be completely appropriate.

I have found that people who loved the very surgical Clipper language
all these years DID keep going and the language is alive and well! I
recently purchased the xHarbour compiler and linker system and am in
process of moving all of my years of personally written Clipper
function libraries over to the 32 bit world. The xHarbour system works
great. A very nice product.

http://www.xharbour.com/

Many of the legacy string handling and data scrubbing custom functions
that I wrote over the years use pieces of the famous SuperLib Clipper
library written by Gary Prefontaine which has been in the public
domain since 1996 (as long as you don't charge anyone for the use of
his source code)

http://www.the-oasis.net/ftpmaster.php3?content=ftplib.htm
(see Supfree.zip)

If I can move all of my old libraries over to the new xHarbour "32 bit
version of Clipper" I'm in a brave new world! My old tricks will live
on in cleaning flat file data before I use it in applications written
in other languages in my current job.

I can get all of the Super Function Library source code to come over
through the xHarbour Clipper language compiler. I can get the C files
involved in the Super Function Library to link in the xHarbour linking system.

But I have (4) .ASM files that I believe I have to recompile in MASM32
to link in as either .OBJ or .DLL files to get the library to work now in 2006!

Here are the .ASM files trapped in 1994 x86 ***MASM 5.11*** x86 assembly language.

I studied the MASM32 examples and tried to see if I could upgrade the code
as best I could without knowing assembly language programming:

I am getting ***THESE VARIOUS COMPILE ERRORS WITH MASM32 ML.EXE***:

***************************************************************************
Assembling: cddtest.asm
cddtest.asm(86): error A2155:
cannot use 16-bit register with a 32-bit address

cddtest.asm(92): error A2155:
cannot use 16-bit register with a 32-bit address

cddtest.asm(115): fatal error A1010:
unmatched block nesting : _prog
***************************************************************************

***************************************************************************
Assembling: isprntest.asm
isprntest.asm(35): error A2008:
syntax error : IX86

isprntest.asm(51): warning A4011:
multiple .MODEL directives found : .MODEL ignored

isprntest.asm(92): error A2148:
invalid symbol type in expression : return

isprntest.asm(94):
error A2081: missing operand after unary operator
return(1):
Macro Called From isprntest.asm(94): Main Line Code
***************************************************************************


***************************************************************************
Assembling: s_mousetest.asm
s_mousetest.asm(47) : warning A4011:
multiple .MODEL directives found : .MODEL ignored

s_mousetest.asm(365) : error A2155:
cannot use 16-bit register with a 32-bit address
***************************************************************************

***************************************************************************
Assembling: s_shifttest.asm
s_shifttest.asm(43): warning A4011:
multiple .MODEL directives found : .MODEL ignored
***************************************************************************

Can anyone easily see what I should do to get these to compile. Am I on the right track?

Best regards to all kind souls here,

Craig Parke

Done ! hutch--

Tedd

This code is very 16-bit centric, and I'm afraid to tell you that 'moving' it to 32-bit really requires an almost full re-write (i.e. it would be quicker and easier to just write it all again in 32-bit, rather than fiddling about trying to convert it all to work as 32-bit.) Luckily, most of the code could simply be removed, and replaced by calls to windows api functions which provide the same functionality.
You do have the option of assembling this as 16-bit and linking it into a 16-bit dos executable, but I don't presume that's what you want, or would be useful to you.

PS Could you remove the code listing, and attach the file to the psot as a zipped attachment :wink
No snowflake in an avalanche feels responsible.

cparke15033

Hi Tedd,

Thank you so much for your very helpful reply!

Attached is my post with the code as a zip file.

I am not exactly sure how to edit my original post to remove the code portion. Can I just delete the lines when I make a reply?

You seem very knowledgable.

*Would you or anyone else here be willing to re-write the code for an hourly rate or set fee?*

I would be willing to pay for this if it was a reasonable rate or fee and a straight forward transaction.

You are correct in your insight. I already have a 16 bit version running from years ago. So compling as a 16 bit DOS app does not push the envelope here. I want to move everything to WIN32.

As I said, I have years of very useful Clipper application code and libraries that would all be alive again without further modification if I can just get these 4 .ASM files across to the modern platform. I feel as long as a body of code is USEFUL as it is in solving real world problems it is NOT obsolete! Clipper was a great language for manipulating flat file data and rapidly writing and executing very intricate and surgical critical data scrubbing routines with little processing overhead. I'd just love to use my old systems but now in WIN32. What a joy it would be! Everything old would be new again!

So let me know if you would be interested in some kind of contract job in making this MASM32 translation. Same with anyone else here who might be interested.

I hope I am not violating any regulation on this very fine site by making this offer here. Someone please inform me if I have violated any rule or standard in doing this.

Anyone may contact me here in a post or privately at my member e-mail regarding do the translation for a fee if that would be better.

Again, thank you for your post. It is very much appreciated!

Best regards,

Craig Parke


[attachment deleted by admin]

Tedd

What exactly are you after? I'm guessing you want some kind of library which provides these same functions, but routing through windows instead of dos.. The question is whether you need one-for-one replacements, or just similar functionality.
The main thing is that windows already provides almost all of this functionality, so if your xbase implementation provides access, then there's not a whole lot to be written :wink However, usage won't be totally the same as for the 'dos' functions.
If you can't get direct access from xbase, then it should be easy enough to write a 'wrapper' library that basically just forwards/translates the function calls.. And if you're happy to pay someone to do that, then I'm happy to take your money :lol


(There should be a "modify" button on your posts - when you're logged-in - click that and you can modify/savage your previous post; it's just that really really really long posts are hard to read.)
No snowflake in an avalanche feels responsible.

cparke15033

Hi Tedd,

Without the .ASM functions being able to be called by the xHarbour Clipper compiled .OBJ's linked code for the Super Function Library these are the errors I get:

.xLINK: error: Unresolved external symbol '_HB_FUN_TAKEOUT
.xLINK: error: Unresolved external symbol '_HB_FUN_CDIR'
.xLINK: error: Unresolved external symbol '_HB_FUN_RAT_ON'
.xLINK: error: Unresolved external symbol '_HB_FUN_RAT_LEFTB'
.xLINK: error: Unresolved external symbol '_HB_FUN_RAT_ROWL'
.xLINK: error: Unresolved external symbol '_HB_FUN_RAT_COLL'
.xLINK: error: Unresolved external symbol '_HB_FUN_RAT_RIGHTB'
.xLINK: error: Unresolved external symbol '_HB_FUN_RAT_ROWR'
.xLINK: error: Unresolved external symbol '_HB_FUN_RAT_COLR'
.xLINK: error: Unresolved external symbol '_HB_FUN_RAT_OFF'
.xLINK: error: Unresolved external symbol '_HB_FUN_RAT_LBHD'
.xLINK: error: Unresolved external symbol '_HB_FUN_RAT_RBHD'
.xLINK: error: Unresolved external symbol '_HB_FUN_RAT_EXIST'
.xLINK: error: Unresolved external symbol '_HB_FUN_NEXTLS'
.xLINK: error: Unresolved external symbol '_HB_FUN_ISPRN'
.xLINK: error: Unresolved external symbol '_HB_FUN_GETSCROW'
.xLINK: error: Unresolved external symbol '_HB_FUN_GETSCCOL'
.xLINK: error: Unresolved external symbol '_HB_FUN_SSPRINKLE'
.xLINK: fatal error: 18 unresolved external(s).

So whatever way will give access for the high level code to call these low level functions in 2006 coding is what I need. It does not have to be for high performance use on a network or anything. It needs just the bare minimum of systems integration for me to use my libraries to create a stand alone linked .EXE
with the new WIN32 xHarbour Compiler and Linker on a local "Drive C" Would a "wrapper" approach be easiest for you to do? If I could get a copy of MASM 5.1 or 6.11 and compiled these 4 .ASM programs in 16 bit and added them to the xHarbour xLINK list, my understanding is that that would not work with the WIN32 xHarbour compiled .OBJ's. Am I correct?

The most elaborate low level function calls are to that mouse program. But I don't even really need mouse features at all in the code I use. Just the Rat_Off() test. But I don't want to have to edit so many programs to take it all out. But I could if I had too.

What is the best approach?

In the original 1994 Clipper language there was some sort of extend system call to interface with C and ASM function code. I think xHarbour is way beyond that now. In their system it appears you just add the .OBJ or .DLL files you want in the project and the linker handles it in a standard way. I am not sure what more is needed. Whatever the standard way of doing it these days is what I am sure they are doing.

I'm willing to give you some hard earned money to do this project if you are willing to take it! :bg

Contact me at your convenience off-line at craig@CraigParke.com if you want to discuss a price on doing this.

Much thanks for your replies!

Best regards,

Craig Parke

PS
I see no "modify" button anywhere as I make this reply? If I could see it I would modify my former long post for you!

linux.eo

Colleagues,

Sory by my poor english, I speak Portugues, Esperanto, and Spanish, but not english.

I am from Brazil.

I obtained success to make SuperLib 3,5 run with xHarbour 0.99.70.

But I believe that will run with others versions of Harbour and xHarbour.

To do this, we dont need to use C and ASM functions from SuperLib.

This functions was "maked" because CLIPPER have limitations.

This limitations we dont finds in xHarbour.

We only need to create similary funtions with same parameters,
and same returns, in .PRG format, with xHarbour language.

Example: the file CDD.ASM is only to change dir. Simple.

In xHarbour we have the function DirChange().

Other problem, in some moment, the author created a
variable named nShadowPosition, and, because CLIPPER
read only 10 initial characteres, the author named nShadowPos.

In xHarbour, we have a error, because dont exist the variable
nShadowPos.

We can resolve this with a simple line:

nShadowPos = nShadowPosition

The others funtions, that uses mouse, verify printer,
and show screen animations, may be re-implemented
and "deleted".

Example, with mouse, there are a funtion to verify
if mouse exists.

I made a function to return FALSE, then the system
dont use others functions from mouse.

I create all funtion of mouse, all returning FALSE.

There are other error: the author create 2 functions
with names that are in conflict with xHarbour:

standard()  and  enhanced()

I only change names to standard2()  and  enhanced2()

and I search what others functions uses this functions,
and I changed all names standard() to standard2()
and enhanced() to enhanced2().

I make this today, and I need examine others things.

I tested all samples and the result is cool.

Some things are with bugs and I will examine then.

Ex: option dropdown from menu bungee, and sometimes with edit memos.

Is this.

See this Brazilian forum to more information:

http://www.pctoledo.com.br/forum/index.php

Thanx and good bye.

Sorry by poor english.


Sávio Menezes Sampaio