News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Recent posts

#1
The Campus / Re: FillConsoleOutputCharacter...
Last post by zedd - June 21, 2025, 11:16:28 PM
Offhand 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)
#2
The Campus / FillConsoleOutputCharacterA no...
Last post by sskaiser - June 21, 2025, 09:53:03 PM
Hey i'm writing this code but rn i can't get it to work, here it is:
clr PROC   
   SUB RSP, 40
   MOV RCX, stdout
   MOVZX RAX, csbi.dwSize.X
   MOVZX RBX, csbi.dwSize.Y
   MUL RBX
   MOV RDX, 32
   MOV R8, RAX
   XOR R9, R9
   MOV num, 0
   LEA RAX, num
   mov QWORD PTR [RSP + 32], RAX
   CALL FillConsoleOutputCharacterA
   ADD RSP, 40
   RET
clr ENDP

variables here:
num DWORD ?
csbi CONSOLE_SCREEN_BUFFER_INFO <> (exactly like in the windows docs, i know it works cuz i use it to get the size)

Also I'm not using the SDK because i'm following a challenge of not using any external code.

#3
ObjAsm / Re: UTF8 performance
Last post by Biterider - June 21, 2025, 09:50:45 PM
Hi
The required size determination for the inverse function is even simpler:

; --------------------------------------------------------------------------------------------------
; 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

Biterider
#4
The Workshop / Re: Looking for MASM feature p...
Last post by fearless - June 21, 2025, 01:52:46 PM
I think it was https://bytepointer.com

But seems to be down, the last snapshot on the wayback machine is this one:

https://web.archive.org/web/20240623141221/https://bytepointer.com/masm/index.htm
#5
The Workshop / Looking for MASM feature per v...
Last post by Shintaro - June 21, 2025, 09:31:45 AM
Hi,

There was a website that showed the different releases of MASM and when the feature/keyword was released.

For the life of me I cannot find that website.

Does anyone know it?

Cheers.
#6
UASM Assembler Development / Re: Linux users, please
Last post by NoCforMe - June 21, 2025, 05:24:45 AM
Quote from: daydreamer on June 20, 2025, 04:42:14 PMCross platform, wrapper functions
Like proc with winapi function names,inside is invoke to Linux same function?
Or the other way around?

You're asking about the package I wrote?
None of the above; it was just an overlay for DOS programs that gave you a text-based windowed interface.
#7
UASM Assembler Development / Re: Linux users, please
Last post by daydreamer - June 21, 2025, 05:01:56 AM
The only "multitasking" in oldest computers was main basic program, while machine code snippet was setup as vblank retrace interrupt
Inspired me to setup wm_timer 1/30 second for game / animation physics + start wm_paint message

#8
UASM Assembler Development / Re: Linux users, please
Last post by TimoVJL - June 21, 2025, 01:27:56 AM
linux have wine libs for common Win32 API

A IBM TopView had rival:
DESQview
#9
The Campus / Re: Nested .REPEAT, .IF and .W...
Last post by _japheth - June 21, 2025, 12:14:41 AM
Hi,

GOTO is an "assembly-time" jump, accepted inside macros only, and probably only useful if combined with conditional assembly instructions ( IF, ELSE [note the missing "dot"]).
That's supposedly not at all what you did want to do!? A simple JMP should work better.
#10
ObjAsm / Re: UTF8 performance
Last post by Biterider - June 20, 2025, 11:15:27 PM
Hi
I had to write a procedure to determine the required buffer size in advance when converting from UTF-8 to wide characters.
The code is essentially a stripped-down version of the code used for the conversion.

; --------------------------------------------------------------------------------------------------
; 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

Biterider