Can anyone explain to me how to do this in assembly?
Thanks,
Joseph
Read/Write Bytes From/To Registers
-
- Member
- Posts: 48
- Joined: Mon Aug 13, 2007 2:30 pm
Shouldn't that be in general programming?
Code: Select all
; The intel syntax is:
mov register, value
; Example:
mov eax, 6298503
mov bh, 34
Conway's Law: If you have four groups working on a compiler, you'll get a 4-pass compiler.
Melvin Conway
Melvin Conway
-
- Member
- Posts: 48
- Joined: Mon Aug 13, 2007 2:30 pm
- mathematician
- Member
- Posts: 437
- Joined: Fri Dec 15, 2006 5:26 pm
- Location: Church Stretton Uk
Re: Read/Write Bytes From/To Registers
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)
POST SCRIPT:
You read from a processor's register by using the same MOV instruction you use to write it:
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