944,093 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 2410
  • Assembly RSS
Aug 22nd, 2008
0

I need halp assembing my program [NASM + NASM - IDE]

Expand Post »
Quote ...
; Source name : EAT.ASM
; Executable name : EAT.COM
; Code model: : Real mode flat model
; Version : 1.0
; Created date : 6/4/1999
; Last update : 9/10/1999
; Author : Jeff Duntemann
; Description : A simple example of a DOS .COM file programmed using
; NASM-IDE 1.1 and NASM 0.98.


[BITS 16] ; Set 16 bit code generation
[ORG 0100H] ; Set code start address to 100h (COM file)

[SECTION .text] ; Section containing code
START:

mov dx, msg; Mem data ref without [] loads the ADDRESS!
mov ah,9 ; Function 9 displays text to standard output.
int 21H ; INT 21H makes the call into DOS.

mov ax, 04C00H ; This DOS function exits the program
int 21H ; and returns control to DOS.

[SECTION .data] ; Section containing initialized data

msg db "This is a message", 17, 10, "$" ;Here's our message

Reading from a book, I played around with it then I got sick of it and nothing worked so I directly copied and pasted that code to try to get it to run. It compiles, but its almost as if the interrupts are ignored. So maybe the IF flag is set? I'm not sure, I tried MOV IF,1. It wouldn't assemble so =S Any help would be greatly appreciated.

BTW I'm compiling as a COM.
Last edited by jetamay; Aug 22nd, 2008 at 6:56 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jetamay is offline Offline
5 posts
since Aug 2008
Aug 23rd, 2008
0

Re: I need halp assembing my program [NASM + NASM - IDE]

What OS are you using? I'm not sure if that stuff is still working under NT (Win 2000 or higher). Than you have to link it directly to an exe (with Link) and execute it.
If so than have a look at the BIOS-interrupt INT 13h (http://www.ctyme.com/rbrown.htm - bookmark this site it's very, very, very important and Ralf Brown is your God!). Int 13h can also be used in the oder DOS-Versions so you bet use that in the future.

By the way: I also startet with Jeff Duntemans Book "Assenbly Language Step by Step" and I can guarantee you that this book is one of the best to start assembling. So keep going!

Greetings
Simon

PS I think that INT13h is also covered in that book a few chapters a head. Have a look there.
Reputation Points: 56
Solved Threads: 29
Posting Whiz in Training
sDJh is offline Offline
255 posts
since Aug 2005
Aug 23rd, 2008
0

Re: I need halp assembing my program [NASM + NASM - IDE]

Thanks, I'm running windows XP. And yes this book is a life saver, the only one I actually feel I understand. I'll give Int 13h a shot. Thanks again.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jetamay is offline Offline
5 posts
since Aug 2008
Aug 23rd, 2008
0

Re: I need halp assembing my program [NASM + NASM - IDE]

Hmm doesn't seem to work. I'm linking it via ALINK
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jetamay is offline Offline
5 posts
since Aug 2008
Aug 25th, 2008
0

Re: I need halp assembing my program [NASM + NASM - IDE]

Ahh, I see I got it to work. Thank you for your help.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jetamay is offline Offline
5 posts
since Aug 2008
May 2nd, 2009
0

Re: I need halp assembing my program [NASM + NASM - IDE]

Hi, jetamay:

I almost encountered the same problem as you had. Can you tell me how to make it work under Windows XP?
Thank you very much!

Garry
Reputation Points: 10
Solved Threads: 0
Newbie Poster
garrychang is offline Offline
1 posts
since May 2009
Nov 7th, 2009
0
Re: I need halp assembing my program [NASM + NASM - IDE]
I see that you are using [org 0100h], that is a .COM file.. you cannot use a linker on it!

From the looks of it, you are trying to display "This is a message."
Give this a shot.. if you are using NASM16, assembly it with this

nasm16 text.asm -o text.com

And also, try this code out. Name the file 'text.asm' and use the NASM16 command above to assemble it.

Assembly Syntax (Toggle Plain Text)
  1. [org 0100h]
  2.  
  3. [section .text]
  4. mov dx,msg1 ;Load the message into DX
  5. mov ah,9 ;Function 9 - Display string
  6. int 21h ;Make the call into DOS and display it
  7.  
  8. mov ax,4ch ;Terminate DOS process
  9. mov ah,0 ;Exit with ERRORLEVEL of 0
  10. int 21h ;Call DOS and exit
  11.  
  12.  
  13.  
  14. [section .data]
  15. msg1 db "This is a message.", 13, 10, "$"
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Goalatio is offline Offline
72 posts
since Oct 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Need help in factorial code
Next Thread in Assembly Forum Timeline: x86 help with procedures





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC