Read/Write Bytes From/To Registers
Posted: Mon Jan 21, 2008 11:56 am
Can anyone explain to me how to do this in assembly?
Thanks,
Joseph
Thanks,
Joseph
The Place to Start for Operating System Developers
https://f.osdev.org/
Code: Select all
; The intel syntax is:
mov register, value
; Example:
mov eax, 6298503
mov bh, 34
If you are talking about peripheral chips like the IDE controller (for instance), you usually use in/out instructions. For example:JoeTheProgrammer wrote:Can anyone explain to me how to do this in assembly?
Thanks,
Joseph
Code: Select all
mov dx, 1f0h
in ax,dx (read primary IDE controller's data register)
in al, 21h (read the master PIC's mask register)
mov dx, 3d4h
out dx,al (write to the CRT controller's address register)
Code: Select all
mov some_data, ax (store the contents of ax in the variable some_data
mov [ebx], cl (store the value of cl in the memory location pointed to by ebx