Skip to content

Commit

Permalink
small documentation refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
boeckmann committed Nov 13, 2023
1 parent 2ff29bf commit 7f9e68d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doc/asm6502.but
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Beside generating an output file containing machine code, ASM6502 may also gener

Pos indicates the position of the instructions regarding the output file. Addr represents the \e{location} or \e{address} of the code while it is executed.

Let's further elaborate what the arguments to instructions may be. In the example above, \c{#42} is a numeric value that is directly used to do the addition. It is therefore called an \e{immediate} value, and the mode the processor operates in is called \e{immediate addressing} mode. The \c{INX} instruction above implicitly operates on a register called X. For this reason it is called \e{implicit addressing}. Often, the argument specifies a memory location. This memory location may be referenced to the start of the address space. In this case it is called \e{absolute addressing} mode. If the memory location is specified relative to some other location we call it \e{relative addressing} mode. Sometimes one does not want to encode a fixed memory location into the machine instruction, but instead use the content of some memory location as the address to operate on. This is called \e{indirect addressing}.
Let's further elaborate what the arguments to instructions may be. In the example above, \c{#42} is a numeric value that is directly used to do the addition. It is therefore called an \e{immediate} value, and the mode the processor operates in is called \e{immediate addressing} mode. The \c{INX} instruction above implicitly operates on a register called X. For this reason it is called \e{implicit addressing}. Often, the argument specifies a memory location. This memory location may be given relative to the start of the address space. This it is called \e{absolute addressing}. If the memory location is specified relative to some other location, we call it \e{relative addressing}. Sometimes one does not want to encode a fixed memory location into the machine instruction, but instead use the content of some memory location as the address to operate on. This is called \e{indirect addressing}.

The sequence of instructions executed by the processor may be altered by the programmer utilizing special machine instructions. Some of these instructions modify this sequence unconditionally, and some alter it if a special condition is met. The instructions are called \e{jump} or \e{branching} instructions. The information of the \e{jump target} is encoded as address within the instruction. The assembler supports the programmer by letting him specify a jump target by giving it a name, called \e{label}. In the introductory example, \c{basic_upstart}, \c{start}, and \c{hello} are labels.

Expand Down Expand Up @@ -219,7 +219,7 @@ Examples:

\c 2+3*5 ; value 17
\c $4700 | $11 ; is $4711
\c 255+255 ; of type word because >256
\c 255+255 ; of type word because >255


\S{}Byte-select and Conversion Operators
Expand Down Expand Up @@ -457,14 +457,14 @@ A byte-sized address is encoded following the opcode byte. The assembler interpr

\S{}Absolute X and Absolute X Addressing

The address is encoded in the word following the opcode and displaced by the contents for the X or Y register.
The address is encoded in the word following the opcode and displaced by the contents of the X or Y register.

\c LDA $4711,X ; load contents of address $4711 displaced by X
\c LDA $4711,Y ; load contents of address $4711 displaced by Y

\S{}Zero-page X and Zero-page Y Addressing

The address is encoded in the byte following the opcode displaced by the contents for the X or Y register.
The address is encoded in the byte following the opcode displaced by the contents of the X or Y register.

\c LDA $47,X ; A = contents of address $47 displaced by X
\c LDX $11,Y ; X = load contents of address $47 displaced by Y
Expand All @@ -483,7 +483,7 @@ To correct this, you may rewrite it as:

\c JMP +(2+3)*1000

This one is correct (indirect addressing):
or

\c JMP ((2+3)*1000)

Expand Down

0 comments on commit 7f9e68d

Please sign in to comment.