I need a tutorial on how to change the code like this to add that in.
I don't know of any tutorials, but there's a tutorial on how to make the workspace bigger in the comment section of this post: "https://itch.io/t/2624472/i-made-an-8-bit-computer-in-digital-logic-sim-v2".