The code of the procedure
disp7seg is programmed for a display with common cathode.
If done properly you need a resistor for each of these segments (and the decimal point as well).
If you don't mind that "1" looks much brighter than "8" only one resistor for the common cathode will do.
In the loop of the procedure
disp7seg the layout of the number is found in the layout array (
the bit which is needed will be shiftet to the right and masked.
This value (0 or 1) will be sent to the pin where the segment is connected to.
In case you use a display with common anode you have to invert the boolean value before writing it to the port.