Changeset 219
- Timestamp:
- Oct 14, 2020, 8:04:25 PM (4 years ago)
- Location:
- branches/CpuSingleSize
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CpuSingleSize/Sample.asm
r218 r219 110 110 POP R3 111 111 RET 112 113 Test: 114 LDI R0, (R1 + 1) 115 STI (R1 + 12), R2 -
branches/CpuSingleSize/UAssembler.pas
r218 r219 174 174 if I > 0 then 175 175 Parser.Expect(tkSpecialSymbol, ','); 176 if InstructionInfo.Params[I] = ptNumber then begin 177 Token := Parser.ReadNext; 178 ParseNumParam(Token); 179 end else 176 180 if InstructionInfo.Params[I] = ptReg then begin 177 181 Token := Parser.ReadNext; … … 194 198 Parser.Expect(tkSpecialSymbol, ')'); 195 199 end else 196 if InstructionInfo.Params[I] = ptNumber then begin 197 Token := Parser.ReadNext; 198 ParseNumParam(Token); 199 end; 200 if InstructionInfo.Params[I] = ptRegIndirectIndex then begin 201 Parser.Expect(tkSpecialSymbol, '('); 202 Token := Parser.ReadNext; 203 if (Token.Value <> '') and (Token.Value[1] = 'R') then begin 204 Token.Value := Copy(Token.Value, 2, MaxInt); 205 if TryStrToInt(Token.Value, Number) then begin 206 Memory.Write(Number); 207 Parser.Expect(tkSpecialSymbol, '+'); 208 Token := Parser.ReadNext; 209 ParseNumParam(Token); 210 end else Error('Expected numeric register index error', Token.Pos); 211 end else Error('Expected register name starting with R character.', Token.Pos); 212 Parser.Expect(tkSpecialSymbol, ')'); 213 end else 200 214 end; 201 215 end; -
branches/CpuSingleSize/UCpu.pas
r216 r219 12 12 inAdd, inSub, inIn, inOut, inJump, inJumpZero, inJumpNotZero, inPush, inPop, 13 13 inCall, inRet, inAnd, inOr, inXor, inShl, inShr, inMul, inDiv, inMod, 14 inJumpRel );14 inJumpRel, inLoadIndex, inStoreIndex); 15 15 16 16 TInteger = Integer; … … 114 114 Index: TInteger; 115 115 Port: TInteger; 116 Dest: TInteger; 116 117 begin 117 118 Instruction := TInstruction(ReadNext); … … 207 208 R[Index] := R[Index] mod R[ReadNext]; 208 209 end; 210 inLoadIndex: R[ReadNext] := Data[R[ReadNext] + ReadNext]; 211 inStoreIndex: Data[R[ReadNext] + ReadNext] := R[ReadNext]; 209 212 end; 210 213 Inc(Ticks); -
branches/CpuSingleSize/UDisassembler.pas
r218 r219 52 52 InstText := InstText + ', ' else 53 53 InstText := InstText + ' '; 54 if InstructionInfo.Params[J] = ptNumber then begin 55 InstText := InstText + IntToHex(Value, 8); 56 end else 54 57 if InstructionInfo.Params[J] = ptReg then begin 55 58 InstText := InstText + 'R' + IntToStr(Value); … … 58 61 InstText := InstText + '(R' + IntToStr(Value) + ')'; 59 62 end else 60 if InstructionInfo.Params[J] = ptNumber then begin 61 InstText := InstText + IntToHex(Value, 8); 63 if InstructionInfo.Params[J] = ptRegIndirectIndex then begin 64 InstText := InstText + '(R' + IntToStr(Value); 65 Value := Memory.Read; 66 InstBytes := InstBytes + IntToHex(Value, 2) + ' '; 67 InstText := InstText + ' + ' + IntToStr(Value) + ')'; 62 68 end; 63 69 end; 64 InstBytes := InstBytes + DupeString(' ', 1 0- Length(InstBytes));70 InstBytes := InstBytes + DupeString(' ', 13 - Length(InstBytes)); 65 71 end; 66 72 end; -
branches/CpuSingleSize/UInstructions.pas
r218 r219 9 9 10 10 type 11 TParamType = (ptNone, ptNumber, ptReg, ptRegIndirect );11 TParamType = (ptNone, ptNumber, ptReg, ptRegIndirect, ptRegIndirectIndex); 12 12 TParamTypeArray = array of TParamType; 13 13 … … 100 100 AddNew(inJump, 'JP', [ptNumber], 'Unconditional absolute jump to defined address.'); 101 101 AddNew(inJumpRel, 'JR', [ptNumber], 'Unconditional relative jump to defined address.'); 102 AddNew(inLoadIndex, 'LDI', [ptReg, ptRegIndirectIndex], 'Loads value from memory with numeric index to register.'); 103 AddNew(inStoreIndex, 'STI', [ptRegIndirectIndex, ptReg], 'Stores value from register to memory with numeric index .'); 102 104 end; 103 105 -
branches/CpuSingleSize/UParser.pas
r218 r219 87 87 function TParser.IsSpecialSymbol(C: Char): Boolean; 88 88 begin 89 Result := (C = ':') or (C = ',') or (C = '(') or (C = ')') ;89 Result := (C = ':') or (C = ',') or (C = '(') or (C = ')') or (C = '+'); 90 90 end; 91 91
Note:
See TracChangeset
for help on using the changeset viewer.