CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2001
    Posts
    2,455

    OFF TOPIC! General Registers

    I am reviewing some assembly notes, simply out of curiosity, and I come across something that I am not sure of. In the 8088 processor, you can access the general registers high byte and low byte by denoting with a H or L respectively. In DEBUG, I typed the following:
    Code:
    - R AH
    and it gives me an error. Can I not access the high and low byte of the general registers on a P4 processor?

    Mike B

  2. #2
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588
    You definitely can. But what is that "R" instruction ? try something like "ADD AL, BL", that should work correctly.

  3. #3
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,020
    r cannot be used to modify the 8-bit registers. The best you can do is look at the AX value and modify the upper 8 bits.

    debug.exe is a 32-bit version of a 16-bit program. It is a hangover from the DOS days. The r instruction for modifying registers only seems to work for the 16-bit registers. .

    I use it in batch files as a version of Unix's sed. It is absolutely brilliant for that.
    Succinct is verbose for terse

  4. #4
    Join Date
    Feb 2001
    Posts
    2,455
    You definitely can. But what is that "R" instruction ? try something like "ADD AL, BL", that should work correctly.
    I am looking at it using DEBUG.EXE where R instruction is used to edit a register.

    r cannot be used to modify the 8-bit registers. The best you can do is look at the AX value and modify the upper 8 bits.
    So what can I use to set the value in the AL and HL?

    Nothing?

    Mike B

  5. #5
    Join Date
    Feb 2001
    Posts
    2,455
    Sorry I figured it out. You cannot directly access the H and L other then actually specifying the values in AX. So:
    Code:
    - R AX
    AX 0000
    : 0102
    
    -R IP
    IP 0100
    : 100
    
    - E 100 
    0AEA:0100 AA.00 43.C4
    The above code will add the high and low bytes of AX
    ADD AH, AL

    Mike B

  6. #6
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,020
    Like I said earlier, you have to use AX to set it. eg if you wish to set AL to 99 hex

    r AX
    AX 1234
    :1299

    Similarly, if you wish to set AH to 50 hex

    r AX
    AX 1234
    :5034
    Succinct is verbose for terse

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured