delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/14/17:30:15

Message-ID: <39986125.80837DE6@ntlworld.com>
From: Steven Watson <steven DOT watson AT ntlworld DOT com>
X-Mailer: Mozilla 4.7 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: newbie makelong?
References: <39985C49 DOT 3542BDAC AT ntlworld DOT com>
Lines: 59
Date: Mon, 14 Aug 2000 22:14:13 +0100
NNTP-Posting-Host: 62.254.82.194
X-Complaints-To: abuse AT net DOT ntl DOT com
X-Trace: news6-win.server.ntlworld.com 966287946 62.254.82.194 (Mon, 14 Aug 2000 22:19:06 BST)
NNTP-Posting-Date: Mon, 14 Aug 2000 22:19:06 BST
Organization: ntlworld News Service
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

hi I am sorry I found out how to do it 

  #include <sys/nearptr.h>
  #include <crt0.h>

  void * MK_FP (unsigned short seg, unsigned short ofs)
  {
    if ( !(_crt0_startup_flags & _CRT0_FLAG_NEARPTR) )
      if (!__djgpp_nearptr_enable ())
        return (void *)0;
    return (void *) (seg*16 + ofs + __djgpp_conventional_base);
  }
it works a treat! next time I will try to read all the docs

Regards
Steven Watson

Steven Watson wrote:
> 
> Hi Everyone,
> I am sorry to have to ask what is probably a silly question
> but I am unable to figure out the conversion to djgpp for this
> snippet I have looked at the faq but I have spent most of my time
> programming windows so I have no dos programming experience.
> the code comes from a C tutorial.
> any help would be appreciated
> Regards
> 
> Steven Watson
> 
> void print(char *str)
> {
>         /*
>            Prints characters only directly to the current display page
>            starting at the current cursor position. The cursor is not
>            advanced.
>            This function assumes a colour display card. For use with a
>            monochrome display card change 0xB800 to read 0xB000
>         */
> 
>         int page;
>         int offset;
>         unsigned row;
>         unsigned col;
>         char far * ptr;
> 
>         page = activepage();
>         curr_cursor(&row,&col);
> 
>         offset = page * 4000 + row * 160 + col * 2;
> 
>         ptr = MK_FP(0xB800,offset);
> 
>         while(*str)
>         {
>                 *ptr++= *str++;
>                 ptr++;
>         }
> }

- Raw text -


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