Search found 2269 matches

by jj2007
Jan 09, 2022 17:31
Forum: General
Topic: UpperCase in ASM
Replies: 30
Views: 2094

Re: UpperCase in ASM

Extra short uppercase: Function UpperCaseJ Naked (s As String) As ZString Ptr Asm mov rax, QWORD Ptr [rcx] or edx, -1 _loopJ: inc edx movzx ecx, Byte Ptr [rax+rdx] jecxz _exitJ cmp ecx, 97 ' a jb _loopJ cmp ecx, 122 ' z ja _loopJ and cl, 223 mov [rax+rdx], cl jmp _loopJ _exitJ: ret End Asm End Funct...
by jj2007
Jan 09, 2022 17:22
Forum: General
Topic: asm noob - registers
Replies: 23
Views: 837

Re: asm noob - registers

Afaik Popcnt is a bottleneck on intel (from Sandy bridge to Skylake and derivatives). Summing 127 times (and then expanding to dword) avoids that. There is a thread on popcnt timings here . "Summing 127 times" sounds slow, but I must admit that I don't quite understand what your code does...
by jj2007
Jan 09, 2022 16:13
Forum: General
Topic: UpperCase in ASM
Replies: 30
Views: 2094

Re: UpperCase in ASM

A variant: Function UpperCaseJ Naked (s As String) As ZString Ptr Asm mov rax, QWORD Ptr [rcx] or ecx, -1 _loopJ: inc ecx movzx edx, Byte Ptr [rax+rcx] test edx, edx jz _exitJ cmp edx, 97 ' a jb _loopJ cmp edx, 122 ' z ja _loopJ and dl, 223 mov [rax+rcx], dl jmp _loopJ _exitJ: ret End Asm End Functi...
by jj2007
Jan 08, 2022 22:22
Forum: General
Topic: asm noob - registers
Replies: 23
Views: 837

Re: asm noob - registers

this is more for scanning for first <x> (based on pcmpeqb) and less for counting <x>. I'm doing counting. This counts the 80h in x7: include \masm32\MasmBasic\MasmBasic.inc .data mask4 OWORD 80808080808080808080808080808080h ; 16*80h x7 OWORD 80008000000080808000800000000080h ; 7*80h Init movups xm...
by jj2007
Jan 07, 2022 22:31
Forum: General
Topic: asm noob - registers
Replies: 23
Views: 837

Re: asm noob - registers

Could you review the asm routine I made last week then? Advanced stuff, looks good. There is not much to gain, performance-wise; these are standard SIMD sequences, and you can rarely speed them up. You might play with aligning innermost loop to 4 or 8 bytes, but even that does not have much effect ...
by jj2007
Jan 07, 2022 13:30
Forum: Windows
Topic: Mini Scintilla editor
Replies: 7
Views: 1438

Re: Mini Scintilla editor

aurelVZAB wrote:thanks jj !
You are welcome. I could send you a PM on Masm32 if you like.
by jj2007
Jan 07, 2022 13:16
Forum: General
Topic: asm noob - registers
Replies: 23
Views: 837

Re: asm noob - registers

Munair wrote:You are right
Most of the time, when it comes to Assembly ;-)
Test this:

Code: Select all

  mov ecx, 10
  mov eax, 100
  mov edx, 123
  imul eax, ecx
by jj2007
Jan 07, 2022 12:16
Forum: General
Topic: asm noob - registers
Replies: 23
Views: 837

Re: asm noob - registers

Munair wrote:MUL doesn't overwrite EDX
MUL always overwrites edx. You can use esi edi ebx, but you must save them before and restore them after, e.g. with

Code: Select all

push esi
push edi
... do your stuff ...
pop edi
pop esi
by jj2007
Jan 06, 2022 22:03
Forum: Windows
Topic: Mini Scintilla editor
Replies: 7
Views: 1438

Re: Mini Scintilla editor

It compiles fine, congrats!
by jj2007
Jan 03, 2022 14:37
Forum: Windows
Topic: How to set the text alignment of a static control ?
Replies: 9
Views: 1749

Re: How to set the text alignment of a static control ?

using SS_OWNERDRAW is the best option. It gives us full control. But we need to draw the entire control. As mentioned earlier, you can also draw directly in the client area of the main window. Pseudocode: MakeBrush hBrush, LiteGrey MakeFont hFont, Height:-16, "Arial Black" Event Paint mov...
by jj2007
Jan 03, 2022 12:37
Forum: Windows
Topic: How to set the text alignment of a static control ?
Replies: 9
Views: 1749

Re: How to set the text alignment of a static control ?

It might even be easier to draw on the main window's DC. No control needed.
by jj2007
Jan 03, 2022 12:19
Forum: Windows
Topic: How to set the text alignment of a static control ?
Replies: 9
Views: 1749

Re: How to set the text alignment of a static control ?

See the doc. I'm afraid that is a case for an ownerdraw exercise...
by jj2007
Dec 27, 2021 15:42
Forum: Windows
Topic: Question about drawing stage in NMCUSTOMDRAW
Replies: 8
Views: 1774

Re: Question about drawing stage in NMCUSTOMDRAW

I haven't used it for a while, but looking at old code it seems that only CDDS_PREERASE and CDDS_PREPAINT are relevant.
by jj2007
Dec 27, 2021 15:37
Forum: Community Discussion
Topic: Revamping the forum?
Replies: 129
Views: 20701

Re: Revamping the forum?

@everybody: cool down a bit. The format of this forum could be improved, but not much - it's already good "as is". Has anybody noticed that there has been incredible activity over the past weeks? I wish other forums would be so active.
by jj2007
Dec 25, 2021 15:59
Forum: Windows
Topic: Flicker controls problem in a window
Replies: 4
Views: 1125

Re: Flicker controls problem in a window

Your code is fine, and under normal conditions there will be no flicker. What is not normal is that you have many buttons, and that means hard work for Windows serving your program. Therefore a certain delay in repainting the buttons.