Page 18 of 44

Re: gtBASIC

Posted: 15 Nov 2021, 20:34
by wbushby
Is command INT(x) implemented in this version of basic ?

Re: gtBASIC

Posted: 15 Nov 2021, 20:34
by wbushby
Is command INT(x) implemented in this version of basic ?

Re: gtBASIC

Posted: 17 Nov 2021, 02:09
by wbushby
I have found issues with comparative logic in IF..THEN statements

IF (A=15 AND O<>20 AND O<>1) OR (A=29 AND O<>16) OR O>C3 THEN...

This gives error 'syntax error in number literal'

Re: gtBASIC

Posted: 17 Nov 2021, 06:13
by at67
wbushby wrote: 15 Nov 2021, 20:34 Is command INT(x) implemented in this version of basic ?
This function converts floats to ints? If so, there are no floats in gtBASIC, yet...

Re: gtBASIC

Posted: 17 Nov 2021, 06:13
by at67
wbushby wrote: 17 Nov 2021, 02:09 I have found issues with comparative logic in IF..THEN statements

IF (A=15 AND O<>20 AND O<>1) OR (A=29 AND O<>16) OR O>C3 THEN...

This gives error 'syntax error in number literal'
Thanks I'll check this line out and get back to you.

Re: gtBASIC

Posted: 17 Nov 2021, 06:40
by at67
Replace that line with this for now:

Code: Select all

IF ((A=15) AND (O<>20) AND (O<>1)) OR ((A=29) AND (O<>16)) OR O>C3 THEN

Re: gtBASIC

Posted: 21 Nov 2021, 19:33
by wbushby
Have an issue with the compile now when it gets to the ASM stage.

Re: gtBASIC

Posted: 26 Nov 2021, 02:23
by wbushby
SORRY !!!! Stand alone this code worked. In the middle of my application it isn't. I will do more testing around that new knowledge

I have found an issue with the VAL function

AAA$ = "7This is a test"
NNN$=LEFT$(AAA$,1)
PRINT NNN$
N = VAL(NNN$)
PRINT N

Result:
7
0

IF I do VAL("7") it works

The ASM looks correct when in the program but it prints 0

LDWI 0x75a0
StringCopy ; NNN$=LEFT$(AAA$,1)

LDWI 0x75a1
IntegerStr
STW _N ; N = VAL(NNN$)

LDW _N
PrintAcInt16
NewLine ; PRINT N

Re: gtBASIC

Posted: 27 Nov 2021, 02:35
by at67
This was a design choice, I coded that particular function in the runtime so that if there are any non-alpha chars, (apart from the -ve symbol), in the string then it would return 0. This function would be 2x or maybe even 3x bigger to handle all cases properly and I deemed it not worth the waste of RAM.

One of the critical design choices was to make the runtime as small, fast and efficient as possible, as well as no runtime function being over 96bytes in length, (except for critical one such as INPUT/etc that use _ext subs), so that 32K RAM users would not lose their >96 byte segments and pages to the runtime, i.e. the runtime always tries and fits into the offscreen 96 byte segments, (unless you specify otherwise).

If you'd like to change it to work the way you want, then head on over to runtime\numeric*.i and modify the integerStr function.

Re: gtBASIC

Posted: 28 Nov 2021, 21:49
by wbushby
UPPER$ says 'unknown symbol UPPER$'

used as

K$=UPPER$(K$)