Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack corruption #18

Open
Duefectu opened this issue Oct 17, 2021 · 0 comments
Open

Stack corruption #18

Duefectu opened this issue Oct 17, 2021 · 0 comments

Comments

@Duefectu
Copy link

Duefectu commented Oct 17, 2021

Hello,

In NextLib 7.5 the stack is changed to point to the "nbtempstackstart" label, leaving a stack area of 256 bytes:

asm 		
filename:
	DEFS 255,0
endfilename:	
end asm 

asm 
nbtempstackstart:
	**ld sp,nbtempstackstart**
end asm 

This can cause serious problems, for example in the use of local variables of type string that are a bit big.
It would be possible not to alter the SP?
I think it would be best to respect the one the main program has, and the library should restore the original stack when finished.
Right now, SP is changed directly by doing "#include <NextLib.bas>", and not works if SP is changed to another position.

Thanks a lot for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant