📄 cpu.pas
字号:
inc(cycles, 4);
inc(pc, 2);
end;
//* *
//* lda instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lda instruction 2005/12/30 *
//*---------------start-------------------*
$AD: //absolute
begin
taddr:=abaddress(pc);
a := memread(taddr);
{$IFDEF debug}
curIns := 'LDA $ ' + intToHex(taddr, 0);
{$ENDIF}
setnz(a);
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* lda instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lda instruction 2005/12/30 *
//*---------------start-------------------*
$BD: //absolute,x
begin
taddr:=iabaddress(pc,x);
a := memread(taddr);
{$IFDEF debug}
curIns := 'LDA $' + intToHex(taddr-x, 0) + ',X ';
{$ENDIF}
setnz(a);
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* lda instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lda instruction 2005/12/30 *
//*---------------start-------------------*
$B9: //absolute,y
begin
taddr:=iabaddress(pc,y);
a := memread(taddr);
{$IFDEF debug}
curIns := 'LDA $' + intToHex(taddr-y, 0) + ',Y ';
{$ENDIF}
setnz(a);
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* lda instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lda instruction 2005/12/30 *
//*---------------start-------------------*
$A1: //indirect,x
begin
{$IFDEF debug}
curIns := 'LDA ($' + intToHex(memread(pc + 1), 0) + ',X) ';
{$ENDIF}
a := memread(IIXaddress(pc,x));
setnz(a);
inc(cycles, 6);
inc(pc, 2);
end;
//* *
//* lda instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lda instruction 2005/12/30 *
//*---------------start-------------------*
$B1: //(indirect),y
begin
{$IFDEF debug}
curIns := 'LDA ($' + intToHex(memread(pc + 1), 0) + '),Y ';
{$ENDIF}
a :=memread(iiyaddress(pc,y));
setnz(a);
inc(cycles, 5);
inc(pc, 2);
end;
//* *
//* lda instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* ldx instruction 2005/12/30 *
//*---------------start-------------------*
$A2: //immediate
begin
{$IFDEF debug}
curIns := 'LDX #$' + intToHex(memread(pc + 1), 0);
{$ENDIF}
x := memread(pc + 1);
setnz(x);
inc(cycles, 2);
inc(pc, 2);
end;
//* *
//* ldx instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* ldx instruction 2005/12/30 *
//*---------------start-------------------*
$A6: //zero page
begin
taddr:=zpaddress(pc,);
x := memread(taddr);
{$IFDEF debug}
curIns := 'LDX $' + intToHex(taddr, 0);
{$ENDIF}
setnz(x);
inc(cycles, 3);
inc(pc, 2);
end;
//* *
//* ldx instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* ldx instruction 2005/12/30 *
//*---------------start-------------------*
$B6: //zero page,y
begin
taddr:=izpaddress(pc,y);
x:=memread(taddr);
{$IFDEF debug}
curIns := 'LDX $' + intToHex(memread(pc + 1), 0) + ',Y ';
{$ENDIF}
setnz(x);
inc(cycles, 4);
inc(pc, 2);
end;
//* *
//* ldx instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* ldx instruction 2005/12/30 *
//*---------------start-------------------*
$AE: //absolute
begin
taddr:=abaddress(pc);
x:=memread(taddr);
{$IFDEF debug}
curIns := 'LDX $' + intToHex(taddr, 0);
{$ENDIF}
setnz(x);
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* ldx instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* ldx instruction 2005/12/30 *
//*---------------start-------------------*
$BE: //absolute,y
begin
taddr:=iabaddress(pc,y);
x := memread(taddr);
{$IFDEF debug}
curIns := 'LDX $' + intToHex(taddr-y, 0) + ',Y';
{$ENDIF}
setnz(x);
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* ldx instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* ldy instruction 2005/12/30 *
//*---------------start-------------------*
$A0: //immediate
begin
{$IFDEF debug}
curIns := 'LDY #$' + intToHex(memread(pc + 1), 0);
{$ENDIF}
y := memread(pc + 1);
setnz(y);
inc(cycles, 2);
inc(pc, 2);
end;
//* *
//* ldy instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* ldy instruction 2005/12/30 *
//*---------------start-------------------*
$A4: //zero page
begin
taddr:=zpaddress(pc);
y:=memread(taddr);
{$IFDEF debug}
curIns := 'LDY $' + intToHex(taddr, 0);
{$ENDIF}
setnz(y);
inc(cycles, 3);
inc(pc, 2);
end;
//* *
//* ldy instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* ldy instruction 2005/12/30 *
//*---------------start-------------------*
$B4: //zero page,x
begin
{$IFDEF debug}
curIns := 'LDY $' + intToHex(memread(pc + 1), 0) + ',X ';
{$ENDIF}
taddr:=izpaddress(pc,x);
y:=memread(taddr);
setnz(y);
inc(cycles, 4);
inc(pc, 2);
end;
//* *
//* ldy instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* ldy instruction 2005/12/30 *
//*---------------start-------------------*
$AC: //absolute
begin
taddr:=abaddress(pc);
y := memread(taddr);
{$IFDEF debug}
curIns := 'LDY $' + intToHex(taddr, 0);
{$ENDIF}
setnz(y);
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* ldy instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* ldy instruction 2005/12/30 *
//*---------------start-------------------*
$BC: //absolute,x
begin
taddr:=iabaddress(pc,x);
y := memread(taddr);
{$IFDEF debug}
curIns := 'LDY $' + intToHex(taddr-x, 0) + ',X';
{$ENDIF}
setnz(y);
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* ldy instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lsr instruction 2005/12/30 *
//*---------------start-------------------*
$4A: // accumulator
begin
{$IFDEF debug}
curIns := 'LSR ' + intToHex(memread(pc + 1), 0);
{$ENDIF}
ps.cf := a and $1;
a := a shr 1;
setnz(a);
inc(cycles, 2);
inc(pc);
end;
//* *
//* lsr instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lsr instruction 2005/12/30 *
//*---------------start-------------------*
$46: //zero page
begin
taddr:=zpaddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'LSR $' + intToHex(taddr, 0);
{$ENDIF}
ps.cf := tempbyte and $1;
tempbyte := tempbyte shr 1;
setnz(tempbyte);
memwrite(taddr, tempbyte);
inc(cycles, 5);
inc(pc, 2);
end;
//* *
//* lsr instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lsr instruction 2005/12/30 *
//*---------------start-------------------*
$56: //zero page.x
begin
taddr:=izpaddress(pc,x);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'LSR $' + intToHex(memread(pc + 1), 0) + ',X ';
{$ENDIF}
ps.cf := tempbyte and $1;
tempbyte := tempbyte shr 1;
setnz(tempbyte);
memwrite(taddr, tempbyte);
inc(cycles, 6);
inc(pc, 2);
end;
//* *
//* lsr instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lsr instruction 2005/12/30 *
//*---------------start-------------------*
$4E: //absolute
begin
taddr:=abaddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'LSR $' + intToHex(taddr, 0);
{$ENDIF}
ps.cf := tempbyte and $1;
tempbyte := tempbyte shr 1;
setnz(tempbyte);
memwrite(taddr, tempbyte);
inc(cycles, 6);
inc(pc, 3);
end;
//* *
//* lsr instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* lsr instruction 2005/12/30 *
//*---------------start-------------------*
$5E: //absolute.x
begin
taddr:=iabaddress(pc,x);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'LSR $' + intToHex(taddr-x, 0) + ',X ';
{$ENDIF}
ps.cf := tempbyte and $1;
tempbyte := tempbyte shr 1;
setnz(tempbyte);
memwrite(taddr, tempbyte);
inc(cycles, 7);
inc(pc, 3);
end;
//* *
//* lsr instruction 2005/12/30 *
//*---------------end---------------------*
//* nop instruction 2005/12/30 *
//*---------------start-------------------*
$EA: // implied
begin
{$IFDEF debug}
curIns := 'NOP ';
{$ENDIF}
inc(cycles, 2);
inc(pc);
end;
//* *
//* nop instruction 2005/12/30 *
//*---------------end---------------------*
//* *
//* ora instruction 2005/12/31 *
//*---------------start-------------------*
$09: //immediate
begin
{$IFDEF debug}
curIns := 'ORA #$' + intToHex(memread(pc + 1), 0);
{$ENDIF}
tempbyte := memread(pc + 1);
a := tempbyte or a;
setnz(a);
inc(cycles, 2);
inc(pc, 2);
end;
//* *
//* ora instruction 2005/12/31 *
//*---------------end---------------------*
//* *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -