If the cast (int8_t) works why Serial.print() prints signed long ?

I want to get the lowest 8 bits from the millis() function as a signed 8 bit number.

void setup() {

void loop() {
  int8_t tim;
  tim = (int8_t) (millis());
  Serial.print(tim, HEX);

It seems the conversion is right but Serial.println() output prints signed long ? Please see the terminal snapshot.

Because Serial.print takes a signed int, your signed 8-bit value is sign-extended as it is cast to int. So you see all those F's when you print it as hex.

To see just the hex value, make it unsigned. e.g.

Serial.print(((uint8_t)tim, HEX);

Yours, TonyWilk