Yet another C question...

Discussion in 'Technical Discussion' started by SegaLoco, Mar 4, 2010.

  1. SegaLoco

    SegaLoco

    W)(at did you say? Misfit
    Okay, so I'm gonna try to write a simple VDP register calculator with GTK+. I'm starting with a CLI version though, which asks the user questions about each register and sets the bits in a short accordingly. I'm having a problem though...
    Code (Text):
    1. fprintf(out, "\tdc.w\t$%x\n", reg[0]);
    where reg is an array of uint16_t prints dc.w $ffff8014 instead of the desired dc.w $8014. Any suggestions?
     
  2. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,890
    23
    18
    USA
    rom-properties
    Code (Text):
    1. fprintf(out, "\tdc.w\t$%04X\n", (unsigned int)reg[0]);
     
  3. AamirM

    AamirM

    Tech Member
    Code (Text):
    1. fprintf(out, "\tdc.w\t$%x\n", reg[0] & 0xFFFF);