Jump to content
IGNORED

GPL Manual - first draft


Willsy

Recommended Posts

Attached is a conversion of Thierry Nouspikel's GPL manual from his website (the document contains appropriate attribution).

 

I've done quite a lot of re-formatting, corrected a litany of spelling errors, added table of contents etc.

 

It's a work in progress. Still more work to do on it, but it's a start. If anyone wants to chip in, feel free. Download it, edit it, and send back to me as a PM.

 

Thierry's manual is split into two HTML files. I'm going to work on merging the second file into this file, so that it's all in one PDF. The PDF will be hyperlinked.

 

Updated 2nd February 2016: Indexed and linked. Much better. Some formatting improvements. Still some linking to do: GPL Manual.pdf

 

Mark

 

Previous Version:

GPL Manual.pdf

GPL Manual.zip

Edited by Willsy
  • Like 5
Link to comment
Share on other sites

Nice :) Now a quick question: how slow do you estimate GPL as compared to assembly or even Turbo Forth? What is the main advantage of programming in GPL?

 

Vorticon,

 

I am very green to GPL but I am trying hard to learn as much as I can. The advantages seem to be :

 

1. Easier to pick up and become productive

2. Can be quite fast if used properly

3. Can embed assembly in parts you need raw speed.

 

The disadvantages:

1. Can never be as fast as assembly but depends what you are aspiring to code

2. Community who can help you with issues is very small

Link to comment
Share on other sites

I think it's slower than TF because a lot of TF words are implemented in machine code.

 

A good test would be to write something like a screen scrolling routine like the one TF had in GPL and test it. I think it will be quite a bit slower.

 

Also, compared to Forth, you can't just type something in and test it. You have to assemble it and make a cart image. Laborious and time consuming but a lot easier with cross compilers than the old days!

 

Finally, for deployment you can't use a simple ROM cart, you need a GROM capable cart.

 

So on the face of it I don't think there are any good reasons to use it, other than its really cool!

 

If I was writing TF now I'd actually put a GROM in it to do the cart header and all the initialization before TF starts up (character sets and all that good stuff). Would have saved around 2k of ROM space. There's a lot of code you can squeeze into 2k. :-)

Link to comment
Share on other sites

Nice :) Now a quick question: how slow do you estimate GPL as compared to assembly or even Turbo Forth? What is the main advantage of programming in GPL?

 

Both GPL and Forth (Turbo and otherwise) are interpreted languages. The most significant difference is that the interpretation of GPL is at execution time; whereas, the interpretation of Forth is at compile time, i.e., there is no lookup when compiled Forth executes. The only advantage GPL has over Forth is that the GPL interpreter (written in TMS9900 ALC) runs on the 16-bit bus from console ROM with no wait states. In both TurboForth and fbForth, the inner “interpreter” (address interpreter) also runs on the 16-bit bus from PAD RAM. TurboForth also runs many of the most-used Forth words from PAD RAM, as well (fbForth does not).

 

...lee

  • Like 1
Link to comment
Share on other sites

how slow do you estimate GPL as compared to assembly or even Turbo Forth?

Speed

 

There are differences, strongpoints and ways to optimize (including embedding some Assembly), but I'd generally put what I've dealt with (nothing to brag about) in 3 categories:

 

1. Fast. Assembly.

2. Quite fast. GPL, Forth, C, Java and XB compiled.

3. Slow. TI Basic and XB.

 

Yes, I'm putting GPL and TurboForth on par.

 

 

What is the main advantage of programming in GPL?

 

Main advantage

 

Interpreter and library built-in. That's absolutely the X-factor opposed to the other "quite fast" (which rely on certain amounts of "library" loaded in RAM and/or stored in ROM).

 

Programming and cross-development

 

This is a matter of personal preference, style, time, practice etc. Once you know Assembly, well, I for one will not "change language", but I may visit for the learning experience and a bit of fun. You constantly have to priorities available time, but never say never.

 

Distribution

 

It's not been all easy with the hardware, but things may be changing now (uberGrom). Ever since emulation started and performed well (around turn of century?) there's no problem there.

 

 

;)

Edited by sometimes99er
Link to comment
Share on other sites

 

5, 4, 3, 2, 1 animated-door-image-0017.gif Hello? Rich? ;)

GPL is not as fast as Fourth or Assembly as it runs from GROM.

But GPL has a maximum space of 640K of space 40K per page of 16 pages and 5 banks per page at 8K per bank.

 

Also 3 8K banks from 0 to 3.

Link to comment
Share on other sites

Can GPL access any area of CPU ram or can it only access PAD ram?

GPL can read and write to any memory and even has CRU access routines built in.

 

Also is much more easy to do DSR stuff then Assembly as the routines are built into the ROM and GROMs of the Console.

 

XB has 12K ROMs and the other 24K is written in GPL.

 

RXB has same 12K ROMs (only 4 bytes modified) and used 40K of GPL.

 

Example of using GPL upgrades:

 

Edited by RXB
Link to comment
Share on other sites

GPL is not as fast as Forth or Assembly as it runs from GROM.

 

Yep, fetching code and data out of GROM is not too fast.

 

But GPL actually has the advantage of running it's interpreter out of 16 bit ROM, whereas Forth and Assembly (typically) runs out of 8 bit RAM/ROM.

 

