4_8.ASM
资源名称:huibian.rar [点击查看]
上传用户:xinbaokeji
上传日期:2022-07-05
资源大小:295k
文件大小:1k
源码类别:
汇编语言
开发平台:
Visual C++
- DATA SEGMENT
- NUM8 DB 93H
- NUM16 DW 0ABCDH
- ASCBUF DB 20 DUP(0)
- DATA ENDS
- STACK SEGMENT PARA STACK 'STACK'
- DB 100 DUP(?)
- STACK ENDS
- CODE SEGMENT
- ASSUME DS:DATA,CS:CODE, SS:STACK
- START: MOV AX,DATA
- MOV DS,AX
- MOV DX,0
- MOV DL,NUM8 ;转换二进制数送DX
- MOV CX,8 ;置位数8
- LEA DI,ASCBUF ;字符串首址→DI
- CALL BTASC ;调用子程序BTASC
- MOV [DI],BYTE PTR 0DH
- MOV [DI+1],BYTE PTR 0AH
- MOV [DI+2],BYTE PTR '$'
- LEA DX, ASCBUF
- MOV AH,09H
- INT 21H
- MOV DX,NUM16
- MOV CX,16 ;置位数16
- LEA DI,ASCBUF
- CALL BTASC
- MOV [DI],BYTE PTR 0DH
- MOV [DI+1],BYTE PTR 0AH
- MOV [DI+2],BYTE PTR '$'
- LEA DX, ASCBUF
- MOV AH,09H
- INT 21H
- MOV AH,4CH
- INT 21H
- BTASC PROC
- PUSH AX ;保存AX
- MOV AL,0
- CMP CX,8 ;比较8位数
- JNE L1 ;直接转换16位数
- MOV DH,DL ;8位数转换送DH
- L1: ROL DX,1 ;DX最高位移入CF
- RCL AL,1 ;CF移入AL最低位
- ADD AL,30H
- MOV [DI],AL
- INC DI
- MOV AL,0
- LOOP L1
- POP AX
- RET
- BTASC ENDP
- CODE ENDS
- END START