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

从F到0 - From F to 0

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

易语言MASM置入代码交换替换长整数型/日期时间型/双精度小数型数组的指定值(无返回值)

[复制链接]
发表于 2020-10-4 19:54:00 | 显示全部楼层 |阅读模式
1.png

  1. .版本 2
  2. .支持库 spec

  3. .程序集 程序集1

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


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

  7. .子程序 _临时子程序
  8. .局部变量 A, 长整数型, , "0"
  9. .局部变量 B, 日期时间型, , "0"
  10. .局部变量 C, 双精度小数型, , "0"

  11. A = { 1, 2, 3, 4, 5 }
  12. B = { [2020年1月1日], [2022年12月21日], [2032年1月6日], [2020年1月1日], [2032年1月6日] }
  13. 长整数型数组_交换数值 (A, 1, 2)
  14. 调试输出 (A)
  15. 日期时间型数组_交换数值 (B, [2032年1月6日], [2020年1月1日])
  16. 调试输出 (B)
  17. C = { 3.14, 3.14, 4.13, 123 }
  18. 双精度小数型数组_交换数值 (C, 3.14, 4.13)
  19. 调试输出 (C)

  20. .子程序 长整数型数组_交换数值, , 公开, 被交换值=1 交换值=2 检测到2则写入1,检测到1则写入2,不能相同否则不转换
  21. .参数 数组, 长整数型, 数组
  22. .参数 被交换值, 长整数型
  23. .参数 交换值, 长整数型

  24. 置入代码 ({ 80, 83, 81, 86, 87, 139, 69, 12, 139, 93, 16, 59, 69, 20, 117, 7, 59, 93, 24, 117, 2, 235, 93, 139, 69, 8, 11, 192, 117, 2, 235, 84, 139, 0, 11, 192, 117, 2, 235, 76, 139, 88, 4, 11, 219, 117, 2, 235, 67, 131, 192, 8, 51, 201, 235, 56, 139, 52, 200, 139, 124, 200, 4, 59, 117, 12, 117, 20, 59, 125, 16, 117, 15, 139, 117, 20, 139, 125, 24, 137, 52, 200, 137, 124, 200, 4, 235, 23, 59, 117, 20, 117, 18, 59, 125, 24, 117, 13, 139, 117, 12, 139, 125, 16, 137, 52, 200, 137, 124, 200, 4, 65, 59, 203, 114, 196, 95, 94, 89, 91, 88 })
  25. ' push eax
  26. ' push ebx
  27. ' push ecx
  28. ' push esi
  29. ' push edi
  30. ' mov eax,[ebp+12]
  31. ' mov ebx,[ebp+16]
  32. ' .if eax == [ebp+20] && ebx == [ebp+24]
  33. ' jmp ASM_END
  34. ' .endif
  35. ' mov eax,[ebp+8]
  36. ' .if !eax
  37. ' jmp ASM_END
  38. ' .endif
  39. ' mov eax,[eax]
  40. ' .if !eax
  41. ' jmp ASM_END
  42. ' .endif
  43. ' mov ebx,[eax+4]
  44. ' .if !ebx
  45. ' jmp ASM_END
  46. ' .endif
  47. ' add eax,8
  48. ' xor ecx,ecx
  49. ' .while ecx < ebx
  50. ' mov esi,[ecx*8+eax]
  51. ' mov edi,[ecx*8+eax+4]
  52. ' .if esi == [ebp+12] && edi == [ebp+16]
  53. ' mov esi,[ebp+20]
  54. ' mov edi,[ebp+24]
  55. ' mov [ecx*8+eax],esi
  56. ' mov [ecx*8+eax+4],edi
  57. ' .elseif esi == [ebp+20] && edi == [ebp+24]
  58. ' mov esi,[ebp+12]
  59. ' mov edi,[ebp+16]
  60. ' mov [ecx*8+eax],esi
  61. ' mov [ecx*8+eax+4],edi
  62. ' .endif
  63. ' inc ecx
  64. ' .endw
  65. ' ASM_END:
  66. ' pop edi
  67. ' pop esi
  68. ' pop ecx
  69. ' pop ebx
  70. ' pop eax


  71. .子程序 日期时间型数组_交换数值, , 公开, 代码与 长整数型数组_交换数值() 相同
  72. .参数 数组, 日期时间型, 数组
  73. .参数 被交换值, 日期时间型
  74. .参数 交换值, 日期时间型

  75. 置入代码 ({ 80, 83, 81, 86, 87, 139, 69, 12, 139, 93, 16, 59, 69, 20, 117, 7, 59, 93, 24, 117, 2, 235, 93, 139, 69, 8, 11, 192, 117, 2, 235, 84, 139, 0, 11, 192, 117, 2, 235, 76, 139, 88, 4, 11, 219, 117, 2, 235, 67, 131, 192, 8, 51, 201, 235, 56, 139, 52, 200, 139, 124, 200, 4, 59, 117, 12, 117, 20, 59, 125, 16, 117, 15, 139, 117, 20, 139, 125, 24, 137, 52, 200, 137, 124, 200, 4, 235, 23, 59, 117, 20, 117, 18, 59, 125, 24, 117, 13, 139, 117, 12, 139, 125, 16, 137, 52, 200, 137, 124, 200, 4, 65, 59, 203, 114, 196, 95, 94, 89, 91, 88 })
  76. ' push eax
  77. ' push ebx
  78. ' push ecx
  79. ' push esi
  80. ' push edi
  81. ' mov eax,[ebp+12]
  82. ' mov ebx,[ebp+16]
  83. ' .if eax == [ebp+20] && ebx == [ebp+24]
  84. ' jmp ASM_END
  85. ' .endif
  86. ' mov eax,[ebp+8]
  87. ' .if !eax
  88. ' jmp ASM_END
  89. ' .endif
  90. ' mov eax,[eax]
  91. ' .if !eax
  92. ' jmp ASM_END
  93. ' .endif
  94. ' mov ebx,[eax+4]
  95. ' .if !ebx
  96. ' jmp ASM_END
  97. ' .endif
  98. ' add eax,8
  99. ' xor ecx,ecx
  100. ' .while ecx < ebx
  101. ' mov esi,[ecx*8+eax]
  102. ' mov edi,[ecx*8+eax+4]
  103. ' .if esi == [ebp+12] && edi == [ebp+16]
  104. ' mov esi,[ebp+20]
  105. ' mov edi,[ebp+24]
  106. ' mov [ecx*8+eax],esi
  107. ' mov [ecx*8+eax+4],edi
  108. ' .elseif esi == [ebp+20] && edi == [ebp+24]
  109. ' mov esi,[ebp+12]
  110. ' mov edi,[ebp+16]
  111. ' mov [ecx*8+eax],esi
  112. ' mov [ecx*8+eax+4],edi
  113. ' .endif
  114. ' inc ecx
  115. ' .endw
  116. ' ASM_END:
  117. ' pop edi
  118. ' pop esi
  119. ' pop ecx
  120. ' pop ebx
  121. ' pop eax


  122. .子程序 双精度小数型数组_交换数值, , 公开, 代码与 长整数型数组_交换数值() 相同
  123. .参数 数组, 双精度小数型, 数组
  124. .参数 被交换值, 双精度小数型
  125. .参数 交换值, 双精度小数型

  126. 置入代码 ({ 80, 83, 81, 86, 87, 139, 69, 12, 139, 93, 16, 59, 69, 20, 117, 7, 59, 93, 24, 117, 2, 235, 93, 139, 69, 8, 11, 192, 117, 2, 235, 84, 139, 0, 11, 192, 117, 2, 235, 76, 139, 88, 4, 11, 219, 117, 2, 235, 67, 131, 192, 8, 51, 201, 235, 56, 139, 52, 200, 139, 124, 200, 4, 59, 117, 12, 117, 20, 59, 125, 16, 117, 15, 139, 117, 20, 139, 125, 24, 137, 52, 200, 137, 124, 200, 4, 235, 23, 59, 117, 20, 117, 18, 59, 125, 24, 117, 13, 139, 117, 12, 139, 125, 16, 137, 52, 200, 137, 124, 200, 4, 65, 59, 203, 114, 196, 95, 94, 89, 91, 88 })
  127. ' push eax
  128. ' push ebx
  129. ' push ecx
  130. ' push esi
  131. ' push edi
  132. ' mov eax,[ebp+12]
  133. ' mov ebx,[ebp+16]
  134. ' .if eax == [ebp+20] && ebx == [ebp+24]
  135. ' jmp ASM_END
  136. ' .endif
  137. ' mov eax,[ebp+8]
  138. ' .if !eax
  139. ' jmp ASM_END
  140. ' .endif
  141. ' mov eax,[eax]
  142. ' .if !eax
  143. ' jmp ASM_END
  144. ' .endif
  145. ' mov ebx,[eax+4]
  146. ' .if !ebx
  147. ' jmp ASM_END
  148. ' .endif
  149. ' add eax,8
  150. ' xor ecx,ecx
  151. ' .while ecx < ebx
  152. ' mov esi,[ecx*8+eax]
  153. ' mov edi,[ecx*8+eax+4]
  154. ' .if esi == [ebp+12] && edi == [ebp+16]
  155. ' mov esi,[ebp+20]
  156. ' mov edi,[ebp+24]
  157. ' mov [ecx*8+eax],esi
  158. ' mov [ecx*8+eax+4],edi
  159. ' .elseif esi == [ebp+20] && edi == [ebp+24]
  160. ' mov esi,[ebp+12]
  161. ' mov edi,[ebp+16]
  162. ' mov [ecx*8+eax],esi
  163. ' mov [ecx*8+eax+4],edi
  164. ' .endif
  165. ' inc ecx
  166. ' .endw
  167. ' ASM_END:
  168. ' pop edi
  169. ' pop esi
  170. ' pop ecx
  171. ' pop ebx
  172. ' pop eax


复制代码

相关帖子

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

本版积分规则

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

腾讯云安全认证

GMT+8, 2024-4-19 12:04 , Processed in 0.579033 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

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