Linux assembly list
 help / color / mirror / Atom feed
From: Emanuele Altieri <ealtieri@hampshire.edu>
To: Anant Aneja <anantaneja@rediffmail.com>
Cc: linux-assembly@vger.kernel.org
Subject: Re: bios interuppts
Date: Tue, 04 Mar 2003 13:04:41 -0500	[thread overview]
Message-ID: <3E64EAB9.5070000@hampshire.edu> (raw)
In-Reply-To: <20030304120742.6160.qmail@webmail7.rediffmail.com>

The simplest way to do it is to use terminal escape codes. That is, you 
put these codes in a string and print the string with a simple write() 
or printf() call. The terminal will recognize the codes in the string 
and execute some special intructions such as clear the screen.

For example:

   #include <stdio.h>

   #define ESC 0x1B   /* escape code */

   int main()
   {
           /* Escape codes */
           char clr[5] = {ESC, '[', '2', 'J', 0};       /* clear screen */
           char cur[6] = {ESC, '[', '0', '0', 'H', 0};  /* goto 0,0 */

           printf(clr);
           printf(cur);

           return(0);
   }

More escape codes can be found at:
http://ilkerf.tripod.com/cdoc/vt100ref.html

and many other similar links.

Hope this helps,

--Emanuele



Anant Aneja wrote:

> My problem is i was using turbo c++ compiler before and
> frequently
> used ROM-BIOS interupts for
> certain functions ( like handling the screen, calling the mouse
> etc all in dos based programs
> using 386 based registers like ah al etc).
>
> Now I've started using gcc and find that even a basic screen
> clearing function requires me to use the
> "ncurses" library. this i did but it handles the screen only
> using
> windows and does not treat the console as an
> unlimited buffer.
>
> I dont wanna use the library therefore. plus it was a lot easier
> calling interupts for most simple tasks.
> I've read somewhere that Linux does not allow BIOS interupts
> since
> it runs in 'protected' mode.
> therefore, I cant do simple stuff like clearing a screen myself.
>
> Is there some way to do the above task easily (with or without
> assembly ?)
>
> Please help.
> Anant
>
>
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe 
> linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


  parent reply	other threads:[~2003-03-04 18:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-04 12:07 bios interuppts Anant Aneja
2003-03-04 16:24 ` hp
2003-03-04 18:04 ` Emanuele Altieri [this message]
2003-03-04 20:28   ` Brian Raiter
2003-03-04 20:34     ` Vince Weaver
2003-03-05  6:55     ` hp
2003-03-05 19:42       ` Brian Raiter
2003-03-05 20:54         ` hp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E64EAB9.5070000@hampshire.edu \
    --to=ealtieri@hampshire.edu \
    --cc=anantaneja@rediffmail.com \
    --cc=linux-assembly@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox