Jump to content
IGNORED

BASIC / XB Translator (TidBit)


matthew180

Recommended Posts

Thanks, guys. =) I just thought "this application is so cool, I've gotta put it on youtube!" So, I kind of just hit record without a plan and did a little demo. =)

 

@sometimes:

 

Thank you very much for your words of encouragement. There are about 7 of those trees in the world, total... When all is said and done, I have plans for each of these trees. =) Since this is the first explorable world, the trees will "give wisdom," if you will. They act as sort of a tutorial. You go up to a tree, "interact" with it (by using "examine"... which is the space bar) and the tree will tell you little pieces of information about the game itself--- how to use certain features, how to best utilize items, how to equip armor/weapons, etc... It's kind of cheezy, but I've always thought that big giant old trees would have quite a bit to say if they could talk... Thankfully, in the world of Beryl Reichardt, they can. =)

 

Back to TIdBiT... Matthew, a desktop version would be great. I'm finding the online version very easy to use, however, and it's not a problem (for me anyway) to have to use the website version. As you can see from the video, using the translator gets you VERY familiar with the term "code|hack|create". =)

Link to comment
Share on other sites

Yeah, but cut-n-paste in a small text box sucks. If I make it too wide it will blow the website layout, and stupid stuff like that. Plus, the page refresh sucks. I would much rather have done this using asynchronous JavaScript (AJAX), but that is just something *ELSE* to learn... Maybe I can come up with a way to cheat. :)

Link to comment
Share on other sites

Hey, the program works. =) I have my text editor for coding... the "pasting in" is just a formality, and it takes less than a second to scroll down from the top upon "refresh." Still, I'm a perfectionist when it comes to stuff I create, so I understand your meticulous attitude towards your work. =) Works perfectly fine on my end, man. Great job, BTW. I tagged your name in the video, but perhaps I should go back and tag [code|hack|create] =)

Link to comment
Share on other sites

The converter does not seem to recognize the RESTORE statement.

 

         RESTORE CharData
GetChr:  READ C,C$
        IF C=0 THEN BrkLoop
        CALL CHAR(C,C$)
        GOTO GetChr
BrkLoop: PRINT "Characters Defined"
        STOP

CharData: DATA 36,FF,45,,128,ABCDEF01

 

Results in

 

100 RESTORE CharData
110 READ C,C$
120 IF C=0 THEN 150
130 CALL CHAR(C,C$)
140 GOTO 110
150 PRINT "Characters Defined"
160 STOP
170 DATA 36,FF,45,,128,ABCDEF01

Link to comment
Share on other sites

Fixed. Thanks for finding that. Seems I forget about RESTORE. These are the commands that I have that can accept a line number as a parameter, did I miss any more?

 

THEN

ELSE

GOTO

GOSUB

ON ERROR

RESTORE

 

Hmm, looks like there is a BREAK statement that takes a line number list... I'll have to add that now.

 

CALL CLEAR
ON ERROR Done
RESTORE TheData

ReadData:
   READ A :: PRINT A
   GOTO ReadData

Done:
   END

TheData:
   DATA 1,2,3,4,5


100 CALL CLEAR
110 ON ERROR 150
120 RESTORE 160
130 READ A :: PRINT A
140 GOTO 130
150 END
160 DATA 1,2,3,4,5

Link to comment
Share on other sites

Yuppers, thanks, indeed. I will be able to get back to structuralizing my program.

 

I cannot think of any other statements off the top of my head which allow line numbers as arguments, but I will let you know as soon as I run across any unaccounted for.

Link to comment
Share on other sites

I'm pretty excited that this program is seeing some use. Once people "get it", it could really help with expanding our game library.

 

Find a C programmer, show him the labeled format of TIdBiT and the BASIC syntax--- go wild. If SPRITEs are left out of the programs and the programmer focuses on integers, one could write in TIdBiT and compile with WBC--- assembly speed. =)

 

Yea, it's a long long long way around... The GCC that's being developed is much more efficient... but this is at least fun to think about. =)

Link to comment
Share on other sites

I ran into a problem with the assumption of tail (!) comments. In particular, I have two lines which have a bang (!) as part of the REMark

REM ** TILES!
REM * BY RICK HARRISON
REM ** (C) 1988 COMPUTE!

 

When the parser comes across the !, it dutifully strips the rest of the line, as well as the character before the !. Since the REMark causes the interpreter to ignore the rest of the line, I believe the proper action for the translator would be to do the same.

 

It does not cause functional problems, over-all. In fact, I believe at this point I have fully structuralized "Tiles" to be translated. Hopefully, the output will "compute." :)

 

Edit: The parser also missed two uses of an undefined label. The label definition was "DispAtClrMsgArea" and the calls were "GOSUB DispAtClearMsgArea".

 

Edit2: The ! issue also adversely affected this line

DATA 003844040810001,7F3F1F1F1F1F3F7F,!

Edited by OLD CS1
Link to comment
Share on other sites

So, the TI BASIC interpreter completely missed these erroneous lines during input. Any other similar occurrences were immediately protested, which is how I found them.

3140 IF I THEN PLAYAGAINASK ELSE 1940
3150 PLAYAGAINASK IF J THEN 3180

 

Wait, wha? heheheheh

 

But it also seems that the translator should have reported that "PlayAgainAsk" was an undefined label.

Edited by OLD CS1
Link to comment
Share on other sites

I'll look into the ! comment problem.

 

As for detecting the undefined label, remember, the program does not interpret or analyze the code, so it does not know that PLAYAGAINASK is not simply a language token. The translator does not have a comprehensive list of BASIC keywords, so it really does not know.

 

