Instruction Set
4-68
IN
IN
Examples
This example reads ASCII characters from a port in I/O space to a string in memory. The
microcontroller copies the bytes and stores them, one by one, from first to last.
Tips
Use IN to talk to the peripheral registers, since they are initially set to I/O space (and not
memory-mapped).
Related Instructions
If you want to
See
Copy a component from a port in I/O memory to a string in main memory
INS
Copy a component from a register to a port in I/O memory
OUT
Copy a component from a string in main memory to a port in I/O memory
OUTS
STRING
DB
128 DUP (?)
; read characters from I/O port to string
; set up registers and flags
LEA
DI,STRING
; load offset into DI (segment = ES)
MOV
CX,LENGTH STRING
; set up counter
CLD
; process string low to high
READ_CHAR:
IN
AL,51h
; copy character from I/O port to AL
STOSB
; copy character from AL to string
LOOP
READ_CHAR
; while CX is not 0, jump to top of loop
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...