74 lines
743 B
NASM
74 lines
743 B
NASM
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 |