News:

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

Scrolling text on console

Started by Vortex, October 20, 2011, 07:11:51 PM

Previous topic - Next topic

Vortex

Here is an example of scrolling text on console screen :


include     ScrollConsole.inc

.data

message     db '          This is a scroll test. ',0

.code

start:

    call    main
    invoke  ExitProcess,0

main PROC uses esi ebx

LOCAL hStd:DWORD
LOCAL csbi:CONSOLE_SCREEN_BUFFER_INFO
LOCAL Coordinates:COORD

    invoke  GetStdHandle,STD_OUTPUT_HANDLE
    mov     hStd,eax

    lea     esi,csbi
    invoke  GetConsoleScreenBufferInfo,eax,esi
    mov     edx,CONSOLE_SCREEN_BUFFER_INFO.dwCursorPosition[esi]
    mov     Coordinates,edx
   
    mov     esi,OFFSET message
    mov     ebx,SIZEOF message
@@:
    invoke  SetConsoleCursorPosition,hStd,Coordinates
    invoke  StdOut,esi
    invoke  Sleep,200
    inc     esi
    dec     ebx
    jnz     @b
    ret

main ENDP

END start

dedndave

nice, but not nearly as fun as the scroll desktop demos   :bg

you can also use ScrollConsoleScreenBuffer