News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

m32lib ClearScreen change

Started by Ranjan, May 29, 2006, 11:02:12 AM

Previous topic - Next topic

Ranjan

The ClearScreen do not clear the screen attribute. A little change for correcting the bug.

code:
ClearScreen proc

  ; -----------------------------------------------------------
  ; This procedure reads the column and row count, multiplies
  ; them together to get the number of characters that will fit
  ; onto the screen, writes that number of blank spaces to the
  ; screen, set the screen buffer attributes and reposition
  ; the prompt at position 0,0.
  ; -----------------------------------------------------------

    LOCAL hOutPut:DWORD
    LOCAL noc    :DWORD
    LOCAL cnt    :DWORD
    LOCAL sbi    :CONSOLE_SCREEN_BUFFER_INFO

    invoke GetStdHandle,STD_OUTPUT_HANDLE
    mov hOutPut, eax

    invoke GetConsoleScreenBufferInfo,hOutPut,ADDR sbi

    mov eax, sbi.dwSize     ; 2 word values returned for screen size

  ; -----------------------------------------------
  ; extract the 2 values and multiply them together
  ; -----------------------------------------------
    mov ecx, eax
    shr eax, 16
    mul cx
    mov cnt, eax

    invoke FillConsoleOutputCharacter, hOutPut, 32, cnt, NULL, ADDR noc

    movzx ecx,sbi.wAttributes
    invoke FillConsoleOutputAttribute, hOutPut, ecx, cnt, NULL, ADDR noc

    invoke SetConsoleCursorPosition, hOutPut, NULL

    ret

ClearScreen endp


zeikman

Thanks for the info, it is very useful

frktons

Mind is like a parachute. You know what to do in order to use it :-)