I recently bought this book online used, it came with no CD. Many of the code examples in this book rely on some file called IO.h that apparently came with the CD. I downloaded this file and I still get many errors. Does anyone have these files, or do I even need them? Can I just learn assembly without even assembling files?

Here is what the program looks like, I cant even assemble it because I dont have IO.h, kind of stupid that this book relies on some header file rather than showing you how to do it without header files though

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

ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD

INCLUDE io.h ; header file for input/output

cr EQU 0dh ; carriage return character
Lf EQU 0ah ; line feed

.STACK 4096 ; reserve 4096-byte stack

.DATA ; reserve storage for data
number1 DWORD ?
number2 DWORD ?
prompt1 BYTE "Enter first number: ", 0
prompt2 BYTE "Enter second number: ", 0
string BYTE 40 DUP (?)
label1 BYTE cr, Lf, "The sum is "
sum BYTE 11 DUP (?)
BYTE cr, Lf, 0

.CODE ; start of main program code
_start:
output prompt1 ; prompt for first number
input string, 40 ; read ASCII characters
atod string ; convert to integer
mov number1, eax ; store in memory

output prompt2 ; repeat for second number
input string, 40
atod string
mov number2, eax


mov eax, number1 ; first number to EAX
add eax, number2 ; add second number
dtoa sum, eax ; convert to ASCII characters
output label1 ; output label and sum

INVOKE ExitProcess, 0 ; exit with return code 0

PUBLIC _start ; make entry point public

Recommended Answers

All 2 Replies

Well, you can assemble your code in memory and run it from there...a perfect place to start for small DOS programs...you probably already have the tool (Debug), just need the tutorial:

http://www.datainstitute.com/debug1.htm

The IO.H file that your book wants is just assembly code for handling the input/output functions so you wont have to code this yourself. Actually, the book is doing you a disservice because you really should learn to code these yourself and this isn't difficult to learn. Check out Ralph Brown's Interupt List at:

http://www-2.cs.cmu.edu/afs/cs.cmu.edu/user/ralf/pub/WWW/ralf-home.html

You will eventually discover that a lot of asmers have given up DOS in favor of Windows programming (which isn't that difficult to learn) and there are plenty of assemblers and resources available for this. Check out the links in the following thread:

http://www.daniweb.com/techtalkforums/thread22522.html

Happy asming!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.