我剛開始玩弄MASM風格的大會,玩了足夠長的時間後,做了一個循環。這只是從修補,所以我想知道是否有人可以給我任何洞察力和解釋,如果這種代碼效率低下或如何改進。任何方式使此片段更有效?
.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
定義高效。 :-)我看到少於10條機器指令,所以沒有太多需要切斷的地方,是嗎? – 2012-07-31 23:21:25
效率我的意思是無論如何,我應該格式化我的代碼,或者我應該使用任何更好的方法來實現相同的結果,例如較小的代碼 - >相同的結果 – 2012-07-31 23:33:46