CS255 Syllabus

### Address Register Operands

• The address registers of M68000

• Recall:

• The M68000 CPU has 8 data registers, named:

 A0, A1, A2, A3, A4, A5, A6, A7, A8

• Each address register contains 32 bits

• Facts:

• Address registers are used to store the address (= location) of a complex variable to help us access a component in the complex variable

• An address is always expressed in 32 bits in M68000 !!!

Consequently:

 M68000 will always use all 32 bits in an address register in all operations involving an address register !!!

• Updating address registers

• Rule:

• When you store a value into an address register, then:

 All 32 bits of the address register will be updated (That is because an address in M68000 always has 32 bits)

• Example of using an address register:

 ``` Before the operation: +----------+----------+----------+----------+ D0 = | 00000000 | 11111111 | 00000000 | 00000011 | +----------+----------+----------+----------+ +----------+----------+----------+----------+ A0 = | 10101010 | 11110000 | 00001111 | 01010101 | +----------+----------+----------+----------+ We execute the operation: MOVE.W D0, A0 (A0 is the destination) After the operation: +----------+----------+----------+----------+ D0 = | 00000000 | 11111111 | 00000000 | 00000011 | +----------+----------+----------+----------+ +----------+----------+----------+----------+ A0 = | 00000000 | 00000000 | 00000000 | 00000011 | +----------+----------+----------+----------+ Notice that all 32 bits in A0 are updated ```

• In contrast, if we use a data register, we will get this result:

 ``` Before the operation: +----------+----------+----------+----------+ D0 = | 00000000 | 11111111 | 00000000 | 00000011 | +----------+----------+----------+----------+ +----------+----------+----------+----------+ D1 = | 10101010 | 11110000 | 00001111 | 01010101 | +----------+----------+----------+----------+ We execute the operation: MOVE.W D0, D1 (D1 is the destination) After the operation: +----------+----------+----------+----------+ D0 = | 00000000 | 11111111 | 00000000 | 00000011 | +----------+----------+----------+----------+ +----------+----------+----------+----------+ D1 = | 10101010 | 11110000 | 00000000 | 00000011 | +----------+----------+----------+----------+ Notice that aonly 16 bits (word operand !!) in D1 are updated ```

• DEMO: click here

• Comments on instructions that update an address register

• Nomenclature:

• Assembler instructions that update an address register has an "A" postfix in their nmenomic

Examples:

 ``` MOVE.L D0, D1 * Copy the long word in D0 to D1 MOVEA.L D0, A1 * Copy the long word in D0 to A1 ADD.L D0, D1 * Add the long word value in D0 to that in D1 ADDA.L D0, A1 * Add the long word value in D0 to that in A1 ```

• Restriction on assembler instructions that update an address register:

• You cannot use a byte form of an M68000 instruction when you update an address register

In other words:

 ``` MOVEA.B src, AddrReg is not allowed You can only use: MOVEA.W src, AddrReg MOVEA.L sec, AddrReg ```