In the end they (GPL, Forth and Assembly) all keeps banging machine code instructions at 3 Mhz (or something).

 

Rich, you once said that GPL could run out of VDP ? Not that it's any faster, but absolutely interesting. On hardware you wouldn't need GRAM/GROM, but could have Assembly start a GPL program stored in VDP ?

 

:)

Link to comment
Share on other sites

So on the face of it I don't think there are any good reasons to use it, other than its really cool!

TF

Program space (Forth/Assembly), variables: 24K (high RAM)

Variables: 8K (low RAM)

 

GPL

GPL program space (without bank switching): 40K

Variables: 32K

Assembly program space (without bank switching): 8K

  • Like 1
Link to comment
Share on other sites

TF

Program space (Forth/Assembly), variables: 24K (high RAM)

Variables: 8K (low RAM)

 

GPL

GPL program space (without bank switching): 40K

Variables: 32K

Assembly program space (without bank switching): 8K

 

Not quite. You can freely mix Forth code, variables, buffers, and assembly language in TF in both high and low memory just by changing the variable H.

 

See H and FFAILM and FFAIHM.

 

But I'm splitting hairs; I take your point that you do have access to more memory in GPL. :thumbsup:

Link to comment
Share on other sites

But I'm splitting hairs; I take your point that you do have access to more memory in GPL. :thumbsup:

At 1/10th the speed. ;)

 

But the real problem I have with GPL is not GROM or the language itself, but the interpreter. Yes, it runs on the 16-bit bus, but it's terribly inefficient code. During the average GPL program execution the speed of GROM is irrelevant because there's (on average) a 12:1 cycle time spent interpreting data versus fetching it. So we spend 30 cycles fetching an opcode (plus 30 more per byte of data) and over 1000 cycles executing it. You can see this count yourself in Classic99, set up a debugger breakpoint as T(0074-0070) -- this will create a cycle counting timer around the LIMI 2/LIMI 0 sequence which is executed just before every instruction. This means that the console interrupt time will not be counted and won't skew the average. Sitting on the master title page will give an average cycle count of around 1100 cycles PER GPL OPCODE. At that average, GPL manages only about 2700 instructions per second. Assembly, being conservative and saying 30 cycles per instruction, gives you 100,000. There are only a couple of GPL instructions that do much more work than assembly instructions.

 

(Edit: I guess I should note that there is a SCAN (keyboard) in that loop... but even the fastest GPL opcodes are around 280 cycles - so 10,000 per second. Which is a little more reasonable. Sorry about that!)

 

GPL is slow, but it's not because of GROM or VDP or any of the memories, it's all because of the interpreter. I suspect (though don't intend to prove it) that with modern techniques we could build a GPL interpreter that seriously flies. ;)

Edited by Tursi
  • Like 4
Link to comment
Share on other sites

I got the numbers while writing that message, using the technique I described. :)

 

Comparing GPL to assembly is somewhat reasonable as most of the opcodes are similarly low level. Comparing BASIC to assembly is pretty much apples to oranges comparison. But consider that BASIC itself is written in GPL (and XB/RXB you can just consider a slightly faster BASIC), so it's another order of magnitude on top of that.

Link to comment
Share on other sites

Soooo, from the great discussions above, it seems to me that GPL may be a gentler introduction to assembly language from an educational standpoint, and a faster alternative to Basic/XB. It makes little sense for those who already know assembly or are familiar with a faster higher level language such as TF, even with the expanded memory access given the speed penalties.

Good to know :)

Link to comment
Share on other sites

I got the numbers while writing that message, using the technique I described. :)

 

Comparing GPL to assembly is somewhat reasonable as most of the opcodes are similarly low level. Comparing BASIC to assembly is pretty much apples to oranges comparison. But consider that BASIC itself is written in GPL (and XB/RXB you can just consider a slightly faster BASIC), so it's another order of magnitude on top of that.

 

While you're at it, how do you think GPL will compare with p-code? I have a very soft spot in my heart for Pascal, and would eventually like to develop a program for it on the TI, but I am concerned about its performance...

Link to comment
Share on other sites

Soooo, from the great discussions above, it seems to me that GPL may be a gentler introduction to assembly language from an educational standpoint, and a faster alternative to Basic/XB. It makes little sense for those who already know assembly or are familiar with a faster higher level language such as TF, even with the expanded memory access given the speed penalties.

Good to know :)

 

Well, from my perspective, even though I am fairly proficient with ALC, learning GPL is useful for the following reasons:

  1. Managing cartridge startup—a limited usage of GPL, to be sure, but useful nonetheless
  2. Probing the logic of specific TI Basic code
  3. Analyzing GPLLiNKed routines such as the transcendental, floating-point-math routines

...lee

Link to comment
Share on other sites

While you're at it, how do you think GPL will compare with p-code? I have a very soft spot in my heart for Pascal, and would eventually like to develop a program for it on the TI, but I am concerned about its performance...

To avoid polluting the thread, let me go start a new one. Benchmarking is always fun ;)

Link to comment
Share on other sites

  • 2 weeks later...

GPL has two more features not mentioned.

1. GPL can store and load from GROM/GRAM and manage multiple Assembly programs and is very very good at this combined with GPL menus.

2. GPL can run and manage SAMS memory with no Assembly space used, so makes management more useful.

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