delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/30/15:32:16

From: xmerm05 AT vse DOT cz (Michal Mertl)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: [Q] using int 0x21 to print text with inline asm
Date: Tue, 26 Aug 1997 13:36:34
Organization: University of Economics - Prague, CZ
Lines: 36
Message-ID: <xmerm05.16.000D9C06@vse.cz>
References: <19970825180600 DOT OAA29264 AT ladder02 DOT news DOT aol DOT com>
NNTP-Posting-Host: s019h14.vse.cz
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Egg Brains wrote:
>i can't print text to the string using asm. it prints, but not the stuff i
>want (just a bunch of garbled ascii characters with beeps and stuff.) 
>here is the code i am/was using...

><-----start----->

>char *myHappy;      /* i have also tried using a character */

>void main()
>{

>myHappy = "Hello, world!";

>asm("movw _myHappy, %dx");
>asm("movb $9, %ah");
>asm("int $0x21");       

>}

><-----end----->

>Thanx...
>    Paul

>P.S. is this because of the p-mode & passing data to the conventional
>memory etc...?

Despite of other bugs pointed out by other people you are right that the 
asm wan't work because of dos expects it to be in es:dx (or ds:dx ? don't 
have the documentation about me) and this must be real mode pointer (and it 
of course isn't in your example). Can't see any reason why you would want to 
do that though, I agree with the other guy that printf is good enough.

Michal 'MiMe' Mertl
e-mail:XMERM05 AT vse DOT cz

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019