Beginners Gaming Guide in Machine Language

The STORE and Transfer Instructions

Note: This book represents a smaller condensed version of the book “The Machine Language Book of the Commodore 64”. I found this much more effective to revise rather than starting from scratch as “machine language” is a complicated subject.

Finally understand that this is a “work in progress” and this page will be updated over time. Eventually it will include the Simple Game I am working on through my Facebook channel, that is seen below. You will control a sprite that can move through several different screens.

The opposite of the LDA instructions is the set of store instructions. This allows you to place contents of a register into memory using 3 specific instructions as seen here:

  • STA
  • STX
  • STY

The contents for each manage components of the accumulator (STA), X-register (STX) or the Y-register (STY). These are also proceeded by an operand. When information is placed in these registers, neither the register or the status flags are altered.

Here is another set of operation codes and addressing modes:

Address mode STA STX STY
——————– ——————— ——————— ——————— ———————
absolute $8D $8E $8C operand codes
zero page $85 $86 $84
absolute X-indexed $9D
absolute Y-indexed $9D
zero-page X-indexed $9D
zero-page Y-indexed $95 $94
Indirect Indexed $91
Indexed Indirect $81

A Basic example could look like this:

STA $8000 POKE $80A
STX $c020, Y POKE $C020 + Y, X
STY $F1 POKE $F1, Y

Notice that the store instructions have a length of two or three bytes, which depends on the addressing mode used. The load instructions are identical to these. No flags are changed by these store instructions.