1.6循环程序设计

实验任务:编一程序,显示ASCII码表,将这些字符以16行,16列的表格形式显示出来。要求显示时按ASCII码的递增顺序分行显示(即行内的ASCII码依此递增,与附录D列出的表格位置正好倒置)。每个相邻的两字符间用空白符或空格分开。注: 采用的是BIOS调用

代码(测试可用,排版格式问题请自行调整):

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

;This program is created by LiZhuYang(LzySeed) 转载请注明出处;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

assume cs:code,ss:stack
stack segment
 db 512 dup(?)
stack ends

code segment
   start: mov ax,stack
       mov ss,ax
       mov sp ,512
       mov si,0
       mov bl,23h
       mov cx,256
       sd:mov ah,02h
          push bx
          and bl,00001111b
          add bl,bl
       mov dl,bl
       pop bx
       push bx
       push cx
       mov cl,4
       shr bl,cl
       mov dh,bl
       pop cx
       mov bh,0
       int 10h
       pop bx
       mov ah,0Ah
       push bx
       mov al,bl
       mov bh,0
       push cx
       mov cx,1
       int 10h
       pop cx
       pop bx
       inc bl
       loop sd
      
       mov ah,02                 ;将光标置到(23,23)以免中断提示覆盖显示的内容

       mov dh,23
       mov dl,23
       mov bh,0
       int 10h
      
          mov ax,4c00h
    int 21h
code ends
end start

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 实验任务二:在CRT上显示九九乘法表。注,采用的是Dos调用

代码:

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;This program is created by LiZhuYnag(LzySeed) 转载请注明出处;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
assume cs:code,ss:stack
stack segment
 db 512 dup(?)
stack ends

code segment
  start:mov ax,stack
    mov ss,ax
    mov sp,512
    mov bl,31h
    mov cx,9
   s99:mov si,31h
      push bx
       sub bl,30h
       push cx
       mov cl,bl
       add bl,30h
   s11:mov ah,02h               
       mov dl,bl
       int 21h
       mov ah,02h                ;*号
       mov dl,2Ah
       int 21h
       mov dx,si
       mov ah,02h
       int 21h
       mov ah,02h                ;=号
       mov dl,3dh
       int 21h
          call _16to10              ;调用计算显示程序
          mov ah,02h                ;空格
          mov dl,00h
          int 21h
          inc si
          loop s11 
          pop cx
          pop bx  
       inc bl               
       mov ah,02h                ;换行
       mov dl,0Ah
       int 21h
       mov ah,02h                ;回车
       mov dl,0dh
       int 21h
       loop s99
       mov ax,4c00h
       int 21h
  _16to10:push ax                   ;此函数用来显示计算出的值
          push bx
          push cx
          sub bl,30h
          mov al,bl
          mov bx,si
          sub bl,30h
          mul bl
          mov dl,10
          div dl
          add al,30h
          mov dl,al
          push ax
          mov ah,02h
          int 21h
          pop ax
          add ah,30h
          mov dl,ah
          mov ah,02h
          int 21h
        
          pop cx
          pop bx
          pop ax
          ret
code ends
end start

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值