flat assembler
Message board for the users of flat assembler.

Index > Main > @@@ FASM vs DJASM & MASM @@@ @F @B

Author
Thread Post new topic Reply to topic
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 09 Dec 2006, 20:33
Code:
        xor     cx, cx                  ; flag for load attempt set cx = 0
        jz      @f2                     ; We always jump, shorter than jmp
@b1:
        mov     al, 110
        mov     dx, msg_no_dpmi
        jmpl    error
@b2:
        or      cx, cx
        jnz     @b1                     ; we already tried load once before
        inc     cx
        call    load_dpmi
        jc      @b1
@f2:
        mov     ax, 0x1687              ; get DPMI entry point
        int     0x2f
        or      ax, ax
        jnz     @b2                     ; if 0 then it's there
        and     bl, 1                   ; 32 bit capable?
    


Code:
                cmp     cl,41h
                jnz     @F
                call    f440D41b
@@:
                cmp     cl,61h
                jnz     @F
                call    f440D61b
@@:
                call    setdsreg2tlb
                push    edx
                xor     edx,edx
                mov     ax,440Dh
                call    rmdos
                pop     edx
                jc              error
                push    esi
                mov     esi,offset tab440D2
@@:
                cmp     byte ptr cs:[esi],-1
                jz              f440D2_ok2
                cmp     cl,cs:[esi]
                jz              f440D2_ok
                inc     esi
                inc     esi
                jmp     @B
f440D2_ok:
                push    ecx
    


Can anyone explain me how the @@@-like labels in code pieces above
(DJASM, "STUB" and MASM, HDPMI) work and how to convert such code to FASM ?

Also, is there a syntax comparison MASM vs FASM available, or some
converting manuals or even utils ?

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 09 Dec 2006, 20:33
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12845
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 09 Dec 2006, 23:46
@@: (point 1)
mov eax,5
cmp eax,[some address]
je @f =====> if equal, would jump to (point 2)
jmp @b =====> jump to (point 1)
@@: (point 2)
cmp edx,[some address]
je @b ======> if equal, jump to (point 2)

hoep you get it Smile
Post 09 Dec 2006, 23:46
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 10 Dec 2006, 15:34
Quote:

je @b ======> if equal, jump to (point 2)
hoep you get it


OK, The catch is that same label occurs many times.

My questions were:

- Does FASM support such @@-labels ?
- If YES, what is the exact syntax ?
- If NO, what is the preferred way to convert them ?

Seems that with FASM I found a very good assembler but it suffers from an
"external bug": the amount of sample and open source code for FASM is
VERY limited, >99% of code available is for other assemblers (MASM Sad,
NASM, DJASM, Watcom ASM (PRAGMA's ...) - are there some infos how to
convert or utils to do/simplify this ?

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 10 Dec 2006, 15:34
View user's profile Send private message Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost 10 Dec 2006, 15:54
I suggest reading the FASM documentation, which contains this info, which sleepsleep has already given you but I will try and explain it more thoroughly.

@@: is an "anonymous" label, you can have as many as you desire. @b is the first preceeding anonymous label, @f is the first proceeding anonymous label.

"b" is for backwards, "f" is for forwards.

Code:
jmp @f ; jumps to "1"

@@: ; "1"
    jmp @b ; jumps to "1"

@@: ; "2"
    jmp @b ; jumps to "2"
    


From the FASM documentation which comes with FASM ->
Quote:

The @@ name means anonymous label, you can have defined many of them
in the source. Symbol @b (or equivalent @r) references the nearest preceding
anonymous label, symbol @f references the nearest following anonymous
label. These special symbol are case–insensitive.

_________________
redghost.ca
Post 10 Dec 2006, 15:54
View user's profile Send private message AIM Address MSN Messenger Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 10 Dec 2006, 16:05
Quote:

I suggest reading the FASM documentation, which contains this info.


OK, this is always a good hint - could you please reveal what docu
(online/download) and what chapter ?

Quote:

@@: is an "anonymous" label, you can have as many as you desire. @b is the first preceeding anonymous label, @f is the first proceeding anonymous label.

"b" is for backwards, "f" is for forwards.


Thanks. This means, that:

- FASM supports this (although NOT used in examples/own source)
- Syntax is same as in MASM ?

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 10 Dec 2006, 16:05
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 10 Dec 2006, 21:13
NTOSKRNL_VXE wrote:

Seems that with FASM I found a very good assembler but it suffers from an
"external bug": the amount of sample and open source code for FASM is
VERY limited, >99% of code available is for other assemblers (MASM Sad,
NASM, DJASM, Watcom ASM (PRAGMA's ...) - are there some infos how to
convert or utils to do/simplify this ?


What OSes and output formats do you intend to use? e.g., WinXP 64-bit, PE64? DOS, .COM? DOS, COFF (link w/ DJGPP -> .EXE)? But anyways, here's a list of some things written in FASM just from this forum alone (not quite as limited as you said):

uFMOD, PROE, FASMLIB, Snake, FRESH, FASMD(PRE), FASMW, PARA512, relsoft's demos, Grenhald's demos, DexOS, Menuet-32 & -64, FDBG, FASMARM, rc-converter, Stega, LDE, md5prt, httpd, AsmRegEx, Mini Sudoku, two other sudoku solvers, Black Box, Alarm, Procb, Shoolib, Reva, Retroforth, B0, macgub's demos, etc.

NASM should be the easiest of any assembler to port to FASM. MASM is only used a lot in Win32 (thanks to its EULA), and even then probably only because of its "macro power" (ugh). I haven't seen anyone use DJASM or Watcom ASM except their own authors (and DJASM isn't even a full assembler, apparently lacks many instructions, just a half-job to generate the 16-bit stub for DJGPP progs).


Last edited by rugxulo on 15 Dec 2006, 21:00; edited 1 time in total
Post 10 Dec 2006, 21:13
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 10 Dec 2006, 22:03
Quote:

I suggest reading the FASM documentation, which contains this info


YES it does. I just was confused by lack of this syntax in the FASM code I've
seen so far so missed it. Smile

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 10 Dec 2006, 22:03
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 10 Dec 2006, 22:21
Quote:
Examples I would need:
(...)
- access to low DOS memory from DPMI

Since the FASMD was already mentioned here - it uses various schemes of accessing low DOS memory in many places. Or do you mean something else?

As for writing stubs and other such things, perhaps the old sources of my HDOS extender might be interesting for you (HDOS was mentioned here: http://board.flatassembler.net/topic.php?t=4919 and also in my presentation about fasm's history on our first meeting in Kraków). Recently I recovered some of those source from a floppy I thought to be broken completely (but fortunately it was broken only partially), I will see if I can put them into shape that I wouldn't be too ashamed to show here.

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 10 Dec 2006, 22:21
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.