Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: CODE SIZE A...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 4559 of 4729
Post > Topic >>

Re: CODE SIZE AND STACK CURRUPTION PROBLEM

by NoSpam@[EMAIL PROTECTED] (Bob Masta) Mar 6, 2008 at 12:53 PM

On Wed, 5 Mar 2008 06:15:49 -0800 (PST), phulepriya
<spamtrap@[EMAIL PROTECTED]
> wrote:

>Hi,
>
>I am trying to develop an application in 16 bit. {Intel: Windows OS}
>
>When I have code size(where i want to jump) of 11 k the lable jump is
>happening ..
>and when code size (where i want to jump) increases to 12 k the BOUCHS
>gives error as
>IRET: Top 6 bytes of stack are currupted.
>
>jmp 0x2A00:0: jumps when code after 2a00 (linked using NASAM) is belOw
>12 k
>
>and same does not jump if code size after 2a00 icreases above 12k
>
>IS THERE ANY RELATION BETWEEN THE CODE SIZE AND JUMP/STACK in 16 BIT?
>
>Thanks in advance...
>

There is a definite relation if you are using the COM format, since
the code and stack share the same segment, with the stack growing
down from above.  The COM model unfortunately leads one down
the primrose path here, since most programs work perfectly fine... but
as your code grows (or the stack usage) a collision eventually
results. By then you may have completely forgotten about the initial
constraint.

One solution is to set your own stack segment at start-up.
Note that under "DOS rules" you own all the memory up to 
the display adapter at A000.  (Not exactly true... you can get
the exact limit from the PSP.)  So just set SS so that there
can never be a collision.  A trick that I used to use is to keep
SS the same, but set SP to 100h as soon as you are done
using the PSP.  This always worked out nicely for me since
I never used the stack much (no recursion or structure passing, etc),
so it was a "set-and-forget" deal.

Best regards,


Bob Masta
 
              DAQARTA  v3.50
   Data AcQuisition And Real-Time Analysis
             www.daqarta.com
Scope, Spectrum, Spectrogram, FREE Signal Generator
        Science with your sound card!
 




 2 Posts in Topic:
CODE SIZE AND STACK CURRUPTION PROBLEM
phulepriya <spamtrap@[  2008-03-05 06:15:49 
Re: CODE SIZE AND STACK CURRUPTION PROBLEM
NoSpam@[EMAIL PROTECTED]   2008-03-06 12:53:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:01:40 CDT 2008.