Jump to content
IGNORED

Extended BASIC G.E.M.


senior_falcon

Recommended Posts

Here is XB28GEM922. This adds the ability to use SUBs and DEFs in chained programs. The docs are the same except for XB28GEM.PDF, which has an expanded section showing how to use SUBs and DEFs in chained programs.

I believe this project is complete now.

 

XB28GEM922.zip

  

 

(Edit 10/15/2020) XB28GEM1014 can be found in post 288 below. This fixes a minor error in the object code loader.

(edit 12/05/2020) See post #326 on page 14 for the latest version, XB28GEM1202

Edited by senior_falcon
  • Like 3
Link to comment
Share on other sites

Here  is a demo program showing XB 2.8 G.E.M. chaining two programs together. Variables are passed effortlessly from the first program to the second. Both programs use DEFs and SUBs with no problems. 

This is not very complex or even all that interesting to watch, unless you know what is happening behind the scenes. The point of the demo is simply to show that this can actually be done. 

RL1TEST.GIF.10fac4bd2773afdfab406003aecdb4e3.GIF

The programs are below. The DEFs and SUBs are included with each program.

10 DEF CUBE(X)=X*X*X
20 DEF FOURTH(X)=X*X*X*X
200 SUB SQUARE(X)
210 PRINT X*X
220 SUBEND
230 SUB ROOT(X)
240 PRINT SQR(X)
250 SUBEND

