A stands for the accumulator and it’s where arithmetic operations usually take place. That sounds fairly cryptical, so let’s look at each of them individually.ĪF The AF register is actually more like two 8 bit registers A and F. It is equipped with 6 registers of 16 bit each and they’re called AF, BC, DE, HL, SP and PC. The Gameboy’s CPU is known as the DMG CPU. In order for that to make sense and also to understand how a CPU knows where to fetch operations, it needs some internal memory called registers. There are a lot more possible instructions and some of them even take arguments. The above instruction is also known as HALT and brings all operations on the CPU to a stop until an interrupt occurs (I’ll be talking about what interrupts are later on in this series). Since I’m dealing with an 8 bit CPU here, a typical instruction for the Gameboy consists of eight bits: 01110110 ![]() What an operation looks like is defined by the CPU’s instruction set. After that it’s back to step one.īut wait, what does it even mean to fetch an operation? How do you know where to fetch the operation from? And what would such an operation even look like in the first place? Instruction Set First the emulated CPU fetches an operation, then it decodes the operation and finally it executes the operation. ![]() ![]() To build an emulation of a CPU you basically just need to implement these three steps.
0 Comments
Leave a Reply. |