mirror of
https://github.com/t-edson/P65Utils.git
synced 2024-06-08 11:32:30 +00:00
Add files via upload
This commit is contained in:
parent
ee93649392
commit
1d05a351f9
32
CPUCore.pas
32
CPUCore.pas
|
@ -21,13 +21,15 @@ type
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TCPUCellState = (
|
TCPUCellState = (
|
||||||
cs_implemen, //Implemented. Can be used.
|
cs_impleSFR, //Implemented. Used by Oeprative System o Kernel
|
||||||
|
cs_impleGPR, //Implemented. Can be used.
|
||||||
cs_unimplem //Not implemented.
|
cs_unimplem //Not implemented.
|
||||||
);
|
);
|
||||||
TCPURamUsed = (
|
TCPURamUsed = (
|
||||||
ruUnused,
|
ruUnused, //(NOT included in PRG output file)
|
||||||
ruCode, //Used for code
|
ruCode, //Used for code (included in PRG output file)
|
||||||
ruVar //Used for variable
|
ruData, //Used for variables (included in PRG output file)
|
||||||
|
ruAbsData //Used for variables in absolute positions (NOT included in PRG output file)
|
||||||
);
|
);
|
||||||
|
|
||||||
type //Models for RAM memory
|
type //Models for RAM memory
|
||||||
|
@ -103,6 +105,7 @@ type
|
||||||
procedure DisableAllRAM;
|
procedure DisableAllRAM;
|
||||||
procedure SetStatRAM(i1, i2: word; status0: TCPUCellState);
|
procedure SetStatRAM(i1, i2: word; status0: TCPUCellState);
|
||||||
function SetStatRAMCom(strDef: string): boolean;
|
function SetStatRAMCom(strDef: string): boolean;
|
||||||
|
function SetDataAddr(strDef: string): boolean;
|
||||||
function HaveConsecRAM(const i, n: word; maxRam: dword): boolean; //Indica si hay "n" bytes libres
|
function HaveConsecRAM(const i, n: word; maxRam: dword): boolean; //Indica si hay "n" bytes libres
|
||||||
procedure UseConsecRAM(const i, n: word); //Ocupa "n" bytes en la posición "i"
|
procedure UseConsecRAM(const i, n: word); //Ocupa "n" bytes en la posición "i"
|
||||||
procedure SetSharedUnused;
|
procedure SetSharedUnused;
|
||||||
|
@ -148,7 +151,7 @@ end;
|
||||||
function TCPURamCell.Avail: boolean;
|
function TCPURamCell.Avail: boolean;
|
||||||
{Indica si el registro es una dirección disponible en la memoria RAM.}
|
{Indica si el registro es una dirección disponible en la memoria RAM.}
|
||||||
begin
|
begin
|
||||||
Result := (state = cs_implemen);
|
Result := (state = cs_impleGPR);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCPUCore }
|
{ TCPUCore }
|
||||||
|
@ -239,10 +242,10 @@ begin
|
||||||
end;
|
end;
|
||||||
staMem := copy(com, 9, 3);
|
staMem := copy(com, 9, 3);
|
||||||
case staMem of
|
case staMem of
|
||||||
'IMP': state := cs_implemen;
|
'IMP': state := cs_impleGPR;
|
||||||
'NIM': state := cs_unimplem;
|
'NIM': state := cs_unimplem;
|
||||||
else
|
else
|
||||||
MsjError := 'Memory definition syntax error: Expected SFR or GPR';
|
MsjError := 'Memory definition syntax error: Expected IMP or NIM';
|
||||||
exit(false);
|
exit(false);
|
||||||
end;
|
end;
|
||||||
//Ya se tienen los parámetros, para definir la memoria
|
//Ya se tienen los parámetros, para definir la memoria
|
||||||
|
@ -251,6 +254,10 @@ begin
|
||||||
finally
|
finally
|
||||||
coms.Destroy;
|
coms.Destroy;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
function TCPUCore.SetDataAddr(strDef: string): boolean;
|
||||||
|
begin
|
||||||
|
|
||||||
end;
|
end;
|
||||||
function TCPUCore.HaveConsecRAM(const i, n: word; maxRam: dword): boolean;
|
function TCPUCore.HaveConsecRAM(const i, n: word; maxRam: dword): boolean;
|
||||||
{Indica si hay "n" bytes consecutivos libres en la posicióm "i", en RAM.
|
{Indica si hay "n" bytes consecutivos libres en la posicióm "i", en RAM.
|
||||||
|
@ -263,7 +270,7 @@ begin
|
||||||
c := 0;
|
c := 0;
|
||||||
j := i;
|
j := i;
|
||||||
while (j<=maxRam) and (c<n) do begin
|
while (j<=maxRam) and (c<n) do begin
|
||||||
if (ram[j].state <> cs_implemen) or (ram[j].used<>ruUnused) then exit;
|
if (ram[j].state <> cs_impleGPR) or (ram[j].used<>ruUnused) then exit;
|
||||||
inc(c); //verifica siguiente
|
inc(c); //verifica siguiente
|
||||||
inc(j);
|
inc(j);
|
||||||
end;
|
end;
|
||||||
|
@ -278,7 +285,7 @@ procedure TCPUCore.UseConsecRAM(const i, n: word);
|
||||||
var j: word;
|
var j: word;
|
||||||
begin
|
begin
|
||||||
for j:=i to i+n-1 do begin
|
for j:=i to i+n-1 do begin
|
||||||
ram[j].used := ruVar; //todos los bits
|
ram[j].used := ruData; //todos los bits
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
procedure TCPUCore.SetSharedUnused;
|
procedure TCPUCore.SetSharedUnused;
|
||||||
|
@ -287,7 +294,7 @@ var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
for i:=0 to high(ram) do begin
|
for i:=0 to high(ram) do begin
|
||||||
if (ram[i].state = cs_implemen) and (ram[i].shared) then begin
|
if (ram[i].shared) and (ram[i].state = cs_impleGPR) then begin
|
||||||
ram[i].used := ruUnused;
|
ram[i].used := ruUnused;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -298,8 +305,8 @@ var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
for i:=0 to high(ram) do begin
|
for i:=0 to high(ram) do begin
|
||||||
if (ram[i].state = cs_implemen) and (ram[i].shared) then begin
|
if (ram[i].shared) and (ram[i].state = cs_impleGPR) then begin
|
||||||
ram[i].used := ruVar; //Set as used for variables
|
ram[i].used := ruData; //Set as used for variables
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -354,6 +361,7 @@ end;
|
||||||
procedure TCPUCore.addTopComm(comm: string; replace: boolean);
|
procedure TCPUCore.addTopComm(comm: string; replace: boolean);
|
||||||
{Agrega un comentario de línea al código en la posición de memoria actual}
|
{Agrega un comentario de línea al código en la posición de memoria actual}
|
||||||
begin
|
begin
|
||||||
|
if iRam>=CPUMAXRAM then exit;
|
||||||
if replace then begin
|
if replace then begin
|
||||||
ram[iRam].topComment := comm;
|
ram[iRam].topComment := comm;
|
||||||
end else begin
|
end else begin
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
Se cambian variables a tipo dword para evitar desborde en TP6502.GetFreeBytes().
|
Se cambian variables a tipo dword para evitar desborde en TP6502.GetFreeBytes().
|
||||||
Se cambia el tipo del campo TCPURamCell.used al enumerado TCPURamUsed, para dar más libertad
|
Se cambia el tipo del campo TCPURamCell.used al enumerado TCPURamUsed, para dar más libertad
|
||||||
para definir a la RAM.
|
para definir a la RAM.
|
||||||
|
Se agrega un estado más para la memoria RAM.
|
||||||
|
|
||||||
0.1
|
0.1
|
||||||
===
|
===
|
||||||
|
|
Binary file not shown.
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="10"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
@ -9,7 +9,6 @@
|
||||||
<Title Value="project1"/>
|
<Title Value="project1"/>
|
||||||
<ResourceType Value="res"/>
|
<ResourceType Value="res"/>
|
||||||
<UseXPManifest Value="True"/>
|
<UseXPManifest Value="True"/>
|
||||||
<Icon Value="0"/>
|
|
||||||
</General>
|
</General>
|
||||||
<i18n>
|
<i18n>
|
||||||
<EnableI18N LFM="False"/>
|
<EnableI18N LFM="False"/>
|
||||||
|
@ -21,9 +20,10 @@
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
</PublishOptions>
|
</PublishOptions>
|
||||||
<RunParams>
|
<RunParams>
|
||||||
<local>
|
<FormatVersion Value="2"/>
|
||||||
<FormatVersion Value="1"/>
|
<Modes Count="1">
|
||||||
</local>
|
<Mode0 Name="default"/>
|
||||||
|
</Modes>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="1">
|
<RequiredPackages Count="1">
|
||||||
<Item1>
|
<Item1>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectSession>
|
<ProjectSession>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<Version Value="10"/>
|
<Version Value="11"/>
|
||||||
<BuildModes Active="Default"/>
|
<BuildModes Active="Default"/>
|
||||||
<Units Count="5">
|
<Units Count="5">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<WindowIndex Value="-1"/>
|
<WindowIndex Value="-1"/>
|
||||||
<TopLine Value="-1"/>
|
<TopLine Value="-1"/>
|
||||||
<CursorPos X="-1" Y="-1"/>
|
<CursorPos X="-1" Y="-1"/>
|
||||||
<UsageCount Value="60"/>
|
<UsageCount Value="61"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="unit1.pas"/>
|
<Filename Value="unit1.pas"/>
|
||||||
|
@ -21,19 +21,18 @@
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="Unit1"/>
|
<UnitName Value="Unit1"/>
|
||||||
<TopLine Value="152"/>
|
<IsVisibleTab Value="True"/>
|
||||||
<CursorPos Y="171"/>
|
<TopLine Value="135"/>
|
||||||
<UsageCount Value="60"/>
|
<CursorPos X="20" Y="154"/>
|
||||||
|
<UsageCount Value="61"/>
|
||||||
<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="1115"/>
|
<TopLine Value="178"/>
|
||||||
<CursorPos X="24" Y="1136"/>
|
<CursorPos X="15" Y="202"/>
|
||||||
<FoldState Value=" TL00C1414113 T5J0{W111 TCjEK5 T7jPJC T8jQ26132 T3m8051]ZD2]E0nFD7I2K T6n601]gHnEF%2L"/>
|
|
||||||
<UsageCount Value="32"/>
|
<UsageCount Value="32"/>
|
||||||
<Bookmarks Count="1">
|
<Bookmarks Count="1">
|
||||||
<Item0 Y="1211" ID="1"/>
|
<Item0 Y="1211" ID="1"/>
|
||||||
|
@ -43,9 +42,8 @@
|
||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="..\CPUCore.pas"/>
|
<Filename Value="..\CPUCore.pas"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="2"/>
|
||||||
<TopLine Value="37"/>
|
<TopLine Value="98"/>
|
||||||
<CursorPos X="42" Y="88"/>
|
<CursorPos X="31" Y="121"/>
|
||||||
<FoldState Value=" TL0040211193 T4801 T5A[64CED8 T7dC6 T8iE230122145 T3kX0331]mHl8B4]i6lI01A T0leR3C pjAjYN3857 TDmZ2e]ZEnU]+'"/>
|
|
||||||
<UsageCount Value="25"/>
|
<UsageCount Value="25"/>
|
||||||
<Bookmarks Count="1">
|
<Bookmarks Count="1">
|
||||||
<Item0 Y="117" ID="3"/>
|
<Item0 Y="117" ID="3"/>
|
||||||
|
@ -60,122 +58,124 @@
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit4>
|
</Unit4>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="29" HistoryIndex="28">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
<Caret Line="363" Column="17" TopLine="254"/>
|
<Caret Line="259" Column="21" TopLine="218"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
|
<Caret Line="355" Column="65" TopLine="252"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
<Caret Line="226" TopLine="211"/>
|
<Caret Line="368" Column="5" TopLine="265"/>
|
||||||
</Position3>
|
</Position3>
|
||||||
<Position4>
|
<Position4>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
|
<Caret Line="373" Column="32" TopLine="265"/>
|
||||||
</Position4>
|
</Position4>
|
||||||
<Position5>
|
<Position5>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
<Caret Line="259" Column="21" TopLine="218"/>
|
<Caret Line="1060" Column="49" TopLine="963"/>
|
||||||
</Position5>
|
</Position5>
|
||||||
<Position6>
|
<Position6>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
<Caret Line="355" Column="65" TopLine="252"/>
|
<Caret Line="1085" Column="49" TopLine="1064"/>
|
||||||
</Position6>
|
</Position6>
|
||||||
<Position7>
|
<Position7>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
<Caret Line="368" Column="5" TopLine="265"/>
|
|
||||||
</Position7>
|
</Position7>
|
||||||
<Position8>
|
<Position8>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
<Caret Line="373" Column="32" TopLine="265"/>
|
<Caret Line="370" Column="8" TopLine="354"/>
|
||||||
</Position8>
|
</Position8>
|
||||||
<Position9>
|
<Position9>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
<Caret Line="1060" Column="49" TopLine="963"/>
|
<Caret Line="369" Column="28" TopLine="354"/>
|
||||||
</Position9>
|
</Position9>
|
||||||
<Position10>
|
<Position10>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
<Caret Line="1085" Column="49" TopLine="1064"/>
|
<Caret Line="1148" TopLine="1141"/>
|
||||||
</Position10>
|
</Position10>
|
||||||
<Position11>
|
<Position11>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
|
<Caret Line="207" Column="33" TopLine="180"/>
|
||||||
</Position11>
|
</Position11>
|
||||||
<Position12>
|
<Position12>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
<Caret Line="370" Column="8" TopLine="354"/>
|
|
||||||
</Position12>
|
</Position12>
|
||||||
<Position13>
|
<Position13>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
<Caret Line="369" Column="28" TopLine="354"/>
|
<Caret Line="1077" Column="62" TopLine="957"/>
|
||||||
</Position13>
|
</Position13>
|
||||||
<Position14>
|
<Position14>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
<Filename Value="..\p6502utils.pas"/>
|
||||||
<Caret Line="1148" TopLine="1141"/>
|
<Caret Line="1446" Column="12" TopLine="1155"/>
|
||||||
</Position14>
|
</Position14>
|
||||||
<Position15>
|
<Position15>
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
|
||||||
<Caret Line="207" Column="33" TopLine="180"/>
|
|
||||||
</Position15>
|
|
||||||
<Position16>
|
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
|
||||||
</Position16>
|
|
||||||
<Position17>
|
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
|
||||||
<Caret Line="1077" Column="62" TopLine="957"/>
|
|
||||||
</Position17>
|
|
||||||
<Position18>
|
|
||||||
<Filename Value="..\p6502utils.pas"/>
|
|
||||||
<Caret Line="1446" Column="12" TopLine="1155"/>
|
|
||||||
</Position18>
|
|
||||||
<Position19>
|
|
||||||
<Filename Value="..\CPUCore.pas"/>
|
<Filename Value="..\CPUCore.pas"/>
|
||||||
<Caret Line="155" Column="6" TopLine="121"/>
|
<Caret Line="155" Column="6" TopLine="121"/>
|
||||||
</Position19>
|
</Position15>
|
||||||
<Position20>
|
<Position16>
|
||||||
<Filename Value="..\P6502utils.pas"/>
|
<Filename Value="..\P6502utils.pas"/>
|
||||||
<Caret Line="152" Column="18"/>
|
<Caret Line="152" Column="18"/>
|
||||||
|
</Position16>
|
||||||
|
<Position17>
|
||||||
|
<Filename Value="..\P6502utils.pas"/>
|
||||||
|
<Caret Line="19" Column="38"/>
|
||||||
|
</Position17>
|
||||||
|
<Position18>
|
||||||
|
<Filename Value="..\P6502utils.pas"/>
|
||||||
|
<Caret Line="144" Column="26" TopLine="20"/>
|
||||||
|
</Position18>
|
||||||
|
<Position19>
|
||||||
|
<Filename Value="..\P6502utils.pas"/>
|
||||||
|
<Caret Line="201" Column="42" TopLine="180"/>
|
||||||
|
</Position19>
|
||||||
|
<Position20>
|
||||||
|
<Filename Value="..\CPUCore.pas"/>
|
||||||
|
<Caret Line="88" Column="3" TopLine="71"/>
|
||||||
</Position20>
|
</Position20>
|
||||||
<Position21>
|
<Position21>
|
||||||
<Filename Value="..\P6502utils.pas"/>
|
<Filename Value="..\P6502utils.pas"/>
|
||||||
<Caret Line="19" Column="38"/>
|
<Caret Line="1129" Column="48" TopLine="1113"/>
|
||||||
</Position21>
|
</Position21>
|
||||||
<Position22>
|
<Position22>
|
||||||
<Filename Value="..\P6502utils.pas"/>
|
|
||||||
<Caret Line="144" Column="26" TopLine="20"/>
|
|
||||||
</Position22>
|
|
||||||
<Position23>
|
|
||||||
<Filename Value="..\P6502utils.pas"/>
|
|
||||||
<Caret Line="201" Column="42" TopLine="180"/>
|
|
||||||
</Position23>
|
|
||||||
<Position24>
|
|
||||||
<Filename Value="..\CPUCore.pas"/>
|
|
||||||
<Caret Line="88" Column="3" TopLine="71"/>
|
|
||||||
</Position24>
|
|
||||||
<Position25>
|
|
||||||
<Filename Value="..\P6502utils.pas"/>
|
|
||||||
<Caret Line="1129" Column="48" TopLine="1113"/>
|
|
||||||
</Position25>
|
|
||||||
<Position26>
|
|
||||||
<Filename Value="..\CPUCore.pas"/>
|
<Filename Value="..\CPUCore.pas"/>
|
||||||
<Caret Line="88" Column="16" TopLine="71"/>
|
<Caret Line="88" Column="16" TopLine="71"/>
|
||||||
|
</Position22>
|
||||||
|
<Position23>
|
||||||
|
<Filename Value="..\CPUCore.pas"/>
|
||||||
|
</Position23>
|
||||||
|
<Position24>
|
||||||
|
<Filename Value="..\P6502utils.pas"/>
|
||||||
|
<Caret Line="1129" Column="48" TopLine="1113"/>
|
||||||
|
</Position24>
|
||||||
|
<Position25>
|
||||||
|
<Filename Value="..\CPUCore.pas"/>
|
||||||
|
<Caret Line="88" Column="42" TopLine="37"/>
|
||||||
|
</Position25>
|
||||||
|
<Position26>
|
||||||
|
<Filename Value="..\P6502utils.pas"/>
|
||||||
|
<Caret Line="1134" Column="7" TopLine="1115"/>
|
||||||
</Position26>
|
</Position26>
|
||||||
<Position27>
|
<Position27>
|
||||||
<Filename Value="..\CPUCore.pas"/>
|
<Filename Value="..\CPUCore.pas"/>
|
||||||
|
<Caret Line="64" Column="24" TopLine="37"/>
|
||||||
</Position27>
|
</Position27>
|
||||||
<Position28>
|
<Position28>
|
||||||
<Filename Value="..\P6502utils.pas"/>
|
<Filename Value="..\P6502utils.pas"/>
|
||||||
<Caret Line="1129" Column="48" TopLine="1113"/>
|
<Caret Line="1172" Column="12" TopLine="1150"/>
|
||||||
</Position28>
|
</Position28>
|
||||||
<Position29>
|
<Position29>
|
||||||
<Filename Value="..\CPUCore.pas"/>
|
<Filename Value="unit1.pas"/>
|
||||||
<Caret Line="88" Column="42" TopLine="37"/>
|
<Caret Line="131" Column="18" TopLine="113"/>
|
||||||
</Position29>
|
</Position29>
|
||||||
<Position30>
|
|
||||||
<Filename Value="..\P6502utils.pas"/>
|
|
||||||
<Caret Line="1134" Column="7" TopLine="1115"/>
|
|
||||||
</Position30>
|
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
<Modes Count="0" ActiveMode="default"/>
|
||||||
|
</RunParams>
|
||||||
</ProjectSession>
|
</ProjectSession>
|
||||||
</CONFIG>
|
</CONFIG>
|
||||||
|
|
Binary file not shown.
|
@ -8,7 +8,7 @@ object Form1: TForm1
|
||||||
ClientWidth = 530
|
ClientWidth = 530
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
LCLVersion = '1.8.0.6'
|
LCLVersion = '2.0.0.4'
|
||||||
object Memo1: TMemo
|
object Memo1: TMemo
|
||||||
Left = 10
|
Left = 10
|
||||||
Height = 312
|
Height = 312
|
||||||
|
|
|
@ -128,7 +128,7 @@ begin
|
||||||
//Extract parameters
|
//Extract parameters
|
||||||
if l = '' then begin
|
if l = '' then begin
|
||||||
//No parameters. Must be Implicit
|
//No parameters. Must be Implicit
|
||||||
pic.codAsmFD(idInst, aImplicit , 0);
|
pic.codAsm(idInst, aImplicit , 0);
|
||||||
if pic.MsjError<>'' then begin
|
if pic.MsjError<>'' then begin
|
||||||
Application.MessageBox(PChar(lin + ':' + pic.MsjError),'');
|
Application.MessageBox(PChar(lin + ':' + pic.MsjError),'');
|
||||||
exit;
|
exit;
|
||||||
|
@ -137,7 +137,7 @@ begin
|
||||||
//It's a string
|
//It's a string
|
||||||
if Par = 'A' then begin
|
if Par = 'A' then begin
|
||||||
//Accumulator mode
|
//Accumulator mode
|
||||||
pic.codAsmFD(idInst, aAcumulat , 0);
|
pic.codAsm(idInst, aAcumulat , 0);
|
||||||
if pic.MsjError<>'' then begin
|
if pic.MsjError<>'' then begin
|
||||||
Application.MessageBox(PChar(lin + ':' + pic.MsjError),'');
|
Application.MessageBox(PChar(lin + ':' + pic.MsjError),'');
|
||||||
exit;
|
exit;
|
||||||
|
@ -149,14 +149,14 @@ begin
|
||||||
//There is a number
|
//There is a number
|
||||||
if n<256 then begin
|
if n<256 then begin
|
||||||
//Zero page. Although could be ,X
|
//Zero page. Although could be ,X
|
||||||
pic.codAsmFD(idInst, aZeroPage , 0);
|
pic.codAsm(idInst, aZeroPage , 0);
|
||||||
if pic.MsjError<>'' then begin
|
if pic.MsjError<>'' then begin
|
||||||
Application.MessageBox(PChar(lin + ':' + pic.MsjError),'');
|
Application.MessageBox(PChar(lin + ':' + pic.MsjError),'');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
//Absolute. Although could be ,X
|
//Absolute. Although could be ,X
|
||||||
pic.codAsmFD(idInst, aAbsolute , 0);
|
pic.codAsm(idInst, aAbsolute , 0);
|
||||||
if pic.MsjError<>'' then begin
|
if pic.MsjError<>'' then begin
|
||||||
Application.MessageBox(PChar(lin + ':' + pic.MsjError),'');
|
Application.MessageBox(PChar(lin + ':' + pic.MsjError),'');
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -190,8 +190,8 @@ type
|
||||||
function DisassemblerAt(addr: word; out nBytesProc: byte; useVarName: boolean
|
function DisassemblerAt(addr: word; out nBytesProc: byte; useVarName: boolean
|
||||||
): string; override;
|
): string; override;
|
||||||
public //RAM memory functions
|
public //RAM memory functions
|
||||||
function GetFreeByte(out addr: word; shared: boolean): boolean;
|
function GetFreeByte(out addr: word): boolean;
|
||||||
function GetFreeBytes(const size: integer; var addr: word): boolean; //obtiene una dirección libre
|
function GetFreeBytes(const size: integer; out addr: word): boolean; //obtiene una dirección libre
|
||||||
function TotalMemRAM: integer; //devuelve el total de memoria RAM
|
function TotalMemRAM: integer; //devuelve el total de memoria RAM
|
||||||
function UsedMemRAM: word; //devuelve el total de memoria RAM usada
|
function UsedMemRAM: word; //devuelve el total de memoria RAM usada
|
||||||
procedure ExploreUsed(rutExplorRAM: TCPURutExplorRAM); //devuelve un reporte del uso de la RAM
|
procedure ExploreUsed(rutExplorRAM: TCPURutExplorRAM); //devuelve un reporte del uso de la RAM
|
||||||
|
@ -265,7 +265,7 @@ begin
|
||||||
end;
|
end;
|
||||||
ram[iRam].value := value;
|
ram[iRam].value := value;
|
||||||
if isData then ram[iRam].name := 'data';
|
if isData then ram[iRam].name := 'data';
|
||||||
ram[iRam].used := ruVar; //marca como usado
|
ram[iRam].used := ruData; //marca como usado
|
||||||
inc(iRam);
|
inc(iRam);
|
||||||
end;
|
end;
|
||||||
procedure TP6502.codAsm(const inst: TP6502Inst; addMode: TP6502AddMode; param: word);
|
procedure TP6502.codAsm(const inst: TP6502Inst; addMode: TP6502AddMode; param: word);
|
||||||
|
@ -668,7 +668,9 @@ begin
|
||||||
i_BEQ:; //branch on equal (zero set)
|
i_BEQ:; //branch on equal (zero set)
|
||||||
i_BIT:; //bit test
|
i_BIT:; //bit test
|
||||||
i_BMI:; //branch on minus (negative set)
|
i_BMI:; //branch on minus (negative set)
|
||||||
i_BNE:; //branch on not equal (zero clear)
|
i_BNE: begin
|
||||||
|
|
||||||
|
end; //branch on not equal (zero clear)
|
||||||
i_BPL:; //branch on plus (negative clear)
|
i_BPL:; //branch on plus (negative clear)
|
||||||
i_BRK:; //break / interrupt
|
i_BRK:; //break / interrupt
|
||||||
i_BVC:; //branch on overflow clear
|
i_BVC:; //branch on overflow clear
|
||||||
|
@ -1138,7 +1140,7 @@ begin
|
||||||
PC.W := AValue;
|
PC.W := AValue;
|
||||||
end;
|
end;
|
||||||
//Funciones para la memoria RAM
|
//Funciones para la memoria RAM
|
||||||
function TP6502.GetFreeByte(out addr: word; shared: boolean): boolean;
|
function TP6502.GetFreeByte(out addr: word): boolean;
|
||||||
{Devuelve una dirección libre de la memoria RAM, a partir de la dirección iRam.
|
{Devuelve una dirección libre de la memoria RAM, a partir de la dirección iRam.
|
||||||
"Shared" indica que se marcará el bit como de tipo "Compartido", y se usa para el
|
"Shared" indica que se marcará el bit como de tipo "Compartido", y se usa para el
|
||||||
caso en que se quiera comaprtir la misma posición para diversos variables.
|
caso en que se quiera comaprtir la misma posición para diversos variables.
|
||||||
|
@ -1151,12 +1153,12 @@ begin
|
||||||
maxRam := CPUMAXRAM; //posición máxima
|
maxRam := CPUMAXRAM; //posición máxima
|
||||||
//Realmente debería explorar solo hasta la dirección implementada, por eficiencia
|
//Realmente debería explorar solo hasta la dirección implementada, por eficiencia
|
||||||
for i:=iRam to maxRam-1 do begin
|
for i:=iRam to maxRam-1 do begin
|
||||||
if (ram[i].state = cs_implemen) and (ram[i].used = ruUnused) then begin
|
if (ram[i].state = cs_impleGPR) and (ram[i].used = ruUnused) then begin
|
||||||
//Esta dirección está libre
|
//Esta dirección está libre
|
||||||
ram[i].used := ruVar; //marca como usado para variable
|
// ram[i].used := ruData; //marca como usado para variable
|
||||||
if shared then begin
|
// if shared then begin
|
||||||
ram[i].shared := true; //Marca como compartido
|
// ram[i].shared := true; //Marca como compartido
|
||||||
end;
|
// end;
|
||||||
addr := i;
|
addr := i;
|
||||||
//Notar que la posición de memoria puede estar mapeada.
|
//Notar que la posición de memoria puede estar mapeada.
|
||||||
Result := true; //indica que encontró espacio
|
Result := true; //indica que encontró espacio
|
||||||
|
@ -1164,24 +1166,25 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
function TP6502.GetFreeBytes(const size: integer; var addr: word): boolean;
|
function TP6502.GetFreeBytes(const size: integer; out addr: word): boolean;
|
||||||
{Devuelve una dirección libre de la memoria RAM para ubicar un bloque
|
{Returns a free memory address of RAM to locate a block of the specified size (in bytes).
|
||||||
del tamaño indicado. Si encuentra espacio, devuelve TRUE.
|
If found returns TRUE. }
|
||||||
El tamaño se da en bytes, pero si el valor es negativo, se entiende que es en bits.}
|
|
||||||
var
|
var
|
||||||
i: dword;
|
i: dword;
|
||||||
maxRam: dWord;
|
maxRam: dWord;
|
||||||
begin
|
begin
|
||||||
Result := false; //valor por defecto
|
Result := false; //valor por defecto
|
||||||
if size=0 then exit;
|
if size=0 then begin
|
||||||
|
addr := 0;
|
||||||
|
exit(true);
|
||||||
|
end;
|
||||||
maxRam := CPUMAXRAM;
|
maxRam := CPUMAXRAM;
|
||||||
for i:=iRam to maxRam-1 do begin //verifica 1 a 1, por seguridad
|
for i:=iRam to maxRam-1 do begin //verifica 1 a 1, por seguridad
|
||||||
if HaveConsecRAM(i, size, maxRam) then begin
|
if HaveConsecRAM(i, size, maxRam) then begin
|
||||||
//encontró del tamaño buscado
|
//encontró del tamaño buscado
|
||||||
UseConsecRAM(i, size); //marca como usado
|
//UseConsecRAM(i, size); //marca como usado
|
||||||
addr := i;
|
addr := i;
|
||||||
Result := true; //indica que encontró espacio
|
exit(true);
|
||||||
exit;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -1222,7 +1225,7 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
function TP6502.ValidRAMaddr(addr: word): boolean;
|
function TP6502.ValidRAMaddr(addr: word): boolean;
|
||||||
{Indica si la dirección indicada es válida dentro del hardware del PIC}
|
{Indica si la dirección indicada es válida dentro del hardware del CPU}
|
||||||
begin
|
begin
|
||||||
if addr > CPUMAXRAM then exit(false); //excede límite
|
if addr > CPUMAXRAM then exit(false); //excede límite
|
||||||
exit(true);
|
exit(true);
|
||||||
|
@ -1251,7 +1254,7 @@ begin
|
||||||
comLat := ram[i].sideComment;
|
comLat := ram[i].sideComment;
|
||||||
comLin := ram[i].topComment;
|
comLin := ram[i].topComment;
|
||||||
//Verifica si es variable
|
//Verifica si es variable
|
||||||
if ram[i].used = ruVar then begin
|
if ram[i].used in [ruData, ruAbsData] then begin
|
||||||
//Escribe en forma de variable
|
//Escribe en forma de variable
|
||||||
if incAdrr then begin
|
if incAdrr then begin
|
||||||
if comLin<>'' then lOut.add(comLin);
|
if comLin<>'' then lOut.add(comLin);
|
||||||
|
@ -1314,7 +1317,7 @@ begin
|
||||||
maxUsed := 0;
|
maxUsed := 0;
|
||||||
//Busca dirección de inicio usada
|
//Busca dirección de inicio usada
|
||||||
for i := 0 to CPUMAXRAM-1 do begin
|
for i := 0 to CPUMAXRAM-1 do begin
|
||||||
if ram[i].used<>ruUnused then begin
|
if ram[i].used in [ruCode, ruData] then begin
|
||||||
if i<minUsed then minUsed := i;
|
if i<minUsed then minUsed := i;
|
||||||
if i>maxUsed then maxUsed := i;
|
if i>maxUsed then maxUsed := i;
|
||||||
end;
|
end;
|
||||||
|
@ -1338,7 +1341,7 @@ begin
|
||||||
SetLength(ram, CPUMAXRAM);
|
SetLength(ram, CPUMAXRAM);
|
||||||
//inicia una configuración común
|
//inicia una configuración común
|
||||||
ClearMemRAM;
|
ClearMemRAM;
|
||||||
SetStatRAM($020, $04F, cs_implemen);
|
SetStatRAM($020, $04F, cs_impleGPR);
|
||||||
|
|
||||||
//Estado inicial
|
//Estado inicial
|
||||||
iRam := 0; //posición de inicio
|
iRam := 0; //posición de inicio
|
||||||
|
@ -1564,7 +1567,7 @@ begin
|
||||||
PIC16InstName[i_TYA].name := 'TYA'; //Transfer Index Y to Accumulator
|
PIC16InstName[i_TYA].name := 'TYA'; //Transfer Index Y to Accumulator
|
||||||
PIC16InstName[i_TYA].AddAddressMode(aImplicit,$98,1,2,'');
|
PIC16InstName[i_TYA].AddAddressMode(aImplicit,$98,1,2,'');
|
||||||
|
|
||||||
PIC16InstName[i_Inval].name := 'Inval';
|
PIC16InstName[i_Inval].name := 'Inv';
|
||||||
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user