### Game control adjustment program for ABM. ### Copyright 1980 Muse Software. ### ### This allows customization of axes and buttons. It does not alter ### the reported range of values. ### Initialization and introduction. 1 PRINT "NOMON C,I,O" 5 DIM P(4,4) 10 TEXT : HOME 40 VTAB 8: PRINT " ABM GAME CONTROL": PRINT " ADJUSTMENT" 50 VTAB 16: PRINT " COPYRIGHT 1980, MUSE SOFTWARE": PRINT " ALL RIGHTS RESERVED" # Reset controls to default. 55 PRINT "BLOAD BKUP.CONTROLS" # Show instructions. 60 VTAB 23: PRINT " PRESS A KEY TO BEGIN " 70 GET A$ 80 HOME 90 VTAB 8: PRINT " THIS PROGRAM ADJUSTS THE CONTROL": PRINT 100 PRINT "SECTIONS OF THE ABM GAME PROGRAM TO": PRINT 110 PRINT "MATCH YOUR GAME CONTROLLER.": PRINT 130 PRINT " MOVE THE GAME CONTROLLER AS THOUGH": PRINT 140 PRINT "YOU WERE CONTROLLING YOUR TARGET": PRINT 150 PRINT "MARKER AS THE ADJUSTER DIRECTS YOU." 170 VTAB 23: PRINT " PRESS A KEY TO GO ON.": GET A$ 180 HOME ## Read all four paddle controls at the four corners. Store values in P. 190 PRINT "MOVE YOUR GAME": PRINT "CONTROLS TO": PRINT "THE UPPER LEFT": PRINT "THEN PRESS A KEY." 200 GET A$:R = 1: GOSUB 5000 210 HOME 220 PRINT " MOVE YOUR GAME": PRINT " CONTROLS TO " 230 PRINT " THE UPPER RIGHT ": PRINT " THEN PRESS A KEY. " 240 GET A$:R = 2: GOSUB 5000 250 HOME : VTAB 16 260 PRINT "MOVE YOUR GAME": PRINT "CONTROLS TO": PRINT "THE LOWER LEFT": PRINT "THEN PRESS A KEY. 270 GET A$:R = 3: GOSUB 5000 280 HOME : VTAB 16 290 PRINT " MOVE YOUR GAME ": PRINT " CONTROLS TO " 300 PRINT " THE LOWER RIGHT ": PRINT " THEN PRESS A KEY. " 310 GET A$:R = 4: GOSUB 5000 320 HOME # Decide which paddle to use for horizontal. 330 PA = 1:PB = 2:PC = 3:PD = 4: GOSUB 6000 338 HP = PP 340 POKE 781,PP - 1 345 POKE 787,PQ # Decide which paddle to use for vertical. 350 PA = 1:PB = 3:PC = 2:PD = 4: GOSUB 6000 360 POKE 790,PP - 1 362 VP = PP 365 POKE 796,PQ 370 HOME ## Get buttons. Collect a baseline of button states in P(n,1). 380 R = 1: GOSUB 7000 390 VTAB 16: PRINT " PRESS THE BUTTON THAT FIRES": PRINT " THE OUTER AND CENTER MISSILES." 395 VTAB 20: PRINT "OUTER CENTER OUTER" # Get current button states in P(n,2), and put the number of the first # delta in PP. 400 R = 2: GOSUB 8000 # Save selection for outer/center (smaller) missiles. 410 POKE 801,PP - 1: POKE 813,128 - PQ 411 HOME : VTAB 13: PRINT " LET UP ON IT!" # Wait for the button to be released. 412 R = 2: GOSUB 7000 413 PP = 0 414 FOR Q = 1 TO 3 415 IF P(Q,2) = P(Q,1) THEN 417 416 PP = Q 417 NEXT Q 418 IF PP > 0 THEN 411 420 HOME 429 HOME ## Now do the same for the inner (bigger) missiles. 430 VTAB 16: PRINT " NOW PRESS THE BUTTON THAT" 440 PRINT " FIRES THE INNER MISSILES." 445 VTAB 20: PRINT " INNER INNER" 450 R = 3: GOSUB 8000 460 POKE 827,PP - 1: POKE 839,128 - PQ 461 IM = PP ## Save the modified file. 470 HOME : VTAB 16: PRINT " OKAY, LET GO.": PRINT " THE GAME IS STARTING!" 490 PRINT "BSAVE CONTROLS,A$300,L$60" 500 PRINT "RUN ABM" ## Unused. 1000 HOME : VTAB 10 1010 PRINT " THERE IS A PROBLEM." 1020 PRINT 1030 PRINT " YOU MOVED ONLY ONE GAME PADDLE.": PRINT 1040 PRINT " YOU NEED TWO PADDLES OR A JOYSTICK": PRINT 1050 PRINT " TO PLAY THIS GAME!" 1060 VTAB 23: PRINT " PRESS A KEY TO START OVER.": GET A$ 1070 GOTO 180 ## Coding error -- should be around line 411. (Counterpart to ## IM on line 461.) 4098 OM = PP ### Read the paddle values into P(n,R). This reads all four ### paddle inputs. Paddles that aren't present return 127. 5000 REM 5005 FOR Q = 1 TO 4:P(Q,R) = PDL (Q - 1): NEXT Q 5020 RETURN ### Compute the best paddle to use for one axis. The paddle number ### is returned in PP, the axis-flip EOR value is returned in PQ. 6000 PP = 0 6005 MX = 0 6010 FOR Q = 1 TO 4 # For each paddle: # horiz: diff = (top_left + lower_left) - (top_right + lower_right) # vert : diff = (top_left + top_right) - (lower_left + lower_right) 6020 DI = P(Q,PA) + P(Q,PC) - (P(Q,PB) + P(Q,PD)) # find the max absolute value 6030 IF ABS (DI) < = ABS (MX) THEN 6050 # new max found, record result 6040 MX = DI:PP = Q 6050 NEXT Q # if max value is negative, invert the axis 6060 PQ = 0: IF MX > 0 THEN PQ = 255: RETURN 6070 RETURN ### Detect which paddle buttons are pressed. Sets values in P(n,R) to 0 or 128. 7000 FOR Q = 1 TO 3 7020 P(Q,R) = 0 7030 IF PEEK (Q - 16288) > 127 THEN P(Q,R) = 128 7040 NEXT Q 7050 RETURN ### Find the first paddle button that changed state. Return it in PP. 8000 GOSUB 7000:PP = 0:PQ = 0 8010 FOR Q = 1 TO 3: IF P(Q,R) = P(Q,1) THEN 8030 8020 PP = Q:PQ = P(Q,R) 8030 NEXT Q # Wait until something is pressed. 8040 IF PP = 0 THEN 8000 8050 RETURN