These originally appeared on my old Dragon blog - some contributions are attributed to the username Zephyr - you know who you are and thanks again!
10 PRINT "DRAGON 32 FOREVER"You can also add a margin
10 PRINT TAB(5) + "DRAGON 32 FOREVER"For most control, use the PRINT @ command
10 PRINT @200, "DRAGON 32 FOREVER"The number after the @ sign is the position on screen. Top left is 0 and the last character on the screen is 511. Try printing your name around the screen.
10 CLS 20 G=RND(512) 30 POKE 1023+G,127+RND(128) 40 GOTO 20
10 CLS 20 X=0:Y=0 30 POKE 1024+((Y*32)+X),ASC("*") 40 A$ = INKEY$ 50 IF A$ = CHR$(10) THEN GOSUB1000:Y = Y + 1 60 IF A$ = CHR$(94) THEN GOSUB1000:Y = Y - 1 70 IF A$ = CHR$(9) THEN GOSUB1000:X = X + 1 80 IF A$ = CHR$(8) THEN GOSUB1000:X = X - 1 110 IF Y>15 THEN Y=15 130 IF X>31 THEN X=31 200 GOTO 30 1000 REM HIDE IT! 1010 POKE 1024+((Y*32)+X),ASC(".") 1020 RETURNMore useful in some situations is to allow the user to press and hold the button for continuous movement. To do this we rely on some PEEK commands which read the keyboard activity straight from the Dragons memory.
10 CLS 20 X=0:Y=0 30 POKE 1024+((Y*32)+X),ASC("*") 40 PE = PEEK(135) : PR = PEEK(337) : IF PR = 255 THEN PE = 0 50 IF PE = 10 THEN GOSUB1000:Y = Y + 1 60 IF PE = 94 THEN GOSUB1000:Y = Y - 1 70 IF PE = 9 THEN GOSUB1000:X = X + 1 80 IF PE = 8 THEN GOSUB1000:X = X - 1 110 IF Y>15 THEN Y=15 130 IF X>31 THEN X=31 200 GOTO 30 1000 REM HIDE IT! 1010 POKE 1024+((Y*32)+X),ASC(".") 1020 RETURN