home *** CD-ROM | disk | FTP | other *** search
-
-
- sample proc far
- jmp short start ────┐ ; go to the start
- start: <───┘
- call getmem ; get memory size
- mov ax,totmem ; total memory
- mov di,offset tmemory
- call convert ; convert to ascii
- mov ax,fremem ; free (available) memory
- mov di,offset amemory
- call convert ; convert to ascii
- call display ; display the answers
- dosret:
- int 20h ; return to dos
-
-
-
- getmem proc near ; get memory size
- mov cl,6 ; shift count
- mov si,2 ; point to top of memory in psp
- mov ax,[si] ; get top of memory
- shr ax,cl ; convert to KB
- mov totmem,ax ; and save total memory
- mov bx,cs ; get current segment
- shr bx,cl ; convert to KB
- sub ax,bx ; subtract from total memory to get
- mov fremem,ax ; free memory
- ret
- getmem endp
-
-
-
- getmem proc near ; get memory size
- ;----------------------------------------------
- ; input: none
- ; output: ax bx cx si
- ;----------------------------------------------
- getmem endp
-
-
-
- convert proc near ; convert number to ascii
- push ax ; save number
- mov al,' '
- mov cx,3
- rep stosb ; clear 3 bytes
- pop ax ; restore number
- mov cx,10 ; divisor
- ┌──>conloop:
- │ xor dx,dx ; clear remainder
- │ div cx ; divide by 10
- │ add dl,30h ; convert to ascii
- │ dec di ; back up 1 byte
- │ mov [di],dl ; save ascii number
- │ cmp ax,0 ; done?
- └─── jnz conloop ; no
- ret
- convert endp
-
-
-
- convert proc near ; convert number to ascii
- ;----------------------------------------------
- ; input: dx di
- ; output: ax cx dx di
- ;----------------------------------------------
- convert endp
-
-
-
- display proc near ; display memory sizes
- mov ah,9 ; display string
- mov dx,offset total ; start of message
- int 21h ; let dos display it
- ret
- display endp
-
-
-
- display proc near ; display memory sizes
- ;----------------------------------------------
- ; input: none
- ; output: ax dx
- ;----------------------------------------------
- display endp
-
-
-
- sample proc far
- ;----------------------------------------------
- ; input: none
- ; output: ax di
- ;----------------------------------------------
- sample endp
-
-
- sample (4)
- ├─ getmem (6)
- ├─ convert (8)
- ├─ convert (8)
- └─ display (6)
-
-
-
- Cross-Reference by Procedure
-
- Procedure: sample
- Labels:
- start
- dosret
-
- Procedure: getmem
- Called by:
- sample
-
- Procedure: convert
- Called by:
- sample(2)
- Labels:
- conloop
-
- Procedure: display
- Called by:
- sample
-
- Max Stack usage: 8
-
-
- PUBLIC items:
-
- PUBLIC sample ; NEAR
- PUBLIC total ; BYTE
- PUBLIC tmemory ; BYTE
- PUBLIC avail ; BYTE
- PUBLIC amemory ; BYTE
- PUBLIC totmem ; WORD
- PUBLIC fremem ; WORD
- PUBLIC start ; NEAR
- PUBLIC dosret ; NEAR
- PUBLIC getmem ; NEAR
- PUBLIC conloop ; NEAR
-
- Items not public:
-
- PUBLIC sample ; FAR
- PUBLIC convert ; NEAR
- PUBLIC display ; NEAR
- PUBLIC getmem ; NEAR
-
- Summary Table
- PROCEDURES: 5
- MACROS: 0
- CALLS: 4
- MACRO CALLS: 0
- EXTERNALS: 0
- Source Lines: 88
- SYMBOLS: 16
- Symbol Space: 117
-