flat assembler
Message board for the users of flat assembler.
Index
> DOS > Can any1 please explain how to combine Turbo C with Fasm? |
Author |
|
edfed 15 Mar 2008, 15:41
you can code windows applications with only fasm. fasmw.exe is an example
|
|||
15 Mar 2008, 15:41 |
|
wedared 15 Mar 2008, 16:20
i know, but i like dos for what it is, simple. so i was thinking if there was any one who could give me some advise as to how to link turbo c and fasm source in dos.
|
|||
15 Mar 2008, 16:20 |
|
dap 15 Mar 2008, 17:27
Just follow the C convention and it should work : http://blogs.msdn.com/oldnewthing/archive/2004/01/02/47184.aspx
|
|||
15 Mar 2008, 17:27 |
|
DOS386 16 Mar 2008, 00:22
.
edfed wrote: > you can code windows applications with only fasm. fasmw.exe is an example Maybe true, but absolutely OFF-topic here, read subforum topic please > i know, but i like dos for what it is, simple. so i was thinking if there > was any one who could give me some advise as to how to link turbo c > and fasm source in dos. The problem is that FASM can't brew 16-bit OMF objects and "Turbo" C can't output assembly Several options: 1. 100% assembly 2. Use NASM or LZASM, both can (reportedly) 16-bit OMF 3. For better performance, use DPMI32 instead of real mode. This way some more possibilities open: - - Link via COFF, DGJPP compiler for C - - Output assembly from compiler and include into FASM source, DGJPP "MASM INTEL" (does it really work ???) , or CC386 compiler (has "minimal" FASM support) |
|||
16 Mar 2008, 00:22 |
|
rugxulo 17 Mar 2008, 18:21
"tcc -S myfile.c" should produce assembly, and it should work with ArrowASM (although you might have to change ".186" to ".286p" or whatever). Or use NASM or LZASM (but need manual conversion in that case). But Turbo C (and TC++) for DOS are old, old, old! Granted, they're still fast, small, light, and useful, but they don't optimize well enough for modern processors (anything past 186, apparently!).
OpenWatcom is better code generation, and it supports 16-bit. It, of course, uses OBJ/OMF also (which FASM doesn't support), but at least it has its own assembler (WASM) and good docs ("whelp cguide") among tons of other goodies. (Of course, it outputs directly to .OBJ, so you have to manually use WDIS else use "owcc -S myfile.c" GCC compiler driver clone instead of "wcl"). Or, try Agner's OBJCONV (but I haven't tested it, so it may not support 16-bit). In short, Turbo C + ArrowASM ("tcc -G -O -a -Easm.exe myfile.asm") works. EDIT: Corrected cmdline of TC. Last edited by rugxulo on 03 May 2008, 06:49; edited 1 time in total |
|||
17 Mar 2008, 18:21 |
|
Kenneth Zheng 02 May 2008, 15:03
We can download open watcom source code and binary files from this web link: http://www.openwatcom.org/index.php/Main_Page.
Thanks, Kenneth Zheng |
|||
02 May 2008, 15:03 |
|
DOS386 02 May 2008, 18:30
> We can download open watcom source code and binary files from this web link: http://www.openwatcom.org/...
YES, but not really new, and the packages are not very great / DOS-friendly Also we can download JWASM, supporting 16-bit OMF and usable with 16-bit C ... but supports MA$M syntax only. _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
02 May 2008, 18:30 |
|
rugxulo 03 May 2008, 06:48
For the record, Turbo C isn't anywhere near as good at optimizing as OpenWatcom. Plus, it ain't FOSS. But anyways, no you don't have to download the 65 MB .EXE installer / .ZIP sfx behemoth anymore, thanks to Arkady B! You can get only what parts you need in separate smaller .ZIPs (a la OW 1.3).
http://www.openwatcom.org/index.php/Alternative_Open_Watcom_distribution |
|||
03 May 2008, 06:48 |
|
rugxulo 03 May 2008, 06:56
Okay, just to prove it works, here's the output of a simple "Hello, world!" application (from free TC 2.01).
Build it via "tcc.exe -G -O -mt -lt -Easm.exe hello.asm". Code: ifndef ??version ?debug macro endm endif ?debug S "hello.c" _TEXT segment byte public 'CODE' DGROUP group _DATA,_BSS assume cs:_TEXT,ds:DGROUP,ss:DGROUP _TEXT ends _DATA segment word public 'DATA' d@ label byte d@w label word _DATA ends _BSS segment word public 'BSS' b@ label byte b@w label word ?debug C E9A70EA3380768656C6C6F2E63 ?debug C E92010AB121E433A5C41524D534C5552505C54435C494E434C5544+ ?debug C 455C737464696F2E68 ?debug C E92010AB121F433A5C41524D534C5552505C54435C494E434C5544+ ?debug C 455C7374646172672E68 _BSS ends _DATA segment word public 'DATA' _DATA ends _TEXT segment byte public 'CODE' ; ?debug L 3 _main proc near push bp mov bp,sp ; ?debug L 5 mov ax,offset DGROUP:s@ push ax call near ptr _printf pop cx ; ?debug L 7 xor ax,ax ; ?debug L 8 pop bp ret _main endp _TEXT ends ?debug C E9 _DATA segment word public 'DATA' s@ label byte db 10 db 72 db 101 db 108 db 108 db 111 db 44 db 32 db 70 db 65 db 83 db 77 db 101 db 114 db 115 db 33 db 10 db 0 _DATA ends _TEXT segment byte public 'CODE' extrn _printf:near _TEXT ends public _main end |
|||
03 May 2008, 06:56 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.