diff --git a/Cambios.txt b/Cambios.txt index db72188..7a972c5 100644 --- a/Cambios.txt +++ b/Cambios.txt @@ -1,3 +1,10 @@ +0.4 +=== +Se corrige un error con la ejecuci髇 de la instrucci髇 ROL. +Se traducen algunos comentarios al ingl閟. +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髇 inicial. diff --git a/MiniAssembler/project1.lps b/MiniAssembler/project1.lps index e2bd946..fb90206 100644 --- a/MiniAssembler/project1.lps +++ b/MiniAssembler/project1.lps @@ -12,7 +12,7 @@ - + @@ -21,9 +21,9 @@ - - - + + + @@ -31,19 +31,19 @@ - - + + - + - - + + @@ -58,124 +58,49 @@ - + - + - - + - + - + + - - + - + - - + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MiniAssembler/unit1.lfm b/MiniAssembler/unit1.lfm index 37c059b..85fcd4a 100644 --- a/MiniAssembler/unit1.lfm +++ b/MiniAssembler/unit1.lfm @@ -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 diff --git a/MiniAssembler/unit1.pas b/MiniAssembler/unit1.pas index 36622aa..24d35d6 100644 --- a/MiniAssembler/unit1.pas +++ b/MiniAssembler/unit1.pas @@ -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 diff --git a/P6502utils.pas b/P6502utils.pas index 29f4531..b85399f 100644 --- a/P6502utils.pas +++ b/P6502utils.pas @@ -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;