The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: greeneyehawk on February 22, 2009, 06:44:31 PM

Title: Learning how to use masm32
Post by: greeneyehawk on February 22, 2009, 06:44:31 PM
Okay, I bought the book 80x86 Assembly Language and Computer Architecture by Richard C. Detmer.  I bought this book on amazon, and it did not come with the disk.  So, I emailed the author, and he sent me the two files I need for the first example in the book, io.h and io.asm.  I am wondering where to put these files for the assembler to use, or if there is something else I need to do with these files. 

Thanks,
Greeneyehawk
Title: Re: Learning how to use masm32
Post by: PBrennick on February 22, 2009, 07:15:33 PM
What you are describing is the contents of a boot-disk, minus command.com

He probably sent you a bootable diskette and the files should stay right where they are.
Paul
Title: Re: Learning how to use masm32
Post by: greeneyehawk on February 22, 2009, 07:43:58 PM
he sent the two files in an email
Title: Re: Learning how to use masm32
Post by: MichaelW on February 22, 2009, 09:28:36 PM
Io.asm is the source for some number/string conversion and console I/O procedures. Io.h contains macros that call the procedures from Io.asm. To use io.h with ML 6.x or later you need to comment out the INVOKE macro, as it will conflict with the INVOKE that ML provides. Io.asm can be used as is. I would place both files in your current working directory. For the only win32 Detmer example I could find:

; Example assembly language program -- adds two numbers
; Author:  R. Detmer
; Date:    revised 7/97

.386
.MODEL FLAT

;ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
...
END _start                      ; end of source code


I had to uncomment the ExitProcess prototype, so ML would know how to call it, and I had to specify a start address on the end directive, so the linker would know what the entry point address is.

I was then able to assemble io.asm to io.obj, assemble the example source, link everything, and run the resulting EXE with this batch file (modify the specified paths as necessary):

@echo off

set file="example"
set lib=c:\masm32\lib
set path=c:\masm32\bin;%path%

if exist %file%.obj del %file%.obj
if exist %file%.exe del %file%.exe
if exist io.obj del io.obj

ml /c /coff io.asm

pause

echo.

ml /c /coff %file%.asm

echo.

pause

echo.

Link /SUBSYSTEM:CONSOLE kernel32.lib %file%.obj io.obj

echo.

pause

echo.

%file%.exe

echo.

pause