2026-02-24

Casio Calculator Program Splitting

(How to put 2 programs in 1 program slot)

|The target audience of this blog post are Hong Kong secondary school students who uses programs in their calculators during exams,| though it may be useful to others as well. This technique should work for the type of calculators commonly used by students.

How-To

Let's get straight to the point. I'll leave all the backgrounds and explanations to later. |There is also a Chinese translation available below.|

  1. Assuming you already have a program input in a slot. We will call it `<prog>`.
  2. Before `<prog>`, add the following:
    `?→X:If X:Then `
  3. After `<prog>`, add the following:
    `◢Else `
  4. After that, input your second program
  5. You now have 2 programs within the same slot!

Now every time you use this program, |you will need to first input a number to select which sub-program to run.| Type `0` to run the 2nd sub-program. Type anything else to run the 1st sub-program.

做法 (中文版本)

  1. 假設現有的 program 稱為 `<prog>`.
  2. 輸入以下字元到 `<prog>` 前方:
    `?→If X:Then `
  3. 輸入以下字元到 `<prog>` 後方:
    `◢Else `
  4. 完成第二步後,輸入第二個 program
  5. 大功告成!

每次你想使用此 program 時,第一個輸入的數字將會用作內部選擇 program。
如選擇 |第二個 program| ,輸入 `0`,否則輸入 |任何數字選擇第一個 program。|

Background

I am a Hongkonger, and I certainly had once been a Hong Kong secondary school student. |I studied Mathematics Module 2 (M2 for short), aka Calculus and Algebra.| To make life easier, we had 2 calculators, one for CORE and one for M2. However, both subject requires its own programs, and while both calculators have 4 slots for programs, the M2 one has significantly less storage space. It was impossible to put all the relevant programs into the corresponding calculator.

Therefore, my friend "Jarmy" and I went on a quest to optimize the heck out of these programs. One of the things we did was |inputting 2 programs into the same program slot| as we want to put some M2 programs into the CORE calculator to fully utilize its storage. Our solution was a few bytes larger than the one I presented here. Pretty good I'd say.

|At one point I had an absolutely insane setup where both of my calculators had 0 bytes left.| Unfortunately my CORE calculator's battery inflated and it lost all its programs.

Explanation

This is how the double-program template looks like:
`?→X:If X:Then <prog1>◢Else <prog2>`
Hopefully this is a bit easier to read and understand for the programmers reading this blog post.

Quoting Mumbo Jumbo, "This is really quite simple."

If you are a good programmer, you should add `◢IfEnd` at the end to properly close the if-else statements. However, since the program is most likely |interpreted| (vs compiled), it will stop running when it reaches the end anyway. As we are optimizing for storage, any amount of bytes saved is good for us.