In x86 assembly, the MOV
instruction is used to get data from RAM and put it in one of the CPU's registers, where you can manipulate it, and the same instruction can write it back to RAM. To use the devices on the computer, that's another story.
Devices use so called interrupts, which are events which are fired when the device wants your (the CPU's) attention. In assembler you register your function to the interrupt to handle it when it fires. To get data to and from the device, you can use the IN
and OUT
instructions, which move data over the data bus. This way, you can provide the device with instructions, for example, get the data from the hard disk sectors X to Y. Then the harddisk spins up, fetches some of the data and fires an interrupt. Your code, which you registered for that interrupt, has to handle it and get the data and write it to some appropriate RAM location. Most CPU's and devices also support DMA (Direct Memory Access), in which you only specify a location in RAM where the device has to write it's data, which it then does without interrupting the CPU inbetween. Only as soon as the device is done, it raises an interrupt and your assembler code can respond accordingly.