;*************************************************************** ; ; Multisprite: 9 Objects With Coordinates ; ; ; By Duane Alan Hahn (Random Terrain) using hints, tips, ; code snippets, and more from AtariAge members such as ; batari, SeaGtGruff, RevEng, Robert M, Atarius Maximus, ; jrok, Nukey Shay, supercat, and GroovyBee. ; ; Score coordinate code provided by bogax. ; ;``````````````````````````````````````````````````````````````` ; ; Instructions ; ; There are 6 sprites (player0 at the top, down to player5 at ; the bottom), 2 missiles (missile0 above missile1) and 1 ball ; on the screen. Hold down the fire button and press the ; joystick up or down to select an object. Hold down the fire ; button and move the joystick left or right to change the size ; of the currently selected object. ; ; To move the currently selected object, release the fire ; button and press the joystick in any direction. ; ;``````````````````````````````````````````````````````````````` ; ; If this program will not compile for you, get the latest ; version of batari Basic: ; ; http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#gettingstarted ; ;*************************************************************** ;*************************************************************** ; ; Kernel setup. ; includesfile multisprite_bankswitch.inc include fixed_point_math.asm set tv ntsc set kernel multisprite set romsize 32kSC set optimization speed set smartbranching on set optimization inlinerand ;*************************************************************** ; ; Variable aliases go here (DIMs). ; ; You can have more than one alias for each variable. ; If you use different aliases for bit operations, ; it's easier to understand and remember what they do. ; ; I start variable aliases with one underscore so I won't ; have to worry that I might be using bB keywords by mistake. ; I also start labels with two underscores for the same ; reason. The second underscore also makes labels stand out ; so I can tell at a glance that they are labels and not ; variables. ; ; Use bit operations any time you need a simple off/on ; variable. One variable essentially becomes 8 smaller ; variables when you use bit operations. ; ; I start my bit aliases with "_Bit" then follow that ; with the bit number from 0 to 7, then another underscore ; and the name. Example: _Bit0_Reset_Restrainer ; ;``````````````````````````````````````````````````````````````` ;``````````````````````````````````````````````````````````````` ; Bits for various jobs. ; dim _Bit0_Reset_Restrainer = t dim _Bit1_Joy0_Restrainer = t ;``````````````````````````````````````````````````````````````` ; Splits up the score into 3 parts. ; dim _sc1 = score dim _sc2 = score+1 dim _sc3 = score+2 ;*************************************************************** ; ; Text minikernel stuff ; ; Constants used for each level instead of variables level ; Constants since Batari Basic had a limit of 500 constants ; dim TextIndex = w const noscore = 1 const textbank = 3 const p0_text = 0 const p1_text = 12 const p2_text = 24 const p3_text = 36 const p4_text = 48 const p5_text = 60 const p6_text = 72 const p7_text = 84 ;**************************************************************** ; ; set screenheight and pixels ; const screenheight = 80 pfheight = 1 ;**************************************************************** ; ; Color of text ; TextColor = $1E ;*************************************************************** ;*************************************************************** ; ; PROGRAM START/RESTART ; ; __Start_Restart ;**************************************************************** ; ; Set up playfield and players ; gosub rs0 bank8 : gosub __Frame_LR_01 bank8 ;*************************************************************** ; ; Displays the screen to avoid going over 262. ; drawscreen ;*************************************************************** ; ; Object placement. ; player0x = 77 : player0y = 46 ;*************************************************************** ; ; Mutes volume of both sound channels. ; AUDV0 = 0 : AUDV1 = 0 ;*************************************************************** ; ; Clears 25 of the normal 26 variables (fastest way). ; The variable z is used for random numbers in this program ; and clearing it would mess up those random numbers. ; a = 0 : b = 0 : c = 0 : d = 0 : e = 0 : f = 0 : g = 0 : h = 0 : i = 0 j = 0 : k = 0 : l = 0 : m = 0 : n = 0 : o = 0 : p = 0 : q = 0 : r = 0 s = 0 : t = 0 : u = 0 : v = 0 : w = 0 : x = 0 : y = 0 ;*************************************************************** ; ; Sets repetition restrainer for the reset switch. ; (Holding it down won't make it keep resetting.) ; _Bit0_Reset_Restrainer{0} = 1 ;*************************************************************** ;*************************************************************** ; ; MAIN LOOP (MAKES THE PROGRAM GO) ; ; __Main_Loop ;*************************************************************** ; ; Sets colors. ; COLUP0 = $1E : COLUPF = $86 ;*************************************************************** ; ; Player0 Controls ; if joy0up then player0y = player0y + 1 : TextIndex = p0_text if joy0down then player0y = player0y - 1 : TextIndex = p1_text if joy0left then player0x = player0x - 1 : TextIndex = p2_text if joy0right then player0x = player0x + 1 : TextIndex = p3_text ;*************************************************************** ; ; Displays the screen. ; drawscreen ;*************************************************************** ; ; Reset switch check and end of main loop. ; ; Any Atari 2600 program should restart when the reset ; switch is pressed. It is part of the usual standards ; and procedures. ; ;``````````````````````````````````````````````````````````````` ; Turns off reset restrainer bit and jumps to beginning of ; main loop if the reset switch is not pressed. ; if !switchreset then _Bit0_Reset_Restrainer{0} = 0 : goto __Main_Loop ;``````````````````````````````````````````````````````````````` ; Jumps to beginning of main loop if the reset switch hasn't ; been released after being pressed. ; if _Bit0_Reset_Restrainer{0} then goto __Main_Loop ;``````````````````````````````````````````````````````````````` ; Restarts the program. ; goto __Start_Restart rem ****************************** rem ****End Bank 1 *************** rem ****************************** rem ****************************** rem ****Start Bank 2 ************* rem ****************************** bank 2 ; ****************************** ; ****End Bank 2 *************** ; ****************************** ; ****************************** ; ****Start Bank 3 ************* ; ****************************** bank 3 ;``````````````````````````````````````````````````````````````` ; ; USe the PDF provided by Carl G to make your text below ; They will coorespond to the "Const" and the movement code ; data text_strings __P, __L, __E, __A, __S, __E, _sp, __H, __E, __L, __P, _ex __S, __A, __V, __E, _sp, __U, __S, _sp, __P, __A, __C, _sp __P, __I, __N, __K, __Y, _sp, __G, __E, __T, __H, __I, __M __C, __A, __T, __C, __H, _sp, __H, __I, __M, _sp, _sp, _sp __P, __4, _sp, _lp, __V, __I, __R, __T, __U, __A, __L, _rp __P, __5, _sp, _lp, __V, __I, __R, __T, __U, __A, __L, _rp __M, __0, _sp, __O, __B, __J, __E, __C, __T, _sp, _sp, _sp __M, __1, _sp, __O, __B, __J, __E, __C, __T, _sp, _sp, _sp __B, __A, __L, __L, _sp, __O, __B, __J, __E, __C, __T, _sp end inline text12b.asm ; ****************************** ; ****End Bank 3 *************** ; ****************************** ; ****************************** ; ****Start Bank 4 ************* ; ****************************** bank 4 ; ****************************** ; ****End Bank 4 *************** ; ****************************** ; ****************************** ; ****Start Bank 5 ************* ; ****************************** bank 5 ; ****************************** ; ****End Bank 5 *************** ; ****************************** ; ****************************** ; ****Start Bank 6 ************* ; ****************************** bank 6 ; ****************************** ; ****End Bank 6 *************** ; ****************************** ; ****************************** ; ****Start Bank 7 ************* ; ****************************** bank 7 ; ****************************** ; ****End Bank 7 *************** ; ****************************** ; ****************************** ; ****Start Bank 8 ************* ; ****************************** bank 8 ;*************************************************************** ; ; Sprite shapes. ; __Frame_LR_01 player0: %01111100 %11111110 %11111000 %11100000 %11111000 %11011110 %11111110 %01111100 end return rs0 playfield: ........X....... ................ XXXXXXXXXXXXXXX. X............... X............... X............... X............... X............... X............... X..XXXXXXXXXXXX. X............... X............... X............... X............... X............... X............... XXXXXXX..XXXXXXX ................ ................ ................ ................ ................ ................ XXXXXXX..XXXXXXX X............... X............... X............... X............... X............... X............... X..XXXXXXXXXXXX. X............... X............... X............... X............... X............... X............... XXXXXXXXXXXXXXX. ................ ........X....... end return inline text12a.asm