王爽《汇编语言》实验14

方法一:

assume cs:code,ds:data
data segment
  db '00/00/00 00:00:00','$'
  db 9,8,7,4,2,0
data ends
code segment
 start:
       mov ax,data
       mov ds,ax
       mov si,0
       mov cx,6
       mov bx,18

   s1: push cx
       mov ax,[bx]
       out 70h,al
       in al,71h

       mov ah,al
       mov cl,4
       shr al,cl
       add al,30h
       and ah,00001111b
       add ah,30h

       mov ds:[si],ax       ;注意别前后颠倒

       inc bx
       add si,3
       pop cx
       loop s1
       
       mov ah,2
       mov bh,0
       mov dh,12
       mov dl,40
       int 10h

       mov ax,data
       mov ds,ax
       mov dx,0
       mov ah,9
       int 21h
    
       jmp short start              

       mov ax,4c00h
       int 21h
code ends
end start

方法二:

assume cs:code,ds:data
data segment
  db '2000/00/00 00:00:00',0
  db 9,8,7,4,2,0
data ends
code segment
 start:
       mov ax,data
       mov ds,ax
       mov si,2
       mov cx,6
       mov bx,20

   s1: push cx
       mov ax,[bx]
       out 70h,al
       in al,71h

       mov ah,al
       mov cl,4
       shr al,cl
       add al,30h
       and ah,00001111b
       add ah,30h

       mov ds:[si],ax

       inc bx
       add si,3
       pop cx
       loop s1
       
       mov ax,0b800h
       mov es,ax
       mov di,120*12+40*2
       mov si,0

  showtime:mov cl,ds:[si]
           mov ch,0
           jcxz ok
           mov es:[di],cl
           inc si
           add di,2
	   jmp short showtime
        ok:
           jmp short start

       mov ax,4c00h
       int 21h
code ends
end start


猜你喜欢

转载自blog.csdn.net/weixin_41944412/article/details/80588423