K
K
Konstantin Malyarov2016-04-29 22:27:38
assembler
Konstantin Malyarov, 2016-04-29 22:27:38

Why does the code not work, what are the nuances of fasm?

include 'win32a.inc'
.code
main:

        mov ah,9
        mov dx, offset Message
        int 21h

        int 20h

Message db 'Hello, world!'
.end main

Everything seems to be correct. What could be the reason for not working?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
none7, 2016-04-30
@none7

Why do you need to include 'win32a.inc' and .code if you write under DOS. There are no WinAPI and no code and data sections. But org 100h at the beginning would not hurt. Although fasm can compile for different systems, the code design is always different; Wikipedia has examples for each of the systems.

A
Alexey, 2016-04-29
@alsopub

At least you forgot the "$" at the end of the line and you're not sure if you have DS installed correctly.
Try adding mov ax, cs and mov ds, ax first, and add $ to the end of the line.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question