Jump to content

Photo

BASIC / XB Translator (TidBit)


218 replies to this topic

#201 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,003 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Mon Dec 26, 2016 5:32 AM

They seem the same to me? Prefer offline since I travel and am often without internet.


AFAIK, the web interface has the top and bottom screens, top for input, bottom for output. The application is command prompt only. What are you using when offline?

Edited by Sinphaltimus, Mon Dec 26, 2016 5:34 AM.


#202 Airshack OFFLINE  

Airshack

    Dragonstomper

  • 550 posts
  • Location:Phoenix, AZ

Posted Mon Dec 26, 2016 8:56 AM

1. Open the windows command prompt.

2. Change directory path to your PHP path.

3. Type:

PHP> php -S localhost:8000

4. Open browser

5. Within browser enter URL:

localhost:8000/tidbit_web.php

Makes TIdbit work offline exactly as it does online -- in the browser. No need to ever use the online interface again. No longer dependent on the web.




Sent from my iPhone using Tapatalk

Edited by Airshack, Mon Dec 26, 2016 8:57 AM.


#203 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,003 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Mon Dec 26, 2016 9:46 AM

1. Open the windows command prompt.

2. Change directory path to your PHP path.

3. Type:

PHP> php -S localhost:8000

4. Open browser

5. Within browser enter URL:

localhost:8000/tidbit_web.php

Makes TIdbit work offline exactly as it does online -- in the browser. No need to ever use the online interface again. No longer dependent on the web.




Sent from my iPhone using Tapatalk




You're now my short duration personal saviour for the day!

#204 Airshack OFFLINE  

Airshack

    Dragonstomper

  • 550 posts
  • Location:Phoenix, AZ

Posted Mon Dec 26, 2016 3:04 PM

We're learning so much of this together you know. I've been reading your questions and learning from them. Glad to have been of some assistance. You made me aware of TIdbit btw.


Sent from my iPhone using Tapatalk

#205 matthew180 OFFLINE  

matthew180

    River Patroller

  • Topic Starter
  • 2,413 posts
  • Location:Castaic, California

Posted Fri Dec 30, 2016 12:43 AM

Just as an alternative, the command-line work-flow looks like this:

 

1. edit your TidBit code.

 

2. at the command prompt, hit "up-arrow" then "enter".

 

3. copy output code to emulator and run.

 

4. goto 1.

 

 

Step 2 could also be automated depending on your editor, since many editors have the ability to run external commands.

 

Some assumptions to making this work:

 

1. php is in your path, so from anywhere at a command prompt you can type "php" and the interpreter will run.

 

2. the command line "tidbit_cmd.php" is located with your source code, or someplace that you know the path.

 

3. that you understand the command-prompt "history", i.e. hitting the "up-arrow" at the command prompt takes you back through any previous commands you have entered.

 

 

So the whole "setup" would look like this:

 

1. open your TidBit source in your favorite text editor (Textpad, Notepad++, etc.), using "source.txt" in this example.

 

2. open or create the output file (the code that TidBit will generate) in your favorite text editor, using "output.txt" in this example.  If you are just starting out then this file may be empty.  You will never edit this file directly, just copy the code from this file.

 

3. open a command prompt and change to whatever directory you have you TidBit source and output files in (I assume then reside in the same directory).

 

4. at the command prompt type: php <path_to_tidbit>\tidbit_cmd.php source.txt 100 10 output.txt

 

5. edit your TidBit code.

 

6. at the command prompt, hit "up-arrow" then "enter".  Or, if you have a macro set up in your text editor, activate the macro.

 

7. switch to the output.txt file, your editor should be telling you it has changed.  Acknowledge and accept the changes since this is the code just generated by TidBit in the previous step.

 

8. select-all and copy from ouptput.txt and paste into your emulator to run.

 

9. goto 5.



#206 Sinphaltimus OFFLINE  

Sinphaltimus

    River Patroller

  • 2,003 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Fri Dec 30, 2016 10:48 AM

I appreciate all that, I really do there's something about the interface I can't get away from. I don't have to worry about paths or files or anything.

