zanedubya / ycpu Goto Github PK
View Code? Open in Web Editor NEWAn imaginary 16-bit cpu, with a complete specification, emulator, assembler, and disassembler, in C#.
An imaginary 16-bit cpu, with a complete specification, emulator, assembler, and disassembler, in C#.
Suggested fix:
private void BitPatternBTI(ushort operand, out ushort value, out RegGeneral destination) {
destination = (RegGeneral)((operand & 0xE000) >> 13); // bits DEF
RegGeneral source = (RegGeneral)((operand & 0x0F00) >> 8);
bool asRegister = (operand & 0x1000) != 0;
value = asRegister ?
(ushort)(R[(int)source] & 0x000F) :
(ushort)((operand & 0x1E00) >> 9);
}
In 3.B, it is implied that user cannot write to FL
, PC
, PS
, and SP
, although they all can still be read.
Line 559 in 0af90f8
In 4.A (ALU Bit Pattern), user can only write to FL
, PC
, and USP
, but not PS
.
Lines 1342 to 1355 in 0af90f8
Additionally, in the C# source, user cannot read from PS
.
YCPU/Source/Libraries/YpsilonCPU/Emulation/Processor/YCPU.cs
Lines 163 to 166 in 0af90f8
I think 4.A makes sense, but I'm not sure if user should be able to read PS
. ๐ค
According to cartridge.txt
, the cartridge puts the return value for messages in R0 register, but from the YCPU spec, R0 is reserved for message acknowledgement (MSG_ACK
, MSG_WAIT
, MSG_ERROR
).
Should the return value be stored in R1 or R2 instead? (In the meantime I'll use R1 in my implementation.)
Segments will allow a much larger program space, and better ability to move data!
RegControl cr = (RegControl)((operand & 0x0700) >> 8);
Appears to be reading bits A98 (rrE per spec). Should have (operand & 0x0E00)
Apparently I'm writing an issue rather than a PR just to keep my cool kid rep as someone who's never written any C# ๐
According to the docs, segment bits 0x00
would translate to (0x00 << 8) + 256 = 256
:
Lines 958 to 959 in d0a1248
but this part of the docs says that 0x00
translates to size 0x10000
:
Line 980 in d0a1248
also from the code it seems like 0x00
would translate to 0x10000
if I'm not mistaken:
YCPU/Source/Libraries/YpsilonCPU/Emulation/Processor/Segment.cs
Lines 154 to 156 in d0a1248
So, which one is correct?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.