News:

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

A New Testbed for MASM32 Forum

Started by frktons, September 21, 2010, 05:25:26 PM

Previous topic - Next topic

MichaelW

This modified code will maximize the console window.

ConsoleSize PROC

    LOCAL csbi:CONSOLE_SCREEN_BUFFER_INFO

    INVOKE AllocConsole

    INVOKE GetStdHandle, STD_INPUT_HANDLE
    mov rHnd,eax

    INVOKE GetStdHandle, STD_OUTPUT_HANDLE
    mov wHnd,eax

    INVOKE SetConsoleTitle, ADDR ConTitle

    CALL   HideTheCursor

    mov windowSize.Left, Zero
    ;mov windowSize.Right, (MaxCols -1)
    mov windowSize.Top, Zero
    ;mov windowSize.Bottom, (MaxRows -1)

    mov bufferSize.x, MaxCols
    mov bufferSize.y, MaxRows

    ;INVOKE SetConsoleWindowInfo, wHnd, TRUE, ADDR windowSize

    INVOKE SetConsoleScreenBufferSize, wHnd, DWORD PTR bufferSize

    INVOKE GetConsoleScreenBufferInfo, wHnd, ADDR csbi

    mov ax, csbi.dwMaximumWindowSize.x
    dec ax
    mov windowSize.Right, ax
    mov ax, csbi.dwMaximumWindowSize.y
    dec ax
    mov windowSize.Bottom, ax

    INVOKE SetConsoleWindowInfo, wHnd, TRUE, ADDR windowSize

    ret

ConsoleSize ENDP

eschew obfuscation

frktons

Quote from: jj2007 on November 17, 2010, 08:55:53 AM
I know. This is what I call "need to maximize it by hand" - and it is two mouseclicks too much.

The lazy opinion.  :lol

Quote from: MichaelW on November 17, 2010, 10:00:49 AM
This modified code will maximize the console window.

ConsoleSize PROC

    LOCAL csbi:CONSOLE_SCREEN_BUFFER_INFO

    INVOKE AllocConsole

    INVOKE GetStdHandle, STD_INPUT_HANDLE
    mov rHnd,eax

    INVOKE GetStdHandle, STD_OUTPUT_HANDLE
    mov wHnd,eax

    INVOKE SetConsoleTitle, ADDR ConTitle

    CALL   HideTheCursor

    mov windowSize.Left, Zero
    ;mov windowSize.Right, (MaxCols -1)
    mov windowSize.Top, Zero
    ;mov windowSize.Bottom, (MaxRows -1)

    mov bufferSize.x, MaxCols
    mov bufferSize.y, MaxRows

    ;INVOKE SetConsoleWindowInfo, wHnd, TRUE, ADDR windowSize

    INVOKE SetConsoleScreenBufferSize, wHnd, DWORD PTR bufferSize

    INVOKE GetConsoleScreenBufferInfo, wHnd, ADDR csbi

    mov ax, csbi.dwMaximumWindowSize.x
    dec ax
    mov windowSize.Right, ax
    mov ax, csbi.dwMaximumWindowSize.y
    dec ax
    mov windowSize.Bottom, ax

    INVOKE SetConsoleWindowInfo, wHnd, TRUE, ADDR windowSize

    ret

ConsoleSize ENDP



The active opinion  :U

Thanks Michael. I'll do it in order to save time/energy and mouses destruction.  :lol

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

frktons

#272
The final release can be downloaded here:

http://www.masm32.com/board/index.php?topic=15365.msg125449#msg125449

and in following posts. Grab one, it's free.  :P

Enjoy it and let me know.

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

frktons

Latest release 1.51. Download from previous link.
Mind is like a parachute. You know what to do in order to use it :-)

Antariy

#274
Hi!

Since Frank allow to add the "Manager" into his latest release, here it is.

Features:
1. Easy to add/remove/change algos into testbed.
Just select empty AlgoX.inc template file, and insert your code piece or proc into it. Read comments to do things - all is simple, and you can tune testbed to show description for algo and specify minimum required instructions set.
2. Printed code size - all labels inside AlgoX.inc files already specified - for code piece, and for entire proc (uncomment which you needed).
3. Changement in code which copy contents of the screen into clipboard - some small fixes of original code and adaptations.
4. All other code is Frank's.
5. Implemented coping into clipboard.

Algos files 1 and 2 already contain two tested procs, and tuned properly for needed instructions set - so see to them as to example, and put code to them after they will not needed anymore.

Feedback is welcomed.
See what it is, how to use it, any suggestions.

EDITED: the great (un)documented feature of GetNumberFormat maked some mess. See for attachment 7 posts below :P


Alex

Antariy

Results (by C key):

