summaryrefslogtreecommitdiff
path: root/cpu.c
diff options
context:
space:
mode:
authorvin <git@vineetk.net>2024-07-04 12:11:53 -0400
committervin <git@vineetk.net>2024-07-04 12:11:53 -0400
commitc4fc40a036293a8f5899800ad3ecb1d24ba77bc4 (patch)
treedc81c2ffd74287ef8f9867e50e463513641680fb /cpu.c
parent5cd467eaf6b4f15f28b98c5fa49ab788dac945b3 (diff)
start implementing unofficial opcodes
Diffstat (limited to 'cpu.c')
-rw-r--r--cpu.c149
1 files changed, 148 insertions, 1 deletions
diff --git a/cpu.c b/cpu.c
index 7ef4985..e3bb7d5 100644
--- a/cpu.c
+++ b/cpu.c
@@ -177,6 +177,8 @@ branch(uint16_t addr, bool cond)
177 regs.pc = addr; 177 regs.pc = addr;
178} 178}
179 179
180/* OFFICIAL OPCODES */
181
180void 182void
181ADC(uint16_t arg) 183ADC(uint16_t arg)
182{ 184{
@@ -696,6 +698,140 @@ TYA(uint16_t arg)
696 STATUS_UPDATE_NZ(regs.a); 698 STATUS_UPDATE_NZ(regs.a);
697} 699}
698 700
701/* UNOFFICIAL OPCODES */
702
703void
704AAC(uint16_t arg)
705{
706 NOP(0);
707}
708
709void
710AAX(uint16_t arg)
711{
712 NOP(0);
713}
714
715void
716ARR(uint16_t arg)
717{
718 NOP(0);
719}
720
721void
722ASR(uint16_t arg)
723{
724 NOP(0);
725}
726
727void
728ATX(uint16_t arg)
729{
730 NOP(0);
731}
732
733void
734AXA(uint16_t arg)
735{
736 NOP(0);
737}
738
739void
740AXS(uint16_t arg)
741{
742 NOP(0);
743}
744
745void
746DCP(uint16_t arg)
747{
748 NOP(0);
749}
750
751void
752DOP(uint16_t arg)
753{
754 NOP(0);
755}
756
757void
758ISC(uint16_t arg)
759{
760 NOP(0);
761}
762
763void
764KIL(uint16_t arg)
765{
766 NOP(0);
767}
768
769void
770LAR(uint16_t arg)
771{
772 NOP(0);
773}
774
775void
776LAX(uint16_t arg)
777{
778 NOP(0);
779}
780
781void
782RLA(uint16_t arg)
783{
784 NOP(0);
785}
786
787void
788RRA(uint16_t arg)
789{
790 NOP(0);
791}
792
793void
794SLO(uint16_t arg)
795{
796 NOP(0);
797}
798
799void
800SRE(uint16_t arg)
801{
802 NOP(0);
803}
804
805void
806SXA(uint16_t arg)
807{
808 NOP(0);
809}
810
811void
812SYA(uint16_t arg)
813{
814 NOP(0);
815}
816
817void
818TOP(uint16_t arg)
819{
820 NOP(0);
821}
822
823void
824XAA(uint16_t arg)
825{
826 NOP(0);
827}
828
829void
830XAS(uint16_t arg)
831{
832 NOP(0);
833}
834
699static void 835static void
700interpret(void) 836interpret(void)
701{ 837{
@@ -711,7 +847,18 @@ interpret(void)
711 printf("%02X", op); 847 printf("%02X", op);
712 for (uint8_t i = 0; i < opcodes[op].bytes - 1; i++) 848 for (uint8_t i = 0; i < opcodes[op].bytes - 1; i++)
713 printf(" %02X", peek(regs.pc + i)); 849 printf(" %02X", peek(regs.pc + i));
714 printf("\t%s ", opcodes[op].name); 850
851 if (opcodes[op].unofficial) {
852 if (opcodes[op].bytes == 1)
853 printf(" ");
854 else if (opcodes[op].bytes == 2)
855 printf(" ");
856 else if (opcodes[op].bytes == 3)
857 putchar(' ');
858 putchar('*');
859 } else
860 putchar('\t');
861 printf("%s ", opcodes[op].name);
715 862
716 mode = opcodes[op].mode; 863 mode = opcodes[op].mode;
717 arg = opcode_mem(mode); 864 arg = opcode_mem(mode);