Assembly Source series of Getspace

Source: Internet
Author: User
Tags mul

This is the past DOS era of the compilation of source code, although has passed, but for the study of the assembly is still helpful, assembly language is just a basic programmer language, most people can grasp, not necessarily in-depth research.

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.