Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change
; --------------------------------------------------------------------------------------------------
; Procedure: UTF8ToWideSize
; Purpose: Calculate the amount of memory needed to store the converted WIDE string from a
; UTF8 stream.
; Arguments: Arg1: -> Source UTF8 BYTE stream. 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.
.code
align ALIGN_CODE
UTF8ToWideSize proc pSource:POINTER
?mov ecx, pSource
xor eax, eax
@@NextChar:
movzx edx, BYTE ptr [xcx]
test edx, edx ;ZTC?
.if ZERO?
add eax, sizeof(WORD) ;ZTC
ret
.endif
test edx, 10000000y
.if ZERO?
;1 Byte encoding (0xxxxxxx)
add eax, sizeof(WORD)
inc xcx
jmp @@NextChar
.endif
and edx, 11111000y
.if edx == 11110000y ;11110xxx
;4 Byte encoding (11110xxx 10xxxxxx 10xxxxxx 10xxxxxx)
add eax, sizeof(WORD)
add xcx, 4*sizeof(BYTE)
jmp @@NextChar
.endif
and edx, 11110000y
.if edx == 11100000y ;1110xxxx
;3 Byte encoding (1110xxxx 10xxxxxx 10xxxxxx)
add eax, sizeof(WORD)
add xcx, 3*sizeof(BYTE)
jmp @@NextChar
.endif
and edx, 11100000y
.if edx == 11000000y ;110xxxxx
;2 Byte encoding (110xxxxx 10xxxxxx)
add eax, sizeof(WORD)
add xcx, 2*sizeof(BYTE)
jmp @@NextChar
.endif
xor eax, eax ;Conversion error
ret
UTF8ToWideSize endp
Quote from: NoCforMe on June 19, 2025, 09:37:21 AMI had never heard of that,
Quotebut yeah, like that. Except that it wasn't anything like a multi-user multitasking "environment", just an overlay on top of DOS programs. It sure looked like the screenshots of the IBM thing, though.
xor eax, eax
mov esi, offset strHW
loop_start:
inc eax
mov edi, offset strHW + 5
add esi, eax
xor ecx, ecx
add ecx, 11
cld
repe cmpsb
jz found
cmp eax, 10
jne loop_start
found:
mov ebx, -1
Is anything I'm doing wrong or unconventional?include \masm32\include\masm32rt.inc
testing MACRO
xor eax, eax
mov esi, offset strHW
.REPEAT
inc eax
mov edi, offset strHW + 5
add esi, eax
xor ecx, ecx
add ecx, 11
cld
repe cmpsb
.IF !ZERO?
GOTO found
.ENDIF
.UNTIL eax == 10
:found
mov ebx, -1
ENDM
.data
data_start EQU $
strHW db 'Hello World!', 0
strQuery db 'test32.exe', 0
.code
start:
testing
push 0
call ExitProcess
end start
and I'm getting this error here.Quote from: LordAdef on June 18, 2025, 05:53:44 AMCongrats!
Quote from: FORTRANS on June 18, 2025, 11:06:40 PMHi,Quote from: NoCforMe on June 18, 2025, 08:08:22 AMI once wrote a pretty good text-based windowing system for 16-bit DOS apps. Worked pretty well: using 80x25 screens you had input and output fields, full control of color and several useful "gizmos" like pop-up boxes, "gas gauges", etc. Kind of like the old *nix-based curses package. Fun stuff.
Like IBM's Topview perhaps? Interesting.