Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2160800
  • 博文数量: 556
  • 博客积分: 11457
  • 博客等级: 上将
  • 技术积分: 5973
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-24 22:33
文章分类

全部博文(556)

文章存档

2013年(22)

2012年(74)

2011年(460)

分类: IT职场

2012-05-09 21:01:13

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
阅读(1008) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~