Introduction to 80 x 86 Assembly Language and Computer Architecture - no CD - help

Reply

Join Date: Feb 2005
Posts: 46
Reputation: Gink is an unknown quantity at this point 
Solved Threads: 0
Gink Gink is offline Offline
Light Poster

Introduction to 80 x 86 Assembly Language and Computer Architecture - no CD - help

 
0
  #1
May 22nd, 2005
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, dwExitCodeWORD

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
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 129
Reputation: Evenbit is on a distinguished road 
Solved Threads: 4
Evenbit's Avatar
Evenbit Evenbit is offline Offline
Junior Poster

Re: Introduction to 80 x 86 Assembly Language and Computer Architecture - no CD - hel

 
0
  #2
May 23rd, 2005
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.e...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!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC