Help understand drawPixel code - 2.4" TFT Shield

Hi,

I have TFT 2.4 shield connected to Arduino UNO.
I've downloaded library to use it and I'm trying to understand how its showing pixels on screen.

Here's some code:

 #define CD_COMMAND *cdPort &=  cdPinUnset
 #define CD_DATA    *cdPort |=  cdPinSet
 #define CS_ACTIVE  *csPort &=  csPinUnset
 #define CS_IDLE    *csPort |=  csPinSet

  #define write8inline(d) {                          \
    PORTD = (PORTD & B00000011) | ((d) & B11111100); \
    PORTB = (PORTB & B11111100) | ((d) & B00000011); \
    WR_STROBE; }

void Adafruit_TFTLCD::drawPixel(int16_t x, int16_t y, uint16_t color) {

    CS_ACTIVE;
    setAddrWindow(x, y, _width-1, _height-1);

    CS_ACTIVE;
    CD_COMMAND;
    write8(0x2C);
    
    CD_DATA;
    write8(color >> 8);
    write8(color);

    CS_IDLE;
}

Can you please help me understand what happens here?
What's the purpose of CS_ACTIVE, CD_COMMAND, CD_DATA and CS_IDLE?
What write8() is doing?

Cheers!

CS_ACTIVE, CD_COMMAND, CD_DATA and CS_IDLE are macros (see #define's at the beginning of code).
Preprocessor replace it names by it definitions.
For example CD_COMMAND are replaced by *cdPort &= cdPinUnset.
It is assumes that cdPort - mcu port address and cdPinUnset - mask with one zero bit. It must be defined in code.
The result are low level at CD pin of display controller.

write8 sends one byte to display controller. Pixel color consists of two bytes - 16 bit - 5(Red)-6(Green)-5(Blue) bits.

Display converts 16 bit color to 18 bit color and when it read from display memory value may be slightly different.