Jump to content
IGNORED

BASIC / XB Translator (TidBit)


matthew180

Recommended Posts

9 hours ago, Vorticon said:

I don't know about less code, but definitely a better structured program with clearly defined  and controlled subroutine parameters. I rely on them heavily.

A SUB creates a list of Temporary variable separate from normal Variables, this saves memory in VDP.

Link to comment
Share on other sites

12 hours ago, TheBF said:

Where are the local variables for the SUB kept Rich? (Never looked into this stuff)

A temporary VDP Buffer is set up and as the main variables already have the values after completion there is no need to save them.

This works the same way as a DSR VDP buffer, it is set up and used but deleted when done.

  • Like 1
Link to comment
Share on other sites

On 11/17/2019 at 10:17 PM, matthew180 said:

 

Ok, looking into it now.  Can you give me a few lines of the actual code?  Also note, labels that collide with reserved words are silently ignored.

 

Here you go:

 

OPEN #1:"RS232".BA=9600.DA=7,UPDATE !OPEN SERIAL COMM WITH ROBOT
PRINT #1:5 !SEND MOVE FORWARD CODE TO ROBOT
fwd_complete:
ON ERROR fwd_complete::INPUT #1:ANS$ !WAIT FOR CONFIRMATION FROM ROBOT
ON ERROR STOP !RESUME NORMAL ERROR TRAPPING
IF ANS$<>"89" THEN fwd_complete !KEEP CHEKCING UNTIL CORRECT CODE RECEIVED
...

The fwd_complete label does not resolve to a line number inside the ON ERROR line, but it does outside of it.

Link to comment
Share on other sites

On 11/18/2019 at 2:00 AM, matthew180 said:

Ok, the double-colon problem is now fixed, and it also fixes the problem posted in #219 above.  I have updated the download file on the first page of this post (V3.1), as well as my website.

 

Also, Vorticon, I'm not sure if you realize but you don't need the continuation operator ".." if the line ends with the double-colon.  I have not seen your tidbit code recently, but the examples you posted many moons ago showed you were still using the ":: .." syntax.


A=1 ::
B=2 ::
C=3 ::

Translates to:

A=1::B=2::C=3

You *don't* need to do this (since somewhere around 2015 or 2016 I think)

A=1 :: ..
B=2 :: ..
C=3

 

Noted. Thanks.

Link to comment
Share on other sites

The word "continue" is a reserved word and cannot be used as a label.  Right now, any reserved words that are used as labels are silently ignored, i.e. they will pass through unmodified.  If you change the code above to something like this, it will work:

 

ON ERROR err_sub
INPUT #1:ANS$

err_continue:
PRINT "HELLO"
END

err_sub:
  PRINT "ERROR!"
  RETURN err_continue

----------------

100 ON ERROR 140
110 INPUT #1:ANS$
120 PRINT "HELLO"
130 END
140 PRINT "ERROR!"
150 RETURN 120

If you have any suggestions as to what to do about labels that conflict with reserved words, please let me know.  To keep the parser simple it does not actually interpret the code, so it does not have the context to know the difference between a label's use and a real BASIC statement/word (which is why all BASIC and XB statements/words are reserved and cannot be used for labels).  Currently, this is the list:

 

    private $reserved_words = array(
        'abs', 'accept', 'all', 'and', 'append', 'asc', 'at', 'atn',
        'base', 'beep', 'break', 'bye',
        'call', 'chr$', 'close', 'con', 'continue', 'cos',
        'data', 'def', 'delete', 'digit', 'dim', 'display',
        'else', 'end', 'eof', 'erase', 'error', 'exp',
        'fixed', 'for',
        'go', 'gosub', 'goto',
        'if', 'image', 'input', 'int', 'internal',
        'len', 'let', 'linput', 'list', 'log',
        'max', 'merge', 'min',
        'new', 'next', 'not', 'num', 'number', 'numeric',
        'old', 'on', 'open', 'option', 'or', 'output',
        'permanent', 'pi', 'pos', 'print',
        'randomize', 'read', 'rec', 'relative', 'rem', 'res', 'resequence', 'restore', 'return', 'rnd', 'rpt$', 'run',
        'save', 'seg$', 'sequential', 'sgn', 'sin', 'size', 'sqr', 'step', 'stop', 'str$', 'sub', 'subend', 'subexit',
        'tab', 'tan', 'then', 'to', 'trace',
        'ualpha', 'unbreak', 'untrace', 'update', 'using',
        'val', 'validate', 'variable',
        'warning',
        'xor'
        );

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

  • 4 months later...

