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
     

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章