| | |
I need halp assembing my program [NASM + NASM - IDE]
![]() |
•
•
Join Date: Aug 2008
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
; 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.
•
•
Join Date: Aug 2005
Posts: 149
Reputation:
Solved Threads: 13
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.
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.
•
•
Join Date: Oct 2009
Posts: 24
Reputation:
Solved Threads: 0
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.
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)
[org 0100h] [section .text] mov dx,msg1 ;Load the message into DX mov ah,9 ;Function 9 - Display string int 21h ;Make the call into DOS and display it mov ax,4ch ;Terminate DOS process mov ah,0 ;Exit with ERRORLEVEL of 0 int 21h ;Call DOS and exit [section .data] msg1 db "This is a message.", 13, 10, "$"
It's passion that drives me.
![]() |
Other Threads in the Assembly Forum
- Previous Thread: Need help in factorial code
- Next Thread: x86 help with procedures
| Thread Tools | Search this Thread |





