Here is my Saturday programming exercise. X is the ball's X position DX is the ball's X direction Y is the ball's Y position DY is the ball's Y direction Positioning the ball on Atari computer 170 POSITION X,Y 175 PRINT CHR$(20) Character 20 being the ball. Positioning the ball on C64 170 POKE 1024 + X + 40*Y,81 81 being the ball. Positioning the ball on TI-99 170 CALL HCHAR(Y,X,81) Positioning the cross on the Apple II 161 PLOT X, Y 162 PLOT X-1,Y+1 163 PLOT X,Y+1 164 PLOT X+1,Y+1 165 PLOT X,Y+2 The TI uses Y,X coordinates where C64 and Apple use X,Y coordinates. Atari and C64 both have predefined ball characters. TI-99 and Apple does not. I'm using character 81 as the ball on C64 - 20 on Atari I'm rewriting character 81 and drawing it as a ball on the TI. There is no simple middle ground with the Apple when doing graphic. I simply slapped 5 blocks together with the plot command in low res graphics. Using TI-99 Extended BASIC, I could have shortened up the TI-99 code a lot, but wanted the code to work with both versions of BASIC. For that matter, I could have shortened up all the BASIC code by CATing code on the same lines, but I'm not a fan of that. Too much and the code stops being easily readable. I have been programming the far majority of my life. I still feel the same about these 4 platforms of the 80s. TI-99 Extended #1, Atari 2nd, C64 3rd, and Apple II still sucks. On to the Code!! The Atari Code First 100 REM CLEAR SCREEN 110 PRINT CHR$(125) 120 GRAPHICS 0 : POKE 752,1 140 X = 1 145 Y = 1 150 DX = 1 155 DY = 1 160 REM DISPLAY BALL 170 POSITION X,Y 175 PRINT CHR$(20) 180 REM LINE 190 SLOW CODE DOWN 190 FOR T = 1 TO 50 195 NEXT T 200 POSITION X,Y 205 PRINT " " 210 X = X + DX 220 IF X <= 0 THEN DX=-DX 225 IF X >= 34 THEN DX=-DX 230 Y = Y + DY 240 IF Y <= 0 THEN DY=-DY 245 IF Y >= 22 THEN DY=-DY 250 GOTO 160 The C64 BALL BOUNCE code! 100 REM CLEAR SCREEN 110 PRINT "{CLR/HOME}" 120 REM BG L-GREEN AND YELLOW BORDER 130 POKE 53280,7 135 POKE 53281,13 140 X = 1 145 Y = 1 150 DX = 1 155 DY = 1 160 REM DISPLAY BALL 170 POKE 1024 + X + 40*Y,81 180 REM LINE 190 SLOW CODE DOWN 190 FOR T = 1 TO 30 195 NEXT 200 POKE 1024 + X + 40*Y,32 210 X = X + DX 220 IF X <= 0 OR X >= 39 THEN DX = -DX 230 Y = Y + DY 240 IF Y <= 0 OR Y >= 24 THEN DY = -DY 250 GOTO 160 The TI-99 BALL BOUNCE code! 100 CALL CLEAR 110 CALL SCREEN(4) 120 CALL CHAR(81,"3C7EFFFFFFFF7E3C") 140 X = 1 145 Y = 1 150 DX = 1 155 DY = 1 160 REM DISPLAY BALL 170 CALL HCHAR(Y,X,81) 180 REM LINE 190 SLOW CODE 190 FOR T = 1 TO 30 195 NEXT T 200 CALL HCHAR(Y,X,32) 210 X = X + DX 220 IF X < 2 THEN 300 225 IF X > 31 THEN 300 230 Y = Y + DY 240 IF Y < 2 THEN 320 245 IF Y > 23 THEN 320 250 GOTO 160 300 DX =-DX 310 GOTO 160 320 DY =-DY 330 GOTO 160 Apple II PLUS BOUNCE code! It is fairly difficult in GR or HGR to make a ball. 100 REM CLEAR SCREEN 120 GR 140 X = 17 145 Y = 5 150 DX = 1 155 DY = 1 160 COLOR = 6 161 PLOT X, Y 162 PLOT X-1,Y+1 163 PLOT X,Y+1 164 PLOT X+1,Y+1 165 PLOT X,Y+2 180 REM LINE 190 SLOW CODE DOWN 190 FOR T = 1 TO 30 195 NEXT T 200 COLOR = 0 201 PLOT X, Y 202 PLOT X-1,Y+1 203 PLOT X,Y+1 204 PLOT X+1,Y+1 205 PLOT X,Y+2 210 X = X + DX 220 IF X <= 2 OR X >= 37 THEN DX = -DX 230 Y = Y + DY 240 IF Y <= 2 OR Y >= 37 THEN DY = -DY 250 GOTO 160Really, Atari does the best job. TI-99 is the easiest to program. Apple II is the "worsteth" of the four.
Linux, Cars, Coding, Classic Gaming, Base Ball Cards, and overall personal blog. Just another blog of a baseball card collector and geek. Older blogs can be found at http://mrgibson.com/
Saturday, January 11, 2025
Ball Bounce - Saturday BASIC coding Exercise
Subscribe to:
Post Comments (Atom)
Ball Bounce - Saturday BASIC coding Exercise
Here is my Saturday programming exercise. X is the ball's X position DX is the ball's X direction Y is the ball's Y position ...
-
Good morning, Merry Christmas. Atari did provide a statement to GameStop saying the VCS has not been discontinued: “We suspended our rel...
-
I have started 2022 with a new vehicle. Traded in the red Mustang and I am now driving a 2022 Santa Cruz. It was the vehicle I didn't ...
No comments:
Post a Comment