flat assembler
Message board for the users of flat assembler.

Index > Main > [DOS vs Win64 FASM vs MASM] Error: Extra characters on line

Author
Thread Post new topic Reply to topic
Hazique35



Joined: 01 Apr 2013
Posts: 7
Hazique35 02 Apr 2013, 15:02
Hello again, Ive been having this problem using OFFSET. i just wanted to display a string. So, is this allowed in fasm, and if not, then I should always use message box?

heres what Ive written:

Code:
include 'win64wxp.inc'

.data

message db "Hello, World!$"

.code

start:

mov dx,OFFSET message
mov ax, SEG message
mov ds, ax
mov ah, 9
int 21h

.end start       
    



Anything I shouldnt be using?
Post 02 Apr 2013, 15:02
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 02 Apr 2013, 15:11
A number of things here:

1) fasm doesn't use either OFFSET or SEG. Just delete them

2) You have included the Windows 64-bit header file but appear to be writing DOS code following it. That can't ever work.

Have a look at the WIN32 or WIN64 examples in the fasm download if you want to write a Windows program.
Post 02 Apr 2013, 15:11
View user's profile Send private message Visit poster's website Reply with quote
Hazique35



Joined: 01 Apr 2013
Posts: 7
Hazique35 02 Apr 2013, 15:16
Ok, so how do I start using DOS instead of using the windows header
Post 02 Apr 2013, 15:16
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 02 Apr 2013, 15:28
There are also DOS example files in the fasm download. This is copied from "MULTISEG.ASM":
Code:
; fasm example of writing multi-segment EXE program

format MZ

entry main:start                        ; program entry point
stack 100h                              ; stack size

segment main                            ; main program segment

  start:
        mov     ax,text
        mov     ds,ax

        mov     dx,hello
        call    extra:write_text

        mov     ax,4C00h
        int     21h

segment text

  hello db 'Hello world!',24h

segment extra

  write_text:
        mov     ah,9
        int     21h
        retf    
There are other examples also, like .com files etc.
Post 02 Apr 2013, 15:28
View user's profile Send private message Visit poster's website Reply with quote
Hazique35



Joined: 01 Apr 2013
Posts: 7
Hazique35 02 Apr 2013, 15:38
thanks. Sorry, I didnt see those example.
Post 02 Apr 2013, 15:38
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1900
DOS386 04 Apr 2013, 01:31
Hazique35 wrote:
Ok, so how do I start using DOS instead of using the windows header


1. Get DOS www.freedos.org www.drdos.org www.drdosprojects.de

2.Get DOS FASM http://flatassembler.net/download.php

3. Look at the examples included

4. Look into the DOS subforum and the FAQ on the top
http://board.flatassembler.net/forum.php?f=2 http://board.flatassembler.net/topic.php?t=9473

Hazique35 wrote:
I should always use message box?


If you want to support DOS: NO
If you want tom support Win64: YES
Post 04 Apr 2013, 01:31
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.