Xref: news2.mv.net comp.os.msdos.djgpp:3808 From: roland DOT nilsson AT communique DOT se (Roland Nilsson) Newsgroups: comp.os.msdos.djgpp Subject: Re: asm in djgpp Date: 13 May 1996 22:05:37 GMT Organization: -+- Private -+- Lines: 77 Message-ID: <4n8bnh$dsc@news.luth.se> References: <31958aa0 DOT 5069247 AT news DOT algonet DOT se> NNTP-Posting-Host: x9.communique.se Mime-Version: 1.0 Content-Type: Text/Plain; charset=US-ASCII To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <31958aa0 DOT 5069247 AT news DOT algonet DOT se>, berth AT algonet DOT se says... > >Hello everybody! > >Been reading docs on the at&t syntax in assembly,but can't figure it >out!. Which have you read? Try the linux as info files, they are rather explicit (though perhaps not on absolute beginner level). >Say if i have the folowing program written for the intel(tasm) >syntax,how would this look in at&t syntax? > >--------------------------------------------------------------------------- > IDEAL ;Special for turbo assembler > DOSSEG > MODEL SMALL > RADIX 16 > STACK 10 > CODESEG >START: > MOV AH,0 > MOV AL,13 > INT 10 > > MOV AH,4C > INT 21 >END START Tranlates roughly like this: --------------------------------------------------------------------------- // few of the pseudo-ops are needed.. ..text // defines text section start: mov $0, %ah mov $0x13, %al int $0x10 mov $0x4c, %ah int $0x21 -------------------------------------------------------------------------- >This program switches video mode to mode 13h(320x200x256) Now for the bad news! as assumes that you're running a 32-bit environment - it can't handle real mode addressing - but BIOS routines like those you use normally can't run in protected mode. You would probably survive until that "int $0x010" of yours, after that you're on thin ice. You wouldn't even hit the right routine, since interrupt and memory layout can differ greatly within a 32-bit environment. Get a book on this if you intend to code 32-bit apps. >the thing that i dont understand is how the specify segments and stuff There aren't much segments around when using as. There are "sections", but those have a slightly different meaning. There are usually three sections in a program, namely ".text", ".data", and ".bss". You can also specify other sections by using ".section ", assuming that the object file format allows this (COFF does). Read the as info files on sections for a deeper discussion on this topic. Usually though, you'll be better off by not digging into this: just use ".text" before you code, and ".data" before data. >in at&t,this program is ment to be run standalone,no inline asm.. Using djgpp, not much can run standalone. In any case you must use go32 or similiar to initialize the flat memory environment. Simply ignoring this and trying to run under DOS alone won't work. Ever. Roland Nilsson