I don't know this is your problem, but it is a problem in any case.
The pointer itself, not just what it points to, would also need to be volatile qualified. That is:
volatile uint8_t *volatile current_port = &PORTB;
volatile uint8_t *volatile next_port = &PORTB;
The volatile after the pointer declarator (the *) determines the volatile quality ...
As Edgar Bonet commented, you can do this using an ATtiny85 IC in an 8-pin DIP package which is available for about $1 and can be programmed using the Arduino IDE.
You have to tell the Arduino software about the ATtiny85 by installing a "core" for it such as Spence Konde's
You will need a device to transfer the program into the ATtiny85, either a $...