Use the TEXT command.
Realize that with copying bitmaps back and forth, if you are updating the bitmap (bitmap 1 in this case) every iteration, you are still running processes and loops to make the updates possible. Your subroutine PrintList only outputs unique values once so it doesn't make sense to run that subroutine every iteration. In your code, you are not only updating bitmap 1 with information that doesn't change (except for the FPS) by calling gosub printlist every loop, but you are copying it to bitmap 0 every loop so you have a lot of extra stuff going on. This first example is just your version eliminating the bitmap swap and using the text command instead of print. I get about 95 to 100 fps this way and about 35 the way it was:
sync on
sync rate 0
`create bitmap 1,640,480
MaxWords = 215
dim Index$(MaxWords)
gosub CreateList
do
if spacekey() = 1 then gosub CreateList :
gosub PrintList
`copy bitmap 1,0
sync : cls
loop
CreateList:
for lp = 0 to MaxWords
r = rnd(2)+3
Index$(lp) = ""
for lp2 = 0 to r
Index$(lp) = Index$(lp) + chr$(rnd(78)+48)
next lp2
next lp
return
PrintList:
`print "FPS: ";screen fps()
text 0,0,"FPS: "+str$(screen fps())
x = 0
y = 0
z = 0
for lp = 0 to MaxWords
y = y + 1
z = z + 1
if y > 30 then y = 0 : x = x + 1
`set cursor x*90,y*15
`print z; " "+Index$(lp)
text x*90,y*15,str$(z)+" "+index$(lp)
next lp
return
This code runs the printlist once on bitmap 1 then copies it into bitmap 0 each loop. Using text and this method I get 340+ fps:
sync on
sync rate 0
create bitmap 1,640,480
MaxWords = 215
dim Index$(MaxWords)
gosub CreateList
gosub Printlist
set current bitmap 0
do
if spacekey() = 1 then gosub CreateList :
`gosub PrintList
copy bitmap 1,0
text 0,0,"FPS: "+str$(screen fps())
sync : cls
loop
CreateList:
for lp = 0 to MaxWords
r = rnd(2)+3
Index$(lp) = ""
for lp2 = 0 to r
Index$(lp) = Index$(lp) + chr$(rnd(78)+48)
next lp2
next lp
return
PrintList:
`print "FPS: ";screen fps()
`text 0,0,"FPS: "+str$(screen fps())
x = 0
y = 0
z = 0
for lp = 0 to MaxWords
y = y + 1
z = z + 1
if y > 30 then y = 0 : x = x + 1
`set cursor x*90,y*15
`print z; " "+Index$(lp)
text x*90,y*15,str$(z)+" "+index$(lp)
next lp
return
Swapping bitmaps is great when you have a lot of static graphics or backgrounds that aren't changing. For example, say you made a paint program or something. At the top is a menu bar, on the right side are a bunch of buttons for functions, and on the bottom is a status bar. The rest of the screen is devoted to the drawing area. To keep processing down, the entire window (without any drawing) can be saved in a bitmap offscreen. Another bitmap can be saved offscreen that is the drawing area. When you start the app, you paste the main background bitmap ONCE with all of the buttons and what not in the non selected state. You then swap in and out the drawing area as you draw. The only time you swap in or out or update the main background is if you select a tool or use the menu or change something on it. Otherwise, you paste it once and only as necessary and the main modifications occur on the drawing area (be sure not to clear screen 0! Or else you'd have to paste the background every iteration).
Enjoy your day.