News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Alloc'ing the last byte in 64K

Started by BigDaddy, January 05, 2005, 06:48:07 PM

Previous topic - Next topic

BigDaddy

Another newbie question.

I tried to do this:

extra segment para
outbuf dq 8192 dup (?) ; 65536 bytes
extra ends

The dq is 8 bytes, I hope. 

I get an error message about an overflow, even though 8192 is within the range for a dq.  So, it must be the resultant 64K that causes the error, right? 

Now, there are 64K bytes addressable in a maxed out segment, right?  Numbered zero to 65535, of course, but when you do a db or dw or whatever, you don't start with a zeroeth element, but an element 1.  So, how do I make a whole segment addressable? 

Thanks

MichaelW

This assembles and links without error:

    .model small
    .386
    .stack

    extra segment para
      outbuf dq 8192 dup (?) ; 65536 bytes
    extra ends

    .data
      msg db "Hello World$"
    .code
    .startup
        mov   ah, 9
        mov   dx, OFFSET msg
        int   21h
        mov   ah,0
        int   16h
    .exit
end


If I change the 8192 to 8193 I get:

Assembling: hello.asm
hello.asm(23) : error A2103: segment exceeds 64K limit : extra

I think your problem lies elsewhere.
eschew obfuscation

BigDaddy

When I'd reduce the segment by a byte, TLINK showed a segment size of 0FFFEh.  I get the message by adding that single byte. 

Turns out, though a normal web search brought up lots of people with the problem using Turbo Assembler (what I have) I only found an answer when I searched directly in the x86 newsnet group. 

Here's the link:

http://groups-beta.google.com/group/comp.lang.asm.x86/msg/e38f4b85bb873e14

It's a known issue, in other words.  TASM gives the "Location counter overflow" warning for a segment that is *exactly* 64K.