delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/28/11:00:47

From: "Campbell, Rolf [SKY:1U32:EXCH]" <cp1v45 AT americasm01 DOT nt DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C++ "Hello World" compiling problem
Date: Mon, 28 Jun 1999 10:26:30 -0400
Organization: Nortel Networks
Lines: 35
Message-ID: <37778615.297BDB25@americasm01.nt.com>
References: <3768D090 DOT 9BA88A6F AT unn DOT ac DOT uk> <7l0luo$s0t$1 AT news3 DOT Belgium DOT EU DOT net>
NNTP-Posting-Host: bmerhc00.ca.nortel.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.6 [en] (X11; I; HP-UX B.10.20 9000/712)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

DaXy_II wrote:

> > int main() {
> >         cout << "Hello World." << endl;
> >         return 0;
> This will be a huge exe! Try this
>
> int cur;
>
> void putc(char* vid, char ch) {
>     vid[cur++] =
>
> int main() {
>     char* video;
>     cur = 0 // You could get the cursor pos ...
>
>     video = (char*)0xB8000; // 0xB0000 for monocrome monitors.
>     while (*message++) {
>         putc(video,*message);
>     }
> }
>
> And link without the stdlib, almost as small as an asm

    Well, assuming you had typed the function correctly ( with "ch;}" at
the end).  You would get a segment violation and you would skip the first
character of your message.  And on top of all of that, you forgot about the
character attribute byte in text memory.  So you would miss every 2nd
character, and they would appear in strange colors.

--
     -Rolf Campbell (39)3-6318



- Raw text -


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