📄 cpu.pas
字号:
curIns := 'CMP $ ' + intToHex(memread(pc + 1), 0) + ',X ';
{$ENDIF}
tempflag:=Ps.off;
acc := a;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,acc
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
Ps.off:=tempflag;
inc(cycles, 4);
inc(pc, 2);
end;
//* *
//* cmp instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* cmp instruction 2005/12/26 *
//*---------------start-------------------*
$CD: //absolute
begin
taddr:=AbAddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'CMP $' + intToHex(taddr, 0);
{$ENDIF}
tempflag:=Ps.off;
acc := a;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,acc
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
Ps.off:=tempflag;
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* cmp instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* cmp instruction 2005/12/26 *
//*---------------start-------------------*
$DD: //absolute,x
begin
taddr:=IABAddress(pc,x);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'CMP $' + intToHex(taddr-x, 0) + ',X';
{$ENDIF}
tempflag:=Ps.off;
acc := a;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,acc
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
Ps.off:=tempflag;
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* cmp instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* cmp instruction 2005/12/26 *
//*---------------start-------------------*
$D9: //absolute,y
begin
taddr:=IABAddress(pc,y);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'CMP $' + intToHex(taddr, 0) + ',Y';
{$ENDIF}
tempflag:=Ps.off;
acc := a;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,acc
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
Ps.off:=tempflag;
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* cmp instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* cmp instruction 2005/12/26 *
//*---------------start-------------------*
$C1: //indirect,x
begin
{$IFDEF debug}
curIns := 'CMP ($' + intToHex(memread(pc + 1), 0) + ',X)';
{$ENDIF}
taddr:=IIXAddress(pc,x);
tempbyte:=memread(taddr);
tempflag:=Ps.off;
acc := a;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,acc
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
Ps.off:=tempflag;
inc(cycles, 6);
inc(pc, 2);
end;
//* *
//* cmp instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* cmp instruction 2005/12/26 *
//*---------------start-------------------*
$D1: //(indirect),y
begin
{$IFDEF debug}
curIns := 'CMP ($' + intToHex(memread(pc + 1), 0) + '),Y ';
{$ENDIF}
taddr:=IIyAddress(pc,y);
tempbyte:=memread(taddr);
tempflag:=Ps.off;
acc := a;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,acc
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
Ps.off:=tempflag;
inc(cycles, 5);
inc(pc, 2);
end;
//* *
//* cmp instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* cpx instruction 2005/12/26 *
//*---------------start-------------------*
$E0: //immediate
begin
{$IFDEF debug}
curIns := 'CPX #$' + intToHex(memread(pc + 1), 0);
{$ENDIF}
tempflag:=Ps.off;
tempbyte := memread(pc + 1);
xr := x;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,xr
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
Ps.off:=tempflag;
inc(cycles, 2);
inc(pc, 2);
end;
//* *
//* cpx instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* cpx instruction 2005/12/26 *
//*---------------start-------------------*
$E4: //zero page
begin
taddr:=ZpAddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'CPX $' + intToHex(taddr, 0);
{$ENDIF}
tempflag:=Ps.off;
xr := x;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,xr
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
Ps.off:=tempflag;
inc(cycles, 3);
inc(pc, 2);
end;
//* *
//* cpx instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* cpx instruction 2005/12/26 *
//*---------------start-------------------*
$EC: //absolute
begin
taddr:=AbAddress(pc);
tempbyte :=memread(taddr);
{$IFDEF debug}
curIns := 'CPX $' + intToHex(taddr, 0);
{$ENDIF}
tempflag:=Ps.off;
xr := x;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,xr
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
Ps.off:=tempflag;
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* cpx instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* cpy instruction 2005/12/26 *
//*---------------start-------------------*
$C0: //immediate
begin
{$IFDEF debug}
curIns := 'CPY #$' + intToHex(memread(pc + 1), 0);
{$ENDIF}
tempflag:=Ps.off;
tempbyte := memread(pc + 1);
yr := y;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,yr
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
Ps.off:=tempflag;
inc(cycles, 2);
inc(pc, 2);
end;
//* *
//* cpy instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* cpy instruction 2005/12/26 *
//*---------------start-------------------*
$C4: //zero page
begin
taddr:=ZpAddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'CPY $' + intToHex(taddr, 0);
{$ENDIF}
tempflag:=Ps.off;
yr := y;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,yr
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
Ps.off:=tempflag;
inc(cycles, 3);
inc(pc, 2);
end;
//* *
//* cpy instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* cpy instruction 2005/12/26 *
//*---------------start-------------------*
$CC: //absolute
begin
tempflag:=Ps.off;
taddr:=AbAddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'CPY $' + intToHex(taddr, 0);
{$ENDIF}
yr := y;
psw := psTopsw;
asm
mov ah,psw
sahf
mov al,yr
cmp al,tempbyte
cmc
lahf
mov psw,ah
end;
pswTops(psw);
ps.off:=tempflag;
inc(cycles, 4);
inc(pc, 3);
end;
//* *
//* cpy instruction 2005/12/26 *
//*---------------end---------------------*
//* *
//* dec instruction 2005/12/27 *
//*---------------start-------------------*
$C6: //zero page
begin
taddr:=ZpAddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'DEC $ ' + intToHex(taddr, 0);
{$ENDIF}
asm
dec tempbyte
end;
memwrite(taddr, tempbyte);
setnz(tempbyte);
inc(cycles, 5);
inc(pc, 2);
end;
//* *
//* dec instruction 2005/12/27 *
//*---------------end---------------------*
//* *
//* dec instruction 2005/12/27 *
//*---------------start-------------------*
$D6: //zero page,x
begin
taddr:=IzpAddress(pc,x);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'DEC $' + intToHex(memread(pc + 1), 0) + ',X ';
{$ENDIF}
asm
dec tempbyte
end;
memwrite(taddr, tempbyte);
setnz(tempbyte);
inc(cycles, 6);
inc(pc, 2);
end;
//* *
//* dec instruction 2005/12/27 *
//*---------------end---------------------*
//* *
//* dec instruction 2005/12/27 *
//*---------------start-------------------*
$CE: //absolute
begin
taddr:=AbAddress(pc);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'DEC $' + intToHex(taddr, 0);
{$ENDIF}
asm
dec tempbyte
end;
memwrite(taddr, tempbyte);
setnz(tempbyte);
inc(cycles, 6);
inc(pc, 3);
end;
//* *
//* dec instruction 2005/12/27 *
//*---------------end---------------------*
//* *
//* dec instruction 2005/12/27 *
//*---------------start-------------------*
$DE: //absolute,x
begin
taddr:=IABAddress(pc,x);
tempbyte:=memread(taddr);
{$IFDEF debug}
curIns := 'DEC $' + intToHex(taddr-x, 0) + ',X';
{$ENDIF}
asm
dec tempbyte
end;
memwrite(taddr, tempbyte);
setnz(tempbyte);
inc(cycles, 7);
inc(pc, 3);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -