TASM IDEAL questions... 
Author Message
 TASM IDEAL questions...

I have a few questions about programming in TASM's IDEAL mode:

1.  How do you request for more memory (allocate) memory.  I've found an
interrupt listing that lists functions for dos interrupt 21h for
allocating, modifing and freeing memory, but can't seem to get them to
work.

1a. Are these functions limited to conventional memory?  If so, how do I
access extended or expanded memory?

1b. Is protected mode required in order to access memory above 640k?

Thanks, in advance, to anyone who can shed some light on this.  I would
really like to get my hands on some sample IDEAL code that accomplishes
this...

BTW: Does anyone know of a fix to TASM's Windows Librarys not working in
Win95?



Wed, 26 May 1999 03:00:00 GMT  
 TASM IDEAL questions...

On Sat, 07 Dec 1996 14:47:59 -0500, "Rodney M. Brown"

Quote:

>1.  How do you request for more memory (allocate) memory.  I've found an
>interrupt listing that lists functions for dos interrupt 21h for
>allocating, modifing and freeing memory, but can't seem to get them to
>work.

The DOS loader allocates all available conventional memory to .COM
files when they start.  For .EXE files this is optional, but most
linkers set the field in the header that makes it happen.  If you want
to use the DOS allocation function 48h, you must first free some
memory with function 49h or 4Ah for it to work.

When your program starts, the word at ES:[2] contains the segment
address of the first byte past your originally allocated block (often
A000, the video graphics segment).  The real end of your program is
CS+64K in a .COM file.  To find the real end of an .EXE program,
define a label at the end of the last segment (or maybe define a
special segment after all the others and put the label there).
Everything between the real end of your program and the segment from
ES:[2] is available to you, either to manage as a local heap like most
high-level languages do or to free with Int 21h, function 49h.

Quote:

>1a. Are these functions limited to conventional memory?  If so, how do I
>access extended or expanded memory?

Expanded memory (EMS) is usually available via INT 67H.  Extended
memory (XMS) functions are usually called via a far call point found
by INT 2Fh, function 4310h.  For more info, try the search engine at
www.ctyme.com and look for EMS or XMS.

Quote:
>1b. Is protected mode required in order to access memory above 640k?

In general, you need protected mode to access memory over 1MB+64K.  If
you use EMS, though, it uses the mapping feature of the 80386+ to make
memory over 1MB appear in a 'window' below 1MB.  Usually you have four
16K windows at some fixed position (often D000:0000 or E000:0000) that
you can cause to point to various areas above 1MB.  This is called
'mapping pages'.

32-bit protected mode is more fun, though.  Flat model removes most of
the segmentation headaches, all registers can be used to address
memory, and the new addressing modes can really compact your code.  It
just takes a little effort to set up.



Thu, 27 May 1999 03:00:00 GMT  
 TASM IDEAL questions...


   >Newsgroups: comp.lang.asm.x86,alt.lang.asm
   >To find the real end of an .EXE program, define a label at the end of
   >the last segment (or maybe define a special segment after all the others
   >and put the label there). Everything between the real end of your program
   >and the segment from ES:[2] is available to you, either to manage as a
   >local heap like most high-level languages do or to free with Int
   >21h, function 49h.

I didn't catch the original message you replied to, but perhaps this message
will catch his eye ..

---------------------------------------

;
; prelude.asm .. free's up unused DOS memory and then calls main() ..
;
;  .stack is not declared here, presumably it is declared in the module that
;  contains main()
;

model small, c

  extrn main:proc

code

  prelude proc

    ; free all unused memory
    ; requires that the stack be the last segment .. tasm's .model _seems_
    ; to do this automagically

    mov ax, es          ; ax = psp
    mov bx, ss          ; bx = bottom of stack
    sub bx, ax          ; bx = paras from PSP to stack
    mov ax, sp          ; ax = stack size in bytes
    add ax, 15          ; convert to paras, rounding up
    shr ax, 4
    add bx, ax          ; bx = size of program in paras
    mov ah, 4ah         ; DOS resize memory block
    int 21h

    ; setup DS

    mov ax, _data       ; just a nicety
    mov ds, ax

    ; ds -> data, es -> psp, fs -> ???, gs -> ???

    call main

    mov ax, 4c00h       ; so we may RET from main
    int 21h

  endp

