Every neslib function that returns an 8-bit value is buggy. According to cc65 calling conventions, every function must return at minimum 16 bits, which means that a function returning 8 bits must zero the X register.
None of the neslib 8-bit functions do this.
I've emailed Shiru about this, I don't think he reads this forum anymore.
This manifests in a lot of ways:
- var = foo + rand8() -> completely wrong value.
- calling a function that takes a constant 16-bit parameter after calling a buggy neslib function will mangle that parameter
- lots of other ways
None of the neslib 8-bit functions do this.
I've emailed Shiru about this, I don't think he reads this forum anymore.
This manifests in a lot of ways:
- var = foo + rand8() -> completely wrong value.
- calling a function that takes a constant 16-bit parameter after calling a buggy neslib function will mangle that parameter
- lots of other ways