Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part III Machine Code and Memory Usage Three (3) points for each instruction Ple

ID: 2291391 • Letter: P

Question

Part III Machine Code and Memory Usage

Three (3) points for each instruction

Please study the following assembly program, then, fill out the table on the next page.

                                ORG                       $4000

                               

                                LDAA                     #$45

                                LDAB                     #$2A

                                ABA

                                STAA                     $1000

                                LDAA                     $1050

                                SUBA                     $1051

                                STAA                     $1001

                                SWI

Note: When downloading the machine executable code to a microcontroller’s memory, the assembler directive ORG tells a microcontroller where the executable code will be stored in the memory.

For this assembly program, “ORG         $4000” tells a microcontroller that the executable program will be stored in the microcontroller’s memory starting at memory location $4000. The entire executable code will be stored in memory in the order of opcode, then, operand, instruction after instruction, consecutively. Please provide memory address for each opcode, and each operand. Please also note that the memory address is provided for each byte.

Assembly Code

Machine Code

Memory Address for

Instruction

Opcode

Operand

Opcode

Operand

LDAA        #$45

$86

$45

LDAB        #$2A

$C6

$2A

ABA

$18 $06

STAA        $1000

$7A

$10 $00

LDAA        $1050

$B6

$10 $50

SUBA        $1051

$B0

$10 $51

STAA        $1001

$7A

$10 $01

SWI

$3F

Assembly Code

Machine Code

Memory Address for

Instruction

Opcode

Operand

Opcode

Operand

LDAA        #$45

$86

$45

LDAB        #$2A

$C6

$2A

ABA

$18 $06

STAA        $1000

$7A

$10 $00

LDAA        $1050

$B6

$10 $50

SUBA        $1051

$B0

$10 $51

STAA        $1001

$7A

$10 $01

SWI

$3F

Explanation / Answer

Assembly Code

Machine Code

Memory Address for

Instruction

Opcode

Operand

Opcode

Operand

LDAA #$45

$86

$45

$4000

$4001

LDAB #$2A

$C6

$2A

$4002

$4003

ABA

$18 $06

$4004 $4005

STAA $1000

$7A

$10 $00

$4006

$4007 $4008

LDAA $1050

$B6

$10 $50

$4009

$400A $400B

SUBA $1051

$B0

$10 $51

$400C

$400D $400E

STAA $1001

$7A

$10 $01

$400F

$4010 $4011

SWI

$3F

$4012

Assembly Code

Machine Code

Memory Address for

Instruction

Opcode

Operand

Opcode

Operand

LDAA #$45

$86

$45

$4000

$4001

LDAB #$2A

$C6

$2A

$4002

$4003

ABA

$18 $06

$4004 $4005

STAA $1000

$7A

$10 $00

$4006

$4007 $4008

LDAA $1050

$B6

$10 $50

$4009

$400A $400B

SUBA $1051

$B0

$10 $51

$400C

$400D $400E

STAA $1001

$7A

$10 $01

$400F

$4010 $4011

SWI

$3F

$4012