flat assembler
Message board for the users of flat assembler.

Index > Main > FASM DLL Problem

Author
Thread Post new topic Reply to topic
Phosque



Joined: 20 May 2007
Posts: 2
Location: Sweden
Phosque 20 May 2007, 17:22
Hi!

I'm new around here, hopefully I'll stay Smile I'm trying to create a DLL in FASM, exporting basic VGA functions. It compiles just fine, but when I run it from another programming language it doesn't work. Any help is greatly appreciated.

Code:
format PE GUI 4.0 DLL
entry DllEntryPoint

include '%fasminc%\win32a.inc'

section '.code' code readable executable

proc DllEntryPoint hinstDLL,fdwReason,lpvReserved
        mov eax,TRUE
        ret
endp

proc OpenScreen
    org 100h    ; DOS
    mov al, 13h ; VGA 320x200
    int 10h     ;
endp

proc SetPixel
     mov ax,0a000h
     mov ds,ax

     mov si,120    ; Position
     mov al,1      ; Color
     mov [si],al   ; Draw in vid mem
endp

section '.edata' export data readable

  export 'gfxlib.dll',\
         OpenScreen, 'OpenScreen'

section '.reloc' fixups data discardable
    


(Yes, I just modified the DLL example that came with FASM)

Thanks,
Martin
Post 20 May 2007, 17:22
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 20 May 2007, 17:39
Code:
proc OpenScreen 
    org 100h    ; DOS 
    mov al, 13h ; VGA 320x200 
    int 10h     ; 
endp     


As you said, it's for DOS and will not work under Windows. You have to use DirectDraw instead. Also note that "org 100h" is not a kind of DOS tag, it only sets the origin, something that could lead some problems when you write a DLL.
Post 20 May 2007, 17:39
View user's profile Send private message Reply with quote
Phosque



Joined: 20 May 2007
Posts: 2
Location: Sweden
Phosque 20 May 2007, 18:05
Alright, thanks for the reply, LocoDelAssembly.
Post 20 May 2007, 18:05
View user's profile Send private message Reply with quote
Hayden



Joined: 06 Oct 2005
Posts: 132
Hayden 21 May 2007, 03:46
to make things more clear for other readers, interrupt calls cannot be used in a window *.dll

_________________
New User.. Hayden McKay.
Post 21 May 2007, 03:46
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 21 May 2007, 13:01
Although it's undocumented you can do it even on NT/2000/XP, look at NTDLL.DLL disassembly on machines with no SYSENTER/SYSCALL support. On http://www.ctyme.com/intr/cat-049.htm you can see interrupt services for non-NT Windowses.

What you can't do is calling BIOS** and DOS** interrupts from Windows.

**On Win9x I'm almost sure that I saw it on 16-bit or 32-bit Windows executables but Int $10 wasn't one of them.
Post 21 May 2007, 13:01
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.