Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 654 Vote(s) - 3.45 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I clear the screen without having to fill it

#1
Does an interrupt service routine exist to help me clear the screen of the terminal? Will it work on windows?
Reply

#2
Setting a graphics mode through BIOS (int 10h with AH=0) will clear the screen.

Scrolling the screen up or down through BIOS (int 10h with AH=6 or 7) can clear the screen as well.

This will only work where you can invoke BIOS service functions.

MSDOS is where this will always work.

In Windows this will work only in DOS applications and if Windows can actually run them. 64-bit editions of Windows don't support DOS applications at all and starting with Windows Vista even in 32-bit editions of Windows many DOS apps don't work fully.

Remember also that if a DOS application runs in a window in Windows, only that window will get cleared, not the entire screen.
Reply

#3
In assembly, try this:

mov ah, 0x06
mov al, 0
int 10h

And no, you cannot do this on windows. This code can only be used for bootloaders, and assembly kernels (16 bit only, WARNING: DO NOT TRY ON 32 BIT!!!)

If you'd like to do in Windows (Console Applications), then try this:

C++
-----

//YOU SHOULD INCLUDE STDIO.H and CONIO.H. You should also type:
//using namespace std

system("cls");

VB.NET
----

//You should imports System and other Default namespaces
shell("cls")

C#
----
System.Diagnostics.Proccess.Start("CMD.exe /c cls");

NOTE: I don't think we can make Console apps using C# or VB. Of course, i never tried. Just saying. But these codes only work for windows.

Reply

#4
For Windows console applications, in plain C:

#include <tchar.h>
#include <wincon.h>

VOID
ClearScreen(HANDLE hConsoleOutput)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD coPos;
DWORD dwWritten;

GetConsoleScreenBufferInfo(hConsoleOutput, &csbi);

coPos.X = 0;
coPos.Y = 0;
FillConsoleOutputAttribute(hConsoleOutput, csbi.wAttributes,
csbi.dwSize.X * csbi.dwSize.Y,
coPos, &dwWritten);
FillConsoleOutputCharacter(hConsoleOutput, TEXT(' '),
csbi.dwSize.X * csbi.dwSize.Y,
coPos, &dwWritten);
SetConsoleCursorPosition(hConsoleOutput, coPos);
}

...

// In your main code:
/* Clear the full console screen */
ClearScreen(hOutput);

where the `hConsoleOutput` is a HANDLE to a console screen-buffer (obtained either via `GetStdHandle(STD_OUTPUT_HANDLE)`, or `CreateConsoleScreenBuffer(...)`, or other means.
What this function does is to, first, retrieve the current console screen-buffer information (that contains its current size), then fill the complete screen-buffer with the default text attribute and with spaces, then finally place the cursor at (0,0).
Reply

#5
I got this to work (used qemu, NASM)

( )

call cls
jmp $

cls:
pusha
mov ah, 0x00
mov al, 0x03 ; text mode 80x25 16 colours
int 0x10
popa
ret
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through