News:

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

irvine32 To MASM32

Started by hfheatherfox07, August 22, 2011, 01:58:36 AM

Previous topic - Next topic

hfheatherfox07


Hi there ...

I run into example from time to time that use "irvine32.inc".... and I downloaded the irvine32 package ..... I like MASM better

my question is this ; is there a formula of includes from MASM that make up "irvine32.inc" so I can use those .asm's ....

For example do this in MASM32 ( very short ASM) http://www.youtube.com/watch?v=KVd811eWs3I

thanks

dedndave

i think all of Kip's functions have a masm32 counterpart
however, there are a number of differences in how he writes and calls functions
generally, Kip preserves all registers, unless one is used to return a value (usually EAX, but not always)
parameters are passed in register, rather than on the stack

so, you have to familiarize yourself with both libraries to make a translation
but, it can be done, and shouldn't be too difficult

hfheatherfox07

I noticed that there are a lot of proc's for stuff that can be called as a window function instead ....although in irvine32 they are written out! can't remember  a specific example off  the top of my head right now but I remember it had to do with consoles....

MichaelW

Within limits it is possible to combine the two. For example, I was able to make this code work:

include Irvine32.inc
includelib irvine32.lib
includelib \masm32\lib\kernel32.lib
include \masm32\include\msvcrt.inc
includelib \masm32\lib\msvcrt.lib
.data
    x REAL8 -250.0
    y REAL8 100.0
    z REAL8 ?
    fmt db "%f%c"
.code
start:
    fld x
    fld y
    fdiv
    fstp z
    invoke crt_printf, ADDR fmt, z, 10
    call DumpRegs
    call WaitMsg
    exit
end start


But I can't recall if I had to make changes to the Irvine32 library to make this work, and there will be major problems if you try to combine the MASM32 windows.inc with the Irvine32 SmallWin.inc. I think the easiest solution would be to create your own MASM32-compatible versions of the Irvine32 macros/procedures that you wish to use, and forget about Irvine32.



eschew obfuscation

dedndave

in the context of a learning tool, Kip's libraries make it easy for beginners to understand how the pieces fit together
the functions are written in a simple "building block" style
and, they make it fairly easy for those who were familiar with 16-bit DOS code

one approach that comes to mind, following what Michael mentioned, would be to make
"wrappers" for masm32 functions that make them behave like Kip's functions

hutch--

D yourself a favour here and don't follow an architecture that is so old. 32 bit Windows code is put together in a particular way that is dictated by (1) the Intel ABI (application binary interface) and (2) the Windows API that are ABI compliant.

If there is something in Kip's library that you want to emulate, rewrite it in modern ABI complaint format.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

baltoro

HFHEATHERFOX07,   
We've had a whole bunch of threads here in the Campus about using Kip Irvine's library and his procedures. It can be problematic for a number of reasons, the essentials of which, Dave described above. If you use the forum search feature, and provide 'irvine' for the subject to search for, and, just search the Campus, you will get a long list of threads discussing typical problems.
I have Kip Irvine's book myself, and have used his code examples in compiled MASM programs. They work, but tend to be as simple as possible to illustrate the concept from the book. And, the MASM32 library and the source code examples provided have similar procedures and macros, so there is definitely some overlap.
The single biggest problem for beginners is using include files from both Irvine and the MASM32 project in their programs. When you do that, without thinking about what those include files specify, you will multiply define numerous standard Windows symbols and Win32 API function names, producing a long list of confusing errors.
Baltoro

hfheatherfox07

Thank you all for the replies .....

I thought that there was a set of includes that would substitute irvine32 , just so I can assemble some of the examples that I find that use  irvine32... with masm32....
I was looking to completely substitute  irvine32 with masm32 , not combine them....

Just love hutch's masm32 package , I can't see my self using any thing else now.... :bg

dedndave

in a way - it isn't all bad to learn both   :P
the reason i say that is - by playing with both, you learn how and why they are different
that, in itself, is a big lesson in assembly language

you will see the difference in how parameters are passed and returned

baltoro

Typically, when writing a MASM32 program, the first line of the assembly file is:    
include \masm32\include\masm32rt.inc

If you read the masm32rt include file, you will find a number of standard MASM include files and corresponding libraries listed at the beginning. The best programming method is to use this pattern, and then, if you want to use some of Kip Irvine's procedures from his library, just copy the entire procedure and paste it into your program file (you may also have to write a Prototype). Frankly, you're better off just using the MASM32 libraries, procedures and macros,...they're better written and much more reliable than Kip Irvine's code. Also, Kip's code is designed to work only with Kip's other procedures in his library,...so, that if you mix some of Kip's code with MASM code, they often will conflict,...unless you rewrite the code to be compatible and work correctly in sequence.
Baltoro

dedndave

well - i can see a need to pick up Kip's libraries
and, there is no reason you can't do both - i have used both, and it wasn't that big of a deal   :bg  (just not together)

the advantage of using Kip's libraries is you get to follow along with his book   :U

baltoro

Well, actually Dave's code is better than Kip's. :eek
Just search the campus forum using Dave's "dedndave" handle and an asterisk for the subject, and you'll get all of Dave's greatest hits.
Baltoro

dedndave

.....which aren't widely accepted

baltoro

Baltoro

hfheatherfox07

Quote from: baltoro on August 22, 2011, 11:43:58 PM
if you want to use some of Kip Irvine's procedures from his library, just copy the entire procedure and paste it into your program file (you may also have to write a Prototype).


I tried that a few times ...did not work for me at all ....

I ended up copying one thing which needed another sub proc ,which needed another, etc...

the assembly became ridiculously huge  :(

it would be nice if there was a set of masm32 includes like the masm32rt.inc... that will allow to assemble irvine's examples ...