I actually removed the "undefined label" warning today while fixing the other RESTORE bug. Now that line numbers can be used in conjunction with labels, I simply removed the warning message.

 

So, is there an error with the GOSUB [label] ? If so, can you post the offending code?

Link to comment
Share on other sites

I actually removed the "undefined label" warning today while fixing the other RESTORE bug. Now that line numbers can be used in conjunction with labels, I simply removed the warning message.

 

Okay, that explains that, then.

 

So, is there an error with the GOSUB [label] ? If so, can you post the offending code?

 

No, just that it was mis-matched with the actual label. I have already corrected the code and am testing the output.

Link to comment
Share on other sites

I seem to have successfully converted my "Tiles" program from line-numbered to structured. Well, if you want to call it "structured." hehehehe I have run it through the translator a few times working out various Stupid Programmer TricksTM and think I will keep it in this format while I work out the Extended BASIC conversion. I just need to work out small changes in the game play and synchronize the listings between the original and the structured and I will be done.

 

Thanks, again, for a really neat tool. The biggest issue I have with this process is not the translator itself, but trying to hybridize a non-structured language with a structured coding technique. In my case, naming major program sections (usually called by GOSUB) was simple, but naming the various IF-THEN-ELSE, ON-GOTO, and GOTO was particularly difficult, plus the destination labels seem to clutter up the source.

 

That is a stylistic challenge, IMHO. TIdBiT is a fun and workable solution, none-the-less.

Link to comment
Share on other sites

Yea... that was the big thing for me... I designed the menu structure for Beryl in TIdBiT, but had to hybridize TIdBiT with XB... It took forever and was very frustrating. However, had I worked on this thing in TIdBiT to start with and didn't have to worry about hybridizing, I would have had a much nicer time of it. =)

 

I'm going to use TIdBiT for my next project as well... I'm waiting to get the source code for an old crappy version of PacMan written in some form of C, compiled to Z80 assembler for application on the Jupiter Ace computer. =) The whole game--graphics and code (compiled) fits in under 3k... I hope to make this my first real conversion... Lemonade Stand was based on an old premise, but with this game, I'm hoping to be able to actually convert code. We'll see. I should be getting the email with the code soon... the guy who recovered the old tape from 1983 said he would send it to me. Apparently he found this game in some attic somewhere in the UK and it had the original C source with it... Talk about cool!

Edited by Opry99er
Link to comment
Share on other sites

Ok, I think I fixed the REM and ! comments. Wow, that was quite some restructuring, so make sure things still come out as before (i.e. I can't promise I didn't break something.)

 

Remember, REM and ! comments are retained in the output, but // comments are removed. So if you want to heavily comment your source without taking up real memory in BASIC, use the // style.

 

Thanks, again, for a really neat tool. The biggest issue I have with this process is not the translator itself, but trying to hybridize a non-structured language with a structured coding technique. In my case, naming major program sections (usually called by GOSUB) was simple, but naming the various IF-THEN-ELSE, ON-GOTO, and GOTO was particularly difficult, plus the destination labels seem to clutter up the source.

 

I think BASIC has structure, it just depends on how you use it. Numeric line numbers promote bad programming practice. I don't know if the translator adds any structure per se, it simply lets you add formatting (indentation, heavy comments, etc.) and to cut loose of the line numbers. I suppose labels can add clutter, but I might counter by saying, it depends on how you format your code. And, you can always fall back to line numbers if necessary. Labels can be single characters and they don't have to be on their own line.

 

To me the most curious aspect of using tidbit is the change in thought process simply be removing the line numbers and allowing some simple formatting. The programs don't even look the same, yet it is the same language.

 

I might propose a few "constructs" to promote better coding:

 

   // Simple while loop
   while: IF NOT ([condition]) THEN break

       .. do stuff ..

   wend: GOTO while
   break:


   // While loop with continue and break support
   continue:
   while: IF NOT ([condition]) THEN break

       .. do stuff..

       IF X THEN continue

       IF Y THEN break

   wend: GOTO while
   break:


   // A switch statement
   switch: ON X GOTO case1, case2, case3, default
       case1:
           .. do case 1 stuff ..
           GOTO break

       case2:
           .. do case 2 stuff ..
           GOTO break

       case3:
           .. do case 3 stuff ..
           GOTO break

       default:
           .. do default ..

   break:

 

Granted that every time you used such a construct you would have to use unique labels for while, wend, break, etc. And the switch is not quite the same, but close in how it looks and behaves. You do have to make sure your input variable is in range though. If tidbit is used enough, I could probably add support for these pseudo statements so you could use WHILE WEND, SWITCH CASE, etc. I have thought about adding support for local labels too... :)

Link to comment
Share on other sites

  • 2 years later...

Man, I'd forgotten how intuitive this thing is. =) Now I just need to familiarize myself, again, with the structure and such. I hadn't seen that TIdBiT video in over 2 years. =)

 

It really did make my menu structure so much more clean to write, though... I ended up using it for the remainder of the development I got done on Beryl before I paused development back in '11.

 

Anyone who has not tried TIdBiT, get off your aZZ and give it a shot. =) You'll like it, if you try it. =)

Link to comment
Share on other sites

That's what I thought... I'm stumped then as to how to run TidBit aside from using Matt's website...

 

Walid...

 

You should be able to set up your local PC with PHP software---essentially making your PC both client and web-server. I haven't tried it myself, but it is surely done all the time.

 

...lee

Link to comment
Share on other sites

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...