Jump to content
IGNORED

Introducing Structured Extended BASIC and TiCodEd


SteveB

Recommended Posts

11 minutes ago, Vorticon said:

The problem with ON GOSUB is that the variable can only have discreet sequential integer values starting at 1, which would be very restrictive.

I much prefer the flexibility of IF/THEN at the expense of elegance.

Hmm we do have a command to deal with this INT(floating point number) 

Link to comment
Share on other sites

52 minutes ago, Vorticon said:

The problem with ON GOSUB is that the variable can only have discreet sequential integer values starting at 1, which would be very restrictive.

I much prefer the flexibility of IF/THEN at the expense of elegance.

Don't have a computer in front of me, but I would imagine that ON GOSUB rounds the value up or down as needed. Not the same as INT which always rounds it down. Easy enough to check this.

  • Like 1
Link to comment
Share on other sites

49 minutes ago, Vorticon said:

ON 1-(a=1)-2*(a=2)-3*(a=3 or a=4) GOSUB CASEELSE, CASE001, CASE002, CASE003

I also tend to the IF-THEN, but above line does not require the numbers to be sequential integers, this would also work with strings or key-codes, as the (Var=Value) terms are -1 when true, with the multiplicator giving the ON value. 

ON 1-(a=65)-2*(a=88)-3*(a=32 or a=13) GOSUB CASEELSE, CASE001, CASE002, CASE003

Would work just as well. 

  • Like 2
Link to comment
Share on other sites

46 minutes ago, senior_falcon said:

Don't have a computer in front of me, but I would imagine that ON GOSUB rounds the value up or down as needed. Not the same as INT which always rounds it down. Easy enough to check this.

This.  Program:

 

10 RANDOMIZE
20 A=RND*10
30 ON A+1 GOSUB 100,110,120,130,140,150,160,170,180,190,200
40 GOTO 20
100 PRINT "0";A :: RETURN
110 PRINT "1";A :: RETURN
120 PRINT "2";A :: RETURN
130 PRINT "3";A :: RETURN
140 PRINT "4";A :: RETURN
150 PRINT "5";A :: RETURN
160 PRINT "6";A :: RETURN
170 PRINT "7";A :: RETURN
180 PRINT "8";A :: RETURN
190 PRINT "9";A :: RETURN
200 PRINT "10";A :: RETURN

 

 

Sample output (notice rounding is always the nearest integer, not restricted to just up or down):

 

sample.png.3a4b5aceb242f753a7d0a255207c4513.png

 

  • Like 2
Link to comment
Share on other sites

1 hour ago, SteveB said:

I also tend to the IF-THEN, but above line does not require the numbers to be sequential integers, this would also work with strings or key-codes, as the (Var=Value) terms are -1 when true, with the multiplicator giving the ON value. 


ON 1-(a=65)-2*(a=88)-3*(a=32 or a=13) GOSUB CASEELSE, CASE001, CASE002, CASE003

Would work just as well. 

Ah I see. Yes that would work. Clever.

I guess then it's up to you to decide how you want to proceed. I'll be a very happy camper either way as long as I have a CASE statement! ?

  • Like 1
Link to comment
Share on other sites

5 hours ago, Vorticon said:

I just noted that the TAB key does not work in the editor. I think it's important to have that functionality for ease of formatting.

I can add a TAB key to RXB Editor so how many spaces should it jump forward or should it look for something like "::" ?

Spoiler

***********************************************************
CTRLS  CEQ   147,@RKEY          CTRL S
            BR    CTRLD                 No, check more
            DST  @VARW,@ARG5       Force cursor to start
*                              ARG5 = current position
            BR   RBACK                Now process like FCTN S
CTRLD  CEQ  132,@RKEY         CTRL D
            BR   CTRLE                 No, check more
            DST  @VARA,@ARG5       Force cursor to end
            CALL SPACES              Look for space
            BR   RFORW                Process like FCTN D
CTRLE  CEQ  133,@RKEY         CTRL E
           BR   CTRLX                  No, check more
           DSUB 32,@ARG5          Up one line
           DCH  @ARG5,@VARW       Check range
           BR   READZ1                Ok, go on
           DADD 32,@ARG5          No, redo
           BR   READZ1               And continue
CTRLX  CEQ  152,@RKEY         CTRL X
           BR   CTRL                    Resume where left off
           DADD 32,@ARG5          Next line
           DCHE @ARG5,@VARA       Check range
           BS   READZ1                Ok, continue
           DSUB 32,@ARG5          No, redo
           BR   READZ1               Now, go on
CTRL   CHE  >20,@RKEY         Control character!!!!
           BS   G6BD0
           BR   G6ADC
SPACES CEQ  >80,V*ARG5        SPACE?
           BR   SPACE2
           DDEC @ARG5
          BR   SPACES
SPACE2 CEQ  >7F,V*ARG5        CURSOR?
          BS   SPACE3
          RTN
