The MASM Forum Archive 2004 to 2012

Specialised Projects => Pelle's Macro Assembler Development => Topic started by: Vortex on October 20, 2011, 07:11:51 PM

Title: Scrolling text on console
Post by: Vortex on October 20, 2011, 07:11:51 PM
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
Title: Re: Scrolling text on console
Post by: dedndave on October 20, 2011, 07:17:16 PM
nice, but not nearly as fun as the scroll desktop demos   :bg

you can also use ScrollConsoleScreenBuffer