News:

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

problems with a book example's

Started by m3gatr0n, October 21, 2006, 03:11:51 PM

Previous topic - Next topic

m3gatr0n

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!

PBrennick

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
The GeneSys Project is available from:
The Repository or My crappy website

m3gatr0n

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?  :(

PBrennick

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
The GeneSys Project is available from:
The Repository or My crappy website

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

m3gatr0n

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)  ::)

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

m3gatr0n

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???

m3gatr0n

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 ???

m3gatr0n

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!

PBrennick

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
The GeneSys Project is available from:
The Repository or My crappy website

m3gatr0n

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.

PBrennick

Which means you have a problem with ethics. and who said I support you, I will never support a person with your ethics.
Paul
The GeneSys Project is available from:
The Repository or My crappy website

m3gatr0n

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!

Zest

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.