简单分支程序设计实验

1076阅读 0评论2012-05-09 高傲的活着
分类:IT职场

1.编写程序,计算下面函数的值并输出。

点击(此处)折叠或打开

  1. TITLE Program Template (Template.asm)
  2. ; Template for Win32 Console Application
  3. ; Program Description:
  4. ; Author:
  5. ; Creation Date:
  6. ; Revisions:
  7. ; Last update: 09/01/2009 Modified by:
  8. include io32.inc
  9. .data
  10. ; (insert variables here)
  11. x byte ?
  12. array byte 'enter x:',0
  13. .code
  14. main proc
  15. ; (insert executable instructions here)
  16. mov eax,offset array ;字符串首地址送eax
  17. call dispmsg ;调用子程序dispmsg显示字符串
  18. call readsid
  19. cmp eax,0
  20. jl two ;表示有符号中 <
  21. cmp eax,10
  22. jle three ;表示有符号中 <=
  23. jmp four
  24. two: mov x,2
  25. imul x
  26. jmp msg
  27. three:
  28. mov x,3
  29. imul x
  30. jmp msg
  31. four:
  32. mov x,4
  33. imul x
  34. jmp msg
  35. msg: call dispsid ;表示有符号输出
  36. ret ;返回操作系统
  37. main endp
  38. ; (insert additional procedures here)
  39. end main
  40. ;end of assembly
上一篇:软件测试2-3次实验报告
下一篇:简单分支程序设计实验(2)