mirror of
https://github.com/t-edson/P65Utils.git
synced 2024-09-27 11:56:21 +00:00
Add files via upload
This commit is contained in:
parent
1b6b5324c2
commit
09fe8183f8
@ -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
|
0.4
|
||||||
===
|
===
|
||||||
Se corrige un error con la ejecución de la instrucción ROL.
|
Se corrige un error con la ejecución de la instrucción ROL.
|
||||||
|
@ -21,18 +21,18 @@
|
|||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="Unit1"/>
|
<UnitName Value="Unit1"/>
|
||||||
|
<IsVisibleTab Value="True"/>
|
||||||
<TopLine Value="114"/>
|
<TopLine Value="114"/>
|
||||||
<CursorPos X="18" Y="131"/>
|
<CursorPos X="22" Y="129"/>
|
||||||
<UsageCount Value="75"/>
|
<UsageCount Value="75"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="..\P6502utils.pas"/>
|
<Filename Value="..\P6502utils.pas"/>
|
||||||
<IsVisibleTab Value="True"/>
|
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="1"/>
|
||||||
<TopLine Value="1045"/>
|
<TopLine Value="1018"/>
|
||||||
<CursorPos X="8" Y="977"/>
|
<CursorPos X="20" Y="1060"/>
|
||||||
<UsageCount Value="38"/>
|
<UsageCount Value="38"/>
|
||||||
<Bookmarks Count="1">
|
<Bookmarks Count="1">
|
||||||
<Item0 Y="1208" ID="1"/>
|
<Item0 Y="1208" ID="1"/>
|
||||||
|
@ -203,7 +203,6 @@ type
|
|||||||
procedure cod_REL_JMP_at(iRam0: integer; const k: word);
|
procedure cod_REL_JMP_at(iRam0: integer; const k: word);
|
||||||
function codInsert(iRam0, nInsert, nWords: integer): boolean;
|
function codInsert(iRam0, nInsert, nWords: integer): boolean;
|
||||||
public //Aditional methods
|
public //Aditional methods
|
||||||
function FindOpcode(Op: string): TP6502Inst; //Find Opcode
|
|
||||||
function IsRelJump(idInst: TP6502Inst): boolean; //Idnetify realtive jumps Opcodes
|
function IsRelJump(idInst: TP6502Inst): boolean; //Idnetify realtive jumps Opcodes
|
||||||
procedure GenHex(hexFile: string; startAddr: integer = - 1); //genera un archivo hex
|
procedure GenHex(hexFile: string; startAddr: integer = - 1); //genera un archivo hex
|
||||||
procedure DumpCodeAsm(lOut: TStrings; incAdrr, incValues, incCom,
|
procedure DumpCodeAsm(lOut: TStrings; incAdrr, incValues, incCom,
|
||||||
@ -217,8 +216,31 @@ var //Global variables
|
|||||||
//mnemónico de las instrucciones
|
//mnemónico de las instrucciones
|
||||||
PIC16InstName: array[low(TP6502Inst)..high(TP6502Inst)] of TP6502Instruct;
|
PIC16InstName: array[low(TP6502Inst)..high(TP6502Inst)] of TP6502Instruct;
|
||||||
|
|
||||||
|
|
||||||
|
function FindOpcode(txt: string; out opCode: TP6502Inst): boolean;
|
||||||
|
|
||||||
implementation
|
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 }
|
{ TP6502Instruct }
|
||||||
|
|
||||||
procedure TP6502Instruct.Init(name0: string);
|
procedure TP6502Instruct.Init(name0: string);
|
||||||
@ -390,29 +412,6 @@ begin
|
|||||||
ram[i] := ram[i-nInsert];
|
ram[i] := ram[i-nInsert];
|
||||||
end;
|
end;
|
||||||
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;
|
function TP6502.IsRelJump(idInst: TP6502Inst): boolean;
|
||||||
{Returns TRUE if the instruction accept the relative address mode}
|
{Returns TRUE if the instruction accept the relative address mode}
|
||||||
begin
|
begin
|
||||||
|
1651
P65C02utils.pas
Normal file
1651
P65C02utils.pas
Normal file
File diff suppressed because it is too large
Load Diff
12
README.md
12
README.md
@ -1,2 +1,10 @@
|
|||||||
# P65Utils
|
# P65Utils 0.5
|
||||||
Utilities for the CPU 6502
|
|
||||||
|
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.
|
Loading…
Reference in New Issue
Block a user