NASM - The Netwide Assembler
NASM Forum => Programming with NASM => Topic started by: Luns on March 24, 2011, 04:50:46 AM
-
I'm trying to learn plain assembly, with no C function calls or anything. I've assembled my code with NASM, and then tried running it in DOSbox, but nothing happens. Here's my program...
org 100h
mov dx,msg
mov ah,9
int 21h
mov ah,4Ch
int 21h
msg db "Hello, World!",0Dh,0Ah,'$'
And then I assemble it with 'nasm -o hello.com -f bin hello.asm'. I run it in DOSbox by just typing 'hello.com', but all that happens is it skips a line and gives me another command prompt. Is the code right? I just got it from here (http://home.myfairpoint.net/fbkotler/clueless.html).
Thanks for looking.
e: I just tried downloading the DOS version of NASM and assembling the program with that in DOSbox, but the same thing happens.
-
OMG, the "Clueless Newbie's Guide"... Well, it "should" still work. Your code looks fine (I would think that, of course :) ). One fairly common mistake is to write "int 21" instead of "int 21h" - you don't seem to have done that. Leaving out the "org 100h" will usually output "garbage" - you don't seem to have done that, either. I dunno.
I have no experience with "dosbox" - I've downloaded it, but can't get it to build. I may have another go at it "one of these days". Even if I had it, "dosbox" for Linux might not be the same as "dosbox" for 64-bit Windows, so it might not help diagnose what's going on. I assume "dosbox" is working normally for you, outside of this problem(?)...
It "shouldn't" matter which build of Nasm you're using - the command line determines the type of file you get. Probably more convenient to have Nasm that'll run within "dosbox", though...
I can't even think what to try... maybe BIOS output?
; nasm -f bin -o myfile.com myfile.asm
org 100h
mov bx, 7
mov ah, 0Eh
mov al, 'X'
int 10h
ret
I really don't know what it'll tell you if that works - or doesn't. Essentially, like our hypothetical "Clueless Newbie", I haven't got a clue!
Best,
Frank
-
Frank's newbie example works fine here:
-Windows 7 Professional 64-bit
-DOSBox 0.74
-NASM 2.05/2.09.07/2.10rc4
-
Haha oh that's your guide? Thanks very much for it, it's very helpful for first starting with assembly.
I have no idea what I changed, but I went back and tried it with the original code and it works now... No clue why but I'm just happy it works.
Thanks very much :)
-
It was helpful to me also. A perfect thing for the beginners.