[A89] Re: Interrupts


[Prev][Next][Index][Thread]

[A89] Re: Interrupts




At 20:10 2002-04-13, you wrote:

>Thanks for the help, I got what I wanted working with the interrupts.  I
>have a different problem now.  My game would keep generating an illegal
>instruction after pressing enter to start the game.  I fiddled around with
>the code a lot, trying to locate the problem, and it seems to be sprintf and
>GrayOn clashing.  I use sprintf to prepare a string for DrawStr, then a
>couple lines later, I turn on grayscale.  If I comment out the sprintf line,
>it will run fine.  I couldn't find anything in the TIGCC help or the list
>archives, any ideas?

It is most probable that, that the buffer you give to sprintf is too small 
for the generated result.
Which results in sprintf writing outside the buffer, trashing some code, 
or, if the buffer is on stack, trashes the return adress.
This will result in the execution of illegal code (either by jumping 
somewhere random in the memory, or plainly executing it).



///Olle




Follow-Ups: References: