设为首页收藏本站淘宝杂货铺

从F到0 - From F to 0

 找回密码
 注册已关闭
搜索
查看: 569|回复: 0
收起左侧

易语言MASM置入代码判断整数型数组中是否存在大于/小于/等于指定值的成员(返回逻辑型)

[复制链接]
发表于 2022-12-22 21:17:29 | 显示全部楼层 |阅读模式
1.png
  1. .版本 2

  2. .程序集 程序集1

  3. .子程序 _启动子程序, 整数型, , 请在本子程序中放置易模块初始化代码


  4. _临时子程序 ()  ' 在初始化代码执行完毕后调用测试代码
  5. 返回 (0)  ' 可以根据您的需要返回任意数值

  6. .子程序 _临时子程序
  7. .局部变量 A, 整数型, , "0"

  8. A = { 1, 2, 3, 4, 5 }
  9. 信息框 (整数型数组_寻找大于值 (A, 4), 0, , )  ' 数组中存在大于4的值,返回真
  10. A = { 1, 2, 3, 4, 5, -1, -2, -3, -4, -5 }
  11. 信息框 (整数型数组_寻找小于值 (A, -10), 0, , )  ' 数组中不存在小于-10的值,返回假
  12. A = { 1, 2, 3, 4, 5, -1, -2, -3, -4, -5 }
  13. 信息框 (整数型数组_寻找 (A, -1), 0, , )  ' 数组中存在-1,返回真

  14. .子程序 整数型数组_寻找大于值, 逻辑型, 公开, 数组中存在大于数值的成员,返回真,否则返回假,空数组返回假
  15. .参数 数组, 整数型, 数组
  16. .参数 数值, 整数型

  17. 置入代码 ({ 83, 81, 82, 139, 69, 8, 11, 192, 117, 2, 235, 48, 139, 0, 11, 192, 117, 2, 235, 40, 139, 88, 4, 11, 219, 117, 4, 51, 192, 235, 29, 131, 192, 8, 139, 85, 12, 51, 201, 235, 13, 57, 20, 136, 126, 7, 184, 1, 0, 0, 0, 235, 7, 65, 59, 203, 114, 239, 51, 192, 90, 89, 91, 201, 194, 8, 0 })
  18. ' push ebx
  19. ' push ecx
  20. ' push edx
  21. ' mov eax,[ebp+8]
  22. ' .if !eax
  23. ' jmp ASM_END
  24. ' .endif
  25. ' mov eax,[eax]
  26. ' .if !eax
  27. ' jmp ASM_END
  28. ' .endif
  29. ' mov ebx,[eax+4]
  30. ' .if !ebx
  31. ' xor eax,eax
  32. ' jmp ASM_END
  33. ' .endif
  34. ' add eax,8
  35. ' mov edx,[ebp+12]
  36. ' xor ecx,ecx
  37. ' .while ecx < ebx
  38. ' .if sdword ptr [eax+ecx*4] > edx
  39. ' mov eax,1
  40. ' jmp ASM_END
  41. ' .endif
  42. ' inc ecx
  43. ' .endw
  44. ' xor eax,eax
  45. ' ASM_END:
  46. ' pop edx
  47. ' pop ecx
  48. ' pop ebx
  49. ' leave
  50. ' retn 8
  51. 返回 (假)

  52. .子程序 整数型数组_寻找小于值, 逻辑型, 公开, 数组中存在小于数值的成员,返回真,否则返回假,空数组返回假
  53. .参数 数组, 整数型, 数组
  54. .参数 数值, 整数型

  55. 置入代码 ({ 83, 81, 82, 139, 69, 8, 11, 192, 117, 2, 235, 48, 139, 0, 11, 192, 117, 2, 235, 40, 139, 88, 4, 11, 219, 117, 4, 51, 192, 235, 29, 131, 192, 8, 139, 85, 12, 51, 201, 235, 13, 57, 20, 136, 125, 7, 184, 1, 0, 0, 0, 235, 7, 65, 59, 203, 114, 239, 51, 192, 90, 89, 91, 201, 194, 8, 0 })
  56. ' push ebx
  57. ' push ecx
  58. ' push edx
  59. ' mov eax,[ebp+8]
  60. ' .if !eax
  61. ' jmp ASM_END
  62. ' .endif
  63. ' mov eax,[eax]
  64. ' .if !eax
  65. ' jmp ASM_END
  66. ' .endif
  67. ' mov ebx,[eax+4]
  68. ' .if !ebx
  69. ' xor eax,eax
  70. ' jmp ASM_END
  71. ' .endif
  72. ' add eax,8
  73. ' mov edx,[ebp+12]
  74. ' xor ecx,ecx
  75. ' .while ecx < ebx
  76. ' .if sdword ptr [eax+ecx*4] < edx
  77. ' mov eax,1
  78. ' jmp ASM_END
  79. ' .endif
  80. ' inc ecx
  81. ' .endw
  82. ' xor eax,eax
  83. ' ASM_END:
  84. ' pop edx
  85. ' pop ecx
  86. ' pop ebx
  87. ' leave
  88. ' retn 8
  89. 返回 (假)

  90. .子程序 整数型数组_寻找, 逻辑型, 公开, 数组中存在指定成员,返回真,否则返回假,空数组返回假
  91. .参数 数组, 整数型, 数组
  92. .参数 数值, 整数型

  93. 置入代码 ({ 83, 81, 82, 139, 69, 8, 11, 192, 117, 2, 235, 48, 139, 0, 11, 192, 117, 2, 235, 40, 139, 88, 4, 11, 219, 117, 4, 51, 192, 235, 29, 131, 192, 8, 139, 85, 12, 51, 201, 235, 13, 57, 20, 136, 117, 7, 184, 1, 0, 0, 0, 235, 7, 65, 59, 203, 114, 239, 51, 192, 90, 89, 91, 201, 194, 8, 0 })
  94. ' push ebx
  95. ' push ecx
  96. ' push edx
  97. ' mov eax,[ebp+8]
  98. ' .if !eax
  99. ' jmp ASM_END
  100. ' .endif
  101. ' mov eax,[eax]
  102. ' .if !eax
  103. ' jmp ASM_END
  104. ' .endif
  105. ' mov ebx,[eax+4]
  106. ' .if !ebx
  107. ' xor eax,eax
  108. ' jmp ASM_END
  109. ' .endif
  110. ' add eax,8
  111. ' mov edx,[ebp+12]
  112. ' xor ecx,ecx
  113. ' .while ecx < ebx
  114. ' .if [eax+ecx*4] == edx
  115. ' mov eax,1
  116. ' jmp ASM_END
  117. ' .endif
  118. ' inc ecx
  119. ' .endw
  120. ' xor eax,eax
  121. ' ASM_END:
  122. ' pop edx
  123. ' pop ecx
  124. ' pop ebx
  125. ' leave
  126. ' retn 8
  127. 返回 (假)
复制代码

相关帖子

您需要登录后才可以回帖 登录 | 注册已关闭

本版积分规则

QQ|手机版|Archiver|从F到0 ( 蒙ICP备17002595号-1 )
蒙公网安备15010402000325号

腾讯云安全认证

GMT+8, 2024-4-20 19:16 , Processed in 0.571033 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表