$\require{cancel}$
Chapter 8, Addressing Modes
- Today's code words.asm
- This relies on MY_IO.asm
- Which I may have broken.
- Chapter 8 is mostly review.
- Intel assembly supports three addressing modes
- registers, simply give the register name and the contents will be accessed/changed
- immediate, the source for some operations, does not work everywhere.
- Memory
- if the name is used, this is simply an address
- Inside [], this accesses memory
- Sometimes the assembler doesn't know the size of the instruction to use
-
inc [rbx]
- In this case we might need to "cast".
-
inc byte [rbx]
- The choices are
- byte
- word 16 bits, 2 bytes
- dword, 32 bits, 4 bytes
- qword, 64 bits, 8 bytes
- Null terminated strings
-
label resb 'string',0
- Better for gdb.
- x /10s &label
- More gdb
-
b functionname
-
s
step to next instruction, into functions
-
n
go to next instruction, skip function calls
- Array addressing
- base address + index * elementSize
- For strings, the element size is 1 byte.
- More conditional control, Jorgensen P 113 (7.7.3)
- cmp will compare two values and set flags.
- je, jne, jump equal, jump not equal
- jl, jle, jg, jge, jump on condition for signed values
- jb, jbe, ja, jae for unsigned (jump below, jump above)
- See page 114.
- We will be back for this soon.