neilsf / XC-BASIC

A compiling BASIC dialect for the Commodore-64
https://xc-basic.net/
MIT License
74 stars 15 forks source link

Strange artifact displayed after INPUT #132

Closed Diduz closed 3 years ago

Diduz commented 3 years ago

Hello, first of all I'd like to thank you for creating this powerful tool. I think it's way more versatile, fast and powerful than the plain Basic V.2.0 a newbie like me would be stuck to. So, thanks again. A lot. I'm encountering a strange bug: a weird character is shown on screen after the program gets user's INPUT. I don't know if I'm doing something wrong. I attach a screenshot of this problem, the character is underlined in red. Here is the code behind the screenshot (I'm trying to code a text adventure, so INPUT is the core of the experience! :-) ). I'm using the latest XC=Basic version, i.e. 2.3.09 Thanks. Dom (Italy)

dim ibuffer![41] i$ = @ibuffer! print "{CLR}" print "" print "write something here:" ; input i$, 41 print "" : print "" print "you wrote:", i$ vice-screen-20210118120755790793

neilsf commented 3 years ago

Hi Dom Thanks for giving XC=BASIC a try! Well, yes, this is a known bug. I'll try to fix it and let you know when it's done.

neilsf commented 3 years ago

Had some time after lunch so I fixed it: https://github.com/neilsf/XC-BASIC/releases/tag/v2.3.10 BTW, there is a possible mistake in your code. The buffer should be one byte longer than the maximum string length. This is because one byte must be preserved for the end character, which is a zero byte (0x00). So if buffer is 41 bytes long, the input should be maximum 40 chars.

Diduz commented 3 years ago

Had some time after lunch so I fixed it: https://github.com/neilsf/XC-BASIC/releases/tag/v2.3.10 BTW, there is a possible mistake in your code. The buffer should be one byte longer than the maximum string length. This is because one byte must be preserved for the end character, which is a zero byte (0x00). So if buffer is 41 bytes long, the input should be maximum 40 chars.

Thank you so much, the mischievous character has disappeared! :-D I also fixed the buffer mistake. ;-)