I'm trying to learn assembly language, and currently i've got a question about different assemblers and how to proper run .bin files
Here is the code i'm using in emu8086:
org 100h
mov bx, HELLO_MSG
call print_string
mov bx, GOODBYE_MSG
call print_string
jmp $
print_string:
pusha
mov ah, 0x0e
loop:
mov al, [bx]
cmp al, 0
je return
int 0x10
inc bx
jmp loop
return:
popa
ret
HELLO_MSG:
db 'Hello, World!', 0
GOODBYE_MSG:
db 'Goodbye!', 0
It works just fine.
However, when i'm using nasm to assemble it (without org 100h
, and adding
times 510 -( $ - $$ ) db 0
dw 0xaa55
at the end), it's just not working. I've tried many other options to make it write a string line on screen, but without success.
I'm beginning to suspect that i'm doing something wrong in the process of running this code. These are my steps:
- Writing the code, using Notepad++ as a text editor and saving it as *.asm
Assembling this file, using cmd with this command:
(e.g.)nasm G:\nasm\hello.asm -f bin -o G:\nasm\hello.bin
Using UltraISO to make the .iso image, i'm putting this hello.bin file inside it and setting it as a boot file (it usually works)
- After that i'm starting VMWare to boot from this .iso, and after that it just not working (this particular code just showing me an empry screen with _ in the right corner)
PS. I'm on Win7 64bit Thank you in advance for any help you can provide