汇编语言: 编写子程序嵌套结构的程序,把整数分别用二进制和八进制形式显示出来。

来源:互联网 发布:神知第二季720百度云 编辑:程序博客网 时间:2024/06/06 18:12

编写子程序嵌套结构的程序,把整数分别用二进制和八进制形式显示出来。

data segmentdata endsstack segment stackdw 20h dup(?)top label wordstack endscode segment    assume ds:data,cs:code,ss:stack    p proc far     mov ax,data    mov ds,ax    mov ax,stack    mov ss,ax    lea sp,top    mov cx,5    xor bx,bxl1: mov ah,01h    int 21h    cmp al,0dh    je input    and ax,1111b    xchg ax,bx    mov si,10    mul si    jc exit    add bx,ax    jc exit    loop l1input:    call to2    mov dl,0ah    mov ah,02h    int 21h    call to8    jmp exitto2 proc near    mov cx,16   l3: rol bx,1    mov dl,bl    and dl,1    add dl,30h    mov ah,02h    int 21h    loop l3    retto2 endpto8 proc near    rol bx,1    mov dl,bl    and dl,1    add dl,30h    mov ah,02h    int 21h    ;    mov cx,5    l4: push cx    mov cl,3    rol bx,cl    mov dl,bl    and dl,111b    add dl,30h    mov ah,02h    int 21h     pop cx    loop l4     retto8 endpexit:    mov ah,4ch    int 21h         p endp      code ends     end p
阅读全文
0 0
原创粉丝点击