Converter for MASM to PB assembler

Started by hutch--, December 21, 2004, 05:19:05 AM

Previous topic - Next topic

hutch--

I had this posted in the old forum and I have reposted it again for PB people.

It will convert a normal mnemonic based algorithm written in MASM to a function in PowerBASIC. It has limitations imposed by the difference in form between MASM and PB and it is based around .IF blocks in MASM being able to handle mnemonics where the HLL If syntax of PB is not designed to do this. Where it can do a direct conversion, it will and where it can't it comments the code out so you can port the rest manually.

It is worth understanding both code forms reasonably to be successful in porting from one to another.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

hutch--

I have just upgraded the MASM2PB tool so it has the complete set of Intel mnemonics supported by the 2 current PowerBASIC compilers, pbwin9 and pbcc5. It also converts the MASM "align" directive to the PowerBASIC "#align" directive.

Note that there are limitations in a conversion of this type due to te differences between a compiler and an assembler, mnemonics convert with no problems, labels are the same but there is no attempt to convert masm macros at all and there is no attempt to convert any of the masm pseudo high level notation like .IF or .WHILE to a PowerBASIC format. To improve the quality of the conversion if a masm procedure has high level notation, disassemble it and convert it in that form as it becomes mnemonics.

Another factor that will degrade the quality of the conversion is if the masm procedure is written without a stack frame as PowerBASIC does not support a procedure in this format and while it will convert OK, the direct stack addressing will not work in PowerBASIC and will crash the executable if used in that form. If you know what you are doing with a masm procedure, convert it back to a normal stack frame first and then convert it as the results will be a lot better.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php