The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: m3gatr0n on October 21, 2006, 03:11:51 PM

Title: problems with a book example's
Post by: m3gatr0n on October 21, 2006, 03:11:51 PM
I'm new into the assembly world. I've recently downloaded the "Introduction to 80X86 Assembly Language And Computer Arhitecture" book (this year i'll have such a couse and i don't want to be a completly n00b)and i have a problem into running the examples that are presented in this book. Precisely, even with the first example:
______________________________________________________________
; 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

  END                            ; end of source code
______________________________________________________________
and running the 6.14 version of masm32, i get the error
"ex1.asm(9) : fattal error A1000: cannot open file : io.h"
when i compile my ex1.asm file with this command:
"mc /c /coff ex1.asm"

I searched indeed into the masm32 folder, and i didn't find no "io.h" file. Is it possible that the "io.h" is available only on the CD that comes with the purchased book? If so, what would be the solution for me to be able to complile the examples there, without that specific "io.h" file? (i'm asking you for a workaround here).
Thanks in advance!
Title: Re: problems with a book example's
Post by: PBrennick on October 21, 2006, 04:03:47 PM
m3gatr0n,
You should copy io.h into the same folder as you copied ex1.asm to. You need that include file so the assembler can find input, output, atod and dtoa.

Paul
Title: Re: problems with a book example's
Post by: m3gatr0n on October 21, 2006, 04:16:52 PM
Quote from: PBrennick on October 21, 2006, 04:03:47 PM
m3gatr0n,
You should copy io.h into the same folder as you copied ex1.asm to. You need that include file so the assembler can find input, output, atod and dtoa.

Paul


Yes Paul, i realize that, but the problem is that i don't have the "io.h" file anywhere in my masm32 directory that i've downloaded from the masm32 official website. I wonder, why is that?  :(
Title: Re: problems with a book example's
Post by: PBrennick on October 21, 2006, 04:26:16 PM
m3gatr0n,
I don't understand the question. Why should it be there? That file is specific to the book and not to masm32. I could just as easily say why isn't somefile.h included in masm32. Do you see the point?

Paul
Title: Re: problems with a book example's
Post by: hutch-- on October 21, 2006, 06:14:35 PM
The file "io.h" is an SDK C/C++ header file and to use it you would need to either convert it to MASM format or find someone else who has.
Title: Re: problems with a book example's
Post by: m3gatr0n on October 21, 2006, 06:46:03 PM
I understand now. The thing is, that downloading the book (and not purchasing it), i don't have access to the CDROM files. Does anyone have that file, or could someone help me working around that problem (meaning showing me how to input/output from the assembly language without that 'magic' file)  ::)
Title: Re: problems with a book example's
Post by: hutch-- on October 22, 2006, 01:40:49 AM
m3gatr0n,

If the IO you mention is file IO, this is basically trivial windows API functions. The MASM32 project has a set of MACROS to handle this stuff and what you can do is look at the source for the macros to see the API functions that are called. CreateFile(), ReadFile(), WriteFile() and a few others like SetFilePointer() are the type of API calls you use to perform file IO.
Title: Re: problems with a book example's
Post by: m3gatr0n on October 22, 2006, 07:37:01 AM
Quote from: hutch-- on October 22, 2006, 01:40:49 AM
m3gatr0n,

If the IO you mention is file IO, this is basically trivial windows API functions. The MASM32 project has a set of MACROS to handle this stuff and what you can do is look at the source for the macros to see the API functions that are called. CreateFile(), ReadFile(), WriteFile() and a few others like SetFilePointer() are the type of API calls you use to perform file IO.


I expressed myself wrong this time. The thing that I want to do is to get 2 numbers from the keyboard and to display their sum on the screen, SOMEHOW!!! How do I do that???
Title: new status
Post by: m3gatr0n on October 22, 2006, 04:56:15 PM
I've obtained the "io.h" file, but now i need somehow to transform it into io.obj. I don't exactly know how, but this is the main problem now. Any ideeas ???
Title: it's done
Post by: m3gatr0n on October 23, 2006, 07:29:27 AM
Someone helped me with those files and now i've got what i need in order to get me started  :cheekygreen:
I'm not allowed to say his name, but he knows who he is. Thanks dude  :U
Topic closed!
Title: Re: problems with a book example's
Post by: PBrennick on October 23, 2006, 10:35:27 AM
m3gatr0n,
I would not want my name released, if it was me, either. That file is how they get you to buy the book and obtaining it and using it in any other way is illegal. They even went so far as to disquise it as a header file, which it is NOT. I own the book (and the file) so I know what it really is. Now you know why no one was responding to your posts.

Paul
Title: hmmm
Post by: m3gatr0n on October 23, 2006, 05:52:06 PM
I understand, but i find this comparable to the microsoft policy. I don't agree with it... but that's my problem, isn't it? Thanks for your support.
Title: Re: problems with a book example's
Post by: PBrennick on October 23, 2006, 05:56:17 PM
Which means you have a problem with ethics. and who said I support you, I will never support a person with your ethics.
Paul
Title: yeah, sure!
Post by: m3gatr0n on October 23, 2006, 06:39:56 PM
When i said support, i meant about the others that replyed me and helped me. And sorry, but i don't think that there is something wrong with my ethics, just because i don't consider that paying 80 bucks for 3 files is worth something. I like the open source principle, and i consider that access to the knowledge should be free. If you have something against, that's your problem, not mine!
Title: Re: problems with a book example's
Post by: Zest on October 23, 2006, 10:47:42 PM
Dear PBrennick,
Hello,
Richard C. Detmer is the author of this book.
He has made another book with this name:
Quote
Essentials of 80x86 Assembly Language (Paperback)
by Richard C. Detmer

Product Details

    * Paperback: 305 pages
    * Publisher: Jones & Bartlett Pub; Bk&CD-Rom edition (May 1, 2006)
    * Language: English
    * ISBN: 076373621X
    * Product Dimensions: 0.8 x 7.5 x 9.0 inches

http://www.amazon.com/gp/product/076373621X/ref=pd_rvi_gw_1/102-4140849-7245726?ie=UTF8



I want to know if you read this one and it's worth buying.

Also he is going to release the second edtion of the first  book on (November 30, 2006):
QuoteIntroducton to 80X86 Assembly Language and Computer Architecture (Hardcover)
by Richard C. Detmer

http://www.amazon.com/Introducton-Assembly-Language-Computer-Architecture/dp/0763705020/sr=1-1/qid=1161643278/ref=sr_1_1/102-4140849-7245726?ie=UTF8&s=books



By the way,may I ask for the files you sent to m3gatr0n.
I need that files to check and examine.
Thanks in advance.
Best Regards,
Zest.
Title: Re: problems with a book example's
Post by: hutch-- on October 23, 2006, 11:35:42 PM
hmmmm,

Quote
When i said support, i meant about the others that replyed me and helped me. And sorry, but i don't think that there is something wrong with my ethics, just because i don't consider that paying 80 bucks for 3 files is worth something. I like the open source principle, and i consider that access to the knowledge should be free. If you have something against, that's your problem, not mine!

Liking open source is one thing, expecting to obtain commercial software for free is another. While this case is trivial, its still piracy and that is something that we don't allow here at all.

This topic is closed and flaunting piracy will not be tolerated.