;``````````````````````````````````````````````````````````````` ; Special thanks below for the smaple codes on Batari Basic ; hints, tips, code snippets, and more from AtariAge members ;``````````````````````````````````````````````````````````````` ; such as batari, SeaGtGruff, RevEng, Robert M, Nukey Shay, ; Atarius Maximus, jrok, supercat, GroovyBee, and bogax. ; code snippets from Atarius Maximus's "GTA style game" ; code snippets from Quad Runner's "move_around_rooms" ; code snippets from Stargunner's "Space dungeon" ; code snippets from Mountain King "GizzlewapG16" ; code snippets from Gemintronic code is used here smoothcrl2.bas ; sprite codes from PAC-MAN-RED ; sprites codes from GoB! Fight for the Desert Patrick Jahn, Greg Kinsey, John Swisshelm ; code snippets from atari2600land's Batarti Man! ; code below complied together by Lewis2907 make "The Quest" ;*************************************************************** ; ; Code and Data adapted from SMB by Chris Spry, 2012. ; Code and Data adapted from Gemintronic, S3: The Sensational Santuci Sisters ; ;*************************************************************** ;``````````````````````````````````````````````````````````````` ; ; Instructions: ; ; Use the joystick to move the sprite around ; ;``````````````````````````````````````````````````````````````` ;``````````````````````````````````````````````````````````````` ; ; 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. ; set kernel_options playercolors player1colors pfcolors include div_mul.asm set tv ntsc set romsize 32k set optimization speed set smartbranching on set optimization noinlinedata 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 ;ember 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 ; dim Moving = a dim _Direction_P0 = b dim global_temp1 = c dim global_temp2 = d ;*************************************************************** ; ; Variables "X" "Y" "Z" control screen scrolling ; dim column = y const pfscore=1 ;*************************************************************** ; ; 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 : z = 0 ;*************************************************************** ; ; Clears screen without clearing var44 through var47. ; var0 = 0 : var1 = 2 : var2 = 0 : var3 = 0 : var4 = 0 : var5 = 0 var6 = 0 : var7 = 0 : var8 = 0 : var9 = 0 : var10 = 0 : var11 = 0 var12 = 0 : var13 = 0 : var14 = 0 : var15 = 0 : var16 = 0 : var17 = 0 var18 = 0 : var19 = 0 : var20 = 0 : var21 = 0 : var22 = 0 : var23 = 0 var24 = 0 : var25 = 0 : var26 = 0 : var27 = 0 : var28 = 0 : var29 = 0 var30 = 0 : var31 = 0 : var32 = 0 : var33 = 0 : var34 = 0 : var35 = 0 var36 = 0 : var37 = 0 : var38 = 0 : var39 = 0 : var40 = 0 : var41 = 0 var42 = 0 : var43 = 0 ;*************************************************************** ;*************************************************************** ; ; PROGRAM START/RESTART ; ; __Start_Restart ;**************************************************************** ; ; Game Setup ; COLUP0 = $0E : COLUPF = $42 : COLUBK = $00 gosub __Player_0 bank7 : gosub __Level_1 bank7 score = 0 : scorecolor = $0E : z=32 player0x=80 : player0y=79 pfscore1=255 : pfscore2=0 : pfscorecolor=28 ;**************************************************************** ; ; Displays the screen prematurely so we won't go over 262. ; drawscreen ;*************************************************************** ;*************************************************************** ; ; MAIN LOOP (MAKES THE PROGRAM GO) ; Also used for unpause the game ; __Main_Loop ;*************************************************************** ; ; Reset switch check. ; ;``````````````````````````````````````````````````````````````` ; The next line will soft reset the Atari if the reset switch ; is pressed. NOTE: Do not use the reboot command if you are ; using rand because it messes up the randomization of numbers. ; I use it because I do not use random numbers in my code. ; if switchreset then goto __Start_Restart ;*************************************************************** ; ; Don't move down if pfpixel is in the way. ; if joy0down then player0y = player0y +1 : then __Up global_temp1 = (player0x - 17)/4 : global_temp2 = (player0y)/8 if pfread(global_temp1, global_temp2) then player0y = player0y - 1 : then __Moves_Done global_temp1 = (player0x - 15)/4 : global_temp2 = (player0y)/8 if pfread(global_temp1, global_temp2) then player0y = player0y - 1 : then __Moves_Done ;*************************************************************** ; ; Don't move up if pfpixel is in the way. ; __Up if joy0up then player0y = player0y - 1 : then __Moves_Done global_temp1 = (player0x - 17)/4 : global_temp2 = (player0y - 6)/8 if pfread(global_temp1, global_temp2) then player0y = player0y + 1 : then __Moves_Done global_temp1 = (player0x - 15)/4 : global_temp2 = (player0y - 6)/8 if pfread(global_temp1, global_temp2) then player0y = player0y + 1 : then __Moves_Done ;*************************************************************** ; ; Don't move down if pfpixel is in the way. ; __Moves_Done if joy0left && !_Direction_P0{5} then _Direction_P0{0}=1 : goto __Moving if joy0right && !_Direction_P0{5} then _Direction_P0{0}=0 : goto __Moving if Moving>0 then Moving=Moving-1 goto __Skip_Moving ;*************************************************************** ; ; Player0 Momentum ; __Moving Moving=Moving+1 if joy0up && Moving>4 then Moving=4 if !joy0up && Moving>2 then Moving=2 __Skip_Moving ;*************************************************************** ; ; Displays the screen. ; gosub __Render_Screen ;*************************************************************** ; ; Moving if player has momentum ; if Moving>0 && _Direction_P0{0} then player0x=player0x-Moving if Moving>0 && !_Direction_P0{0} then player0x=player0x+Moving ;*************************************************************** ; ; Scroll screen if moving in middle also check for edge of levels ; if player0x<17 then player0x=17 if player0x>137 then player0x=137 if !_Direction_P0{0} && player0x>80 && z<127 then player0x=80 : gosub __Scroll_Left if _Direction_P0{0} && player0x<72 && z>32 then player0x=72: gosub __Scroll_Right ;*************************************************************** ; ; Displays the screen. ; gosub __Render_Screen ;*************************************************************** ; ; Mission complete! Go back to the beginning of program ; This is not a " Game Reset" ; goto __Main_Loop __Render_Screen ;*************************************************************** ; ; Flips Player0 left / right ; if _Direction_P0{0} then REFP0=8 else REFP0=0 ;*************************************************************** ; ; Displays the screen. ; drawscreen return ;*************************************************************** ; ; Scrools the screen left ; __Scroll_Left ;*************************************************************** ; ; Don't move left if pfpixel is in the way. ; global_temp1 = (player0x - 8)/4 : global_temp2 = (player0y - 6)/8 if pfread(global_temp1, global_temp2) then return global_temp1 = (player0x - 8)/4 : global_temp2 = (player0y - 1)/8 if pfread(global_temp1, global_temp2) then return pfscroll left x=z*2 : column = level[x] if column{0} then var3 = var3 | 128 else var3 = var3 & 127 if column{1} then var7 = var7 | 128 else var7 = var7 & 127 if column{2} then var11 = var11 | 128 else var11 = var11 & 127 if column{3} then var15 = var15 | 128 else var15 = var15 & 127 if column{4} then var19 = var19 | 128 else var19 = var19 & 127 if column{5} then var23 = var23 | 128 else var23 = var23 & 127 if column{6} then var27 = var27 | 128 else var27 = var27 & 127 if column{7} then var31 = var31 | 128 else var31 = var31 & 127 x=(z*2)+1 : column=level[x] if column{0} then var35 = var35 | 128 else var35 = var35 & 127 if column{1} then var39 = var39 | 128 else var39 = var39 & 127 if column{2} then var43 = var43 | 128 else var43 = var43 & 127 z=z+1 return ;*************************************************************** ; ; Scrools the screen right ; __Scroll_Right ;*************************************************************** ; ; Don't move right if pfpixel is in the way. ; global_temp1 = (player0x - 21)/4 : global_temp2 = (player0y - 6)/8 if pfread(global_temp1, global_temp2) then return global_temp1 = (player0x - 21)/4 : global_temp2 = (player0y - 1)/8 if pfread(global_temp1, global_temp2) then return ;*************************************************************** ; ; Scrools the screen right ; pfscroll right x=(z-32)*2 : column=level[x] if column{0} then var0 = var0 | 128 else var0 = var0 & 127 if column{1} then var7 = var7 | 128 else var7 = var7 & 127 if column{2} then var8 = var8 | 128 else var8 = var8 & 127 if column{3} then var12 = var12 | 128 else var12 = var12 & 127 if column{4} then var16 = var16 | 128 else var16 = var16 & 127 if column{5} then var20 = var20 | 128 else var20 = var20 & 127 if column{6} then var27 = var27 | 128 else var27 = var27 & 127 if column{7} then var28 = var28 | 128 else var28 = var28 & 127 x=((z-32)*2)+1 : column=level[x] if column{0} then var32 = var32 | 128 else var32 = var32 & 127 if column{1} then var36 = var36 | 128 else var36 = var36 & 127 if column{2} then var40 = var40 | 128 else var40 = var40 & 127 z=z-1 return ;*************************************************************** ; ; data adapted from SMB by Chris Spry, 2012. ; data to dsiplay the playfield ; Not sure how to adjust to make the playfield "yet" ; data level 0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4 0,4,64,4,36,4,36,4,36,4,36,4,36,4,66,4,129,4,129,4,129,4,129 4,129,4,64,4,0,4,0,12,0,12 0,12,0,12,0,12,0,4,0,7,0,7,0,7,0,4,0,4,0,12,16,4,16,4,16,4,16 4,16,4,16,4,0,12,0,4,0,7,0,7,0,7,0,4,0,4,0,12,0,12,0,12,0,12 0,4,0,4,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,4,0,4,0,4,0,4,32,12,32,12,32,12,32,12,36 4,36,4,68,4,4,4,4,4,0,28,0,28,4,4,36,4,36,4,36,4,36,4,32,4,32 4,32,4,0,188,0,188,0,188,0,4 0,4,128,4,128,4,128,4,128,4,32,4,32,4,32,4,32,4,32,4,32,4,8,24 8,24,8,24,8,24,8,24,8,24,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,4,0,7,0 7,0,7,0,4,0,4,0,4,0,4 end data level_a 0,4,0,7,0,7,0,7,0,4,0,188,0,188,0,188,64,4,0,188,0,188,0,188,0 188,66,4,0,188,0,188,0,188,0,188,64,4,0,188,0,188,0,188,0,188 0,188,0,188,32,4,32,4,32,4,32,4,0,12,0,12,0,12 0,12,0,4,0,6,0,6,0,7,0,7,128,7,128,7,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,128,7,128,7,0,7,0,7,0,6,0,6,0,4,0,4,0,28,16,4,16,4,16,4 16,4,16,4,0,188,0,188 0,188,0,188,0,188,0,188,0,188,0,188,33,4,33,4,33,4,33,4,33,4,33 4,33,4,33,4,33,4,33,4,0,188,0,188,0,12,0,12,0,12,0,12,0,4,0,7,0 7,0,7,0,4,0,4,0,188,0,188,64,4,32,4 32,4,32,4,32,4,0,4,0,12,0,12,0,12,0,12,0,4,0,4,0,6,0,6,0,7,0,7 128,7,128,7,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4,0 172,0,4,0,4,0,4 end ;*************************************************************** ;*************************************************************** ; ; Bank 2. ; ; bank 2 ;*************************************************************** ;*************************************************************** ; ; Bank 3. ; ; bank 3 ;*************************************************************** ;*************************************************************** ; ; Bank 4. ; ; bank 4 ;*************************************************************** ;*************************************************************** ; ; Bank 5. ; ; bank 5 ;*************************************************************** ;*************************************************************** ; ; Bank 6. ; ; bank 6 ;*************************************************************** ;*************************************************************** ; ; Bank 7. ; ; bank 7 ;**************************************************************** ; ; Level I playfield setup ; __Level_1 pfcolors: $42 $1A $42 $42 $42 $42 $1A $42 $C6 $C6 $3E end playfield: .......................XXXXX.... ......................X......... .................XXXXX.......... ................................ ................................ .................XXXXX.......... ................X.....X.....X... .......................XXXXX.... ................................ ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end return ;**************************************************************** ; ; Player0 setup "Sub" ; __Player_0 player0color: $86 $86 $86 $86 $86 end player0: %11111110 %01110001 %11111110 %00011000 %00001000 end return ;*************************************************************** ;*************************************************************** ; ; Bank 8. ; ; bank 8