implmenting more opcodes

This commit is contained in:
Thiago Auler 2017-11-14 16:06:51 -02:00 committed by GitHub
parent 57159c7484
commit bb31cc3386
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 1 deletions

View File

@ -100,7 +100,7 @@ void adc()
{
// add memory to accumalator with carry
fetch_operand();
ac = ac + operand + C_IS_SET;
ac = adder(ac, operand + C_IS_SET);
}
void and()
@ -108,6 +108,7 @@ void and()
// and memory with accumulator
fetch_operand();
ac = ac & operand;
adjustNZ(ac);
}
void asl()
@ -115,6 +116,7 @@ void asl()
// shift left one bit (memory or accumulator)
fetch_operand();
operand = operand << 1;
adjustNZ(operand);
}
void bcc()
@ -257,16 +259,23 @@ void cpy()
void dec()
{
// decrement memory by one
operand = operand - 1;
write_mem(address, operand);
adjustNZ(operand);
}
void dex()
{
// decrement index x by one
x = x - 1;
adjustNZ(x);
}
void dey()
{
// decrement index y by one
y = y - 1;
adjustNZ(y);
}
void eor()
@ -285,12 +294,14 @@ void inx()
{
// increment index x by one
x = x + 1;
adjustNZ(x);
}
void iny()
{
// increment index y by one
y = y + 1;
adjustNZ(y);
}
void jmp()
@ -316,16 +327,19 @@ void jsr()
void lda()
{
// load accumulator with memory
ac = operand;
}
void ldx()
{
// load index x with memory
x = operand;
}
void ldy()
{
// load index y with memory
y = operand;
}
void lsr()
@ -391,59 +405,80 @@ void sbc()
void sec()
{
// set carry flag
C_SET;
}
void sed()
{
// set decimal flag
D_SET;
}
void sei()
{
// set interrupt disable status
I_SET;
}
void sta()
{
// store accumulator in memory
write_mem(address, ac);
adjustNZ(y);
}
void stx()
{
// store index x in memory
write_mem(address, x);
adjustNZ(x);
}
void sty()
{
// store index y in memory
write_mem(address, y);
adjustNZ(y);
}
void tax()
{
// transfer accumulator to index x
x = ac;
adjustNZ(x);
}
void tay()
{
// transfer accumulator to index y
y = ac;
adjustNZ(y);
}
void tsx()
{
// transfer stack pointer to index x
x = sp;
adjustNZ(x);
}
void txa()
{
// transfer index x to accumulator
ac = x;
adjustNZ(x);
}
void txs()
{
// transfer index x to stack pointer
sp = x;
adjustNZ(x);
}
void tya()
{
// transfer index y to accumulator
ac = y;
adjustNZ(y);
}