Page 1 of 1

Turbo C issues

Posted: Sat Oct 11, 2008 8:46 pm
by Troy Martin
I'm going to write a 16-bit kernel in C, so I decided that TC is the only viable option to use under windoze. I've run into a few problems:

- How the hell do I do inline asm in this thing without it complaining about "inline assembly not allowed" or even "undefined symbol 'mov'" or anything like that?
- Will it compile to a simple flat binary?

EDIT: I'm using version 2.01.

Re: Turbo C issues

Posted: Sun Oct 12, 2008 12:01 pm
by i586coder
Hi,

coding OS under TC is realy cooool 8)

to use assembly inside c code

first,let TC active 32bit opcode,using TASM5
(turbo assembler)

Code: Select all

 #pragma inline
note:
by default TASM is not in TC package ,you need to add it in your /tc/bin

to add your assembly code use -> asm <-

Code: Select all

main(){

 asm{.386
          mov eax,0x12345678
 }

}
finally,i invite you to use TC3.1 becuse it easy to do 32bit shift by <<,>> operator

you may use .286x,.236x,.486x,.586x
where x=no things || p

to make flat binary
it's difficult to convert .exe to .bin result to segmentation in exe,but if you make a .exe in tiny memory model you can
i recomended EXE2BIN.exe to do that

good luck :mrgreen: