User Tools

Site Tools


sd:sd-8516_stellar_basic

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sd:sd-8516_stellar_basic [2026/04/24 13:52] appledogsd:sd-8516_stellar_basic [2026/04/28 15:55] (current) appledog
Line 1: Line 1:
 = SD=8516 Stellar Basic = SD=8516 Stellar Basic
-* Stellar BASIC [[Practical Speed Tests]] 
  
 == Stellar BASIC == Stellar BASIC
Line 8: 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 can execute over 3,000 lines per second at 4 MHz (1.28 MIPS)! Although of course, graphics-heavy statements can slow this down to 800 lines/second. Check out our [[Practical Speed Tests]].+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 since it's four times faster. First, the SD-8516 does not experience the register pressure of a 6502. With more registers available to the programmer, the code size is smaller, and therefore faster. 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 since it's four times faster. First, the SD-8516 does not experience the register pressure of a 6502. With more registers available to the programmer, the code size is smaller, and therefore faster.
Line 78: Line 77:
 </codify> </codify>
  
-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 because we would have to PEEK the byte, modify it, and write it out again. The 6 seconds it took is much faster because we used an optimization that draws two pixels at once.+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, because we would have to PEEK the byte, modify it, and write it out again.
  
-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 fasterthe 2d accelerated graphics commands PIXEL and PEXEL.
  
 === PIXEL and PEXEL === PIXEL and PEXEL
Line 108: 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 114: 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"; A$    130 INPUT "PRESS ENTER"; A$
Line 120: Line 119:
 </codify> </codify>
  
-If you time this program you will find that it is even slower than the POKE version. This is because we're writing out the full 64,000 pixels-- the POKE version only wrote 32,000. If you weigh it pound for pound, comparably, PIXEL is about 30% faster than using POKE to draw.+If you time this program you will find that it is vastly faster than the POKE version, completing in //under// a minute! We may need something faster.
  
 === 160x200 CGA Mode === 160x200 CGA Mode
Line 140: 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 155: Line 153:
 </codify> </codify>
  
-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 thisthe 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 170: Line 168:
 </codify> </codify>
  
-This program is even shorter than the others, and ever so much faster! Clocking in at well under a tenth of a second, it is the fastest version of this demo yet.+This program is even shorter than the others, and ever so much faster. It's so fast you may have trouble timing it. It is the fastest version of this demo yet.
  
 === CIRCLE === CIRCLE
Line 183: Line 181:
     60 MODE 1     60 MODE 1
 </codify> </codify>
 +
 +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.1777038750.txt.gz · Last modified: by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki