Xref: news2.mv.net comp.os.msdos.djgpp:7790 From: alaric AT abwillms DOT demon DOT co DOT uk (Alaric B. Williams) Newsgroups: comp.os.msdos.djgpp Subject: Re: assembly Date: Wed, 21 Aug 1996 20:51:55 GMT Lines: 42 Message-ID: <840660714.11131.1@abwillms.demon.co.uk> References: <32177794 DOT 5CA AT unm DOT edu> NNTP-Posting-Host: abwillms.demon.co.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp strider7 AT unm DOT edu wrote: >im trying to learn assembly (at&t syntax), and i made a little program that >prints out a string: > movl $string, %dx # move string into dx > movb $0x09, %ah # print the string, calling > int $0x21 # int 21h, subfunction 9h >it works under win95, but doesnt under dos (with cwsdpmi v2), it prints out >junk on the screen. am i doing this right, if im not, how come it works >under win95? This is because the pointers you pass to int 21 make no sense - they're protected mode pointers, and DOS runs in real or V86 mode. Win95's protected mode interface will intercept int 21 from protected mode and convert the pointers for you, so it works. cwsdpmi doesn't bother, since that service is never needed by DJGPP applications unless somebody starts calling int 0x21 on their own - an unnecessary thing to do when you can call puts from assembler! >another question, what does '.align' do and why do i need it? It makes sure that the code after the .align starts on a given boundary. This just makes some hardware accesses to memory faster, if something is aligned on a dword boundary. Regards, ABW --- COMPUTER: We are in position over the Rebel homeworld. VADAR: Engage the Death Star primary weapon, let those rebel worms die! COMPUTER: Sorry, your evaluation version of Battle Computer 3.0 has expired. Please send 2.6 billion dollars to the address in REGISTER.TXT Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk Hello :-)