pouët.net

Go to bottom

Turbo C/C++ 3.0

category: code [glöplog]
i try to compile to .com. ive set the memory model to tiny but dont know how to set entry point in Turbo C?

ive set "-mt -lt -c -1" parameters in compiler and "/t /n" in linker

i get error msg like: "invalid initial entry point address" when linking.
is there a parameter to set the entry point address?
added on the 2013-03-11 15:46:13 by rudi rudi
Whoa, what a blast from the past. .com files always have an entry opint of 0100h, they're just raw code. Turbo C options though... no idea.
added on the 2013-03-11 15:53:05 by Preacher Preacher
maybe i should change the compiler then. i thought this one would be able to do this, but can't find anything in the manual.
added on the 2013-03-11 16:09:21 by rudi rudi
oh well. doing a direct compile without the -c option generates a huge .com that is 3kb's big and has all sorts of crap in it.
added on the 2013-03-11 16:13:56 by rudi rudi
If you want to create a small .com-file, why not write it in assembler? I would hardly think that C is really efficient for such things anyway...
added on the 2013-03-11 17:38:43 by Preacher Preacher
Preacher: i do i do :) this is just for extra puffs.
added on the 2013-03-11 19:07:46 by rudi rudi
Rudi: Maybe http://pouet.net/prod.php?which=27020 could help you?
sensenstahl: hm. indeed its something like that i am looking for, but it doesnt say much in the .txt.
Tigrou: nice site though.

i try djgpp as well, but even when compiling as exe i get error msg. argh:
Code:Exiting due to signal SIGSEGV Page fault at eip=00001de3, error=0006 eax=00000000 ebx=00001000 ecx=00000000 edx=0000033f esi=00000054 edi=0000e344 ebp=0008e320 esp=0008e320 program=..... cs: sel=00a7 base=10000000 limit=0009ffff ds: sel=00af base=10000000 limit=0009ffff es: sel=00af base=10000000 limit=0009ffff fs: sel=008f base=00001aa0 limit=0000ffff gs: sel=00bf base=00000000 limit=0010ffff ss: sel=00af base=10000000 limit=0009ffff App stack: [0008e344..0000e344] Exceptn stack: [0000e2a4..0000c364] Call frame traceback EIPs: 0x00001de3 0x000037a8
added on the 2013-03-11 20:55:32 by rudi rudi
@rudi : i learned C/C++ with that website, back in 1998/99... ;-)
added on the 2013-03-11 22:14:30 by Tigrou Tigrou
Tigrou :D memories :)
added on the 2013-03-11 22:28:05 by rudi rudi
Here is an example that works with Turbo C 2.01 and NASM, example.com file is 121 bytes :)
added on the 2013-03-12 04:58:58 by phant phant
phant: thanks alot!
added on the 2013-03-12 16:33:27 by rudi rudi
Any reason why you're not using openwatcom? =)
added on the 2013-03-12 19:14:10 by sol_hsa sol_hsa
Sol: for linking to .com?
added on the 2013-03-12 20:21:31 by ara ara
I've gotten back to Turbo C after all these years.
I want to produce the smallest .com file, in tiny memory model.
I've managed to compile and link to a 5 byte big .com file.

The code generation code looks like this:
Code:55 push bp 8b ec mov bp,sp ...insert main() { } code here... 5d pop bp c3 ret


This "bloat" seems to be a typical way of storing stack frames in executables.
I wonder if Turbo C has an compiler option to suppress thes code generation of these four bytes (except ret)?

Ideas are welcome
added on the 2019-05-03 09:53:40 by rudi rudi
I have no clue about Turbo C, but the bloat seems to be equivalent to the ENTER instruction to which the one-byte-instruction LEAVE is the reverse (which i still want to abuse in the extreme tiny intros). The generated code seems to be shorter than ENTER though. At the very least you could patch the resulting binary with a custom build step, just remove the push/pop BP, and maybe even the mov instruction (which i suspect to break the code)

For Turbo C, you might be searching for FPO, there is an option for that in Turbo C apparently (page 49/50), but like i said, i don't know much about that ;)
added on the 2019-05-03 10:58:10 by HellMood HellMood
tiny intro with C? oO
added on the 2019-05-03 12:04:58 by g0blinish g0blinish
Don't know if this helps, but the oldest directory in Pyrit's history folder is a C+ASM program that compiles in Borland C++ 3.1 and NASM.
added on the 2019-05-03 13:13:56 by rrrola rrrola
Quote:
How about https://github.com/guitmz/virii/blob/master/c/C0T.ASM?


@Gargaj: yes, i allready used that tiny c0t.asm to build my .com files. it removes alot of bloat, but there are still some bytes left: 55 8b ec and 5d. those are still there.

@hellmood: i think about just removing the bytes manually or with a patch as end-step as you say.
added on the 2019-05-03 22:17:01 by rudi rudi
@rudi, the "standard stack frame" switch didn't work for you?
added on the 2019-05-03 22:19:55 by HellMood HellMood
Y0bi wrote this
Quote:
try -mt -1 -f- -Z -O


I'm not a C expert, but not the "inline" is the magic keyword?
@HellMood: What's the switch for that?

@TomCat: I tried that and several other switches. I get Y0bi's intro down to 239 bytes, but it still has those bytes. well, I think I will take a break from this right now, and just remove the bytes later if necessary.
added on the 2019-05-04 12:51:46 by rudi rudi

login

Go to top