flat assembler
Message board for the users of flat assembler.

Index > DOS > mixing fasm and pascal

Author
Thread Post new topic Reply to topic
avcaballero



Joined: 02 Feb 2004
Posts: 203
Location: Madrid - Spain
avcaballero 05 Sep 2009, 17:12
Hello, anyone can help about mixing fasm and pascal, Let's say:

Code:
; fasm AsmPF2.asm
format MS COFF
public WriteChar
section '.text'
main:
  WriteChar:
    PUSH   BP
    MOV    BP, SP
    MOV    AH, 02h
    MOV    DL, BYTE [BP+4]
    INT    21h
    MOV    SP, BP
    POP    BP
  RET        2
    


Code:
Program MixPascalFasm; (* TPAsmN2.pas *)
uses crt;
PROCEDURE WriteChar(Car: Char); External;
{$L AsmPF2.obj}
begin
  WriteChar('A');
  ReadKey;
end.
    


Well i don't need to say that it doesn't work. The error returned by pascal compiler is: "Invalid object file record (ASMPF2.OBJ)"

EDIT by DOS386 2009-10-21 : added {code} tags
Post 05 Sep 2009, 17:12
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20401
Location: In your JS exploiting you and your system
revolution 05 Sep 2009, 17:50
Maybe Pascal would prefer a DLL file?
Post 05 Sep 2009, 17:50
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 05 Sep 2009, 21:24
Uh, I would've guessed you're using FPC, but your asm is 16-bit (why???). Two obvious comments: FASM doesn't support OBJ/OMF needed by some older DOS Pascals, and also Pascal the language, in general, can probably do WriteChar natively (without needing asm).
Post 05 Sep 2009, 21:24
View user's profile Send private message Visit poster's website Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 203
Location: Madrid - Spain
avcaballero 07 Sep 2009, 07:07
I wanted an easy example to mix fasm and turbo pascal (16 bits)… Well, no comments if FASM doesn't support OBJ, even with 32 bits coding
Post 07 Sep 2009, 07:07
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 07 Sep 2009, 11:45
This may help
http://diamondz.land.ru/hll/hll_eng.htm
If you read how they got round some of the problems, it may help you.
Post 07 Sep 2009, 11:45
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 10 Sep 2009, 23:49
avcaballero, either use ObjConv (though probably only works for 32-bit) or switch to FPC or GPC or VPC.
Post 10 Sep 2009, 23:49
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 21 Oct 2009, 02:06
> avcaballero, either use ObjConv (though probably only works for 32-bit)

This had been discussed many times, Rugxulo advertising ObjConv 1'000'000'000 times, but indeed it is no help for 16-bit OMF creation

> or switch to FPC or GPC or VPC.

FPC uses COFF, so FASM's COFF or MSCOFF might help ...

For 16-bit OMF, the probably easiest solution is NASM.
Post 21 Oct 2009, 02:06
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.