1.编写程序,计算下面函数的值并输出。
点击(此处)折叠或打开
- TITLE Program Template (Template.asm)
- ; Template for Win32 Console Application
- ; Program Description:
- ; Author:
- ; Creation Date:
- ; Revisions:
- ; Last update: 09/01/2009 Modified by:
- include io32.inc
- .data
- ; (insert variables here)
- x byte ?
- array byte 'enter x:',0
- .code
- main proc
- ; (insert executable instructions here)
- mov eax,offset array ;字符串首地址送eax
- call dispmsg ;调用子程序dispmsg显示字符串
- call readsid
- cmp eax,0
- jl two ;表示有符号中 <
- cmp eax,10
- jle three ;表示有符号中 <=
- jmp four
- two: mov x,2
- imul x
- jmp msg
- three:
- mov x,3
- imul x
- jmp msg
- four:
- mov x,4
- imul x
- jmp msg
- msg: call dispsid ;表示有符号输出
- ret ;返回操作系统
- main endp
- ; (insert additional procedures here)
- end main
- ;end of assembly