Assembly Program not displaying text

Started by AKalair, December 02, 2008, 08:09:49 PM

Previous topic - Next topic

AKalair

Hello,
I am working through "Assembly Language Step by Step" by Jeff D. and I'm trying to run one of the example programs but when I run it on the command prompt it just flashes and returns the prompt line.

This is  the source code:


;  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, eatmsg        ; 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 initialised data

eatmsg     db "Eat at Joe's!", 13, 10, "$"  ;Here's our message


I'm on Windows Vista 32bit, can someone point me in the right direction?

Thanks

FORTRANS

Hi,

   It is probably printing and exiting too fast to be
seen if you are using Windows XP or its ilk.  Put


        MOV     AX,0
        INT     16H     ; BIOS read keyboard


just before your exit.


Vortex


locche

Hi
You can try the following 'Debug' code to see if it's just the code:

Start up debug just open up a cmd window and type in 'debug'. I assume it ships with Vista. I know edlin does.
You will see a '-' prompt. A this prompt type in an 'a' for assemble. Now you'll see 8 digits, the first 4 for our purpose here you
can ignore, they're different on every pc. The next for after the colon are memory offsets. Now a com program like the one
you had starts at offset 0100 hex. My pentium 1 shows 1882:0100  _.  So type following code. After each line press Enter.
To quit coding press Enter twice.
1882:0100 mov ah, 09
1882:0102 mov dx,0200
1882:0105 int 21
1882:0107 mov ax,,4c00
1882:010A int 21
Now press enter twice. Now type in 'a 0200' and type in your string then press enter.
1882:0200 db "Eat at Joe's", 0d,0a,24
To run your code just type 'g' and enter. If your prompt appears, it's probably your code.  I don't know nasm syntax. I do remember
to load the address of a string I had to use the word 'offset' before the string,i.e. mov dx, offset mystring...