Hi,
Okay, got another step towards subroutines for the "Zombie Escape" game ... a sort of Etch-A-Sketch using keyboard inputs:
0 REM BLINK6.BAS.txt
10 REM Initialize DAZZLER and Clear the Screen
20 GOSUB 9000 : REM Clear the screen
30 X = 128 : REM Starting X position (center)
40 Y = 128 : REM Starting Y position (center)
50 CURSORCOLOR = 23 : REM Initial blinking color (white)
60 USERCOLOR = 16 : REM Default user color (black)
70 PREVX = X : REM Track previous X position
80 PREVY = Y : REM Track previous Y position
100 REM Main loop
110 GOSUB 200 : REM Draw the blinking cursor
120 GOSUB 300 : REM Wait for keypress and move cursor
130 GOTO 110 : REM Repeat the loop
200 REM Subroutine to draw blinking cursor
210 DZOP "P", PREVX, PREVY : REM Position at previous position
220 DZOP "C", USERCOLOR : REM Set previous dot to user-selected color
230 DZOP "D" : REM Draw the previous dot
240 PREVX = X : REM Update previous X to current
250 PREVY = Y : REM Update previous Y to current
260 DZOP "P", X, Y : REM Position at current X, Y
270 DZOP "C", CURSORCOLOR : REM Set color for blinking cursor
280 DZOP "D" : REM Draw the cursor dot
290 RETURN
300 REM Subroutine to handle keypress and move cursor
310 PRINT "Enter direction (L, R, U, D): ";
320 INPUT DIRECTION$ : REM Get direction from user
330 PRINT "Enter steps (1-999): ";
340 INPUT STEPS : REM Get number of steps (1-999)
350 IF STEPS < 1 OR STEPS > 999 THEN PRINT "Invalid steps!" : RETURN
360 REM Handle direction and move cursor
370 IF DIRECTION$ = "L" AND X > 0 THEN X = X - STEPS : IF X < 0 THEN X = 0 : REM Prevent going off screen
380 IF DIRECTION$ = "R" AND X < 255 THEN X = X + STEPS : IF X > 255 THEN X = 255 : REM Prevent going off screen
390 IF DIRECTION$ = "U" AND Y > 0 THEN Y = Y + STEPS : IF Y < 0 THEN Y = 0 : REM Prevent going off screen
400 IF DIRECTION$ = "D" AND Y < 255 THEN Y = Y - STEPS : IF Y > 255 THEN Y = 255 : REM Prevent going off screen
410 GOSUB 200 : REM Draw the new blinking cursor at the new position
420 PRINT "Enter color (1-8 for colors 16-23): ";
430 INPUT COLORNUM : REM Get color number from user
440 IF COLORNUM >= 1 AND COLORNUM <= 8 THEN USERCOLOR = 15 + COLORNUM
450 RETURN
9000 REM Clear the Screen Routine
9010 DZOP "C", 16 : REM Set color to black
9020 DZOP "P", 0, 0 : REM Position cursor at (0, 0)
9030 DZOP "R", 255, 255 : REM Fill the screen with black
9040 RETURN
.