Add files via upload

This commit is contained in:
Tito Hinostroza 2020-10-22 21:48:21 -05:00 committed by GitHub
parent 1b6b5324c2
commit 09fe8183f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1693 additions and 30 deletions

View File

@ -1,3 +1,8 @@
0.5
===
04/09/2020: Se mueve el método FindOpcode() fuera del objeto TP6502Instruct.
22/10/2020: Se agrega protección de dirección excesiva, a TCPUCore.addTopLabel().
0.4
===
Se corrige un error con la ejecución de la instrucción ROL.

View File

@ -21,18 +21,18 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<TopLine Value="114"/>
<CursorPos X="18" Y="131"/>
<CursorPos X="22" Y="129"/>
<UsageCount Value="75"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\P6502utils.pas"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="1045"/>
<CursorPos X="8" Y="977"/>
<TopLine Value="1018"/>
<CursorPos X="20" Y="1060"/>
<UsageCount Value="38"/>
<Bookmarks Count="1">
<Item0 Y="1208" ID="1"/>

View File

@ -203,7 +203,6 @@ type
procedure cod_REL_JMP_at(iRam0: integer; const k: word);
function codInsert(iRam0, nInsert, nWords: integer): boolean;
public //Aditional methods
function FindOpcode(Op: string): TP6502Inst; //Find Opcode
function IsRelJump(idInst: TP6502Inst): boolean; //Idnetify realtive jumps Opcodes
procedure GenHex(hexFile: string; startAddr: integer = - 1); //genera un archivo hex
procedure DumpCodeAsm(lOut: TStrings; incAdrr, incValues, incCom,
@ -217,8 +216,31 @@ var //Global variables
//mnemónico de las instrucciones
PIC16InstName: array[low(TP6502Inst)..high(TP6502Inst)] of TP6502Instruct;
function FindOpcode(txt: string; out opCode: TP6502Inst): boolean;
implementation
function FindOpcode(txt: string; out opCode: TP6502Inst): boolean;
{Search a string that represent an instruction (Opcode). If found, returns TRUE and
the instruction identifier in "opCode", otherwise returns FALSE and "i_Inval" in
"opCode". }
var
idInst: TP6502Inst;
tmp: String;
begin
tmp := UpperCase(txt);
for idInst := low(TP6502Inst) to high(TP6502Inst) do begin
if PIC16InstName[idInst].name = tmp then begin
opCode := idInst;
exit(true);
end;
end;
//No found.
opCode := i_Inval;
exit(false);
end;
{ TP6502Instruct }
procedure TP6502Instruct.Init(name0: string);
@ -390,29 +412,6 @@ begin
ram[i] := ram[i-nInsert];
end;
end;
//procedure TP6502.BTFSC_sw_BTFSS(iRam0: integer);
//{Exchange instruction i_BTFSC to i_BTFSS, or viceversa, in the specified address.}
//begin
// //Solo necesita cambiar el bit apropiado
// ram[iRam0].value := ram[iRam0].value XOR %10000000000;
//end;
function TP6502.FindOpcode(Op: string): TP6502Inst;
{Search a string that represent an instruction (Opcode). If found, returns the
instruction identifier, otherwise returns "i_Inval". }
var
idInst: TP6502Inst;
tmp: String;
begin
tmp := UpperCase(Op);
for idInst := low(TP6502Inst) to high(TP6502Inst) do begin
if PIC16InstName[idInst].name = tmp then begin
Result := idInst;
exit;
end;
end;
//No found.
Result := i_Inval;
end;
function TP6502.IsRelJump(idInst: TP6502Inst): boolean;
{Returns TRUE if the instruction accept the relative address mode}
begin

1651
P65C02utils.pas Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,10 @@
# P65Utils
Utilities for the CPU 6502
# P65Utils 0.5
Pascal utilities for the CPU 6502.
This utilities are used by the compiler P65Pas: https://github.com/t-edson/P65Pas
Content:
- CPUCore.pas -> Unit with basic definitions of 6502 CPU families.
- P6502utils.pas -> Unit with Pascal definitions for the CPU 6502.
- P65C02utils.pas -> Unit with Pascal definitions for the CPU 65C02.