汇编源码系列之getspace
2008-04-29 09:33:33 来源:WEB开发网这个都是过去DOS时代的汇编源码,虽然已经过去了,但是对于学习汇编还是有帮助的,汇编语言只是程序员一门基础语言,大多人掌握即可,不一定要深入研究.......
CSEG SEGMENT
PUBLIC GETSPACE
GETSPACE PROC FAR
ASSUME CS:CSEG
PUSH BP
MOV BP,SP
MOV BX,[BP]+6
MOV DI,[BX]+2
MOV CX,8
MOV AL,' '
CLD
REP STOSB
MOV BX,[BP]+8
MOV SI,[BX]+2
MOV AX,[SI]
AND AL,0DFH
CMP AL,41H
JGE CKVER
JMP EXITSPC
CKVER:
PUSH AX
MOV AH,30H
INT 21H
XCHG AL,AH
SPACE20:
POP DX
XOR DL,40H
MOV AH,36H
INT 21H
CMP AX,0FFFFH
JE EXITSPC
XOR DX,DX
MUL CX
XCHG BX,CX
MUL CX
PUSH AX
PUSH DX
ENDSPC:
MOV BX,[BP]+6
MOV DI,[BX]+2
ADD DI,7
POP DX
POP AX
HEXTODEC:
MOV SI,10
PUSH AX
MOV AX,DX
XOR DX,DX
DIV SI
POP CX
PUSH AX
MOV AX,CX
DIV SI
POP SI
OR DL,30H
MOV BYTE PTR [DI],DL
DEC DI
XCHG DX,SI
OR AX,AX
JNZ HEXTODEC
EXITSPC:
POP BP
RET 4
RET
GETSPACE ENDP
CSEG ENDS
END
更多精彩
赞助商链接