毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> 开发语言 >> 正文

用80X86汇编语言写出来的九九乘法表

更新时间:2012-6-13:  来源:毕业论文

求大神给出用80X86汇编语言写出来的九九乘法表格式如下
1*1=1
2*1=2 2*2=4
3*1=3 3*2=6 3*3=9
4*1=4 4*2=8 4*3=12 4*4=16

datasg segment
  menuinfo db 'Menu',0ah,0dh,
  '0 for print 9X9 multiplication table',0ah,0dh,
  '1 for print ASCII table',0ah,0dh,'$'
  errorinfo db 'illegal input,try again','$'
datasg ends

codesg segment
  assume ds:datasg,cs:codesg
start:
  mov ax,datasg
  mov ds,ax
  lea dx,menuinfo
  mov ah,9
  int 21h

  mov ah,8
  int 21h
   
  cmp al,'0'
  je Print99MultTable
  cmp al,'1'
  je PrintASCIITable

  lea dx,errorinfo
  mov ah,9
  int 21h
exit:
  mov ax,4c00h
  int 21h

Print99MultTable:
  mov bx,1
  mov cx,1
s0:
  mov ax,bx
  push cx
  mov cx,1
s3:
  mov dl,bl
  add dl,30h
  mov ah,2
  int 21h
  mov dl,'*'
  int 21h
  mov dl,cl
  add dl,30h
  int 21h
  mov dl,'='
  int 21h

  mov ax,bx
  mov dl,bl
  mul cl
   
  call htod

  mov ah,2
  mov dl,20h
  int 21h

  inc cx
  cmp cx,bx
  jle s3

  mov dl,0dh
  mov ah,2
  int 21h
  mov dl,0ah
  int 21h

  pop cx
  inc cx
  cmp cx,10
  inc bx
  jb s0

  jmp exit

PrintASCIITable:
  xor dl,dl
  mov cx,128
  mov ah,2
s2:
  int 21h
  inc dl
  loop s2
  jmp exit

htod proc
  push ax
  push cx
  push dx
  push bx

  xor cx,cx
  mov bx,10
s:
  xor dx,dx
  div bx
  inc cx
  push dx
  cmp ax,0
  jne s
s1:
  pop dx
  add dl,30h
  mov ah,2
  int 21h
  loop s1

  pop bx
  pop dx
  pop cx
  pop ax
  ret
htod endp
codesg ends

end start

[1] [2] 下一页

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。