News:

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

Kip Irvine's library in Masm32

Started by jj2007, December 02, 2011, 03:04:44 PM

Previous topic - Next topic

jj2007

Since many people post code here that requires Kip Irvine's library, I am testing what would be needed to make it compatible with the Masm32 environment. This simple example works already:

include \masm32\include\masm32rt.inc
include \masm32\MasmBasic\IrvineMb\Irvine32Mb.inc

.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


Almost the same but for use with MasmBasic:

include \masm32\MasmBasic\MasmBasic.inc   ; download
include \masm32\MasmBasic\IrvineMb\Irvine32Mb.inc

.data
x   REAL8 -250.0
y   REAL8 100.0
z   REAL8 ?
fmt   db "Little FPU test: %f%c", 0

   Init
   fld x
   fld y
   fdiv
   fstp z
   invoke crt_printf, ADDR fmt, z, 10   ; Masm32 CRT function
   PrintLine CrLf$, "Irvine DumpRegs:"
   call DumpRegs
   mov ecx, Hex$(ebp)   ; for comparison: ebp as Hex$
   mov eax, offset fmt   ; deb can show strings
   deb 4, "MasmBasic dump (decimal)", $eax, eax, ebx, ecx, edx, esi, edi, ebp, $ecx
   mov eax, 123456789
   call WriteDec
   mov edx, Chr$(13, 10, "Combining Kip Irvine's lib with MasmBasic is simple", 13, 10)
   call WriteString
   call WaitMsg
   Exit
end start

Now I wonder how a bit more complex code would behave - feedback welcome from the "Irviners". Just extract the archive to the root of your Masm32 drive with "use folder names" on.

EDIT: I had forgotten the lib file. New archive attached.

clive

Well it's certainly a good plan. I'm not terribly fond of the book/library, but I do have several editions of the book I picked up at thrift stores, and it does seem to have some significant in-roads into academia. Basically the "teach to the book" assembler courses, back in the day if someone was teaching assembler, they'd written a book or designed a chip, or you picked up a copy of Leventhal, Zaks, Crawford, Gelsinger or Nelson.
It could be a random act of randomness. Those happen a lot as well.