📄 cpu.pas
字号:
end;
//* *
//* dec instruction 2005/12/27 *
//*---------------end---------------------*
//* *
//* dex instruction 2005/12/27 *
//*---------------start-------------------*
$CA: //
begin
{$IFDEF debug}
curIns := 'DEX ';
{$ENDIF}
tempbyte := x;
asm
dec tempbyte
end;
x := tempbyte;
setnz(tempbyte);
inc(cycles, 2);
inc(pc);
end;
//* *
//* dex instruction 2005/12/27 *
//*---------------end---------------------*
//* *
//* dey instruction 2005/12/27 *
//*---------------start-------------------*
$88: //
begin
{$IFDEF debug}
curIns := 'DEY ';
{$ENDIF}
tempbyte := y;
asm
dec tempbyte
end;
y := tempbyte;
setnz(tempbyte);
inc(cycles, 2);
inc(pc);
end;
//* *
//* dey instruction 2005/12/27 *
//*---------------end---------------------*
//* *
//* eor instruction 2005/12/29 *
//*---------------start-------------------*
$49: //immediate
begin
{$IFDEF debug}
curIns := 'EOR #$' + intToHex(memread(pc + 1), 0);
{$ENDIF}
tempbyte := memread(pc + 1);
a := tempbyte xor a;
setnz(a);
inc(cycles, 2);
inc(pc, 2);
end;
//* *
//* eor instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* eor instruction 2005/12/29 *
//*---------------start-------------------*
$45: //zero
begin
taddr:=ZpAddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'EOR $' + intToHex(taddr, 0);
{$ENDIF}
a := tempbyte xor a;
setnz(a);
inc(cycles, 3);
inc(pc, 2);
end;
//* *
//* eor instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* eor instruction 2005/12/29 *
//*---------------start-------------------*
$55: //zero,x
begin
taddr:=IzpAddress(pc,x);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'EOR $' + intToHex(memread(pc + 1), 0) + ',X ';
{$ENDIF}
a := tempbyte xor a;
setnz(a);
inc(cycles, 4);
inc(pc, 2);
end;
//* *
//* eor instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* eor instruction 2005/12/29 *
//*---------------start-------------------*
$4D: //absolute
begin
taddr:=AbAddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'EOR $' + intToHex(taddr, 0);
{$ENDIF}
a := tempbyte xor a;
setnz(a);
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* eor instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* eor instruction 2005/12/29 *
//*---------------start-------------------*
$5D: //absolute,x
begin
taddr:=iabaddress(pc,x);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'EOR $' + intToHex(taddr-x, 0) + ',X';
{$ENDIF}
a := tempbyte xor a;
setnz(a);
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* eor instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* eor instruction 2005/12/29 *
//*---------------start-------------------*
$59: //absolute,y
begin
taddr:=iabaddress(pc,y);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'EOR $' + intToHex(taddr-y, 0) + ',Y';
{$ENDIF}
a := tempbyte xor a;
setnz(a);
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* eor instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* eor instruction 2005/12/29 *
//*---------------start-------------------*
$41: //indirect,x
begin
{$IFDEF debug}
curIns := 'EOR ($' + intToHex(memread(pc + 1), 0) + ',X) ';
{$ENDIF}
taddr:=iixaddress(pc,x);
tempbyte:=memread(taddr);
a := tempbyte xor a;
setnz(a);
inc(cycles, 6);
inc(pc, 2);
end;
//* *
//* eor instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* eor instruction 2005/12/29 *
//*---------------start-------------------*
$51: //(indirect),y
begin
{$IFDEF debug}
curIns := 'EOR ($' + intToHex(memread(pc + 1), 0) + '),Y ';
{$ENDIF}
taddr:=iiyaddress(pc,y);
tempbyte:=memread(taddr);
a := tempbyte xor a;
setnz(a);
inc(cycles, 5);
inc(pc, 2);
end;
//* *
//* eor instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* inc instruction 2005/12/29 *
//*---------------start-------------------*
$E6: //zero page
begin
taddr:=zpaddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'INC $' + intToHex(taddr, 0);
{$ENDIF}
asm
inc tempbyte
end;
memwrite(taddr, tempbyte);
setnz(tempbyte);
inc(cycles, 5);
inc(pc, 2);
end;
//* *
//* inc instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* inc instruction 2005/12/29 *
//*---------------start-------------------*
$F6: //zero page,x
begin
taddr:=izpaddress(pc,x);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'INC $' + intToHex(memread(pc + 1), 0) + ',X ';
{$ENDIF}
asm
inc tempbyte
end;
memwrite(taddr, tempbyte);
setnz(tempbyte);
inc(cycles, 6);
inc(pc, 2);
end;
//* *
//* inc instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* inc instruction 2005/12/29 *
//*---------------start-------------------*
$EE: //absolute
begin
taddr:=abaddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'INC $' + intToHex(taddr, 0);
{$ENDIF}
asm
inc tempbyte
end;
memwrite(taddr, tempbyte);
setnz(tempbyte);
inc(cycles, 6);
inc(pc, 3);
end;
//* *
//* inc instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* inc instruction 2005/12/29 *
//*---------------start-------------------*
$FE: //absolute,x
begin
taddr:=iabaddress(pc,x);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'INC $' + intToHex(taddr, 0) + ',X';
{$ENDIF}
asm
inc tempbyte
end;
memwrite(taddr, tempbyte);
setnz(tempbyte);
inc(cycles, 7);
inc(pc, 3);
end;
//* *
//* inc instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* inx instruction 2005/12/29 *
//*---------------start-------------------*
$E8: //
begin
{$IFDEF debug}
curIns := 'INX ';
{$ENDIF}
tempbyte := x;
asm
inc tempbyte
end;
x := tempbyte;
setnz(tempbyte);
inc(cycles, 2);
inc(pc);
end;
//* *
//* inx instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* iny instruction 2005/12/29 *
//*---------------start-------------------*
$C8: //
begin
{$IFDEF debug}
curIns := 'INY ';
{$ENDIF}
tempbyte := y;
asm
inc tempbyte
end;
y := tempbyte;
setnz(tempbyte);
inc(cycles, 2);
inc(pc);
end;
//* *
//* iny instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* jmp instruction 2005/12/29 *
//*---------------start-------------------*
$4C: //absolute
begin
inc(cycles, 3);
tempbyte := memread(pc + 1);
pc := (memread(pc + 2) shl 8) or tempbyte;
{$IFDEF debug}
curIns := 'JMP $' + intToHex(pc, 0);
{$ENDIF}
end;
//* *
//* jmp instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* jmp instruction 2005/12/29 *
//*---------------start-------------------*
$6C: //indirect
begin
inc(cycles, 5);
tempbyte := memread(pc + 1);
taddr := (memread(pc + 2) shl 8) or tempbyte;
tempbyte := memread(taddr); //low address
taddr:=(taddr and $ff00) or byte((taddr and $00ff) +1 ); //
//high address
pc := (memread(taddr ) shl 8) or tempbyte;
{$IFDEF debug}
curIns := 'JMP ($' + intToHex(pc, 0) + ')';
{$ENDIF}
end;
//* *
//* jmp instruction 2005/12/29 *
//*---------------end---------------------*
//* *
//* jsr instruction 2005/12/30 *
//*---------------start-------------------*
$20: //absolute
begin
inc(cycles, 6);
taddr := pc + 2;
push((taddr shr 8) and $00FF);
push(taddr and $00FF);
taddr := memread(pc + 1);
taddr := taddr or (memread(pc + 2) shl 8);
pc := taddr;
{$IFDEF debug}
curIns := 'JSR $' + intToHex(taddr, 0);
{$ENDIF}
end;
//* *
//* jsr instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lda instruction 2005/12/30 *
//*---------------start-------------------*
$A9: //immediate
begin
{$IFDEF debug}
curIns := 'LDA #$' + intToHex(memread(pc + 1), 0);
{$ENDIF}
a := memread(pc + 1);
setnz(a);
inc(cycles, 2);
inc(pc, 2);
end;
//* *
//* lda instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lda instruction 2005/12/30 *
//*---------------start-------------------*
$A5: //zero page
begin
taddr:=zpAddress(pc);
a := memread(taddr);
{$IFDEF debug}
curIns := 'LDA $' + intToHex(taddr, 0);
{$ENDIF}
setnz(a);
inc(cycles, 3);
inc(pc, 2);
end;
//* *
//* lda instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lda instruction 2005/12/30 *
//*---------------start-------------------*
$B5: //zero page,x
begin
{$IFDEF debug}
curIns := 'LDA $' + intToHex(memread(pc + 1), 0) + ',X ';
{$ENDIF}
a := memread(izpaddress(pc,x));
setnz(a);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -