Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7075707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:12:35+00:00 2026-05-28T06:12:35+00:00

Ohai, I’m currently trying to implement an 8086 ASM debugger for learning purposes. Until

  • 0

Ohai,
I’m currently trying to implement an 8086 ASM debugger for learning purposes. Until now, I tried to simulate the 8 and 16 bit registers with char arrays but this approach is driving me nuts, when working with AX, AL and AH.

#define setAL() { int i; for (i = 0; i < 8; i++) AL[i] = AX[i]; }
char AX[16]   = {0, 1, 1, 1, 1 ,1 ,1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
char AL[8]    = {0, 0, 0, 0, 0, 0, 0, 0};

Does anyone has any good idea (or something like ‘best practice’) how to simulate those registers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:12:35+00:00Added an answer on May 28, 2026 at 6:12 am

    I don’t think there’s a ‘best practice’ way of doing this, but one approach you could take that may drive you nuts less is to use a union to overlay the 8 and 16 bit portions:

    struct RegByte { 
       unsigned char low;
       unsigned char high;
    };
    
    struct RegWord {
       unsigned short value;
    };
    
    union Reg {
       struct RegWord word;
       struct RegByte bytes;
    };
    

    Alternatively given you’re explicitly targeting just 8086 you could have one structure containing all the 16 bit registers and one containing all of the byte portions. e.g.

    struct RegByte {
       unsigned char al, ah, bl, bh, cl, ch, dl, dh;
    };
    
    struct RegWord {
       unsigned short ax, bx, cx, dx;
       /* nothing stopping you from continuing with si, di, etc even though
        * they don't have addressable high and low bytes */
    };
    
    union Reg {
       struct RegWord word;
       struct RegByte byte;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run ohai.bat os_version within cygwin on Windows Server 2003 R2, and
I'm trying to set the onclick attribute of a link generated with jQuery. While
Ohai, I'm writing a small PHP application, using a separated config.php file and a
I'm trying to overload the XMLHttpRequest.* method in JavaScript so a webpage can figure
I've been following two tutorials on some Visual C++ fundamentals but they all seem
I'm studying object literals and self-executing functions in Javascript. Looking through some YUI code
ok, so, i have an xml file that looks like this: <?xml version=1.0?> <Users>
Using Drupal 6.20. We can setup some form elements like this:- <input type=select name=somename[]><option>ohai</option></select>
What is the preferred way to post something to your Twitter? Earlier you could
In Javascript, I can do this: var person = { name: 'Joe', age: '35',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.