sd:sd-8516_stellar_basic
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sd:sd-8516_stellar_basic [2026/04/21 15:55] – appledog | sd:sd-8516_stellar_basic [2026/04/28 15:55] (current) – appledog | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| == It's fast! | == It's fast! | ||
| - | Stellar BASIC is a kind of 8 bit TinyBASIC, with a few improvements under the hood. It runs at 2500 lines per second at 4 MHz (1.28 MIPS)! | + | Stellar BASIC is a kind of 8 bit TinyBASIC, with a few improvements under the hood. It can execute over 3,000 lines per second at 4 MHz! Although of course, graphics-heavy statements can slow this down to about half that. Check out our [[Practical Speed Tests]]. |
| - | Now, compared to a C64 running at 1mhz, why is it so fast? You would expect it to top out at 800 lines per second | + | Now, compared to a C64 running at 1mhz, why is it so fast? You would expect it to top out at ~800 lines per second |
| - | Secondly, Commodore BASIC 2.0 treats all numbers as floats, which is expensive and slows down the interpreter. Stellar BASIC is more advanced because it has 26 dedicated INT registers (A-Z). When you use A to Z, it is a native INT (native 16 bit register width). | + | Secondly, Commodore BASIC 2.0 is inefficient. It treats all numbers as floats, which is expensive and slows down the interpreter. Stellar BASIC is more advanced because it has 26 dedicated INT registers (A-Z). When you use A to Z, it is a native INT (native 16 bit register width). |
| == Terminal Control | == Terminal Control | ||
| Line 77: | Line 77: | ||
| </ | </ | ||
| - | The problem with this is that it's a bit slow. In fact, it executes in 6 seconds at 100mhz. | + | The problem with this is that it's a bit slow. In fact, it takes over a minute to finish drawing! |
| - | The reason why it takes so long is because Mode 3 uses a packed pixel format -- one byte holds two pixels (each pixel is four bits). In fact, if we wrote this program normally it would take over 12 seconds | + | The reason why it takes so long is because Mode 3 uses a packed pixel format -- one byte holds two pixels (each pixel is four bits). In fact, if we wrote this program normally it would take even longer to finish, |
| - | If you'd like to use something a bit faster, you can try the 2d accelerated graphics commands PIXEL and PEXEL. | + | Let's try something a bit faster; the 2d accelerated graphics commands PIXEL and PEXEL. |
| === PIXEL and PEXEL | === PIXEL and PEXEL | ||
| Line 107: | Line 107: | ||
| 30 FOR X = 0 TO 19 | 30 FOR X = 0 TO 19 | ||
| 40 FOR Y = 0 TO 199 | 40 FOR Y = 0 TO 199 | ||
| - | 50 PIXEL(C * 20 + X, Y, C) | + | 50 PIXEL C * 20 + X, Y, C |
| 60 NEXT Y | 60 NEXT Y | ||
| 70 NEXT X | 70 NEXT X | ||
| Line 113: | Line 113: | ||
| 90 REM DIAGONAL LINE IN WHITE | 90 REM DIAGONAL LINE IN WHITE | ||
| 100 FOR I = 0 TO 199 | 100 FOR I = 0 TO 199 | ||
| - | 110 PIXEL(I, I, 3) | + | 110 PIXEL I, I, 3 |
| 120 NEXT I | 120 NEXT I | ||
| 130 INPUT "PRESS ENTER"; | 130 INPUT "PRESS ENTER"; | ||
| Line 119: | Line 119: | ||
| </ | </ | ||
| - | If you time this program you will find that it is even slower | + | If you time this program you will find that it is vastly faster |
| === 160x200 CGA Mode | === 160x200 CGA Mode | ||
| Line 139: | Line 139: | ||
| It's still slow to POKE, but if you're just drawing a scene or some letters or art, you can easily get away with POKE in 160x200 mode. | It's still slow to POKE, but if you're just drawing a scene or some letters or art, you can easily get away with POKE in 160x200 mode. | ||
| - | |||
| === LINE | === LINE | ||
| Line 154: | Line 153: | ||
| </ | </ | ||
| - | Line drawing is much faster. It takes 0.14 seconds at 100mhz. That is an incredible speed-up over the previous record. But there is an even faster command than this -- the RECT drawing command. | + | Line drawing is much faster. It takes under a second. That is an incredible speed-up over the previous record. But there is an even faster command than this, the RECT drawing command. |
| === RECT | === RECT | ||
| - | Yes! What's even better than a LINE? A rectangle! | + | What's even better than a LINE? A rectangle, of course. |
| <codify BASIC> | <codify BASIC> | ||
| Line 169: | Line 168: | ||
| </ | </ | ||
| - | This program is even shorter than the others, and ever so much faster! Clocking in at well under a tenth of a second, | + | This program is even shorter than the others, and ever so much faster. It's so fast you may have trouble timing |
| === CIRCLE | === CIRCLE | ||
| Line 182: | Line 181: | ||
| 60 MODE 1 | 60 MODE 1 | ||
| </ | </ | ||
| + | |||
| + | The format is: | ||
| + | |||
| + | CIRCLE x1,y1, xr, yr, color | ||
| Now you can create truly stunning art on the SD-8516! | Now you can create truly stunning art on the SD-8516! | ||
sd/sd-8516_stellar_basic.1776786924.txt.gz · Last modified: by appledog
