[Coco] Colorful OS-9 Maze on CoCoTalk EOU B6 Preview 12/12

Andrew keeper63 at cox.net
Wed Dec 30 18:53:11 EST 2020


I took the code from the online emulator, expanded it, then transcribed 
it, with some comments and guesses - it still runs, but my guesses as to 
what is doing what may or may not be correct. I am not a BBC Basic 
coder, and heck, I haven't done much in BASIC period in a long time:

10 REM SETUP GRAPHICS MODE, CLEAR SCREEN
15 MODE 2: COLOUR 134: CLS
20 REM DRAW SHADOW (?)
25 GCOL 0, 0: MOVE 1029,250: PLOT 153, 250, 0

29 REM DRAW CHECKERBOARD BALL
30 FOR J = 0 TO 6
31   FOR X = 1 TO 19
32     C = COS(X * PI / 21)
33     FOR K = J TO J + 1
34       REM NEXT LINE FOR CHECKERBOARD PALLETTE PATTERN?
35       GCOL 0,8 + (X + J * 4) MOD 8
36       H = COS(K * PI / 7)
37       U = 25 * C * SQR(1 - H * H)
38       V = 25 * H
39       PLOT 84 - (X > 1), 990 + U * 9 + V * 4, 290 + V * 9 - U * 4
40     NEXT K
41   NEXT X
42 NEXT J

43 REM INITIALIZE VERTICAL POSITION
44 V=1
50 P = -512
52 U = J MOD 25
54 X = X + V : J = J + 1
55 REM CALC FOR PALLETTE INDEX?
56 A = &600 + X + INT(U * 2.5 - U * U * .1) * 80
57 REM BOUNCE OFF EDGE?
58 IF X < 3 OR X > 44 V = -V

59 REM NOT SURE, FUNCTION DEF?
60*FX19
65 REM I THINK THIS MIGHT BE FOR PALLETTE SWAPPING?
70 ?P = 12: P?1 = A / 256
72 ?P = 13: P?1 = A

73 REM I THINK THE NEXT LINE IS FOR THE MOTION
74 C = 8 + (X + V * 2) MOD 8
75 REM MOVES VIDEO BUFFER, NOT BALL?
76 VDU 19, C, 1;0;19, 8 + (C + 4) MOD 8,7;0;
80 GOTO 50

I'm sure someone could (partially) translate this into something for the 
CoCo 3. But the real magic in this happens in line 76 (of my 
translation). No way of doing that on the CoCo 3 in SECB...but I bet you 
could write some assembler to do it, and call it from BASIC - maybe?

Andrew L. Ayers
Glendale, Arizona
phoenixgarage.org
github.com/andrew-ayers


More information about the Coco mailing list