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

Reply

Join Date: Aug 2008
Posts: 5
Reputation: jetamay is an unknown quantity at this point 
Solved Threads: 0
jetamay jetamay is offline Offline
Newbie Poster

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

 
0
  #1
Aug 22nd, 2008
; 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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 149
Reputation: sDJh is an unknown quantity at this point 
Solved Threads: 13
sDJh sDJh is offline Offline
Junior Poster

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

 
0
  #2
Aug 23rd, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 5
Reputation: jetamay is an unknown quantity at this point 
Solved Threads: 0
jetamay jetamay is offline Offline
Newbie Poster

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

 
0
  #3
Aug 23rd, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 5
Reputation: jetamay is an unknown quantity at this point 
Solved Threads: 0
jetamay jetamay is offline Offline
Newbie Poster

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

 
0
  #4
Aug 23rd, 2008
Hmm doesn't seem to work. I'm linking it via ALINK
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 5
Reputation: jetamay is an unknown quantity at this point 
Solved Threads: 0
jetamay jetamay is offline Offline
Newbie Poster

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

 
0
  #5
Aug 25th, 2008
Ahh, I see I got it to work. Thank you for your help.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 1
Reputation: garrychang is an unknown quantity at this point 
Solved Threads: 0
garrychang garrychang is offline Offline
Newbie Poster

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

 
0
  #6
May 2nd, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 24
Reputation: Goalatio is an unknown quantity at this point 
Solved Threads: 0
Goalatio Goalatio is offline Offline
Newbie Poster
 
0
  #7
16 Days Ago
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.

  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, "$"
It's passion that drives me.
Reply With Quote Quick reply to this message  
Reply

Message:



Other Threads in the Assembly Forum
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC