Jump to content
IGNORED

Development idea of a new TRACE


Recommended Posts

Since some time, I have in mind a function that could be implemented into XB256 or TiCodED, if it is considered interesting.

 

TI Basic offers the TRACE function that, in theory, is very useful to detail the behavior of a program when running and to catch possible bugs, unexpected routes.
But TRACE has a big default that makes it unusable in most of the time: the listing of the lines in execution destroys the screen content  that often makes graphical programs impossible to run correctly.
Could be possible to make a sort of TRACE that creates a log file on a disk that contains all the lines executed until the program stops? I think that this log would be rich in information for any XB developer.

Has my proposal some sense? 

Edited by fabrice montupet
  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Yes.  A technical guru could possibly write a function for a command to do such a thing.  ( not me !! ) ... some tech wizard out there might just know how to do this:
LIST "TRACE" ... this would work like LIST "CLIP" for copying to clipboard in Classic99 except that it activates the TRACE command "silently" ... instead of spewing it all up over the screen it copies all the trace stuff into a clipboard, then you go to your notepad file and Ctrl-V or Paste, and it's all there.

EDIT: Actually that's bullshit you need it to be "live" as you watch it unfold.  Okay yeah I have no idea.

  • Like 1
Link to comment
Share on other sites

13 minutes ago, 1980gamer said:

check this out...

Thank you, it's interesting! 