end prelude

---------------------------------------

again, take note that the code requires the stack to be the last segment.
I find it's not just a good idea, its the default

THE GENERATION OF RANDOM NUMBERS IS TOO IMPORTANT TO BE LEFT TO CHANCE

Net-Tamer V 1.07 - Test Drive



Fri, 28 May 1999 03:00:00 GMT  
 TASM IDEAL questions...



Quote:
>I have a few questions about programming in TASM's IDEAL mode:

Well your questions below really have nothing to do with Tasm IDEAL mode,
they are mostly generic to any assembler.

Quote:
>1.  How do you request for more memory (allocate) memory.  I've found an
>interrupt listing that lists functions for dos interrupt 21h for
>allocating, modifing and freeing memory, but can't seem to get them to
>work.

If you create a *.COM file then you are already allocated the entire free
conventional memory available, by default. It's upto you to reduce that
allocation if you want. But you don't have allocate anymore, in fact you
can't allocate anymore, because you already are assigned the maximum
available in conventional memory.

Quote:
>1a. Are these functions limited to conventional memory?  If so, how do I
>access extended or expanded memory?

Yes, conventional memory only. Extended and expanded memory are a broad
subject, couldn't go into it all in this one message. I'll just give you a
summary of what specifications you will need to study.

For expanded memory, you will need to obtain the LIM
(Lotus-Intel-Microsoft) EMS specifacation version 4.0. Those are the
latest, and most like the last _ever_ specifications for expanded memory.
It's largely been replaced by extended memory protocols.

For extended memory, you have specifications. Starting from least
sophisticated to most sophisticated, you have (1) XMS version 3.0, then you
have (2) VCPI version 1.0, and finally (3) DPMI version 1.0.

Quote:
>1b. Is protected mode required in order to access memory above 640k?

No, it's just required when you have to access memory above 1088K (1MB +
64K).

Quote:
>Thanks, in advance, to anyone who can shed some light on this.  I would
>really like to get my hands on some sample IDEAL code that accomplishes
>this...

Masm mode is more common, and in this case, it's just as good, there's
nothing that IDEAL mode is particularly better suited at than Masm mode.

                                        Yousuf Khan
--
Yousuf J. Khan

Ottawa, Ont, Canada
Nation's capital



Fri, 28 May 1999 03:00:00 GMT  
 TASM IDEAL questions...

Quote:

> I have a few questions about programming in TASM's IDEAL mode:
> 1.  How do you request for more memory (allocate) memory.  I've found an
...
> 1a. Are these functions limited to conventional memory?  If so, how do I
...
> 1b. Is protected mode required in order to access memory above 640k?

I suppose all these questions are well answered in the FAQ.
If any isn't, let me know.

...

Quote:
> BTW: Does anyone know of a fix to TASM's Windows Librarys not working in
> Win95?

I suppose you need buy W95 version of these libraries.
(how to fix a car which doesn't fly? buy airplane!)


Fri, 28 May 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. TASM IDEAL questions...

2. TASM: IDEAL: IRPC/ENDM problem

3. Odd problem using STRUC in TASM 5.0 IDEAL mode

4. TASM ideal mode and PROCDESC

5. TASM Ideal mode and PROCDESC

6. TASM IDEAL to MASM51 - far jump

7. TASM: IDEAL: IRPC/ENDM problem

8. STRUCs in TASM Ideal mode

9. Q re TASM ideal mode

10. TASM Ideal mode MMX macroes (REPOST) (2/2)

11. TASM Ideal mode MMX macroes (REPOST) (1/2)

12. Tasm's Ideal mode

 

 
Powered by phpBB® Forum Software