0% found this document useful (0 votes)
29 views3 pages

Assembly Language Corrections & Clarifications

The document outlines corrections made to Chapter 2-2 of Assembly Language Basics, including fixes to examples and clarifications on directives, data types, and addressing modes. Key corrections involve proper handling of the DIV instruction and ensuring size matching for MOV operations. Additional clarifications were added to the matrix example and LEA notes, while other sections remained unchanged as they were already correct.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views3 pages

Assembly Language Corrections & Clarifications

The document outlines corrections made to Chapter 2-2 of Assembly Language Basics, including fixes to examples and clarifications on directives, data types, and addressing modes. Key corrections involve proper handling of the DIV instruction and ensuring size matching for MOV operations. Additional clarifications were added to the matrix example and LEA notes, while other sections remained unchanged as they were already correct.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Corrected Version — Chapter 2-2 Assembly Language Basics (Notes & Code)

Corrections Applied:

• Fixed DIV example remainder printing.

• Fixed Base+Index+Displacement example (EAX must be initialized before MUL).

• Added size■matching rule for MOV var.

• Added clarifications where needed.

-----------------------------

1) Directives vs Instructions

(unchanged content)

2) Data Types

(unchanged content)

3) Addressing Modes

(unchanged content)

4) OFFSET vs [] Clarification

MOV dest, var is valid only if the size of dest matches the variable.

Otherwise you must use:

movzx eax, BYTE PTR var

movzx eax, WORD PTR var

Or sign■extend equivalents.

5) Arithmetic — MUL / IMUL / DIV

IMPORTANT correction:

In 32■bit DIV:

xor edx, edx ; always clear before div


mov eax, num1

mov ebx, num2

div ebx ; quotient=EAX, remainder=EDX

Correct remainder printing:

mov ecx, edx ; save remainder

mov eax, ecx

call WriteDec

(Old incorrect line “mov eax, edx after msg load” removed.)

6) Base + Index + Displacement Example (Corrected)

Record size = 12 bytes, so index * 12 must be computed using EAX:

mov ebx, OFFSET myList

mov eax, 1 ; record index

mov ecx, 12

mul ecx ; EAX = index * 12

mov esi, eax

mov eax, [ebx + esi + 4] ; field B offset = 4

7) LEA Notes

(unchanged but clarified)

LEA does not dereference memory. It only computes effective addresses.

8) Matrix Example Clarification

This version is correct ONLY because matrix is BYTE elements (TYPE=1).

If WORD/DWORD arrays are used, multiply index by TYPE.

Other sections unchanged because they were correct.


-----------------------------

Full corrected content ready for study.

You might also like