# Def, Const or Bit Operations as variables, random numbers

## Recommended Posts

Below is from the page that RT maintains. Since there are only 26 variables. Some can be reused depending on what they are for. Is there a way to correctly use Def, Const or Bit Operations as variables? That would possibly increase the number of variables past 26 like DPC+ has 35 variables and Standard Kernel has 94 variables. I know we can use temp1-6, but that is obliterated once you use drawscreen. Probably a way with ASM, but I'm not familiar with ASM to even attempt it.

Hopefully what I posted makes sense, basically have more variables for the multisprite kernel

""Since the Atari 2600 only has 128 bytes of RAM, and batari Basic only has 26 bytes available for variables (depending on the kernel you are using), it is very likely that you will need to use individual bits for game state information. For example, a common use of a bit is to determine whether a game is over or still in progress. The 8 bits of a byte are numbered 0 through 7, starting from right to left, with 0 being the least significant bit (LSB) or smallest.""

##### Share on other sites

Speaking of bits, have you seen this part:

##### Share on other sites

RT,

Thanks. I gonna try that out and see what happens. Probably do a small example program as proof of concept. Then try to implement into larger programs.

##### Share on other sites

I'm not sure I entirely follow what you are asking. Bit operations let you use 8 individual bits of a single variable to track 8 different true/false types of conditions. Const lets you define any number of unchanging constant values in your code, which is handy for readability and maintainability of the code. Def effectively lets you hide the bit operations by giving a specific bit its own name that can be used in operations. If you give a better idea of what you are trying to do, then perhaps we could give you better information.

##### Share on other sites

I attached a small program of what I'm trying to do. basically I'm trying to reuse "a" over or use as bit for random numbers or another operation I may need. I may be over thinking this. I put some notes inside the .bas program to better explain where my thought process is going with this if it works.

##### Share on other sites

it looks like you set the cart type to 32k ROM with SuperChip RAM.  That means you have a lot more variables to work with.  Just, they have a weird way of accessing them.

## Join the conversation

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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