Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change
Quote from: zedd on June 21, 2025, 11:16:28 PMOffhand I would say we need more information. Are you using GetConsoleScreenBufferInfo to fill the CONSOLE_SCREEN_BUFFER_INFO structure? Is the structure getting filled properly? Is the handle to stdout valid?
Perhaps post the (pertinent) code that you used prior to calling your clr procedure??
Have you stepped the code in a debugger? (While watching return values in rax and watching whether or not any exceptions are found)
Quote from: Quan on June 22, 2025, 12:19:25 AMBecause putting a label in a macro for the JMP instruction, and then using the macro multiple times causes the compiling to complain about label redefinition. Or is that okay and can safely be ignored?
Quote from: _japheth on June 21, 2025, 12:14:41 AMThat's supposedly not at all what you did want to do!? A simple JMP should work better.I don't think this works? Because putting a label in a macro for the JMP instruction, and then using the macro multiple times causes the compiling to complain about label redefinition. Or is that okay and can safely be ignored?
; --------------------------------------------------------------------------------------------------
; Procedure: WideToUTF8Size
; Purpose: Calculate the amount of memory needed to store the converted UTF8 stream from a
; WIDE string.
; Arguments: Arg1: -> Source WIDE string. Must be zero terminated.
; Return: eax = Number of BYTEs requred. Zero if failed.
; Notes: The ZTC is always included in size calculations.
; The returned value can only be zero if the procedure fails.
; Wide chars can only encode the Basic Multilingual Plane (BMP, or Plane 0),
; meaning that sequences of a maximum of three bytes can be generated.
.code
align ALIGN_CODE
WideToUTF8Size proc pSource:POINTER
xor eax, eax
?mov ecx, pSource
.if xcx == NULL
ret
.endif
@@NextChar:
movzx edx, CHRW ptr [xcx]
test edx, edx
.if ZERO?
inc eax ;Include this last ZTC
ret
.endif
.if edx <= 07Fh
inc eax
.elseif edx <= 07FFh
add eax, 2
.else
add eax, 3
.endif
add xcx, sizeof(CHRW)
jmp @@NextChar
WideToUTF8Size endp