|
-
May 16th, 2002, 10:57 PM
#1
Thread Starter
PowerPoster
A simple hello world
I just downloaded the latest version of nasm but the "Hello World!" code in the FAQ doesn't work now. It gives me some kind of error message on Line #1. I just restarted doing assembly after a few months and I remember I was able to run some asm code using nasm but can't now. Any idea on what would the starting lines for Nasm (eg .Stack, .Code, etc) and where to put the actual code?
-
May 17th, 2002, 12:03 PM
#2
Lively Member
type it
type your program here and i will see if i can halp u but whole program please
-
May 17th, 2002, 03:10 PM
#3
Thread Starter
PowerPoster
PHP Code:
jmp start
Message1 db "Hello World!$"
start:
mov ah, 09h
mov dx, offset Message1
int 21h
mov ax, 4c00h
int 21h
-
May 17th, 2002, 04:05 PM
#4
Lively Member
try this
.modal small
.stack 100h
.data
rec db 'zdravo narode(hello world)$'
.code
start:
mov dx,@data
mov ds,dx
mov dx,offset rec
mov ah,9h
int 21h
mov ah,4ch
int 21h
end start
-
May 17th, 2002, 04:15 PM
#5
Thread Starter
PowerPoster
Doesn't work - gives me errors (starting from line #1) saying something like "attempt to define a local label before any non-local labels". Also gives me an error message on line 9 saying "Comma or end of line expected" and another error on line #14 saying "parser: instructions expected".
-
May 17th, 2002, 05:44 PM
#6
Lively Member
hmhmh
i think we don't use the same version of asm or something like that
try again
jmp start
rec db 'ererrw$'
start:
mov dx,@data
mov ds,dx
mov dx,offset rec
mov ah,9h
int 21h
mov ah 4ch
int 21h
or something like this it should works
-
May 18th, 2002, 03:09 AM
#7
Thread Starter
PowerPoster
-
May 18th, 2002, 05:41 AM
#8
Lively Member
sranje
try to download this version of asm and 100% it will works
-
May 18th, 2002, 05:46 AM
#9
Lively Member
sranje
well i sugest u to download some other version of asm becouse seample which i gave u is fine and it works very good on my conm
here some code from my program:
.model small
.stack 100h
.data
poruka db 13,10,'usa$'
sifra db 'minja$'
duz equ $-sifra
text db 13,10,'Enter password:$'
poz db 13,10,'HMHMHM$'
.code
start:
mov dx,@data
mov ds,dx
poc:
mov dx,offset text
mov ah,9
int 21h
mov bx,0
mov cx,0
ponovi:
xor ax,ax
mov ah,8
int 21h
cmp al,13
je lab1
cmp al,sifra[bx]
jne lab2
ispis:
mov dl,'*'
mov ah,2
int 21h
inc bx
jmp ponovi
lab2:
mov cx,1
jmp ispis
lab1:
cmp cx,1
jne p2
p1:
lea dx,poruka
mov ah,9
int 21h
jmp poc
p2:
cmp bx,duz-1
jne p1
lea dx,poz
mov ah,9
int 21h
kraj:
mov ah,4ch
int 21h
end start
tell me if it works
-
May 18th, 2002, 05:46 AM
#10
Lively Member
else
well i sugest u to download some other version of asm becouse seample which i gave u is fine and it works very good on my conm
here some code from my program:
.model small
.stack 100h
.data
poruka db 13,10,'usa$'
sifra db 'minja$'
duz equ $-sifra
text db 13,10,'Enter password:$'
poz db 13,10,'HMHMHM$'
.code
start:
mov dx,@data
mov ds,dx
poc:
mov dx,offset text
mov ah,9
int 21h
mov bx,0
mov cx,0
ponovi:
xor ax,ax
mov ah,8
int 21h
cmp al,13
je lab1
cmp al,sifra[bx]
jne lab2
ispis:
mov dl,'*'
mov ah,2
int 21h
inc bx
jmp ponovi
lab2:
mov cx,1
jmp ispis
lab1:
cmp cx,1
jne p2
p1:
lea dx,poruka
mov ah,9
int 21h
jmp poc
p2:
cmp bx,duz-1
jne p1
lea dx,poz
mov ah,9
int 21h
kraj:
mov ah,4ch
int 21h
end start
tell me if it works
-
May 18th, 2002, 12:31 PM
#11
Thread Starter
PowerPoster
There is no other version of asm. I think you are talking about the assembler. Right now I am using NASM 0.98 but I'll try to use TASM and see if that works.
-
May 18th, 2002, 03:15 PM
#12
Lively Member
yes
i work whit that kind of asembller TASM i don't know what is NASM and all programs from upside going to work if u download TASM
end i think u gonna find good version of TASM but if you need help just say
good luck
-
Jul 17th, 2002, 04:39 AM
#13
Addicted Member
mmiill
This is TASM, so it certainly won't work in Nasm...
However, I wouldn't work with:
mov dx, offset rec
I'd use
lea dx, rec
It's the newer and better way.
dozwidanie
CodeRonin
-
Jul 17th, 2002, 05:58 AM
#14
Lively Member
-
Jul 17th, 2002, 09:36 AM
#15
Hyperactive Member
type this in. I had the same problem too. Hope this helps.
section .data
db txtString "Hello World$"
section .bss
section .text
@start:
mov dx,txtString
mov ah,9h
int 21h
@end:
mov ah,4Ch
int 21h
-
Jul 14th, 2003, 06:32 PM
#16
Fanatic Member
mmiill, that code listing works in NASM?
"Can't" and "shouldn't" are two totally separate things.
All questions should be answered. All answers should be true. That is why I post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|