gtBASIC

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

Is command INT(x) implemented in this version of basic ?
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

Is command INT(x) implemented in this version of basic ?
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post 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'
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post 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...
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post 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.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post 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
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

Have an issue with the compile now when it gets to the ASM stage.
Attachments
issue.jpg
issue.jpg (166.86 KiB) Viewed 1862 times
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post 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
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post 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.
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

UPPER$ says 'unknown symbol UPPER$'

used as

K$=UPPER$(K$)
Post Reply