III. CHIP-8 Language ProgrammingCHIP-8 is an easy-to-learn programming languagethat lets you write your own programs. To use theCHIP-8 language, you must first store the 512-byteCHIP-8 language program at memory locations 0000 to01FF. The CHIP-8 language program is shown inAppendix C in hex form so you can enter it directly inmemory using the hex keyboard. You can then record iton a memory cassette for future use. Each CHIP-8instruction is a two-byte (4-hex-digit) code. There are31, easy-to-use CHIP-8 instructions as shown in Table LWhen using CHIP-8 instructions your program mustalways begin at location 0200. There are 16 one-byte variables labeled 0-F. VX or VY refers to the valueof one of these variables. A 63FF instruction setsvariable 3 to the value FF (V3=FF). I is a memorypointer that can be used to specify any location in RAM.An A232 instruction would set I= 0232. 1 would thenaddress memory location 0232.Branch InstructionsThere are several types of jump or branch instructionsin the CHIP-8 language. Instruction 1242 would causean unconditional branch to the instruction at memorylocation 0242. Instruction BMMM lets you index thebranch address by adding the value of variable 0 to itbefore branching. Eight conditional skip instructions letyou test the values of the 16 one-byte variables ordetermine if a specific hex key is being pressed. Thislatter capability is useful in video game programs. (Onlythe least significant hex digit of VX is used to specifythe key.)A 2570 instruction would branch to a subroutinestarting at location 0570. 00EE at the end of thissubroutine will return program execution to theinstruction following the 2570. The subroutine itselfcould use another 2MMM instruction to branch to (orcall) another subroutine. This technique is known assubroutine nesting. Note that all subroutines called (orbranched to) by 2MMM instructions must end with00EE. Ignoring this rule will cause hard-to-findprogram bugs.How to Change andUse the VariablesThe CXKK instruction sets a random byte value intoVX. This random byte would have any bits matching 0bit positions in KK set to 0. For example, a C407instruction would set V4 equal to a random byte valuebetween 00 and 07.A timer (or real-time clock) can be set to any valuebetween 00 and FF by a FX15 instruction. This timer isautomatically decremented by one, 60 times per seconduntil it reaches 00. Setting it to FF would require about 4seconds for it to reach 00. This timer can be examinedwith a FX07 instruction. A FX18 instruction causes atone to be sounded for the time specified by the value ofVX. A value of FF would result in a 4-second tone. Theminimum time that the speaker will respond to is thatcorresponding to the variable value 02.A FX33 instruction converts the value of VX todecimal form. Suppose 1=0422 and V9=A7. A F933instruction would cause the following bytes to be storedin memory:0422 010423 060424 07Since A7 in hex equals 167 in decimal, we see that the