News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Newbie VC8->asm transition

Started by e64, February 15, 2006, 01:47:26 PM

Previous topic - Next topic

e64

Hi,
I've compiled a small C program with MSVC8, and I want to assemble it with MASM. I'm running into problems with files with extern variables.

eg:
Assembling: vortex.asm
vortex.asm(25) : error A2006: undefined symbol : ?vortex_raw_data@@3PAEA

And in the main.asm:
main.asm(64) : error A2034: must be in segment block

where line 64 is:
EXTRN   __imp__GetDC@4:PROC
?rpal@@3PAKA DD   0200H DUP (?)            ; rpal <-- line 64

Are the VC8 assembly output files compatible with MASM 6.14.8444?
Would someone be able to tell me how to "include" the extra files so that it will all assemble, or what I need to do to make this all work..

Thanks in advance!

Tedd

Quote from: e64 on February 15, 2006, 01:47:26 PM
Are the VC8 assembly output files compatible with MASM 6.14.8444?

I don't think so. (But conversion may not be too difficult.)

But feel free to attach the code and we can take a look :wink
No snowflake in an avalanche feels responsible.

Timbo

Yes, you can convert the assembly output into something you can assemble with MASM.  Why would you want to, though?  The assembly generated by the compiler depends upon LIBC, which means you will be leaving alot of bloat in your code.  It is also not meant to be manually maintained, thus the nonsense symbols.  You would be better off just redoing it in asm (especially since it is a small program to begin with) if you hope to reap any reward (even if it's just a smaller executable size).

Regards,

Tim

arafel

Quote from: Timbo on February 15, 2006, 09:11:07 PM
Yes, you can convert the assembly output into something you can assemble with MASM.  Why would you want to, though? 

one of the reasons could be for doing some optimizations to the compiler generated code.

Timbo

Arafel, your point is valid but can you honestly tell me that the output from MSVC is anything but atrocious (in terms of readability)? It would take me longer to decode the ouput than it would to just write it in asm in the first place. :lol IMO, if you already second-guess the compiler and feel you have the skill to outcode it, then you should just do that entire module in asm and be done with it.

I realize my preference is just that, so your point is well taken.

To the original poster:  Please post your code so we can take a gander at it.

Regards,

Tim

e64

Hi All,
Thanks for the replies, I'm trying to re-compile the assembly code for two reasons:
1. I'm using a non-conventional linker, it will only link against MSVC6 obj files, and not VC8, so I was hoping just to use the VC8 asm to build compaitble obj files.
2. I was hoping to hand-optimize any 'large' bits of code to smaller assembly code. (I am hoping to re-use existing VC8 asm output to save time (my coding time)).

This is for a 4kb intro competition, so I do not wish to post the full code until the competition is over.

Attached is an assembly code example of the code - it won't actually do anything if you manage to get it to run. It illustrates the issues I'm having though.


[attachment deleted by admin]

hutch--

e64,

You usually need good reason to bother manually coding something that is produced by a C compiler and with a 4k demo, its usually size optimisation rather than speed optimisation that you are after.

You can improve on VC6 to VC2005 CL output in speed terms if you know enough and do enough work but its not for the faint of heart. I would suggest that you break the demo into modules rather than one single file then build them one at a time so you more accurately spot what you want to try and change.

One of the tricks of speed optimisation is to build the module with all of the optimisation turned off as it does not use all of the registers that way and you can start to manually optimise the code.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php