Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8312411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:09:19+00:00 2026-06-08T20:09:19+00:00

I just started playing around with MASM styled assembly and after playing around long

  • 0

I just started playing around with MASM styled assembly and after playing around long enough managed to make a sort of loop. This is just from tinkering so I was wondering if anybody could give me any insight and explanation on if this code is inefficient or how it can be improved.

.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib

.data
MsgBxTitle db "Loop Step", NULL

.data?
Buff dd ?
MsgBxBody dd ?

.code
start:
XOR eax,eax
MOV Buff, eax 
lp:
invoke dw2hex, Buff, addr MsgBxBody
invoke MessageBox, NULL, addr MsgBxBody, addr MsgBxTitle, MB_OKCANCEL
.IF eax==IDCANCEL
RET
.ENDIF
INC Buff
CMP Buff,10
JL lp
RET
end lp
invoke ExitProcess, NULL
end start
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:09:20+00:00Added an answer on June 8, 2026 at 8:09 pm

    You can shave 16 bytes off the code this way. Zero a register and push that for zero. Use a register for you dword buffer. Using registers Assemble to smaller opcodes and are “faster” than memory (labels).

    I personally don’t like/use the high level stuff.

    start:
        xor     edi, edi
        xor     esi, esi
        mov     ebx, 10
    lp:
        push    offset MsgBxBody
        push    edi
        call    dw2hex
    
        push    MB_OKCANCEL
        push    offset MsgBxTitle
        push    offset MsgBxBody
        push    esi
        call    MessageBox
        test    eax, IDCANCEL
        jnz     Done
    
        inc     edi
        dec     ebx
        jns     lp
    
    Done:
        push    esi
        call    ExitProcess
    end start
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just started playing around with android, so pardon me if this is a
I just started playing around with MSBuild this evening and am porting an nAnt
I've just started playing around in Haskell. After years of Ruby, I got used
I just started playing around with Amazon S3 and CloudFront and have managed to
I just started playing around with JSON and I have created this example. var
I've just started playing around with Android Licensing and I ran into this problem.
Just started playing around with ice_cube I've got a weekly schedule (with a granularity
I just started playing around with threading today and I ran into something that
I just started playing around with the 960 CSS framework and found that it
I'm just started on playing around with the canvas HTML5-object. For the sake of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.