9. Data transfer

A CPU, in order to process data, needs to move that data around. This includes moving data between its internal registers and it includes moving data in an out of external RAM.

A number of mnemonic commands support this movement of data

 

Mnemonic Comment Code Operation
MOV Move (copy) MOV dest, source

dest = source,

source remains source

PUSH Place item on to the stack PUSH source stack contain source
POP Get item from stack POP dest get item from stack
XCHG Swap around XCHG dest,source

dest = source

source = dest

IN Input from a port IN dest, port dest = data at port
OUT Output to a port OUT port, source port = content or source

The MOV command may include a number of variants within the full instruction set, but it basically copies data from one location to another.

The PUSH and POP operations are the commands that control the contents of the stack. The stack is used to control subroutine calls and returning from subroutines.

A CPU may have a number of 'ports'. A port is one or more physical pins on the chip assigned to handling data moving into and out of the chip.

For example a serial port or an 8 bit data port may be available on the chip. CPUs especially developed for control purposes have many complicated ports, for example an automotive engine management CPU.

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: control CPUs

 

 

Copyright © www.teach-ict.com