C68 4k Buffers on Stack SMSq/e

Anything QL Software or Programming Related.
Post Reply
User avatar
XorA
Site Admin
Posts: 1358
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

C68 4k Buffers on Stack SMSq/e

Post by XorA »

Are there any known issues with the combo in the topic?

Trying to debug a difference in behaviour in a program between Qemulator and QPC2 and narrowed it down to a 4k buffer as a local variable which seems to be corrupting something to do with file handling. When I move the buffer to a global variable it moves the issue to the next place a 4k buffer is used locally.

Before I replace these with malloc I thought I would check with the QDOS gods!


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: C68 4k Buffers on Stack SMSq/e

Post by tofro »

What's the dataspace you have given to that job?

What's the value of the global variable _stack (that's the stack size given to your job, and default is 2kBytes only)?

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
XorA
Site Admin
Posts: 1358
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: C68 4k Buffers on Stack SMSq/e

Post by XorA »

tofro wrote:What's the dataspace you have given to that job?
Whatever C68 said it was in the Xtcc field
What's the value of the global variable _stack (that's the stack size given to your job, and default is 2kBytes only)?
That would certainly explain the problem as the stack of the program is certainly well over 16k (old unix program).

Id have to look at the value when Im next at devel machine!


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: C68 4k Buffers on Stack SMSq/e

Post by tofro »

Simply increase the stack space of your program by placing an

Code: Select all

extern long _stack = 16384;
declaration somewhere in your program (to set the stack to 16k, for example) and you're done.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
XorA
Site Admin
Posts: 1358
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: C68 4k Buffers on Stack SMSq/e

Post by XorA »

Thanks Tobias, saved me hours of puzzling ;-)

Is this info somewhere modern PC readable these days? Trying to apply my *nix C skills to QL!


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: C68 4k Buffers on Stack SMSq/e

Post by tofro »

Dilwyn has some of the C68 manuals on his homepage as e-book and pdf here:

http://www.dilwyn.me.uk/docs/ebooks/index.html

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Post Reply