Author Topic: Question about registers  (Read 16385 times)

Offline c0wb0yc0d3r

  • New Member
  • Posts: 1
Question about registers
« on: August 19, 2010, 08:48:11 PM »
I just starting to learn assembly and I am curious as to whether I can use any register to store anything or if only certain registers can store certain data.

Any help would be awesome, thanks everyone!

EDIT:

After doing some poking around, am I right in saying that I have to use certain register for certain tasks?

For instance, i found this code snippet:
Code: [Select]
org 100h ; dos will load us at offset 100h (256) into some segment

section .text

    mov ah, 9
    mov dx, msg
    int 21h

    ret

section .data
    msg db "hello world!$"

here: http://forum.nasm.us/index.php?topic=832.msg2691#msg2691

When I compiled it as a .COM file using the -f bin flag it ran just fine. However when I modified the code like this:

Code: [Select]
org 100h ; dos will load us at offset 100h (256) into some segment

section .text

    mov ax, 9
    mov dx, msg
    int 21h

    ret

section .data
    msg db "hello world!$"

and recompiled it using the -f bin flag it no longer works. Can someone possibly explain to me why the first code snippet works and the second one does not?
« Last Edit: August 19, 2010, 09:14:45 PM by c0wb0yc0d3r »

Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: Question about registers
« Reply #1 on: August 19, 2010, 09:17:07 PM »
Have a look at THIS entry in RBIL.