GithubHelp home page GithubHelp logo

ycpu's People

Contributors

princessriikka avatar zanedubya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ycpu's Issues

Emulator's BTI pattern does not match spec.

private void BitPatternBTI(ushort operand, out ushort value, out RegGeneral destination) {

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);
    }

Conflicting information about control registers in user mode

In 3.B, it is implied that user cannot write to FL, PC, PS, and SP, although they all can still be read.

* Cannot write to any processor control registers, but can read from them.

In 4.A (ALU Bit Pattern), user can only write to FL, PC, and USP, but not PS.

YCPU/Documentation/ycpu.txt

Lines 1342 to 1355 in 0af90f8

Note 4: The control register operand indexes are as follows:
Index Desc. User write?
$00 FL register Y
$01 PC register Y
$02 PS register N
$03 RESERVED, UNDEFINED. N
$04 RESERVED, UNDEFINED. N
$05 RESERVED, UNDEFINED. N
$06 USP Y
$07 current Stack Pointer (USP / SSP) Y
It is always possible to read control registers to general
purpose registers, regardless of supervisor/user mode. However,
user mode is limited in which processors it can write to.

Additionally, in the C# source, user cannot read from PS.

case RegControl.PS:
if (PS_S)
return m_PS;
Interrupt_UnPrivFault(operand);

I think 4.A makes sense, but I'm not sure if user should be able to read PS. ๐Ÿค”

Emulator's BitPatternALU doesn't quite match spec

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# ๐Ÿ˜›

Need clarification on segment size bits

According to the docs, segment bits 0x00 would translate to (0x00 << 8) + 256 = 256:

YCPU/Documentation/ycpu.txt

Lines 958 to 959 in d0a1248

s - These bits determine the size of the segment. This value is left shifted
by 8 and incremented by 256 for a range of 256 - 2^16.

but this part of the docs says that 0x00 translates to size 0x10000:

CS: $8000 0000 ; CS in ROM, base = $00000000, size = $10000

also from the code it seems like 0x00 would translate to 0x10000 if I'm not mistaken:

// get size
uint s = (m_Register & c_SegRegSize) >> c_SegRegSizeShift;
m_Size = s == 0 ? ushort.MaxValue + 1 : s;

So, which one is correct?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.