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 975893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:39:48+00:00 2026-05-16T03:39:48+00:00

In assembly, when they say immediate data is that signed or unsigned?? I’m writing

  • 0

In assembly, when they say “immediate data” is that signed or unsigned??

I’m writing a Gameboy emulator and am using the opcodes here:

http://www.pastraiser.com/cpu/gameboy/gameboy_opcodes.html

Opcode 0xC6 for example is ADD A, d8.

My guess is that it’s unsigned else why would they need “SUB A, d8” but I thought that I’d ask just while I’m checking over my code…

  • 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-16T03:39:49+00:00Added an answer on May 16, 2026 at 3:39 am

    It seems like it’s an unsigned int. Look at MAME’s LR35902 CPU emulator, they use UINT8 for the immediate.

    Some relevant code:

    /* ... */
    case 0xC6: /*      ADD A,n8 */
        x = mem_ReadByte (cpustate, cpustate->w.PC++);
        ADD_A_X (x)
        break;
    /* ... */
    
    #define ADD_A_X(x) \
         { \
           register UINT16 r1,r2; \
           register UINT8 f; \
           r1=(UINT16)((cpustate->b.A&0xF)+((x)&0xF)); \
           r2=(UINT16)(cpustate->b.A+(x)); \
           cpustate->b.A=(UINT8)r2; \
           if( ((UINT8)r2)==0 ) f=FLAG_Z; \
             else f=0; \
           if( r2>0xFF ) f|=FLAG_C; \
           if( r1>0xF )  f|=FLAG_H; \
           cpustate->b.F=f; \
         }
    

    Now, the routine for LD HL,SP+n8 is

    case 0xF8: /*      LD HL,SP+n8 */
    /*
     *   n = one UINT8 signed immediate value.
     */
    
      {
        register INT32 n;
        n = (INT32) ((INT8) mem_ReadByte (cpustate, cpustate->w.PC++));
    

    Here the immediate is cast to an signed 8-bit int (INT8), so I imagine it’s otherwise unsigned.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are they the same? Longer version : Say I wrote, in assembly, on a
Everywhere I read about the new DLR in .net 4, they say that a
Let's say we have a project that will handle lots of data (employees, schedules,
What is a satellite assembly, and when should they be used?
I have several special methods, and I want analyze they calls in compiled assembly.
Let's say we use NASM as they do in this answer: how to write
People always say that C is more efficient than any other high level language.I
Let’s say that I have two C# applications - game.exe (XNA, needs to support
Say we have an existing process (or application) that calls a COM object from
I am learning C and assembly language together. I noticed that assembly is a

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.