home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
sysutl
/
moreram1.arc
/
MORERAM1.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-10-28
|
3KB
|
143 lines
TITLE MORERAM 10-27-88 [10-28-88]
;Disassembly, tweak
;David Kirschbaum
;Toad Hall
;kirsch@braggvax.ARPA
LF EQU 0AH
CR EQU 0DH
CSEG SEGMENT
ASSUME DS:CSEG, SS:CSEG ,CS:CSEG ,ES:CSEG
org 2
currmem dw ? ;PSP current memory
ORG 100H
MoreRam proc near
JMP Start_1CA
L0103 DB "MORE RAM than switches (v 1.1) by Daniel M. O'Brien "
db '(21 Dec 1983)',CR,LF ;,'$'
L0147 DB ' Current memory is $'
L015B DB ' K bytes. $'
L0166 DB CR,LF,' Physical memory is $'
L017D DB ' Analyzing & Clearing...$'
L0196 DB ' Re-Booting...',CR,LF,'$'
L01A7 DB CR,LF,' Memory size is set correctly.',CR,LF,'$'
MoreRam endp
Start_1CA proc near
MOV DX,OFFSET L0103 ;'MORE RAM' intro
MOV AH,9
INT 21H
; MOV DX,OFFSET L0147 ;'Current memory is '
; MOV AH,9
; INT 21H
MOV AX,currmem ;DS:2 ;get current memory from PSP
PUSH DS ;save DS
PUSH AX ;save PSP memory value
MOV CL,6 ;convert paras to Kb
SHR AX,CL
CALL Display_Int_25C ;display memory size
MOV DX,OFFSET L015B ;'K bytes'
MOV AH,9
INT 21H
MOV DX,OFFSET L017D ;'Analyzing and clearing..'
MOV AH,9
INT 21H
XOR AX,AX
OUT 0A0H,AL ;disable NMI
POP AX ;restore PSP memory value
SegLup_1F7:
xor bx,bx
CMP AX,0B000H ;hit max?
JZ L0219 ;yep, done with clearing
MOV DS,AX ;point DS to last memory seg
MOV [BX],AX ;stuff seg nr at segment base
MOV CX,[BX] ;see if it really took (real RAM)
CMP AX,CX ;did we stuff the number to real RAM?
JNZ L0219
MOV CX,8 ;gonna store 16 zeroes
MOV ES,AX ;point to current segment
XOR AX,AX
XOR DI,DI ;segment base
REPZ STOSW ;clear with 16 zeroes
MOV AX,DS ;get last memory seg
INC AX ;bump to next segment
JMP SHORT SegLup_1F7 ;and go until maxed out
L0219: MOV BX,AX ;save last seg a second
MOV AL,80H
OUT 0A0H,AL ;?reenable NMI or maybe clear error
MOV AX,BX ;get last seg back
MOV CL,6
SHR AX,CL ;convert paras to Kb
MOV BX,40H ;BIOS seg
MOV DS,BX
ASSUME DS:Nothing
MOV BX,13H ;413H=available memory
CMP [BX],AX ;BIOS knows the truth?
JZ No_Action_252 ;true memory is set on switches,
;no action required, terminate.
MOV [BX],AX ;force true memory into BIOS
PUSH AX ;dumb
POP AX ;but maybe needs to delay a sec?
POP DS ;restore DS
ASSUME DS:CSEG
PUSH AX ;save true memory val (Kb)
MOV DX,OFFSET L0166 ;'Physical memory is'
MOV AH,9
INT 21H
POP AX ;restore true memory val (Kb)
CALL Display_Int_25C ;display memory size
MOV DX,OFFSET L015B ;'K bytes'
MOV AH,9
INT 21H
MOV DX,OFFSET L0196 ;'Rebooting'
MOV AH,9
INT 21H
INT 19H ;Reboot
;L0252 L022F CJ
No_Action_252:
POP DS
ASSUME DS:CSEG
MOV DX,OFFSET L01A7 ;'Memory size is set correctly'
MOV AH,9
INT 21H
INT 20H ;terminate
Start_1CA endp
;L025C L01E1 CC L023F CC
;Display an integer in AX
;Doesn't matter if we destroy all regs
Display_Int_25C proc near
XOR CX,CX ;clear digit counter
MOV BX,0AH ;10 constant divisor
Lup265: XOR DX,DX ;clear remainder
DIV BX ;integer /10
ADD DX,'00' ;asciify remainder
PUSH DX ;push DL on stack
INC CX ;count the pushes
OR AX,AX ;integer zeroed out?
JNZ Lup265 ;nope, keep going
Lup273: POP DX ;Ascii digit in DL
MOV AH,2 ;display char
INT 21H
LOOP Lup273 ;for each push
RET ;_NEAR
Display_Int_25C endp
Cseg ENDS
END MoreRam