SPACE3 DSUB 4,@ARG5
         BR   SPACES
         BR   G6A86
***********************************************************

I think the best thing would be tab maybe 24 characters at time so next line in Editor each tab.

XB EXAMPLE:

100 ! This is a test line at line 100 and just to show an example.

 

When you hit tab the screen would like this:

100 ! This is a test line at

@line 100 and just to sh

ow an example.

 

The @ is where the Cursor would move to.

  • Like 1
Link to comment
Share on other sites

58 minutes ago, RXB said:

I can add a TAB key to RXB Editor so how many spaces should it jump forward or should it look for something like "::" ?

  Reveal hidden contents

***********************************************************
CTRLS  CEQ   147,@RKEY          CTRL S
            BR    CTRLD                 No, check more
            DST  @VARW,@ARG5       Force cursor to start
*                              ARG5 = current position
            BR   RBACK                Now process like FCTN S
CTRLD  CEQ  132,@RKEY         CTRL D
            BR   CTRLE                 No, check more
            DST  @VARA,@ARG5       Force cursor to end
            CALL SPACES              Look for space
            BR   RFORW                Process like FCTN D
CTRLE  CEQ  133,@RKEY         CTRL E
           BR   CTRLX                  No, check more
           DSUB 32,@ARG5          Up one line
           DCH  @ARG5,@VARW       Check range
           BR   READZ1                Ok, go on
           DADD 32,@ARG5          No, redo
           BR   READZ1               And continue
CTRLX  CEQ  152,@RKEY         CTRL X
           BR   CTRL                    Resume where left off
           DADD 32,@ARG5          Next line
           DCHE @ARG5,@VARA       Check range
           BS   READZ1                Ok, continue
           DSUB 32,@ARG5          No, redo
           BR   READZ1               Now, go on
CTRL   CHE  >20,@RKEY         Control character!!!!
           BS   G6BD0
           BR   G6ADC
SPACES CEQ  >80,V*ARG5        SPACE?
           BR   SPACE2
           DDEC @ARG5
          BR   SPACES
SPACE2 CEQ  >7F,V*ARG5        CURSOR?
          BS   SPACE3
          RTN
SPACE3 DSUB 4,@ARG5
         BR   SPACES
         BR   G6A86
***********************************************************

I think the best thing would be tab maybe 24 characters at time so next line in Editor each tab.

XB EXAMPLE:

100 ! This is a test line at line 100 and just to show an example.

 

When you hit tab the screen would like this:

100 ! This is a test line at

@line 100 and just to sh

ow an example.

 

The @ is where the Cursor would move to.

I have trouble seeing how much functionality this would add. Both RXB and XB 2.8 G.E.M. can use Ctrl up and Ctrl down to go up or down one line in the editor. That would be a tab of 28 characters. I suppose going to the statement separator "::" could be of use.

  • Like 1
Link to comment
Share on other sites

2 hours ago, senior_falcon said:

I have trouble seeing how much functionality this would add. Both RXB and XB 2.8 G.E.M. can use Ctrl up and Ctrl down to go up or down one line in the editor. That would be a tab of 28 characters. I suppose going to the statement separator "::" could be of use.

Hmm that line can be 4 screen lines long. That is a lot to get to what you want to edit using  the left arrow.

Besides now that I have moved so much GPL from GROM to ROM I can add all kinds of features to XB no one else has added. 

 

I think the FIND? command using the FCTN TAB key would be great to find :: or say something like SPRITE or a Variable name.

 

  • Like 1
Link to comment
Share on other sites

3 hours ago, RXB said:

Hmm that line can be 4 screen lines long. That is a lot to get to what you want to edit using  the left arrow.

 

Yes, using the left and right arrows can be a very tedious way of getting navigating a long line. I suspect that's why the author of RXB made it so Ctrl Up and Ctrl Down work the way they do.

  • Thanks 1
  • Haha 1
Link to comment
Share on other sites

SELECT CASE likewise is unconcerned about variable type or content.  It can be a string, an integer, a double, a single, a long...An array index...--- whatev.

 

For this reason I would say the GOSUB surrogate, while clever, is not really a substitute for SELECT CASE.  Especially since CASE allows the use of the "OTHER" case, which is "All things not specified".  Sure, you could do something similar with "VARIABLE >=[integer]", with all the lower values being your branch targets--- but then how do you deal with the edge case of the integer not being proper (such as a 0)?  Depending on how you are using that CASE surrogate, it could be messy.

 

OK, this is annoying. I click on a thread I KNOW FOR A FACT THAT I HAVE READ, and it sends me to a page that is older than dirt, I am sleepy, dont pay attention, and then reply to it and look like a chump.  (makes angry old man sounds)

 

Edited by wierd_w
  • Haha 1
Link to comment
Share on other sites

15 hours ago, RXB said:

I can add a TAB key to RXB Editor so how many spaces should it jump forward or should it look for something like "::" ?

  Reveal hidden contents

***********************************************************
CTRLS  CEQ   147,@RKEY          CTRL S
            BR    CTRLD                 No, check more
            DST  @VARW,@ARG5       Force cursor to start
*                              ARG5 = current position
            BR   RBACK                Now process like FCTN S
CTRLD  CEQ  132,@RKEY         CTRL D
            BR   CTRLE                 No, check more
            DST  @VARA,@ARG5       Force cursor to end
            CALL SPACES              Look for space
            BR   RFORW                Process like FCTN D
CTRLE  CEQ  133,@RKEY         CTRL E
           BR   CTRLX                  No, check more
           DSUB 32,@ARG5          Up one line
           DCH  @ARG5,@VARW       Check range
           BR   READZ1                Ok, go on
           DADD 32,@ARG5          No, redo
           BR   READZ1               And continue
CTRLX  CEQ  152,@RKEY         CTRL X
           BR   CTRL                    Resume where left off
           DADD 32,@ARG5          Next line
           DCHE @ARG5,@VARA       Check range
           BS   READZ1                Ok, continue
           DSUB 32,@ARG5          No, redo
           BR   READZ1               Now, go on
CTRL   CHE  >20,@RKEY         Control character!!!!
           BS   G6BD0
           BR   G6ADC
SPACES CEQ  >80,V*ARG5        SPACE?
           BR   SPACE2
           DDEC @ARG5
          BR   SPACES
SPACE2 CEQ  >7F,V*ARG5        CURSOR?
          BS   SPACE3
          RTN
SPACE3 DSUB 4,@ARG5
         BR   SPACES
         BR   G6A86
***********************************************************

I think the best thing would be tab maybe 24 characters at time so next line in Editor each tab.

XB EXAMPLE:

100 ! This is a test line at line 100 and just to show an example.

 

When you hit tab the screen would like this:

100 ! This is a test line at

@line 100 and just to sh

ow an example.

 

The @ is where the Cursor would move to.

I was thinking more along the lines of text indentation in TICODED.

But the idea of tabbing within the RXB editor is also interesting and I would lean towards tabbing to the next "::" which would simplify the editing of long multi-statement lines. I have also found that using the CTRL-arrow keys to freely move around a line in the XB GEM editor was very useful, the closest we could get to a full-screen editor in XB, something to perhaps also consider in RXB.

  • Like 1
Link to comment
Share on other sites

7 hours ago, Vorticon said:

I was thinking more along the lines of text indentation in TICODED.

But the idea of tabbing within the RXB editor is also interesting and I would lean towards tabbing to the next "::" which would simplify the editing of long multi-statement lines. I have also found that using the CTRL-arrow keys to freely move around a line in the XB GEM editor was very useful, the closest we could get to a full-screen editor in XB, something to perhaps also consider in RXB.

Well Senior Falcon is correct RXB already had CONTOL ARROWS for first of line, end of line and up and down lines.

But I am going to add FIND into XB Editor Mode so like RES or NUM or COPY just type in FIND linenumber,string

EXAMPLE:

FIND 2070,RK=LF

Would start at line number 2070 and look for "RK=LF" in program and show line number with "RK=LF" in that line number.

Error output would be No Program Present, Bad Value, Bad Line Number or Line Not Found in case no match found. 

Link to comment
Share on other sites

On 7/12/2021 at 2:40 PM, Vorticon said:

I just noted that the TAB key does not work in the editor. I think it's important to have that functionality for ease of formatting.

What is not working for you? 

 

On an empty page TAB indents 3 characters, otherwise it tries to align with the indention of the line above. This is a function of the Lazarus SynEdit component and not changed by me.

 

Does it behave differently on your system?

 

Steve

 

 

Link to comment
Share on other sites

43 minutes ago, SteveB said:

What is not working for you? 

 

On an empty page TAB indents 3 characters, otherwise it tries to align with the indention of the line above. This is a function of the Lazarus SynEdit component and not changed by me.

 

Does it behave differently on your system?

 

Steve

 

 

OK so I was entering code into the XB tab instead of the SXB one. Duh...

Everything works fine. Sorry about the false alarm.

  • Like 2
Link to comment
Share on other sites

I just released version 1.2 of TiCodEd. The biggest change is the new "Variable" tab. As I was writing a larger SXB program I found it difficult to remember all the tiny variable names I was using to preserve precious RAM. With this new feature you can use long, meaningful variable names in SXB and get the substituted for memory saving short names in XB when writing the tokenized file (on the XB tab the long name is still used). This tab also features a cross-reference for you to see in which XB line a variable is used. 

 

I also fixed some bugs and made some usability enhancements, i.e. the window size and position is now remembered. You can download the new version as always at http://lizardware.de/ with Lazarus Source for Windows 64 and 32 bit.

 

Enjoy

Steve

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