I'm wondering if anyone is actively using TidBit on my website?  Due to the pandemic situation, I'm going to be shutting down my current server and moving to a smaller cheaper service, and I'm reluctant to keep the "online" TidBit page working.  The security risk has always made me uncomfortable too.  Anyway, since I don't run any stats on my website, I don't know how much that page actually gets used.

Link to comment
Share on other sites

11 minutes ago, matthew180 said:

I'm wondering if anyone is actively using TidBit on my website?  Due to the pandemic situation, I'm going to be shutting down my current server and moving to a smaller cheaper service, and I'm reluctant to keep the "online" TidBit page working.  The security risk has always made me uncomfortable too.  Anyway, since I don't run any stats on my website, I don't know how much that page actually gets used.

I piddled yesterday, but don't really use it.

Link to comment
Share on other sites

3 hours ago, matthew180 said:

I'm wondering if anyone is actively using TidBit on my website?  Due to the pandemic situation, I'm going to be shutting down my current server and moving to a smaller cheaper service, and I'm reluctant to keep the "online" TidBit page working.  The security risk has always made me uncomfortable too.  Anyway, since I don't run any stats on my website, I don't know how much that page actually gets used.

I definitely use it any time I work on an XB program. I can always install php on my computer and use it that way as well.

Link to comment
Share on other sites

Depending on the demand for a browser-based TidBit, I was considering porting it to C, the use Emscripten to compile to JavaScript.  Then it would run in people's browser instead of on my server, and it would not be a security risk to my server either.  But that is a lot of effort if no one is really using it very often.  Maybe after the MK2 is done...

 

Or, just port to C and make a native app for Win/MAC/Unix.

 

17 minutes ago, OLD CS1 said:

I have a cunning plan...

What is your plan?

 

Link to comment
Share on other sites

I can’t say I use it very often, but I have been using the version on your website. I understand the desire to get rid of security risks, but please don’t let the concept die. And thanks for making these cool tools.


Sent from my iPad using Tapatalk

Link to comment
Share on other sites

3 hours ago, jwild said:

... but please don’t let the concept die. ...

I'm not talking about it going away, the program has always been available as open-source.  You can download and run it on your own computer.  I'm just talking about not moving the functional page on CodeHackCreate.com to the new domain (dnotq.io) that I'm migrating to.

 

TidBit will always have a page that describes it, as well as the github repo: https://github.com/dnotq/tidbit

 

7 hours ago, Vorticon said:

I definitely use it any time I work on an XB program.

Would having a native Win/MAC/Unix executable be better for your workflow?  If I port it to C, this would be an option.

  • Like 1
Link to comment
Share on other sites

5 hours ago, matthew180 said:

Would having a native Win/MAC/Unix executable be better for your workflow?  If I port it to C, this would be an option.

Yes that would work great. For the record, I really think no one should code in Basic or XB without using TIdBiT unless working on real iron exclusively.

  • Like 2
Link to comment
Share on other sites

Porting to C would also have a potential advantage of being compiled using GCC for the TMS9900 so that you could run it natively on the TI.  I've got another C project that I'm doing to learn how to use files on the TI, so I can offer my help with TidBit too.

Link to comment
Share on other sites

6 hours ago, unhuman said:

I'd be happy to host. ...

TibBit has always been open source, it is just one PHP file, and two example support files depending on if you want to run from the command line or via a web-form.  Anyone who wants to set up a page on their website, please feel free to do so.

 

1 hour ago, PeteE said:

Porting to C would also have a potential advantage of being compiled using GCC for the TMS9900 so that you could run it natively on the TI.

Interesting.  Possible I suppose.  But the tool expects the source to be entirely in memory for parsing and building the symbol table, which takes up even more memory and a lot of time searching.  I'll keep it in mind, but I can't make any promises, and I don't have a lot of time to spend on this.

Link to comment
Share on other sites

I added a feature to TIPI this weekend, that lets you OLD or RUN your native tidbit source directly into basic/xb as though it was a PROGRAM image file. 

 

Just edit from your PC, and load on the 4A. Conversion happens as the load occurs.

 

Files must end in '.TB' on your PC, that '/TB' from the 4A perspective.

 

-M@

  • Like 10
  • Thanks 2
Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...