NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: Ruud on October 26, 2009, 01:22:03 PM

Title: Message doesn't show on screen
Post by: Ruud on October 26, 2009, 01:22:03 PM
Hallo allemaal,

It must have been almost years ago I last programmed in assembler using TASM. I decided to program again, but using NASM. Next code produces rubbish on the screen. Using DEBUG I see that register SI gets a completely wrong address. An equivalent program written for TASM works fine. I'm sure I'm doing something wrong, maybe even something simple and obvious, but what ???

[BITS 16]

[SECTION .text]
[ORG 100]
mov   ax, cs
mov   ds, ax

mov   ah, 0Eh
mov   bx, 7

mov   si, MsgRuud
mov   cx, 18
L1:
lodsb
int   10h

loop   L1

mov   al, 43h
int   10h
mov   al, 44h
int   10h

mov   ax,4C00h   ; Funktienummern + Foutcode 0
int   21h      ; naar DOS

MsgRuud      db "Message by Ruud :)"


Thanks for correcting me :)

Groetjes, Ruud
Title: Re: Message doesn't show on screen
Post by: nobody on October 26, 2009, 02:50:20 PM
org 100... H! (or org 256)

Took me a while to spot that! Otherwise your code looks fine. You don't need to set ds in a .com file (mov ax, cs/mov ds, ax), but it won't hurt...

Best,
Frank
Title: Re: Message doesn't show on screen
Post by: Ruud on October 27, 2009, 06:34:50 AM
BIG BLUSH, what else can I say?

Regarding DS, in the beginning I had no idea at all what to do and as you say, it wouldn't hurt.

Many thanks!


Groetjes, Ruud