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?
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?
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.
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.
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.
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...
Preacher: i do i do :) this is just for extra puffs.
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:
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
@rudi : i learned C/C++ with that website, back in 1998/99... ;-)
Tigrou :D memories :)
Here is an example that works with Turbo C 2.01 and NASM, example.com file is 121 bytes :)
phant: thanks alot!
Any reason why you're not using openwatcom? =)
Sol: for linking to .com?
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:
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
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
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 ;)
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 ;)
tiny intro with C? oO
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.
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.
@rudi, the "standard stack frame" switch didn't work for you?
Y0bi wrote this
I'm not a C expert, but not the "inline" is the magic keyword?
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.
@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.