This code compiles using sdcc (just use the make command from a command prompt.  If you want to compile it using the Keil compiler, you'll need to make some trivial edits.
You won't need to compile it if you're using the same IO, as I've included the .hex file.  IO used by my STC89C52 dev board is:
RS = P0.7, R/W = P0.6, E = P0.5, 8-bit dataport = P2
If your STC development board uses different IO pins for RS, RW, E, and/or the databus, edit gd.h to suit
Beware dev boards that have LEDs connected to the dataport - the LEDs pull the pins up harder than the LCD module can pull them down, so read operations fail and the code won't work.
In such a situation, you can make it run in write-only mode by editing the GDwaitWhileBusy() function to:

void GDwaitWhileBusy() { // read busy flag (also gets address counter AC)
  GD_RS_LOW;
  GDdelay(1);
  return;
  while (GDreadDataPort() & 0x80) continue; // loop while display busy
}

It should then run, but you'll see messed up characters and graphics, because the code needs to read the display memory to draw graphics or character strings that start and/or finish inside a 2-byte chunk
Solution is to remove the LEDs, or their pull-up resistors, if you have such a board.  Some dev boards have a jumper so that the supply to the pull-up resistors can be disconnected, but not all.

ceptimus 2022-06-02
