Hi,
    I am now reading a dos programming book.When I read the sentence " If do not chose the right memory model, you could encounter critical memory overflow or maybe the app will execute slowly ".
    Then I try to prove it with code follows:
.model tiny
.code
start:
        mov ax,cs
        mov ds,ax

        mov ah,0eh
        mov si,offset testm
        mov cx,0
Next:
        mov al,
        mov bx,0
        int 10h

        inc cx
        cmp cx,0fff0h
        jnz Next

        mov ah,4ch
        int 21h


        testm db 0fff0h dup('a')

        end start



    but,while compiling, I got a warning error saying "location couter overflow".Then, i get a fatal error while linking saying "32-bit record encountered in moudle overflow.asm".
    At this time,I am getting doubt that any assembly code could casue the memory overflow.Could somebody give me some kind of clue or sample code.
-----
thx,
Regards.
Posted on 2008-10-24 23:17:49 by kybyw
are you using a 16 bit linker?
Posted on 2008-10-28 21:35:37 by rags
You're defining a block of $FFF0 bytes, which leaves just 16 bytes for the rest of your code.
$FFFF is the maximum address when using 16 bits.
Your code is compiling just a few bytes larger than the 16 bit limit, meaning that a 32bit record is being generated rather than a 16bit one.
So that's why it's complaining.

Posted on 2008-10-28 23:41:58 by Homer
1.
are you using a 16 bit linker?

   Yes,I am programming under MS-DOS7.0 using turbo c++ 3.0.
2.
You're defining a block of $FFF0 bytes, which leaves just 16 bytes for the rest of your code.
$FFFF is the maximum address when using 16 bits.
Your code is compiling just a few bytes larger than the 16 bit limit, meaning that a 32bit record is being generated rather than a 16bit one.
So that's why it's complaining.

    Yes,I knew it.What I mean is that if I could not use this kind of method to overflow the memory, how could the memory overflow since the compiler and linker could detect segment overflow.
3. Anyway thx for your replys.
4. Now I considering using dynamic allocate.demo,It seems if you want to get memory that is not belong to u.
the library function like alloc() will just return NULL.^_^
----
Regards.
Posted on 2008-10-30 18:54:47 by kybyw
You can of course, if you need more memory, populate your segment selectors with appropriate values that point to segments that are not being used at the moment. You can ask DOS to give you an empty segment as far as I remember doing my OASML library.
Posted on 2008-10-31 10:36:58 by XCHG
thx... :lol: I really appericiate it...and it seems that this library get too much commets...ha ha...
Posted on 2008-10-31 22:27:33 by kybyw