Port using for reading adresses of parralel flash

Hi guys, i want to use ports for read 19 pins using paraller flash 29f800 for adressing

My trouble is with programing, i need read from more ports and put it together to byte string and this string

write in dec (or hex) value on uart (for loging adresses which mpc use for reading in flash)

I have here atmega 2560 board or bluepill or maple leaf boards.

Can someone help me with code ?

Somethink like PINA + PINB + PINL read as 010101010100101010101010110

And this string print like one number from 000000 to 0FFFFE in serial monitor.

or better way If one pin on flash have high OE (output enable) make read all other pins

and put to serial monitor like in first choice.

I need it working as fast like is possible.

I want to know where sak C167 cr lm read out of flash (loging adresses )

In real time.

My problem is, im car mechanic and i understand what happend in ECU (engine control unit)

But i have no experience with programing like my brother, he is far away from me now.

Can someone help with this easy code (like might be say my brother :) )

Thanks again :)

Ports PA, PC & PL look to be 8 bit wide ports on the Mega that are not doubled up or part of standard Arduino pins so maybe you could use them to connect your 19 bit address.
The direct port manipulation info here does not cover the Mega but the principle is the same.
Once you have setup all the port pins for input using the DDR registers

DDRA = B00000000;
DDRC = B00000000;
DDRL = B00000000;

you can read the pin states with PIN

uint32_t Address = 0;
Address = PINA;
Address = Address << 8;
Address = Address | PINC;
Address = Address << 8;
Address = Address | PINL;

The reading code can be simplified/compacted but as it is it shows how you read Port A and rotate the bits up by 8 then read port C and rotate and finally read port L.
Address will contain the 19 bit address from the ports in the form AAACCCCCCCCLLLLLLLL

Super, i will test it and let you know. Many thanks I press karma for you.