Add 6502 DEX and DEY instructions

This commit is contained in:
g1n 2021-10-15 14:39:52 +03:00
parent 94b94c611d
commit b27a51bc04
5 changed files with 21 additions and 9 deletions

View File

@ -33,6 +33,15 @@ void iny(FILE *outfile) {
fwrite(INY, 1, 1, outfile); fwrite(INY, 1, 1, outfile);
} }
void dex(FILE *outfile) {
fwrite(DEX, 1, 1, outfile);
}
void dey(FILE *outfile) {
fwrite(DEY, 1, 1, outfile);
}
void nop(FILE *outfile) { void nop(FILE *outfile) {
fwrite(NOP, 1, 1, outfile); fwrite(NOP, 1, 1, outfile);
} }

View File

@ -10,6 +10,8 @@
#define INX "\xE8" #define INX "\xE8"
#define INY "\xC8" #define INY "\xC8"
#define DEX "\xCA"
#define DEY "\x88"
#define NOP "\xEA" #define NOP "\xEA"
@ -22,6 +24,8 @@ void tya(FILE *outfile);
void inx(FILE *outfile); void inx(FILE *outfile);
void iny(FILE *outfile); void iny(FILE *outfile);
void dex(FILE *outfile);
void dey(FILE *outfile);
void nop(FILE *outfile); void nop(FILE *outfile);

View File

@ -39,6 +39,10 @@ void parser(char lexed_buf[512][128][128], FILE *outfile) { // outfile is needed
inx(outfile); inx(outfile);
} else if (!strcmp(lexed_buf[i][j], "INY")) { } else if (!strcmp(lexed_buf[i][j], "INY")) {
iny(outfile); iny(outfile);
} else if (!strcmp(lexed_buf[i][j], "DEX")) {
dex(outfile);
} else if (!strcmp(lexed_buf[i][j], "DEY")) {
dey(outfile);
} else if (!strcmp(lexed_buf[i][j], "TAX")) { } else if (!strcmp(lexed_buf[i][j], "TAX")) {
tax(outfile); tax(outfile);
} else if (!strcmp(lexed_buf[i][j], "TAY")) { } else if (!strcmp(lexed_buf[i][j], "TAY")) {

View File

@ -1,14 +1,9 @@
INY INY
INY INY
INX
TXA
INY INY
TAX DEY
INX
INX
TAY
INX INX
INX INX
INX INX
INY DEX
INY DEX

View File

@ -1 +1 @@
ИИиЉИЄииЁиииИИ ИИИ€иииКК