mirror of
https://github.com/t-edson/P65Utils.git
synced 2025-02-08 15:31:07 +00:00
Add files via upload
This commit is contained in:
parent
4205b2147d
commit
1b6b5324c2
@ -1,3 +1,10 @@
|
||||
0.4
|
||||
===
|
||||
Se corrige un error con la ejecución de la instrucción ROL.
|
||||
Se traducen algunos comentarios al inglés.
|
||||
Se elimina el campo TP6502.b_ porque no se usa.
|
||||
Se elimina el campo TP6502.k_ porque no se usa.
|
||||
|
||||
0.3
|
||||
===
|
||||
Se elimina la bandera hasDataAdrr y se pasa a usar dataAddr1, como bandera y dirección inicial.
|
||||
|
@ -12,7 +12,7 @@
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
<UsageCount Value="74"/>
|
||||
<UsageCount Value="75"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
@ -21,9 +21,9 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
<TopLine Value="135"/>
|
||||
<CursorPos X="20" Y="154"/>
|
||||
<UsageCount Value="74"/>
|
||||
<TopLine Value="114"/>
|
||||
<CursorPos X="18" Y="131"/>
|
||||
<UsageCount Value="75"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
@ -31,19 +31,19 @@
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="171"/>
|
||||
<CursorPos Y="171"/>
|
||||
<TopLine Value="1045"/>
|
||||
<CursorPos X="8" Y="977"/>
|
||||
<UsageCount Value="38"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 Y="1211" ID="1"/>
|
||||
<Item0 Y="1208" ID="1"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\CPUCore.pas"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="124"/>
|
||||
<CursorPos X="31" Y="121"/>
|
||||
<TopLine Value="121"/>
|
||||
<CursorPos X="6" Y="155"/>
|
||||
<UsageCount Value="31"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 Y="117" ID="3"/>
|
||||
@ -58,124 +58,49 @@
|
||||
<UsageCount Value="9"/>
|
||||
</Unit4>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<JumpHistory Count="11" HistoryIndex="10">
|
||||
<Position1>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="355" Column="65" TopLine="252"/>
|
||||
<Caret Line="1085" Column="49" TopLine="1064"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="368" Column="5" TopLine="265"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="373" Column="32" TopLine="265"/>
|
||||
<Caret Line="370" Column="8" TopLine="354"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="1060" Column="49" TopLine="963"/>
|
||||
<Caret Line="369" Column="28" TopLine="354"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="1085" Column="49" TopLine="1064"/>
|
||||
<Caret Line="1148" TopLine="1141"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="207" Column="33" TopLine="180"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="370" Column="8" TopLine="354"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="369" Column="28" TopLine="354"/>
|
||||
<Caret Line="1077" Column="62" TopLine="957"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="1148" TopLine="1141"/>
|
||||
<Caret Line="1446" Column="12" TopLine="1155"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="207" Column="33" TopLine="180"/>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="1590" Column="22" TopLine="1571"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="61" Column="10" TopLine="43"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="1077" Column="62" TopLine="957"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="..\p6502utils.pas"/>
|
||||
<Caret Line="1446" Column="12" TopLine="1155"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="..\CPUCore.pas"/>
|
||||
<Caret Line="155" Column="6" TopLine="121"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="152" Column="18"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="19" Column="38"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="144" Column="26" TopLine="20"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="201" Column="42" TopLine="180"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="..\CPUCore.pas"/>
|
||||
<Caret Line="88" Column="3" TopLine="71"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="1129" Column="48" TopLine="1113"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="..\CPUCore.pas"/>
|
||||
<Caret Line="88" Column="16" TopLine="71"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="..\CPUCore.pas"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="1129" Column="48" TopLine="1113"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="..\CPUCore.pas"/>
|
||||
<Caret Line="88" Column="42" TopLine="37"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="1134" Column="7" TopLine="1115"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="..\CPUCore.pas"/>
|
||||
<Caret Line="64" Column="24" TopLine="37"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="1172" Column="12" TopLine="1150"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="131" Column="18" TopLine="113"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="234" Column="30" TopLine="211"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="..\P6502utils.pas"/>
|
||||
<Caret Line="1651" Column="5" TopLine="1620"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -8,7 +8,7 @@ object Form1: TForm1
|
||||
ClientWidth = 530
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
LCLVersion = '2.0.0.4'
|
||||
LCLVersion = '2.0.4.0'
|
||||
object Memo1: TMemo
|
||||
Left = 10
|
||||
Height = 312
|
||||
|
@ -107,7 +107,7 @@ var
|
||||
l: String;
|
||||
idInst: TP6502Inst;
|
||||
Inst: String;
|
||||
stx, lin, Par: String;
|
||||
lin, Par: String;
|
||||
n: word;
|
||||
begin
|
||||
pic.iRam:=0; //Start to code at $0000
|
||||
|
@ -132,16 +132,14 @@ const //Constants of address and bit positions for some registers
|
||||
_N = 7;
|
||||
// _IRP = 7;
|
||||
type
|
||||
{Objeto que representa al hardware de un PIC de la serie 16}
|
||||
{Object representing CPU6502 hardware}
|
||||
{ TP6502 }
|
||||
TP6502 = class(TCPUCore)
|
||||
public //Campos para desensamblar instrucciones
|
||||
idIns: TP6502Inst; //ID de Instrucción.
|
||||
modIns: TP6502AddMode; //Modo de direccionamiento
|
||||
parIns: word; //Parámetro de instrucción. Válido solo en algunas instrucciones.
|
||||
b_ : byte; //Bit destino. Válido solo en algunas instrucciones.
|
||||
k_ : word; //Parámetro Literal. Válido solo en algunas instrucciones.
|
||||
private //Campos para procesar instrucciones
|
||||
public //Fields to disassembler instructions
|
||||
idIns: TP6502Inst; //Instruction ID
|
||||
modIns: TP6502AddMode; //Address mode
|
||||
parIns: word; //Instruction parameter. Only valid for some instructions.
|
||||
private //Fields to process instructions
|
||||
function GetINTCON: byte;
|
||||
function GetINTCON_GIE: boolean;
|
||||
function GetSTATUS_C: boolean;
|
||||
@ -160,11 +158,11 @@ type
|
||||
procedure SetFRAM(value: byte);
|
||||
function GetFRAM: byte;
|
||||
public //Fields to modelate internal register (For Simulation)
|
||||
W : byte; //Work register
|
||||
X,Y : byte; //Index registers
|
||||
W : byte; //Work register
|
||||
X,Y : byte; //Index registers
|
||||
PC : TWordRec; //PC as record to fast access for bytes
|
||||
SP : byte; //Stack Pointer
|
||||
SR : byte; //Status Register
|
||||
SP : byte; //Stack Pointer
|
||||
SR : byte; //Status Register
|
||||
property STATUS: byte read SR;
|
||||
property STATUS_N: boolean read GetSTATUS_N write SetSTATUS_N;
|
||||
property STATUS_V: boolean read GetSTATUS_V write SetSTATUS_V;
|
||||
@ -197,7 +195,7 @@ type
|
||||
function UsedMemRAM: word; //devuelve el total de memoria RAM usada
|
||||
procedure ExploreUsed(rutExplorRAM: TCPURutExplorRAM); //devuelve un reporte del uso de la RAM
|
||||
function ValidRAMaddr(addr: word): boolean; //indica si una posición de memoria es válida
|
||||
public //Métthods to code instructions according to syntax
|
||||
public //Methods to code instructions according to syntax
|
||||
procedure useRAMCode;
|
||||
procedure codByte(const value: byte; isData: boolean);
|
||||
procedure codAsm(const inst: TP6502Inst; addMode: TP6502AddMode; param: word);
|
||||
@ -215,7 +213,7 @@ type
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
var //variables globales
|
||||
var //Global variables
|
||||
//mnemónico de las instrucciones
|
||||
PIC16InstName: array[low(TP6502Inst)..high(TP6502Inst)] of TP6502Instruct;
|
||||
|
||||
@ -251,10 +249,9 @@ end;
|
||||
|
||||
{ TP6502 }
|
||||
procedure TP6502.useRAMCode;
|
||||
{Marca la posición actual, como usada, e incrementa el puntero iRam. Si hay error,
|
||||
actualiza el campo "MsjError"}
|
||||
{Set current position as used and increase the index iRam. If error;update "MsjError"}
|
||||
begin
|
||||
ram[iRam].used := ruCode; //marca como usado
|
||||
ram[iRam].used := ruCode; //Mark as used.
|
||||
inc(iRam);
|
||||
end;
|
||||
procedure TP6502.codByte(const value: byte; isData: boolean);
|
||||
@ -266,7 +263,7 @@ begin
|
||||
end;
|
||||
ram[iRam].value := value;
|
||||
if isData then ram[iRam].name := 'data';
|
||||
ram[iRam].used := ruData; //marca como usado
|
||||
ram[iRam].used := ruData; //Mark as used.
|
||||
inc(iRam);
|
||||
end;
|
||||
procedure TP6502.codAsm(const inst: TP6502Inst; addMode: TP6502AddMode; param: word);
|
||||
@ -286,8 +283,8 @@ begin
|
||||
exit;
|
||||
end;
|
||||
ram[iRam].value := rInst.instrInform[addMode].Opcode;
|
||||
useRAMCode; //marca como usado e incrementa puntero.
|
||||
//Codifica parámetros
|
||||
useRAMCode; //Set as used and increase index.
|
||||
//Encode parameters
|
||||
case addMode of
|
||||
aImplicit: begin
|
||||
//No parameters
|
||||
@ -400,8 +397,8 @@ end;
|
||||
// ram[iRam0].value := ram[iRam0].value XOR %10000000000;
|
||||
//end;
|
||||
function TP6502.FindOpcode(Op: string): TP6502Inst;
|
||||
{Busca una cádena que represente a una instrucción (Opcode). Si encuentra devuelve
|
||||
el identificador de instrucción . Si no encuentra devuelve "i_Inval". }
|
||||
{Search a string that represent an instruction (Opcode). If found, returns the
|
||||
instruction identifier, otherwise returns "i_Inval". }
|
||||
var
|
||||
idInst: TP6502Inst;
|
||||
tmp: String;
|
||||
@ -413,7 +410,7 @@ begin
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
//No encontró
|
||||
//No found.
|
||||
Result := i_Inval;
|
||||
end;
|
||||
function TP6502.IsRelJump(idInst: TP6502Inst): boolean;
|
||||
@ -983,7 +980,7 @@ begin
|
||||
else tmp := ram[addr].value;
|
||||
|
||||
C_tmp := STATUS_C;
|
||||
STATUS_C := (tmp and $07) <> 0; //Get bit 7
|
||||
STATUS_C := (tmp and $80) <> 0; //Get bit 7
|
||||
tmp := byte(tmp << 1);
|
||||
if C_tmp then tmp := tmp or $01; //Insert bit 0
|
||||
STATUS_Z := tmp = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user