这个代码应该怎么优化?
查了好久, 网上一直都在说 bytes. 不过老师也没讲过,连 .if都没讲过, 实在是不知道如何优化这个代码了, 请大神帮我看看
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
; Build this with the "Project" menu using
; "Console Assemble & Link"
comment * «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
This demo shows how to perform simple addition using registers and assembler
instructions in the first example. The second example shows how to compare
a memory variable to an immediate number and branch to different labels
depending on how large the number is. Branching logic in assembler is very
simple and compact code.
««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« *
.486
.model flat, stdcall
option casemap :none
include \masm32\include\masm32rt.inc
include \masm32\macros\macros.asm ; MASM support macros
; ------------------------------------------------
; Library files that have definitions for function
; exports and tested reliable prebuilt code.
; ------------------------------------------------
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
; ------------------------------------------------
; Library files that have definitions for function
; exports and tested reliable prebuilt code.
; ------------------------------------------------
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
.code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
call main
exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
main proc
LOCAL str1:DWORD ; space for a DWORD variable
LOCAL var1:DWORD ; a string handle for the input data
; test the MOV and ADD instructions
mov eax, 100
mov ecx, 250
add ecx, eax
print str$(ecx)
print chr$(13,10,13,10)
; ----------------------------------------
; The two following macros can be combined
; once you are familiar with how they work
; ----------------------------------------
;mov str1, input("Enter a number : ")
;mov var1, sval(str1) ; convert the result to a signed integer
mov var1, sval(input("Enter a number : "))
cmp var1, 100
je equal
jg bigger
jl smaller
equal:
print chr$("The number you entered is 100",13,10)
jmp over
bigger:
print chr$("The number you entered is greater than 100",13,10)
jmp over
smaller:
print chr$("The number you entered is smaller than 100",13,10)
over:
ret
main endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start