Jump to content



0

Woun't Compile


2 replies to this topic

#1 Primordial Ooze OFFLINE  

Primordial Ooze

    Dragonstomper

  • 504 posts
  • Quacker Blaster Lead Programmer
  • Location:United States of America

Posted Sat Mar 22, 2008 1:53 PM

I'm using the player scores minikernel and am getting the following error:

Quote

---------- Capture Output ----------
> "C:\Atari2600\bB\2600bas.bat" C:\Projects\Atari2600\OpenSourcePong\OpenSourcePong.bas
(235): Error: Unknown keyword: addbcd

Compilation failed.

> Terminated with exit code 0.

Here is my code:
   rem Open Source Pong
   rem an Open Source Pong Remake
   rem Updated: March 17, 2008
   rem Website: http://opensourcepong.freepgs.com

   goto setup
   
   rem setup all the game variables
setup
   rem include for player scores multikernel
   include playerscores.asm
   
   rem include bcd math helper
   include bcd_math.asm
   
   rem set the rom size
   set romsize 4k

   rem define the number of player scores
   const playerscores = 2
   
   rem define noscores constant
   const noscore = 1
   
   rem set kernel options
   rem readpaddle - set it so the paddle controlers are read
   set kernel_options no_blank_lines readpaddle

   rem set an alias for the ball's x velocity
   dim ballxvelocity = a

   rem set an alias for the ball's y velocity
   dim ballyvelocity = b
   
   rem set an alias for troggling the 2 player mode
   dim playervsplayer = c
   
   rem color the background green
   COLUBK = 198

   rem set the color of the playfield to white
   COLUPF = 14

   rem set player 1's score color to his sprite color
   player0scorecolor = $0E
   
   rem set player 2's score color to his sprite color
   player1scorecolor = $6E
   
   rem define the playfield
   playfield:
   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end

   rem define player 1's sprite
   player0:
   %00011000
   %00011000
   %00011000
   %00011000
   %00011000
   %00011000
   %00011000
   %00011000
end

   rem define player 2's sprite
   player1:
   %00011000
   %00011000
   %00011000
   %00011000
   %00011000
   %00011000
   %00011000
   %00011000
end
   
   rem finished seting up the game variables
   
   rem start the game loop
   goto startNewGame
   
   rem start a new game and reset everything that was changed during
   rem the course of the game
startNewGame
   rem set player 1's inital x positon
   player0x = 140

   rem set player 1's inital y positon
   player0y = 45

   rem set a default value for the 2 player troggle
   playervsplayer = 0
   
   rem if the left switch is set to B, paddle 1 controls the
   rem computers paddle
   if !switchleftb then playervsplayer = 1
   
   rem set player2's inital x positon
   player1x = 15

   rem set player2's inital y positon
   player1y = 45

   rem set ball's inital x positon
   ballx = 80

   rem set ball's inital y positon
   bally = 45

   rem set the ball's initial x velocity
   ballxvelocity = 1
   
   rem set the ball's initial x velocity
   ballyvelocity = 1
   
   rem reset player 1's score
   player0score = $00

   rem reset player 1's score
   player1score = $00
   
   rem finished reseting all the game variables changed during
   rem the course of the game
   
   rem go to the game loop
   goto gameLoop
   
   rem start of the game loop
