Code doesn't work on ESP8266

Hello.
Interested in the issue of adapting the code from arduino pro micro for esp8266.
As I understand it, esp8266 does not support working with ports, it simply does not have them.
The code for working with DDRB PORTB or DDRD PORTD does not work, incl. gives a compiler error.

uint8_t pd = PIND & B10100; // pins 2 and 4 direct reading ((pd == B10100) || (pd == B00000)) ? encoderPos++ : encoderPos--;
In general, of course, it’s interesting, ESP8266 is a fairly powerful module with 80 MHz CPU and Wi-Fi on board, but it cannot process the same code as in a slower arduino UNO or PRO MICRO - 16 MHz and without Wi-Fi.
Give advice on how to be.
Or the code does not solve the problem, and it is necessary to combine the ESP8266 and UNO together in the hardware?
...
Also a question - maybe someone came across the N5110_SPI library?

I connect the pins of the RST/CE/DC in digital pins on ESP8266.
And connect the pins of the DIN/CLK in hardware SPI pins.
The display Nokia 5110 does not show an image.
Tell me some advice on how to be, or is there only one solution - to take a board from atmega 328p and ESP8266 on board?

Your topic was MOVED to its current forum category as it is more suitable than the original as it has nothing to do with the installation and troubleshooting of the IDE

try to replace direct pin access with standard arduino digitalread() digitalWrite() functions. For example, this code

is equalent to

if (digitalRead(pin2)  ^ digitalRead(pin4) )  encoderPos--;
else encoderPos++;

Or:

  if (digitalRead(2) == digitalRead(4))
    encoderPos++;
  else
    encoderPos--;

yess
easier is better

From 2015'ish:

= Parts ==

* Adafruit Huzzah ESP8266 https://www.adafruit.com/products/2471

* Adafruit PCD8544/5110 display https://www.adafruit.com/product/338

* Adafruit USB to TTL serial cable https://www.adafruit.com/products/954

== Connection ==

USB TTL     Huzzah      Nokia 5110  Description
            ESP8266     PCD8544

            GND         GND         Ground
            3V          VCC         3.3V from Huzzah to display
            14          CLK         Output from ESP SPI clock
            13          DIN         Output from ESP SPI MOSI to display data input
            12          D/C         Output from display data/command to ESP
            #5          CS          Output from ESP to chip select/enable display
            #4          RST         Output from ESP to reset display
            15          LED         3.3V to turn backlight on, GND off

GND (blk)   GND                     Ground
5V  (red)   V+                      5V power from PC or charger
TX  (green) RX                      Serial data from IDE to ESP
RX  (white) TX                      Serial data to ESP from IDE
******************************************************************/

// Hardware SPI (faster, but must use certain hardware pins):
// SCK is LCD serial clock (SCLK) - this is pin 14 on Huzzah ESP8266
// MOSI is LCD DIN - this is pin 13 on an Huzzah ESP8266
// pin 12 - Data/Command select (D/C) on an Huzzah ESP8266
// pin 5 - LCD chip select (CS)
// pin 4 - LCD reset (RST)
Adafruit_PCD8544 display = Adafruit_PCD8544(12, 5, 4);

WHile the ESP8266 does not have "PORTS" it still offers direct access to the GPIO registers.