I'm working on an 8080/SI emulator as my first emulator project. I've been using the 8080 instruction manual as a reference, implementing opcodes as I get to them in the ROM.
I just hit the 0xd3 opcode, OUT, and it's time for me to start figuring out how I/O works in this thing. Can I restate my understanding of how some of this stuff works, and somebody tells me if I'm heading down the wrong track?
OUT takes a port as an argument, and writes the contents of reg A to that port. The OP states that I can get away without implementing OUT 3, OUT 5, and OUT 6. OUT 2 means that I'm shifting the bitshift register by some offset, and OUT 4 means that I'm writing the contents of A to the bitshift (specifically, to the left half of the bitshift). So I need to have some sort of uint16_t, like a double register, and use that as the bitshift.
IN takes an argument, and depending on what argument that is (1, 2, or 3), it reads the contents of a uint_8 and treats that as a mask where each bit indicates that input is coming from a particular source (directional buttons, dipswitches, etc). So I need to make keyboard listeners, map keys to certain inputs, and maintain input masks; when I detect keyboard input, set the appropriate bit in the mask and wait for the IN instruction to read it.
As far as video goes, there's a section of the ram devoted to video; I should be able to just read the ram from $2400 to $3fff, call it a bmp, and blit it on to the screen with something like SDL. I don't need to worry about the bmp file header, because that's only important before the bmp is stored in ram; since the rom is generating the bmps on the fly, they're already in memory and I can just say it's a bmp.
Is that basically correct?