![]() It takes the 16 bit address, perform its own operations, update the status flags and/or registers, and commit the results (if any) on the same memory address. The instruction function prototype is: void Op_ADC(uint16_t addr) They all returns the actual memory address (16 bit) used by the instruction to read/write the operand/result Uint16_t Addr_INY() // INDEXED-Y INDIRECT Uint16_t Addr_INX() // INDEXED-X INDIRECT Uint16_t Addr_ABY() // INDEXED-Y ABSOLUTE Uint16_t Addr_ABX() // INDEXED-X ABSOLUTE Uint16_t Addr_ZEY() // INDEXED-Y ZERO PAGE Uint16_t Addr_ZEX() // INDEXED-X ZERO PAGE Here the addressing mode functions: // Addressing modes To me speed is not an issue so instead of writing a huge switch-case statement and repeat the same code again and again (different opcodes can refer to the same instruction using a different addressing mode) I'd like to separate actual instruction code from the addressing mode code: I found this solution very neat as it would require to write only 13 addressing mode functions and 56 instruction functions without repeat myself. ![]() ![]() The 6502 has 56 different instructions plus 13 addressing modes giving a total of 151 different opcodes. I used to write down a lot of assembly code for this CPU so all the opcodes, addressing modes and other stuff are not a big deal. In the spare time I'm starting writing a very simple C++ emulator for the 6502 CPU. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |