Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

MC6.0 on DOS: Return segment address of the environment and it's size

ligangligang Member Posts: 76
this is the code run on dos

/*************************************************************************/* Return segment address of the environment and it's size */
/*****************************************************************************/
static
int MemENV (unsigned int *seg, unsigned int *esize)
{
unsigned int envseg;
unsigned int envsegsize;

/* Get ENV SegAddress */
/* This needs to be in ASM to insure working in all environments */
*/
/* It does this by getting the "Master Environment" from Command.com */

_asm
{
push es ; Save Regs
push si ; Save Regs
push di ; Save Regs

; push ds ; Save Regs
; mov ax, 5100h ; Parm to request the cur PSP address
; INT 21h ; DOS Function to get PSP Seg address
; pop ds ; Restore Regs
; mov es, bx ; Point to it
; mov ax, es:[2ch] ; Get ENV seg addr
; mov ourenv, ax ; Save it

push ds ; Save Regs
mov ax, 352Eh ; Parm to request the 2E int
INT 21h ; DOS Function to get PSP Seg address
pop ds ; Restore Regs
mov ax, es:[2ch] ; Get ENV seg addr
mov envseg, ax ; Save ENV Segment addr

dec ax ; Point to MCB (prev paragraph)
mov es, ax ; Put in es
mov ax, es:[03h] ; Get size in paragraphs
mov envsegsize, ax ; Save ENV Segment size

pop di ; Restore Regs
pop si ; Restore Regs
pop es ; Restore Regs
}

*seg = envseg; /* Return Seg value */
*esize = envsegsize; /* Return Seg size */

return (0); /* Return */
}

If Anyone can reveal any details for this function ?


Comments

  • Shawn CarterShawn Carter Member Posts: 0

    _______ [ http://forcoder.org ] free ebooks and video tutorials about < Ruby, PL/SQL, MATLAB, Delphi, Perl, PHP, C#, Visual Basic, Swift, Visual Basic .NET, Java, C, Objective-C, R, Python, JavaScript, Go, Scratch, Assembly, C++ ABAP, F#, ML, Crystal, FoxPro, D, SAS, Apex, Erlang, VBScript, Clojure, Fortran, Lisp, LabVIEW, Ada, Awk, Transact-SQL, Alice, Scheme, Kotlin, Scala, Lua, Julia, Dart, Logo, Prolog, COBOL, Bash, Rust, Hack /> ________

Sign In or Register to comment.