1 ! RL1TESTA - The initial program in chain
30 DIM SR(30)
40 CALL CLEAR :: CALL SCREEN(4)
42 PRINT "Now running RL1TESTA"
50 CALL CHAR(128,"0103070B0A1B2A2B2A2B4A4B4A7B0E0A0080C0A0A0B0A8A8A8A8A4A4A4BCE0A0")
60 CALL MAGNIFY(4):: CALL SPRITE(#1,128,5,100,120,-7,0)
62 X=11 :: PRINT :X :: CALL SQUARE(X):: CALL ROOT(X)
64 PRINT CUBE(X):: PRINT FOURTH(X)
66 Z=31 :: A=PI
70 FOR I=1 TO 30 :: SR(I)=SQR(I):: NEXT I
75 READ DT$ :: PRINT DT$
80 INPUT "ENTER A STRING: ":A$
90 CALL RUNL1("DSK9.RL1TESTB")
100 DATA "Data-line 100, 1st program"

1 ! RL1TESTB - 2nd part of demo
110 CALL CLEAR :: CALL SCREEN(12)
120 PRINT "Now running RL1TESTB"
122 FOR I=1 TO 30 :: PRINT SR(I),:: NEXT I :: PRINT
124 PRINT Z :: CALL SQUARE(Z):: CALL ROOT(Z)
126 PRINT CUBE(Z):: PRINT FOURTH(Z)
130 PRINT A$
140 RESTORE :: READ DT$ :: PRINT DT$;
150 GOTO 150
190 DATA "Data-line 190, 2nd program"

An explanation of the program is in order so you know what is happening.

(Description of RL1TESTA)
42 – prints “Now running RL1TESTA” 
50,60 – creates a sprite and sets it in motion
62 sets X=11; prints X; CALL SQUARE(X); CALL ROOT(X)                       (The two SUBs print X^2,then SQR(x)) 
64 PRINT CUBE(X); PRINT FOURTH(X)                                                               (uses DEFs to print x^3 and x^4)
66 Z=31 :: A=PI                                  (these values not used here, they will be used by the next program in chain)
70 fills the array SR(n) with square roots from 1 to 30                                             (used in next program in chain)
75 reads a string from a data statement and prints it
80 asks you to enter a string                                                                (the string is used in next program in chain)
90 loads and runs the program RL1TESTB

 

When RL1TESTB is run in line 90, XB doesn't know that a completely new program has been loaded. It assumes it is continuing with the original program and so all the variables are retained automatically, as demonstrated by the second program in the chain.


(Description of RL1TESTB)
The sprite created in the first program continues to move across the screen.
120 – prints “Now running RL1TESTB”
122 – prints the 30 square roots that were created in line 70 of RL1TESTA  (shows that variables can be passed)
124 – prints Z; CALL SQUARE(Z); CALL ROOT(Z)             (shows that Z is passed and that SUBs work properly)
126 – PRINT CUBE(Z); PRINT FOURTH(Z)                                  (shows that DEFs work in the chained program)
130 – PRINT A$                                              (shows that string variables can b e passed to the second program)
140 – RESTORE; read string from DATA statement; print it.                (DATA can be used in the chained program)
150 – wait for Fctn 4 to be pressed

 

 

  • Like 5
Link to comment
Share on other sites

There are times when it is desirable to use a random number seed. For example, when testing a program it can be useful to have the same sequence of random numbers throughout the test. Or, if you are generating a maze, using a seed could generate the same maze every time for each level of the game, but with a different maze every time you advance a level. The random number generator from TI BASIC is over 5x faster than the XB random number generator. It has been incorporated in two versions of XB that I know of; RXB and XB 2.8 G.E.M. The program below sets the random number seed to 99, prints a sequence of 4 random numbers, then loops 4 times. It is run in TI BASIC, XB 2.8 G.E.M., and RXB 2015. You can see that XB 2.8 G.E.M. gives the same sequence as TI BASIC. In RXB, RANDOMIZE (99) has no effect. I would imagine that Rich has addressed this in the newest version, but until that is released the only version of XB that can use the fast random number generator plus a random number seed is XB 2.8 G.E.M. (It should be noted that the sequence of random numbers generated in XB 2.8 G.E.M. is different than standard XB. This is to be expected because they use totally different code.)


100 FOR I=1 TO 4
110 RANDOMIZE (99)
120 PRINT RND,RND:RND,RND: :
130 NEXT I

(Edit) - turns out the parentheses are not necessary. 110 can be RANDOMIZE 99

270123284_RANDOMSEED.thumb.JPG.7030353f9ee1deeca9be5044fc0b3ed5.JPG

 

 

 

Edited by senior_falcon
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

16 hours ago, senior_falcon said:

There are times when it is desirable to use a random number seed. For example, when testing a program it can be useful to have the same sequence of random numbers throughout the test. Or, if you are generating a maze, using a seed could generate the same maze every time for each level of the game, but with a different maze every time you advance a level. The random number generator from TI BASIC is over 5x faster than the XB random number generator. It has been incorporated in two versions of XB that I know of; RXB and XB 2.8 G.E.M. The program below sets the random number seed to 99, prints a sequence of 4 random numbers, then loops 4 times. It is run in TI BASIC, XB 2.8 G.E.M., and RXB 2015. You can see that XB 2.8 G.E.M. gives the same sequence as TI BASIC. In RXB, RANDOMIZE (99) has no effect. I would imagine that Rich has addressed this in the newest version, but until that is released the only version of XB that can use the fast random number generator plus a random number seed is XB 2.8 G.E.M. (It should be noted that the sequence of random numbers generated in XB 2.8 G.E.M. is different than standard XB. This is to be expected because they use totally different code.)



100 FOR I=1 TO 4
110 RANDOMIZE (99)
120 PRINT RND,RND:RND,RND: :
130 NEXT I

270123284_RANDOMSEED.thumb.JPG.7030353f9ee1deeca9be5044fc0b3ed5.JPG

 

 

 

Hey I started up RXB 2020 several times and not once did I get the same numbers ever?

Now you may have a point in that RXB 2020 (or RXB 2015) does not have a seed that works.

But why do you need a seed? I have only seen 2 XB games that needed the same numbers each time?

I guess I could fix the RANDOMIZE(99) to work.

My additional problem is even when I get the seed working it still is never the same TWICE as per the video I explain why!

 

 

 

Link to comment
Share on other sites

Let me get this straight. I noted that RXB 2015 with the fast RND from BASIC could not use a random number seed. Your response was to create and post a 5 minute video that shows. . . . . . . . . . . .(wait for it). . . . . . . . . . . . .that RXB could not use a random number seed.

The perceptive reader could have figured that out without wasting 5 minutes by simply looking at the program, then the picture showing the results from BASIC, XB 2.8 G.E.M., and RXB.

You made it sound as if you had to jump through hoops to get RXB to produce random numbers. If you take out 110 RANDOMIZE 99, you'll see that TI BASIC, XB, and XB 2.8 G.E.M. behave exactly like RXB in your video, without the need for using RANDOMIZE.

As to why a random number seed might be desirable, read more carefully my post 278 above; also posts 33-37 of this thread. If you do a search in TI-99/4a development you will find several other posts explaining how this is useful. 

This capability was added in response to a request by 1980gamer. Although I don't recall ever using this, I can still appreciate that others might have a need for features that I don't use

 

Speaking of random numbers, as far as I know XB G.E.M. and XB v2.8 G.E.M. are the only variants of XB that produce an actual random number when autoloading a LOAD program in DSK1.  See posts 8 and 10 above on the first page. 

Edited by senior_falcon
Link to comment
Share on other sites

3 hours ago, senior_falcon said:

Let me get this straight. I noted that RXB 2015 with the fast RND from BASIC could not use a random number seed. Your response was to create and post a 5 minute video that shows. . . . . . . . . . . .(wait for it). . . . . . . . . . . . .that RXB could not use a random number seed.

The perceptive reader could have figured that out without wasting 5 minutes by simply looking at the program, then the picture showing the results from BASIC, XB 2.8 G.E.M., and RXB.

You made it sound as if you had to jump through hoops to get RXB to produce random numbers. If you take out 110 RANDOMIZE 99, you'll see that TI BASIC, XB, and XB 2.8 G.E.M. behave exactly like RXB in your video, without the need for using RANDOMIZE.

As to why a random number seed might be desirable, read more carefully my post 278 above; also posts 33-37 of this thread. If you do a search in TI-99/4a development you will find several other posts explaining how this is useful. 

This capability was added in response to a request by 1980gamer.

 

 

Speaking of random numbers, as far as I know XB G.E.M. and XB v2.8 G.E.M. are the only variants of XB that produce an actual random number when autoloading a LOAD program in DSK1.  See posts 8 and 10 above on the first page. 

I explained in video what is the point of RANDOMIZE SEED? 

Can you show me anything anyone would use a Random Number seed for in a game? (If they really want this test it on XB it is slow for a reason!)

Besides calling it RANDOM when EXACTLY THE SAME EACH TIME IS NOT RANDOM! It IS SET IN STONE EVERY TIME!

Your QUOTE: "Although I don't recall ever using this, I can still appreciate that others might have a need for features that I don't use"

I could also provide a bunch of things no one will ever use, but please convince me as to why I need to do this?

I have no issue with you doing it and great job on G.E.M., but unless you can prove it has more then 1 time use I see not a reason for it.

Honestly it appears to me like tits on a fish. Yea possible to use, but really do we have a huge base that would use it everyday? NO!

 

(I will get off your thread now!)

  • Haha 1
Link to comment
Share on other sites

9 hours ago, RXB said:

I explained in video what is the point of RANDOMIZE SEED? 

Can you show me anything anyone would use a Random Number seed for in a game? (If they really want this test it on XB it is slow for a reason!)

Besides calling it RANDOM when EXACTLY THE SAME EACH TIME IS NOT RANDOM! It IS SET IN STONE EVERY TIME!

 

It is standard procedure to provide for seeding a PRNG (Pseudo Random Number Generator) with a known seed for testing purposes. This works because a PRNG always produces the same sequence of PRNs when started with the same seed. At least, that is how all the PRNGs I have used work. Discussion for TI Basic’s RND is here: RND and RAND: Pseudorandom Number Generation by TI Basic.

 

TI Basic’s RANDOMIZE modifies >83C0 with an unpredictable 16-bit number. If you supply RANDOMIZE with a seed value, It stashes in >83C0 the first 16-bits of the floating point (FP) number your seed was converted to. For example, If you enter “ RANDOMIZE 0.06789 ”, the number is converted to FP as this 8-byte hexadecimal number: 3F06 4E5A 0000 0000. RANDOMIZE will put >3F06 in >83C0.

 

I believe you are using XB’s RANDOMIZE for RXB, which does absolutely nothing to >83C0 when given an explicit seed because it is storing the seed (10 bytes!) it generates to VRAM at >03A0 and >03A5. The seed is actually two FP numbers, with only the first 5 bytes of each used. There is a fair amount of manipulation before those two numbers are finally stored. If a seed is not provided, this RANDOMIZE generates the seed with the same constants for the first two and last bytes of each seed number: 4201 uuvv 00 and 4201 wwxx 00. It calls GPL RAND with 99 once for each of the remaining bytes,  ‘uu’ and once for ‘ww’ and shifts the  shifting each byte right two bits, limiting each byte to a range of hex 00 – 3F (0 – 63) ‘vv’ and ‘xx’ are left alone with whatever may have made its way there.  In the process of calling RAND, >83C0 gets changed, unpredictably,  twice  4 times as a side effect.

 

It should be a simple matter to substitute the TI Basic RANDOMIZE for XB’s. The former is only 8 GPL instructions, whereas the latter is 41! 

 

...lee

Edited by Lee Stewart
CORRECTION
  • Like 2
Link to comment
Share on other sites

RXB in post #281 above: Can you show me anything anyone would use a Random Number seed for in a game?

 

RXB in Extended BASIC G.E.M., page 12, post #279

I have only seen 2 XB games that needed the same numbers each time?
--------------------------------------------------------------------------
1980gamer in Extended BASIC G.E.M., page 2, post #33

Though I like a more random, random number generator...
I actually routinely REM my Randomize command so I can have repeatable "randomness"  when testing things!

Maybe a SEED value could be supplied to create repeatable result for testing?
---------------------------------------------------------------------------
SteveB in XB Game Developer's Package, page 30, post #748

But some 36 years ago I had the brilliant idea of not storing level data and save the memory, but recreating it every time by using the RANDOMIZE X function, feeding the level-number as the seed to the randomizer. As stated in the manual, Isabella ignores the RANDOMIZE statement, with and without an argument. It might be strange at first, but I use RANDOMIZE and RND to do the exact opposite of random numer generation, I generate repeatable numbers. ..

Will there be an Isabella 7 with RANDOMIZE SEED function or should I rewrite my code to use my own RAND function?
-------------------------------------------------------------------------
Opry99er in Berylrogue, page 2, post #36

With Adam's discussion recently about random seeding/mapping and how it works, it really makes me excited to look at this again.
--------------------------------------------------------------------------
Sometimes99er in Arlington Horse Racing, post #7

In the Short and Sweet contest (30 lines +) I had a different seed for each level. Drawing a "random" level with a specific seed made sure it would turn out the same every time.
-----------------------------------------------------------------------------
Lee Steward in XB/BASIC Seeds, post #2

Most PRNGs are designed to reproduce the same pattern every time they start with the same seed so that code using them can be adequately debugged.

  • Like 2
Link to comment
Share on other sites

Sorry back just to post that I fixed RAMDOMIZE(value) and it works exactly the same as TI Basic and XB G.E.M. every single time.

Just needed to add one line of code and take out old XB RANDOMIZE, oddly less then 21 bytes does what hundreds of bytes of XB did.

* RXB PATCH CODE FOR INTRND
INTRND DST  >3567,@>83C0      Random number seed
       RTN
* Initialize random number generator 
* INTRND MOVE 10,G@X2SEED,V@RNDX2
*        RTN
* X2SEED BYTE >42,>03,>23,>15,>00 * =   33521, X2 INITIAL VAL
* X1SEED BYTE >43,>02,>3E,>2A,>17 * = 2624223, X1 INITIAL VAL

But thanks Senior_Falcon for pointing this out.

I work like Stephen Hawking does, I argue both sides of any argument while working on both sides.

Nice now both sides are happy so thanks again for the tip.

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

19 minutes ago, RXB said:

Sorry back just to post that I fixed RAMDOMIZE(value) and it works exactly the same as TI Basic and XB G.E.M. every single time.

Just needed to add one line of code and take out old XB RANDOMIZE, oddly less then 21 bytes does what hundreds of bytes of XB did.

 

This may take care of the startup, always-the-same value for the seed, but does nothing for RANDOMIZE, which is not a lot of code (8 GPL instructions) in TI Basic. We can continue this in our current, offline discussion or over in the main RXB thread, if you like. We should probably give this thread back to “Extended BASIC G.E.M.”

 

...lee

Link to comment
Share on other sites

Back to G.E.M. topics. I was working on the compiler, which is loaded into high memory and run from there. Sadly, When running HMLOADER, the fast A/L loader borrowed from minimemory crashed. I'm sure I tested this and it worked, and I might have actually done that, but it turns out there is only 1 chance in 4 of it working correctly.

 

The MiniMemory loader tries to be smarter than the XB loader. It checks for duplicate definitions and issues an error if it finds a duplicate. XB doesn't do this and for reasons I won't go into, it turns out that when this check is bypassed in the fast loader, all works properly and HMLOADER can do its job properly.

 

Now I want to go through the loader and make sure all the errors are reported correctly. I cannot report errors from the cartridge rom because I can see no way to flip back to the XB rom. So I stash an error byte where it can be acted on after the return to GPL and the XB rom is selected. In my naivete I thought a disk error would be the only one required, but it turns out there are several others that could be needed.

 

 

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Here is XB v2.8 G.E.M. (version 2.820201014) This corrects the problems mentioned above that I found in my adaptation of the fast object code loader borrowed from MiniMemory. (Almost no one would have even noticed these.)  Using the Classic99 debugger, I have checked carefully to see that it now functions the same as the loader from XB. Same error messages, same buffer areas, same "releasing file buffer", etc. In addition it can also use DEFs, load compressed code, and do most of the more advanced things possible with the E/A and MiniMemory loaders. 

 

I don't believe  any more changes will be needed.

 

XB28GEM1014.zip

(edit 12/05/2020) See post #326 on page 14 for the latest version, XB28GEM1202

Edited by senior_falcon
  • Like 5
  • Thanks 3
Link to comment
Share on other sites

Omega wanted a way to go directly to force command from XB. I have added one more subprogram: CALL FC which will go directly to force command.

I also did a little cleaning up in how XB 2.8  G.E.M. handles colors, fonts, autoload behavior and force command from BYE. Now you can modify 2 bytes in the grom file so it will use your preferences for default values, not mine.

This is described on page 8 of the XB28GEM manual. The README file will help TIPI most users avoid frustration when setting up. 

 

XB28GEM1021.zip

 

 

 

(edit 12/18/2020) See post #370 on page 15 for the latest version, XB28GEM1202

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Edited by senior_falcon
  • Like 7
  • Thanks 1
Link to comment
Share on other sites

6 minutes ago, senior_falcon said:

Omega wanted a way to go directly to force command from XB. I have added one more subprogram: CALL FC which will go directly to force command.

I also did a little cleaning up in how XB 2.8  G.E.M. handles colors, fonts, autoload behavior and force command from BYE. Now you can modify 2 bytes in the grom file so it will use your preferences for default values, not mine.

This is described on page 8 of the XB28GEM manual. The README file will help TIPI users avoid frustration when setting up. 

 

 

 

Gracias! Gamsahabnida! Arigatogozaimashita!  Dunkachen!  Spasibo!   

I swore the first Extended BASIC that would do 80 columns, have a quick exit to DOS and still be 100% backwards compatible would be my Extended BASIC for life!  This does everything I want and need... and so much more!  So, my quest is now over!  Again, THANK YOU!  

 

 

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

It is hard for me to remember is the ASCII codes for the letters and I hate looking it up. CALL HELP, then space bar 3 times (I think) will get you to a place where you can press a key to find out the ASCII of that key. This can be any key, not just the alphabetic characters. If you can't remember the ASCII for left arrow, simply press left arrow and the ASCII will be displayed. You can even find out the ascii for quit. Since space bar advances through the menu, you just have to remember that space is 32.

  • Like 5
Link to comment
Share on other sites

Here is an interesting program that runs on The Missing Link.

It is a variation on the "binary tree" programs seen in LOGO. 

CALL LINK("PR") is important to invert the pixels. That is, a pixel that is foreground becomes background color and vice versa.

This somehow reminds me of the ovipositor on an ichneumon fly.

 


100 CALL LINK("PR"):: X=1.414 :: L=60 :: A=90 :: B=L/X^6 :: GOSUB 130
110 GOTO 100
130 IF L<B THEN CALL LINK("GETPEN",R,C,ANG):: CALL LINK("BOX",R-4,C-4,R+4,C+4):: L=L*X :: RETURN
140 CALL LINK("TURN",-A):: CALL LINK("FWD",L):: L=L/X :: GOSUB 130
150 CALL LINK("FWD",-L,A*2):: CALL LINK("FWD",L):: L=L/X :: GOSUB 130
160 CALL LINK("FWD",-L,-A):: L=L*X :: RETURN

 

EGGDROP.gif

Edited by senior_falcon
  • Like 7
Link to comment
Share on other sites

Some of you may not have tried @senior_falcon's latest new utilities for Extended BASIC because you remember your old experiences from back in the day, where these utilities just took too damn much time to load rendering them impractical for normal use.  Well, I gotta tell you, this new Extended BASIC 2.8 G.E.M. cartridge version of these utilities blows away any time aspects that may have held you back in the past, because now they simply do not apply.

 

 

 

 

  • Like 3
Link to comment
Share on other sites

The object code loader built into XB is written in GPL and is pretty slow as shown in the video. Most packages such as XB256, TML, T40XB, use that slow loader to get the object code into memory. Then the code is embedded into a XB loader program. When the loader program is run it very quickly copies the code into (usually) low memory. The loader program takes less than a second to run once it is loaded. As shown above, selecting an option from the menu is even faster as there is no disk access involved. The big breakthrough in XB 2.8 G.E.M. is that the object code loader takes about 4-5 seconds to do the same thing you saw taking way over a minute in the above video. This fast loader makes program development much easier. Also, now it would be possible for an XB program to load assembly support routines as needed without an unacceptably long wait.

  • Like 8
Link to comment
Share on other sites

That Omega is sure a harsh taskmaster. He has convinced me that a worthy addition to XB 2.8 G.E.M. would be the ability to turn on the graphics mode from the program that uses it. So for example:

10 CALL TML

20 rest of program for The Missing Link

30.....

I had not thought this was possible because it involves moving some things around in VDP ram. But it looks like it should work for XB256, T40XB and T80XB. Not so sure about the 2 Missing Link variants.

 

  • Like 6
Link to comment
Share on other sites

On 9/4/2020 at 10:16 AM, mizapf said:

Obviously, no one tried to build a RPK for MAME, so here is my attempt. It is the original XB GEM (with 16K ROM); for the XB 2.8 GEM I had to change the bank handling in the gromemu cartridge type, so I will publish the 2.8 RPK when the new MAME release is out.

 

By the way, is there a real Extended Basic 2.8 GEM, or does it only depend on emulation or FinalGROM? (This is relevant for me whether I extend the current paged378 type or the gromemu type, which is a catch-all for exotic cartridge types.)

extended_basic_gem.rpk 41.32 kB · 13 downloads

 

could this be added to the hash as a zip cartridge?  If so how?  inquiring minds want to know!

Link to comment
Share on other sites

On 9/4/2020 at 8:16 AM, mizapf said:

Obviously, no one tried to build a RPK for MAME, so here is my attempt. It is the original XB GEM (with 16K ROM); for the XB 2.8 GEM I had to change the bank handling in the gromemu cartridge type, so I will publish the 2.8 RPK when the new MAME release is out.

 

By the way, is there a real Extended Basic 2.8 GEM, or does it only depend on emulation or FinalGROM? (This is relevant for me whether I extend the current paged378 type or the gromemu type, which is a catch-all for exotic cartridge types.)

extended_basic_gem.rpk 41.32 kB · 15 downloads

I would expect, having looked at the parts, it would go nicely on an UberGrom board.

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