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
UASM Assembler Development / Re: Linux users, please
Last post by TimoVJL - Today at 01:27:56 AM
linux have wine libs for common Win32 API

A IBM TopView had rival:
DESQview
#2
The Campus / Re: Nested .REPEAT, .IF and .W...
Last post by _japheth - Today at 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.
#3
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
#4
UASM Assembler Development / Re: Linux users, please
Last post by FORTRANS - June 20, 2025, 10:09:18 PM
Hi,

Quote from: NoCforMe on June 19, 2025, 09:37:21 AMI had never heard of that,

   Ah, well it was fairly short lived, I suppose.  But it was fun to
try it out.

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.

   Well, I was wondering about that.  Nice to hear about it.

Thanks,

Steve N.
#5
The Campus / Re: Nested .REPEAT, .IF and .W...
Last post by Quan - June 20, 2025, 07:18:14 PM
Adding to this, I'm essentially trying to replicate this chunk of code in a macro so I can use it multiple times.
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?

EDIT: Minor, unrelated logic error, cmp instruction at the end of the loop is supposed to compare eax with 10, not ecx with 10.
#6
The Campus / Nested .REPEAT, .IF and .WHILE...
Last post by Quan - June 20, 2025, 07:12:40 PM
I have this simple programme here
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.
C:\3\test.asm(35) : fatal error A1010:unmatched block nesting : .if-.repeat-.while

I think my syntax is correct. Am I missing something? Or .if being nested in .repeat is not allowed?

EDIT: The condition in .UNTIL is supposed to be eax == 10 and not ecx == 10. The same error is still produced after this edit.
#7
UASM Assembler Development / Re: Linux users, please
Last post by daydreamer - June 20, 2025, 04:42:14 PM
Cross platform, wrapper functions
Like proc with winapi function names,inside is invoke to Linux same function?
Or the other way around?
#8
Showcase / Re: mcLB2, a new Windows contr...
Last post by NoCforMe - June 19, 2025, 09:40:52 AM
Quote from: LordAdef on June 18, 2025, 05:53:44 AMCongrats!

Thanks. Maybe you want to try it sometime?
#9
UASM Assembler Development / Re: Linux users, please
Last post by NoCforMe - June 19, 2025, 09:37:21 AM
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.

I had never heard of that, but 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.

The original one I wrote in the late 1980s was written in assembly language. Later I wrote a similar but less extensive package that I called the "Gizmo" package, also for DOS programs. That one was written in C and used the curses library.
#10
ObjAsm / Re: New Editor
Last post by Biterider - June 19, 2025, 03:15:09 AM
Hi
Today was an exciting day! I ran a Lua script in the editor for the first time.  :cool:

After spending a few hours setting things up, I ran a simple 'Hello World' print command from within a Lua script.
Initially, I couldn't see anything because I had forgotten to update the view. However, as soon as I scrolled down a bit, there it was! It looked great!   :biggrin:

Designing the interface between the script engine and the editor is challenging because I don't yet know exactly which commands I will need. I'll start with a small set of commands and extend them as necessary.

Biterider