News:

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

Copying a string variable to the Win clipboard

Started by frktons, November 14, 2010, 12:12:33 PM

Previous topic - Next topic

frktons

I added the tags [<code>] and [</code>] so the screen is copied into the clipboard sorrounded
by the tags to be posted directly into the Forum:


; -------------------------------------------------------------------------
; The text is extracted from the Screen Buffer and prepared to be copied
; into the Windows Clipboard with code tags enclosing it and with
; LF+CR at the end of each text line.
; -------------------------------------------------------------------------

CopyScreenText PROC


    lea  esi, TopCode
    lea  edi, TextResults

    movq mm7, qword ptr [esi]
    movq qword ptr [edi], mm7

    add  edi, Eight   
    lea  esi, SavedScreen

    mov  ecx, CharNumber
   
    xor  eax, eax
    xor  ebx, ebx



NextCharText:

    mov eax, [esi]
   
    mov BYTE PTR [edi], al

    add esi, Four
    add edi, One
    inc ebx

    cmp ebx, MaxCols
    jl  GoOn

    mov BYTE PTR [edi], CR
    mov BYTE PTR [edi + 1], LF
    add edi, Two
    xor ebx, ebx

GoOn:

    dec ecx
    jnz NextCharText

SetNULL:

    lea  esi, BottomCode

    movq mm7, qword ptr [esi]
    movq qword ptr [edi], mm7

    add  edi, Eight   

    mov WORD PTR [edi], 00A0h;  CR + NULL

End_cycle:

    ret
   
CopyScreenText ENDP

; ----------------------------------------------------


The New Testbed is almost ready. Coming soon the first complete, but still unoptimized, version.  :P

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

dedndave

well - if all else fails - write the screen to a text file for them   :P
in fact, it might be nice if the text did not have the line characters in it
there is no rule that says the information that is pasted in the forum looks the same as the screen
also, with all the line characters, forum thread pages get long very fast

frktons

Quote from: dedndave on November 15, 2010, 07:03:52 PM
well - if all else fails - write the screen to a text file for them   :P
in fact, it might be nice if the text did not have the line characters in it
there is no rule that says the information that is pasted in the forum looks the same as the screen
also, with all the line characters, forum thread pages get long very fast

I really like line characters, but instead of copying the whole screen I think I'll only copy to clipboard
the part that contains the algo results, leaving out the empty one:

┌────────────────────────────────────────────────────────────────────────────────────────┐
│OS  : Microsoft Windows 7 Ultimate Edition, 64-bit (build 7600)                         │
│CPU : Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz with 2 logical core(s) with SSSE3           │
├──────────────────────────────────┬─────────┬──────────┬──────────┬──────────┬──────────┤
│        Algorithm notes           │Proc Size│ Test # 1 │ Test # 2 │ Test # 3 │ Test # 4 │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│01 Alex / MMX - PUNPCKLBW MOVQ    │    64   │    5.551 │    5.412 │    5.417 │    5.502 │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│02 Frank / 486 - MOV-BSWAP        │    43   │   12.114 │   11.882 │   11.892 │   12.156 │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│03 Frank / XMM PUNPCKLBW MOVDQA   │    45   │    2.347 │    2.361 │    2.584 │    2.591 │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│04 Alex / MMX - PUNPCKLBW MOVNTQ  │    64   │    8.522 │    8.311 │    8.317 │    8.364 │
├──────────────────────────────────┼─────────┼──────────┼──────────┼──────────┼──────────┤
│05 Frank / 386 - MOV-SHIFT        │    42   │   11.759 │   11.842 │   11.919 │   11.644 │


Frank

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

dedndave

here is the same stuff, with the extra lines removed, just for comparison
OS  : Microsoft Windows 7 Ultimate Edition, 64-bit (build 7600)
CPU : Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz with 2 logical core(s) with SSSE3
        Algorithm notes           │Proc Size│ Test # 1 │ Test # 2 │ Test # 3 │ Test # 4 │
01 Alex / MMX - PUNPCKLBW MOVQ    │    64   │    5.551 │    5.412 │    5.417 │    5.502 │
02 Frank / 486 - MOV-BSWAP        │    43   │   12.114 │   11.882 │   11.892 │   12.156 │
03 Frank / XMM PUNPCKLBW MOVDQA   │    45   │    2.347 │    2.361 │    2.584 │    2.591 │
04 Alex / MMX - PUNPCKLBW MOVNTQ  │    64   │    8.522 │    8.311 │    8.317 │    8.364 │
05 Frank / 386 - MOV-SHIFT        │    42   │   11.759 │   11.842 │   11.919 │   11.644 │


http://www.masm32.com/board/index.php?topic=15331.0

http://www.masm32.com/board/index.php?action=recent

frktons

Of course everybody can post the results in any way he likes.

I like readable stuff, well spaced, well aligned, well commented, even if it takes some lines more
as you can see from my coding style. These are old habits of an old ex professional coder. Bear
with me if you can  :lol

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

MichaelW

Quote from: frktons on November 15, 2010, 10:11:15 PM
Of course everybody can post the results in any way he likes.

I like readable stuff, well spaced, well aligned, well commented, even if it takes some lines more

I agree, the way you are currently formatting the screens is very good.
eschew obfuscation

Magnum

Quote from: frktons on November 15, 2010, 10:11:15 PM
Of course everybody can post the results in any way he likes.

I like readable stuff, well spaced, well aligned, well commented, even if it takes some lines more
as you can see from my coding style. These are old habits of an old ex professional coder. Bear
with me if you can  :lol

Frank

I like your your judicious use of these.
; -------------------------------------------------------------------------

Like men going to a store.

We're highly focused on the "mission." No offense ladies.

Andy

Have a great day,
                         Andy

frktons

Quote from: MichaelW on November 16, 2010, 03:31:33 AM

I agree, the way you are currently formatting the screens is very good.

Thanks Michael.  :U

Quote from: Magnum on November 16, 2010, 10:21:28 AM

I like your your judicious use of these.
; -------------------------------------------------------------------------

Like men going to a store.

We're highly focused on the "mission." No offense ladies.

Andy

That's a good one.  :lol
Mind is like a parachute. You know what to do in order to use it :-)