My workflow now consists of this:
1. Execute custom batch file to launch tidbit web on local host.
2. Open np++ which auto opens my source and tidbit output.
3. Edit source.
4. Copy paste source in to tb, translate, then copy paste output in to np++ file.
5. Edit tb output (because I have commented lines that need to be executed when I copy paste into emulator.
6. Copy paste in to emulator and test.

This is my dream zone where everything happens within my comfort zone of happiness.

#207 Airshack OFFLINE  

Airshack

    Dragonstomper

  • 550 posts
  • Location:Phoenix, AZ

Posted Sat Jan 14, 2017 5:28 PM

See above^^^^

No typing just copy and paste = user friendly and best.
  • RXB likes this

#208 LASooner OFFLINE  

LASooner

    Chopper Commander

  • 154 posts

Posted Sat Aug 19, 2017 8:11 PM

So I'm using TIdBit a lot lately and the workflow was starting to get in my way. Yes it's faster than typing it all in on the TI, but it could be faster with the command line version.

 

It requires that you have TIdBIT set up locally

 

I've created 2 batch scripts to help speed up using it

 

You'll need to edit both to add your own paths to PHP and TIdBIT cmd.

 

The "compile" batch is if you're iterating on the same file, the "input compile" is if you want to do a quick compile on some code without editing the compile batch file

 

Open the input file 

 

When you're ready to compile your TIdBIT code,save the source, run the compile batch file
 
When you run it, it copies the compiled file to clipboard, post straight to Classic 99
 
removes task of copying your source, clearing the web INPUT field, and pasting it, pressing translate, select output, copying output to paste in Classic 99.
 
Also one less window you have to have open or deal with because you're not using a browser anymore.

 

These batch files are going to save some of my sanity.

Attached Files


Edited by LASooner, Sat Aug 19, 2017 8:24 PM.


#209 LASooner OFFLINE  

LASooner

    Chopper Commander

  • 154 posts

Posted Sun Aug 20, 2017 1:46 AM

I noodled some more with the batch file, and created an auto compile batch, change the paths and files in auto_compile.bat (everything in astericks below)

And when you run it, it will stay resident and check to see if you have changed the file that you specified.

 

So run the batch file, edit your tidbit code in whatever editor you use, save it, it will auto compile and get copied to your clipboard. So as long as the batch is running all you have to do is save and paste into C99

@Echo Off
Set _Delay=10
Set _Monitor=[****INPUT PATH****]\input.xb
Set _Base=%temp%\BaselineState.dir
Set _Chck=%temp%\ChkState.dir
Set _OS=6
Ver|Findstr /I /C:"Version 5">Nul
If %Errorlevel%==0 Set _OS=5 & Set /A _Delay=_Delay*1000
:_StartMon
Call :_SetBaseline "%_Base%" "%_Monitor%"
:_MonLoop
If %_OS%==5 (Ping 1.0.0.0 -n 1 -w %_Delay%>Nul) Else Timeout %_Delay%>Nul
Call :_SetBaseline "%_Chck%" "%_Monitor%"
FC /A /L "%_Base%" "%_Chck%">Nul
If %ErrorLevel%==0 Goto _MonLoop

[****PHP PATH****]\php [****TIdBIT PATH****]\tidbit_cmd.php [****INPUT PATH****]\input.xb 100 10 [****OUTPUT PATH****]\output.xb

clip < "[****OUTPUT PATH****]\output.xb"

Goto :_StartMon
:::::::::::::::::::::::::::::::::::::::::::::::::::
:: Subroutine
:::::::::::::::::::::::::::::::::::::::::::::::::::
:_SetBaseline
If Exist "%temp%\tempfmstate.dir" Del "%temp%\tempfmstate.dir"
For /F "Tokens=* Delims=" %%I In ('Dir /S "%~2"') Do (
Set _Last=%%I
>>"%temp%\tempfmstate.dir" Echo.%%I
)
>"%~1" Findstr /V /C:"%_Last%" "%temp%\tempfmstate.dir"
Goto :EOF

Attached Files


Edited by LASooner, Sun Aug 20, 2017 1:48 AM.


#210 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 2,814 posts
  • Location:Eagan, MN, USA

Posted Sun Aug 20, 2017 5:15 AM

Nice. Will have to try it out.



#211 LASooner OFFLINE  

LASooner

    Chopper Commander

  • 154 posts

Posted Mon Aug 21, 2017 9:06 PM

Just to clarify, "autocompile" translates TIdBit code to Basic. It doesn't actually compile the code to assembly. There was some confusion about that.



#212 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 2,814 posts
  • Location:Eagan, MN, USA

Posted Fri Sep 29, 2017 8:18 PM

 

I noodled some more with the batch file, and created an auto compile batch, change the paths and files in auto_compile.bat (everything in astericks below)

And when you run it, it will stay resident and check to see if you have changed the file that you specified.

 

So run the batch file, edit your tidbit code in whatever editor you use, save it, it will auto compile and get copied to your clipboard. So as long as the batch is running all you have to do is save and paste into C99

@Echo Off
Set _Delay=10
Set _Monitor=[****INPUT PATH****]\input.xb
Set _Base=%temp%\BaselineState.dir
Set _Chck=%temp%\ChkState.dir
Set _OS=6
Ver|Findstr /I /C:"Version 5">Nul
If %Errorlevel%==0 Set _OS=5 & Set /A _Delay=_Delay*1000
:_StartMon
Call :_SetBaseline "%_Base%" "%_Monitor%"
:_MonLoop
If %_OS%==5 (Ping 1.0.0.0 -n 1 -w %_Delay%>Nul) Else Timeout %_Delay%>Nul
Call :_SetBaseline "%_Chck%" "%_Monitor%"
FC /A /L "%_Base%" "%_Chck%">Nul
If %ErrorLevel%==0 Goto _MonLoop

[****PHP PATH****]\php [****TIdBIT PATH****]\tidbit_cmd.php [****INPUT PATH****]\input.xb 100 10 [****OUTPUT PATH****]\output.xb

clip < "[****OUTPUT PATH****]\output.xb"

Goto :_StartMon
:::::::::::::::::::::::::::::::::::::::::::::::::::
:: Subroutine
:::::::::::::::::::::::::::::::::::::::::::::::::::
:_SetBaseline
If Exist "%temp%\tempfmstate.dir" Del "%temp%\tempfmstate.dir"
For /F "Tokens=* Delims=" %%I In ('Dir /S "%~2"') Do (
Set _Last=%%I
>>"%temp%\tempfmstate.dir" Echo.%%I
)
>"%~1" Findstr /V /C:"%_Last%" "%temp%\tempfmstate.dir"
Goto :EOF

 

This seems to work really well! Much easier workflow now. Thanks!



#213 LASooner OFFLINE  

LASooner

    Chopper Commander

  • 154 posts

Posted Fri Sep 29, 2017 8:33 PM

no problem.

 

I stopped using the auto translate. I feel like I have more control by executing the batch scripts myself.



#214 RXB OFFLINE  

RXB

    River Patroller

  • 2,844 posts
  • Location:Vancouver, Washington, USA

Posted Fri Sep 29, 2017 10:56 PM

See above^^^^

No typing just copy and paste = user friendly and best.

Same thing I do with GPL Code on Classic99 other then I have to run the Ryte Data GPL Assembler, but I have 4 sessions going on at same time so can do multiple Classic99 projects at once all using varied drives 1 to 9.



#215 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 2,814 posts
  • Location:Eagan, MN, USA

Posted Sun Oct 1, 2017 8:51 PM

Looks like I found a bug.

When a double colon separating 2 statements follows a label, the label is not interpreted. 

For example:

 

IF TEST=1 THEN GOSUB some_label :: PRINT "TEST"

 

When translated, the label some_label is not exchanged for a line number...



#216 LASooner OFFLINE  

LASooner

    Chopper Commander

  • 154 posts

Posted Sun Oct 1, 2017 10:34 PM

I ran into this last night, I just added a space between them and it worked fine



#217 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 2,814 posts
  • Location:Eagan, MN, USA

Posted Mon Oct 2, 2017 7:09 AM

I ran into this last night, I just added a space between them and it worked fine

 

Good to know. Thanks.



#218 matthew180 OFFLINE  

matthew180

    River Patroller

  • Topic Starter
  • 2,413 posts
  • Location:Castaic, California

Posted Mon Oct 2, 2017 9:15 PM

Can you give the me example of the code that does not work, but use the forum [ code ] tags so I can see exact syntax that was failing.  Also keep in mind that TidBit does not parse for execution like the real interpreter, thus it relies on space more than the interpreter.



#219 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 2,814 posts
  • Location:Eagan, MN, USA

Posted Tue Oct 3, 2017 5:35 PM

Here you go:

CALL CLEAR
A$="THIS IS A TEST"::GOSUB print_string::STOP
print_string:
PRINT A$
RETURN





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users