Jump to content
billyj1285

Console swtich question

Recommended Posts

Good afternoon everyone,

 

I this post in Atari 2600 programming too, however it is a batari basic question, so I posted here too.

 

I have a really dumb question. I am sorry. I have looked it up and experimented, however I just cant figure this simple thing out.

 

I have a small start of a game. Its just a sprite going up and down right now. This is Batari basic by the way.

 

I just want to set the console reset switch to reset. I have tried the ifthen and I just cannot get it to work. Here is the listing.

I am also having trouble making that bottom row solid.

 

I am sorry. I am new and am just having a little trouble. any help would be apprciated.

 

Thanks,

Bj

 

 

  set kernel_options player1colors playercolors pfcolors
  player0x = 75
  player0y = 80
  
  COLUBK=$15
  


main

   playfield:
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end
 

 
 f=f+1
  rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME...
  if f = 10 then player0:
        %01100110
        %00100100
        %00100100
        %11111111
        %00111100
        %00111100
        %00111100
        %00100100
end
   if f = 10 then player0color:
    $FC;
    $FC;
    $FC;
    $F4;
    $F4;
    $F2;
    $F0;
    $F0;
end
  if f = 20 then player0:
        %00000110
        %01100100
        %00100100
        %11111111
        %00111100
        %00111100
        %00111100
        %00100100
end
   if f = 20 then player0color:
    $FC;
    $FC;
    $FC;
    $F4;
    $F4;
    $F2;
    $F0;
    $F0;
end
  if f = 30 then player0:
        %01100000
        %00100110
        %00100100
        %11111111
        %00111100
        %00111100
        %00111100
        %00100100
end
   if f = 30 then player0color:
    $FC;
    $FC;
    $FC;
    $F4;
    $F4;
    $F2;
    $F0;
    $F0;
end

  
  drawscreen
  
  

  if joy0up then player0y = player0y - 1
  if joy0down then player0y = player0y + 1
  
 
  goto main
 

Share this post


Link to post
Share on other sites

I haven't compiled your code in batari however im thinking by having a quick look you're after something like this.

 

   set kernel_options player1colors playercolors pfcolors

reset

  player0x = 75
  player0y = 80
  
  COLUBK=$15
  


main

   playfield:
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   ................................
   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end
 

 
 f=f+1
  rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME...
  if f = 10 then player0:
        %01100110
        %00100100
        %00100100
        %11111111
        %00111100
        %00111100
        %00111100
        %00100100
end
   if f = 10 then player0color:
    $FC;
    $FC;
    $FC;
    $F4;
    $F4;
    $F2;
    $F0;
    $F0;
end
  if f = 20 then player0:
        %00000110
        %01100100
        %00100100
        %11111111
        %00111100
        %00111100
        %00111100
        %00100100
end
   if f = 20 then player0color:
    $FC;
    $FC;
    $FC;
    $F4;
    $F4;
    $F2;
    $F0;
    $F0;
end
  if f = 30 then player0:
        %01100000
        %00100110
        %00100100
        %11111111
        %00111100
        %00111100
        %00111100
        %00100100
end
   if f = 30 then player0color:
    $FC;
    $FC;
    $FC;
    $F4;
    $F4;
    $F2;
    $F0;
    $F0;
end

  
  drawscreen
  
  if switchreset then goto reset  

  if joy0up then player0y = player0y - 1
  if joy0down then player0y = player0y + 1
  
 
  goto main

One thing to note when reading bitwise operations is the syntax is different from traditional variables.

 

So in BASIC syntax some examples:

 

Peek: on or off

if switchreset then goto reset

or

if !switchreset then goto skip_blah_blah_blah

Poke/push values into individual bits (in this case abit0): on or off

if switchreset then a{0} = 1

or

if !switchreset then a{0} = 0

To read/peek at the state of say individual bits within a variable you would use the same syntax i explained with the reset switch. For example:

rem check if a{0} = 1 if so then turn off a{0} and turn on a{1}
if a{0} then a{0} = 0 : a{1} = 1

or

rem check if not a{0} if so then turn on a{0} and turn off a{1}
if !a{0} then a{0} = 1 : a{1} = 0

ect ect

 

Check out RT's site for further examples

Share this post


Link to post
Share on other sites

I did the same thing, but can't get anything to happen, does this work for you?

 

 

  set kernel_options player1colors playercolors pfcolors

 

reset

 

loop

 ;drawscreen

 ;if switchreset then loop

 

  player0x = 75

  player0y = 80

  

  COLUBK=$15

  

   playfield:

   ................................

   ................................

   ................................

   ................................

   ................................

   ................................

   ................................

   ................................

   ................................

   ................................

   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

end

 

 player0color:

    $FC;

    $FC;

    $FC;

    $F4;

    $F4;

    $F2;

    $F0;

    $F0;

end

 

main

 

  if joy0up then player0y = player0y - 1

  if joy0down then player0y = player0y + 1

 

 

 f=f+1

  rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME...

  if f = 10 then player0:

        %01100110

        %00100100

        %00100100

        %11111111

        %00111100

        %00111100

        %00111100

        %00100100

end

 

  if f = 20 then player0:

        %00000110

        %01100100

        %00100100

        %11111111

        %00111100

        %00111100

        %00111100

        %00100100

end

 

  if f = 30 then player0:

        %01100110

        %00100100

        %00100100

        %11111111

        %00111100

        %00111100

        %00111100

        %00100100

end

 

  if f = 40 then f = 0 : player0:

        %01100000

        %00100110

        %00100100

        %11111111

        %00111100

        %00111100

        %00111100

        %00100100

end

 

  drawscreen

  

 if switchreset then goto reset

 

  goto main

Share this post


Link to post
Share on other sites
8 minutes ago, Lillapojkenpåön said:

I did the same thing, but can't get anything to happen, does this work for you?

Ok so i fired it up and had a look, everything is working fine for me.

 

reset_switch.bas

 

edit: @Lillapojkenpåön i see what you have done wrong, the condition statement you placed is outside the mainloop meaning it never gets read.

Share this post


Link to post
Share on other sites
5 minutes ago, Lillapojkenpåön said:

I can't seem to map my keys in any of my stella versions, when I open it up again reset is back to F2, which just lowers the volume  on my computer.

You don't have a function key? "FN" next to the windows key? If so press and hold the FN key and press F2 simultaneously

Share this post


Link to post
Share on other sites
Posted (edited)
37 minutes ago, TwentySixHundred said:

edit: @Lillapojkenpåön i see what you have done wrong, the condition statement you placed is outside the mainloop meaning it never gets read.

Nope it's in there, I just put it after drawscreen so you have as much time as possible for the init code, and don't overcycle, Fn + F2 worked, thanks.

 

EDIT: Oh you mean the one at the top, that's just a comment.

Edited by Lillapojkenpåön
  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...