Programmer Mode

 


BASES

CalcTastic can display everything in one of four bases: binary, octal, decimal or hexadecimal. You can switch bases at any time by pressing (and holding) the buttons:

BIN, OCT, DEC or HEX

The current base is always highlighted on the keyboard, like so:

DEC

All screens and dialog windows in the programmer mode will print values in the current base. Here is an example of a calculation performed in decimal:

1 + 2 × 3 = 7

and then how it would look if you switched to binary:

1 + 10 × 11 = 111

 


INTEGER SIZES

CalcTastic can perform calculations in one of eight different integer-sizes (or word-sizes). There are four signed sizes:

S08, S16, S32, S64

and four un-signed sizes:

U08, U16, U32, U64

Press and hold the corresponding button for the size you want to switch to. The currently selected integer-size will always be highlighted on the keyboard:

S64

You can type in a number in one size and cast it to another size, just like you would in many programming languages (ie Java, C++). Here we’ll replicate casting a Java Integer to a Short (in DECIMAL). First, enter the number in the starting base. A Java Integer is a 32-bit signed integer:

S32451,800,364

Then switch to the new size and you’ll see the value in the new size. A Java Short is a 16-bit signed integer:

S16-4,820

The current calculation, all values on the stack and the M-position memory register all live in the current integer size. Every calculation in your history will be saved with the integer-size that it was performed in. Here’s some examples you may see in the history (in HEX):

S16: 1 + 2 × 3 = 7

U64: FF | (25 x 14) << 13 = 1720 00FF

 


BINARY BIT DISPLAY

In programmer mode, you can toggle the binary bit-display at any time by pressing the Bits button. With the bit-display open, you can press any half-byte nibble, which will open an expanded view of those bits, allowing you to toggle them as well. This allows you to enter or modify numbers with ease. Below is a screenshot:

help_bit_display

 


OTHER FUNCTIONS

The rest of the functions in the programmer-mode are fairly easy to use, so my goal here is to simply give an example (or two) of each. These examples will all be done using signed 64-bit integers and in hexadecimal. Press and hold S64 followed by Hex to set this up and CLR before each example:

 

What is 789 AND CBC?

789AndCBC=S64: 488

What is 789 OR CBC?

789OrCBC=S64: FBD

What is 789 XOR CBC?

789XorCBC=S64: B35

What is 3A745 << 2?

3A745<<<<S64: E 9D14

or…

3A745Lsh2=S64: E 9D14

What is 3A745 >> 2?

3A745>>>>S64: E9D1

or…

3A745Rsh2=S64: E9D1

What is the 1’s complement of 77?

1’s77=S64: FFFF FFFF FFFF FF88

What is the 2’s complement of 77?

2’s77=S64: FFFF FFFF FFFF FF89

What is 3 & ~3?

3AndNot3=S64: 0

How do I flip the bytes in AABB CCDD?

F8AABBCCDD=S64: DDCC BBAA 0000 0000

How do I flip the words in AABB CCDD?

F16AABBCCDD=S64: CCDD AABB 0000 0000

What is 285A mod 34?

285AMod34=S64: 22

How can I get a random integer?

Rdm

 


ORDER OF OPERATIONS

If you omit parenthesis, here is the order of operations for the Programmer Mode. Anything on the same line has equal priority as other items on that line, anything below has lower priority, and anything above has higher priority:

8 – yx
7 – × ÷
6 – +
5 – Mod
4 – Lsh Rsh
3 – And
2 – Xor
1 – Or