gameLoop
   rem if the user presses the reset switch, start a new game
   if switchreset then goto startNewGame

   rem color player 1's paddle
   COLUP0 = 140

   rem color player 2's paddle
   COLUP1 = 28

   rem read paddle 0, use it to position player 1 across the screen
   currentpaddle = 0
   
   rem draw the game screen
   drawscreen
   
   rem set player1's y position to the paddle control's axis
   rem plus 8
   player0y = paddle + 8
   
   rem make sure player 1 doesn't go off the top screen
   if player0y < 16 then player0y = 16
   
   rem make sure player 1 doesn't go off the bottom screen
   if player0y > 79 then player0y = 79
   
   rem if the 2 player mode is activated then paddle 1 controls the
   rem second paddle
   if playervsplayer = 1 then gosub player2controls
   
   rem otherwise set player 2's y position to the balls y position
   if playervsplayer = 0 then player1y = bally
   
   rem make sure player 2 doesn't go off the top screen
   if player1y < 16 then player1y = 16
   
   rem make sure player 2 doesn't go off the bottom screen
   if player1y > 79 then player1y = 79
   
   rem move the ball
   ballx = ballx + ballxvelocity
   bally = bally + ballyvelocity
   
   rem make sure the ball doesn't go off the top screen
   if bally < 9 then ballyvelocity = 0 - ballyvelocity
   
   rem make sure the ball doesn't go off the bottom screen
   if bally > 77 then ballyvelocity = 0 - ballyvelocity
   
   rem if the ball collides with player 1's paddle
   if collision(player0, ball) then gosub player1collision

   rem if the ball collides with player 2's paddle
   if collision(player1, ball) then gosub player2collision
   
   rem if the ball goes past player 1's paddle
   if ballx > 160 then gosub player2scores
   
   rem if the ball goes past the computer paddle
   if ballx < 1 then gosub player1scores
   
   rem if either players scores 11 points start a new game
   rem if lives < 32 then goto gameover
   
   goto gameLoop
   
   rem end of the game loop code, restart the game loop
   
   rem code for handling collision between player and ball
player1collision
   rem move the ball a bit so it doesn't stick
   ballx = ballx - 3
   
   rem and reverse its x velocity
   ballxvelocity = 0 - ballxvelocity
   return
   
   rem end of player collision code
   
   rem code for handling when the ball hits player 2's paddle
player2collision
   rem move the ball a bit so it doesn't stick
   ballx = ballx + 3
   
   rem and reverse its x velocity
   ballxvelocity = 0 - ballxvelocity
   return
   
   
   rem code for handling when the ball goes past player 2's paddle
   rem and the player 1 scores
player1scores

   rem increase player 1's score by 1
   addbcd(player0score,1)   

   rem have the computer serve the ball
   ballx = player1x + 3
   bally = player1y
   
   rem reverse the balls x velocity
   ballxvelocity = 0 - ballxvelocity
   
   rem increase the score by 10 points
   score = score + 10
   
   return
   
   rem end of player 1 scores
   
   rem code for handling when player 1 misses the ball and
   rem player 2 scores
player2scores
   
   rem increase player 2's score by 1
   addbcd(player1score,1)
   
   rem have the player serve the ball
   ballx = player0x - 3
   bally = player0y
   
   rem reverse the balls x velocity
   ballxvelocity = 0 - ballxvelocity
   
   return
   
   rem end of player 2 scores code
   
   rem code for handling when the 2 player troggle is enabled and
   rem the second paddle controls the computer paddle
player2controls

   rem read paddle 1, use it to position player 2's paddle across the screen
   currentpaddle = 1
   
   rem draw the game screen
   drawscreen
   
   rem set player 2's y position to the paddle 2's control's axis
   rem plus 8
   player1y = paddle + 8
   
   return
   
   rem end of player 2 controls code
   
   rem code for handling when either players score  reaches 11
   rem and its gameover
gameover
   rem if the user presses the reset switch, start a new game
   if switchreset then goto startNewGame
   
   rem color player 1's paddle
   COLUP0 = 140

   rem color player 2's paddle
   COLUP1 = 28   

   rem draw the screen
   drawscreen
   
   rem if the user presses the fire button, start a new game
   if joy0left then goto startNewGame
   
   rem otherwise just keep looping
   goto gameover
Any ideas?

Sincerely,

Open Source Pong

Edited by Open Source Pong, Sat Mar 22, 2008 1:53 PM.


#2 batari OFFLINE  

batari

    )66]U('=I;B$*

  • 6,236 posts
  • begin 644 contest

Posted Sat Mar 22, 2008 3:40 PM

A function must return a value, so you must assign addbcd to a variable.

For example: myvar=addbcd(x,y)

Edited by batari, Sat Mar 22, 2008 3:43 PM.


#3 Primordial Ooze OFFLINE  

Primordial Ooze

    Dragonstomper

  • 504 posts
  • Quacker Blaster Lead Programmer
  • Location:United States of America

Posted Sun Mar 23, 2008 2:31 PM

Thank You it worked! I have attached the updated code for future reference.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users