┌─────────────────────────────────────────────────────────────[24-Nov-2010 at 01:33 GMT]─┐
│OS  : Microsoft Windows XP Professional Service Pack 2 (build 2600)                     │
│CPU : Intel(R) Celeron(R) CPU 2.13GHz with 1 logical core(s) with SSE3                  │
├──────────────────────────────────┬─────────┬──────────┬──────────┬──────────┬──────────┤
│        Algorithm notes           │Proc Size│ Test # 1 │ Test # 2 │ Test # 3 │ Test # 4 │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│01 Alex / MMX                     │ 55      │ 10 853   │ 10 908   │ 10 787   │ 10 778   │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│02 Frank / SSE2                   │ 45      │ 8 419    │ 8 259    │ 8 353    │ 8 451    │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤


dedndave

 :bg oh oh
it appears there are null(s) after the formatted numeric string data instead of spaces

┌─────────────────────────────────────────────────────────────[24-Nov-2010 at 02:32 GMT]─┐
│OS  : Microsoft Windows XP Professional Service Pack 2 (build 2600)                     │
│CPU : Intel(R) Pentium(R) 4 CPU 3.00GHz with 2 logical core(s) with SSE3                │
├──────────────────────────────────┬─────────┬──────────┬──────────┬──────────┬──────────┤
│        Algorithm notes           │Proc Size│ Test # 1 │ Test # 2 │ Test # 3 │ Test # 4 │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│01 Alex / MMX                     │ 55      │ 14,437


Antariy

Quote from: dedndave on November 24, 2010, 02:33:56 AM
:bg oh oh
it appears there are null(s) after the formatted numeric string data instead of spaces

┌─────────────────────────────────────────────────────────────[24-Nov-2010 at 02:32 GMT]─┐
│OS  : Microsoft Windows XP Professional Service Pack 2 (build 2600)                     │
│CPU : Intel(R) Pentium(R) 4 CPU 3.00GHz with 2 logical core(s) with SSE3                │
├──────────────────────────────────┬─────────┬──────────┬──────────┬──────────┬──────────┤
│        Algorithm notes           │Proc Size│ Test # 1 │ Test # 2 │ Test # 3 │ Test # 4 │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│01 Alex / MMX                     │ 55      │ 14,437



In other it work? :P

Did you instert trailing CODE tag yourself, or code do this itself?

Very big sources, which entangled for looking not by developer. :P

dedndave

yes - works fine otherwise
no - the clipboard had the closing code tag at that point ??

at least you have an idea where to look   :P

Antariy

I found culprit - GetNumberFormat is returns count of chars copied + ZERO terminator - unusual behaviour, which is not documented in my sources. :P

Will post after minute...


Antariy

This if fixed version. DEC EAX added to agree with (un)documentation of GetNumberFormat :P

dedndave

 :U

┌─────────────────────────────────────────────────────────────[24-Nov-2010 at 02:51 GMT]─┐
│OS  : Microsoft Windows XP Professional Service Pack 2 (build 2600)                     │
│CPU : Intel(R) Pentium(R) 4 CPU 3.00GHz with 2 logical core(s) with SSE3                │
├──────────────────────────────────┬─────────┬──────────┬──────────┬──────────┬──────────┤
│        Algorithm notes           │Proc Size│ Test # 1 │ Test # 2 │ Test # 3 │ Test # 4 │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│01 Alex / MMX                     │ 55      │ 14,096   │ 14,641   │ 14,524   │ 14,501   │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│02 Frank / SSE2                   │ 45      │ 8,432    │ 8,768    │ 8,637    │ 8,278    │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤


Antariy

Quote from: dedndave on November 24, 2010, 02:52:00 AM
:U

┌─────────────────────────────────────────────────────────────[24-Nov-2010 at 02:51 GMT]─┐
│OS  : Microsoft Windows XP Professional Service Pack 2 (build 2600)                     │
│CPU : Intel(R) Pentium(R) 4 CPU 3.00GHz with 2 logical core(s) with SSE3                │
├──────────────────────────────────┬─────────┬──────────┬──────────┬──────────┬──────────┤
│        Algorithm notes           │Proc Size│ Test # 1 │ Test # 2 │ Test # 3 │ Test # 4 │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│01 Alex / MMX                     │ 55      │ 14,096   │ 14,641   │ 14,524   │ 14,501   │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│02 Frank / SSE2                   │ 45      │ 8,432    │ 8,768    │ 8,637    │ 8,278    │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤



:bg

Well, now you can try to add some code into test - this will require a much less efforts, probably. :P

GregL

Alex,

Did you update the readme.txt file with any changes?

Antariy

Quote from: GregL on November 24, 2010, 03:34:11 AM
Did you update the readme.txt file with any changes?

No, I didn't. I leave translation of "cyrillic English" to Frank :lol