But the TRACE5 uses a part of the screen to display lines numbers (and this is what I would like a such tool doesn't). That said, it crashes when I load it with ti994w  and when programming I only use this emulator.

Link to comment
Share on other sites

Well I have made a note to add this feature to XB but there is quite a bit of GPL and Assembly Code to be added or modified.

Here is the routine to find TRACE flag: 

***********************************************************
[0594]               *               NUD / STATEMENT BRANCH TABLE
[0595]               ***********************************************************
[0596] A13B 41,7D    NUDTB  BR   RECX              'RECORD'              0
[0597] A13D 45,E8           BR   NBREAK            'BREAK'               0
[0598] A13F 45,FA           BR   NUNBRK            'UNBREAK'             0
[0599] A141 45,DE           BR   NTRACE            'TRACE'               0
[0600] A143 45,E3           BR   NUNTRC            'UNTRACE'             0
[0601] A145 41,80           BR   NREADX            'READ'                0
[0602] A147 41,83           BR   PRINTX            'PRINT'               0
[0603] A149 41,7A           BR   SZRUNX            'RUN'                 0
[0604] A14B 41,9B           BR   LINPUX            Reserved for LINPUT   1
[0605] A14D 41,86           BR   RESTOX            'RESTORE'             1
[0606] A14F 43,35           BR   NRNDMZ            'RANDOMIZE'           1
[0607] A151 41,89           BR   INPUTX            'INPUT'               1
[0608] A153 41,8C           BR   OPENX             'OPEN'                1
[0609] A155 41,8F           BR   CLOSEX            'CLOSE'               1
[0610] A157 42,3C           BR   NPI               'PI'                  1
[0611] A159 42,4C           BR   NMAX              'MAX'                 1
[0612] A15B 42,59           BR   NMIN              'MIN'                 2

99/4 GPL-ASSEMBLER (Pass 3) correct                                   PAGE 0011 
RXB 2023
[0613] A15D 45,85           BR   RPTZ01            'RPT$'                2
[0614] A15F 41,92           BR   ACCEPX            'ACCEPT'              2
[0615] A161 41,77           BR   EOFX              'EOF'                 2
[0616] A163 44,79           BR   ASC01             'ASC'                 2
[0617] A165 45,1A           BR   POS01             'POS'                 2
[0618] A167 44,B4           BR   VAL01             'VAL'                 2
[0619] A169 44,8A           BR   STRZ01            'STR$'                2
[0620] A16B 43,EF           BR   SEGZ01            'SEG$'                3
[0621] A16D 41,98           BR   DELETX            'DELETE'              3
[0622] A16F 41,95           BR   DISPLX            'DISPLAY'             3
[0623] A171 44,52           BR   LEN01             'LEN'                 3
[0624] A173 44,5E           BR   CHRZ01            'CHR$'                3
[0625]               *RXB PATCH CODE FOR BASIC RND REPLACEMENT ***********
[0626] A175 42,87           BR   NRND              'RND'                 3      
[0627]               * The following are long branches to another GROM
[0628] A177 05,80,1C EOFX   B    EOF
[0629] A17A 05,60,1E SZRUNX B    SZRUN
[0630] A17D 05,80,22 RECX   B    REC
[0631] A180 05,80,0E NREADX B    NREAD
[0632] A183 05,80,04 PRINTX B    PRINT
[0633] A186 05,80,0C RESTOX B    RESTOR
[0634] A189 05,80,06 INPUTX B    INPUT
[0635] A18C 05,80,08 OPENX  B    OPEN
[0636] A18F 05,80,0A CLOSEX B    CLOSE
[0637] A192 05,80,1E ACCEPX B    ACCEPT
[0638] A195 05,80,00 DISPLX B    DISPL1
[0639] A198 05,80,02 DELETX B    DELET
[0640] A19B 05,80,30 LINPUX B    LINPUT
[0641]               ***********************************************************
[0642]               * FLAGS USED IN EXECUTION MODE:    this needs to be checked
[0643]               *  @FLAG   BIT   RESET               SET
[0644]               *           0
[0645]               *           1    Warning PRINT       PRINT off
[0646]               *           2    Warning NEXT        STOP
[0647]               *           3    Not in UDF          Executing a UDF
[0648]               *           4    TRACE mode          Normal mode
[0649]               *           5
[0650]               *           6    BREAK allowed       BREAK not allowed
[0651]               *           7    No LST/EDT protect  LIST/EDIT protected
[0652]               ***********************************************************
[0653]               * ON WARNING {NEXT | STOP | PRINT}
[0654]               * ON WARNING NEXT  - Causes warning messages to be ignored
[0655]               *                    and execution to continue as if a
[0656]               *                    warning never occurred
[0657]               * ON WARNING STOP  - Causes a warning to be treated as an
[0658]               *                    error - i.e. the message is displayed
[0659]               *                    and execution is halted
[0660]               * ON WARNING PRINT - Causes the default warning handling to
[0661]               *                    be in effect, i.e. any warning
[0662]               *                    messages are printed and execution
[0663]               *                    continues
[0664]               ***********************************************************

Here is the code in GPL to use or not use TRACE:

***********************************************************
[1292]               *                   TRACE STATEMENT
[1293]               ***********************************************************
[1294] A5DE B6,45,10 NTRACE OR   >10,@FLAG         Set the trace bit
[1295] A5E1 0F,75    XMLCON XML  CONT              Continue on
[1296]               ***********************************************************
[1297]               *                 UNTRACE STATEMENT
[1298]               ***********************************************************
[1299] A5E3 B2,45,EF NUNTRC AND  >EF,@FLAG         Reset the trace bit
[1300] A5E6 0F,75           XML  CONT              Continue on
[1301]               ***********************************************************

Finally here is the Assembly in XB ROM to show TRACE being used.

 0974            * Loop for each statement in the program  
  0975      650E  EXEC10 EQU  $   
  0976 650E D020         MOVB @FLAG,R0          Now test for trace mode   
       6510 8345  
  0977 6512 0A30         SLA  R0,3              Check the trace bit in FLAG   
  0978 6514 115F         JLT  TRACL             If set->display line number   

This line uses GPL to display the line number trace is on:

1142            * Trace a line (Call GPL routine)   
  1143 6672 C820  TRACE  MOV  @C2,@ERRCOD       Load return vector  
       6674 6000  
       6676 8322  
  1144 6678 020B         LI   R11,EXEC11-2      Set up for return to execute  

 99/4 ASSEMBLER
PARSES                                                       PAGE 0025
       667A 6514  
  1145 667C 10F7         JMP  CALGPL            Call GPL to display line #  
  1146            * Special code to handle concatenate (&)  
  1147 667E 0200  CONC   LI   R0,CONCAT         Go to GPL to handle it  
       6680 0008  
  1148 6682 10E7         JMP  EXIT              Exit to GPL interpeter  

And this line from above code:

1050 65D4 104E  TRACL  JMP  TRACE   

 

Thus this happens each time a line is executed and interpreted in a XB program as that program is running with TRACE flag turned on.

I can patch this code and the only place I could set up a PAB in XB for this is either RXB USER PAB or make a new one that would suck up some VDP memory.

 

Good news it is doable for me.

  • Like 1
Link to comment
Share on other sites

47 minutes ago, RXB said:

Now that is just evil!

If Fabrice has no interest in RXB, and says so in regards to his question, then no evil is afoot.  What could be evil is multiple posts in defiance of the thread owner who has asked that the topic be dropped.  This will be the end of the discussion so the topic can return to Fabrice's original request before the next page comes into play.  Period.

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

18 hours ago, InsaneMultitasker said:

The Myarc BASIC for the Geneve has a command called LTRACE that outputs to a device, such as a printer. I don't know that the code would be of any use to review, just mentioning it since the source is available, and might help someone in this venture.

That's actually pretty cool.  In my mind I was thinking of output to clipboard like list "clip" but with list "trace" ... then i realized it was a pretty crap idea.  But listing to printer is great way of tracing without messed up screen.  :) 

  • Like 2
Link to comment
Share on other sites

22 hours ago, RXB said:
0978 6514 115F         JLT  TRACL             If set->display line number

@RXB Is there any way a modified XB could display this at position 0 on the screen ?  (Basic position 1,1) 
        For example, instead of spilling the TRACE number down the screen in a printed fashion, have it at position 0 and maybe enable a function key to stop/step without breaking?

Link to comment
Share on other sites

Quote

Is there any way a modified XB could display this at position 0 on the screen ?  (Basic position 1,1) For example, instead of spilling the TRACE number down the screen in a printed fashion, have it at position 0 and maybe enable a function key to stop/step without breaking?

In the case of a solution that alter a part of the screen, the good solution is proposed by Harry with TRACE5.

  • Like 2
Link to comment
Share on other sites

Apart of this, I succeed to make TRACE5 working with my program.

As the ti994w emulator offers the way to manage the speed execution with a great flexibility, it is very easy to read all the lines in execution displayed in only 5 lines without missing one. The routine alters the top left part of the screen and in some cases, it can be a problem if it erases characters that are necessary for the program execution. A fine solution could be to be able to insert a value at the routine call permitting to select the TRACE5 area position among the four corners of the screen.
Without replacing a sort of TRACE in a log file, this routine does a great job and can be extremely useful. It joins preciously in my developing tools. Thanks Harry 🙂

 

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

Trace (#a number)

1=Upper left corner!
2=Upper right corner!
3=Lower right corner!
4=Lower left corner!
5=Middle of the screen!

Then Trace post the line numbers at that position. If important info is in that spot, use another number for a stationary post of line numbers, as program is running!

Link to comment
Share on other sites

I am having a difficult time keeping this thread cleaned up without having to address complaints of "oh, my post was hidden, that's not fair."  I am handling this without site mods, who can be far more heavy handed, unless you want them involved.  The posts will stand as illustration.  Now, enough.

  • Like 2
Link to comment
Share on other sites

2 hours ago, OLD CS1 said:

I am having a difficult time keeping this thread cleaned up without having to address complaints of "oh, my post was hidden, that's not fair."  I am handling this without site mods, who can be far more heavy handed, unless you want them involved.  The posts will stand as illustration.  Now, enough.

Thank you for your moderation and the cleaning, I appreciate.

  • Like 1
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...