加深对汇编指令的熟练

来源:互联网 发布:linux开启smtp服务 编辑:程序博客网 时间:2024/05/16 08:41

根据长度结束循环
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  .386
  .model flat,stdcall
  option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include  windows.inc
include  gdi32.inc
includelib gdi32.lib
include  user32.inc
includelib user32.lib
include  kernel32.inc
includelib kernel32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data
str1 byte "431028198516341"
testup byte "7"
testdown byte "3"
strBuffer byte sizeof str1 dup(0)
strMsg db "在3-7的数字",0
strMsg1 db "选出在3-7的数字",0
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start:
     pushad
     invoke MessageBox,0,addr str1,addr strMsg1,1
     mov edi,0
     mov esi,offset str1
     mov ecx,lengthof str1
L1:mov al,[esi]
     cmp al,testdown
     jb L2
     cmp al,testup
     ja L2
     mov  strBuffer[edi],al
     inc edi
L2:inc esi
     loop L1
     popad
     invoke MessageBox,0,addr strBuffer,addr strMsg,1
     invoke ExitProcess,NULL
     end start
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 根据读到0结束循环
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  .386
  .model flat,stdcall
  option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Include 文件定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include  windows.inc
include  gdi32.inc
includelib gdi32.lib
include  user32.inc
includelib user32.lib
include  kernel32.inc
includelib kernel32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data
str1 byte "43128198516341",0
testup byte "7"
testdown byte "3"
strBuffer byte sizeof str1 dup(0)
strMsg db "在3-7的数字",0
strMsg1 db "选出在3-7的数字",0
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start:
     pushad
     invoke MessageBox,0,addr str1,addr strMsg1,1
     mov edi,0
     mov esi,offset str1
L1:mov al,[esi]
     cmp al,0
     je L3
     cmp al,testdown
     jb L2
     cmp al,testup
     ja L2
     mov  strBuffer[edi],al
     inc edi
L2:inc esi
     jmp L1
L3:popad
     invoke MessageBox,0,addr strBuffer,addr strMsg,1
     invoke ExitProcess,NULL
     end start
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

原创粉丝点击