Git Product home page Git Product logo

eightdad's Introduction

tl;dr I make tools and provide technical support

๐Ÿ› ๏ธ I use this account to post and contribute to projects in my spare time
๐Ÿ“ง Email me either at the address I gave you, or via this name on gmail
๐Ÿ•น๏ธ If you prefer Discord, I hang out on the following Discord servers:

My Skills & Languages

Topic My Skills Include... Skill Level
Technical Support Empathizing with users and documenting bugs ๐Ÿ‹๏ธ Powerful
QA / Test Automation Writing adapters, TestNG, Selenium, pytest ๐Ÿ’ช Experienced
Containers & Deployment Docker, AWS, GCP, Virtual Machines ๐Ÿ‘ Productive
Web Technologies HTML, CSS, JSON, and JavaScript ๐Ÿ‘ Productive

Your Repository's Stats

Note: Roff is misreported in the stats above. It's actually Octo Assembly Language, but GitHub doesn't support it correctly yet!

Check my pins below!

eightdad's People

Contributors

pushfoo avatar

Watchers

 avatar

eightdad's Issues

Move breakpoint support into the VM object

At the moment, breakpoints are only implemented in the arcade frontend in the update method and constructor, and even then only hackily.

This should be moved or re-implemented in a better way. It's currently in the way of #63 , and will likely be partially torn out for the time being.

Do a linting pass on the code.

One of the linters, maybe black. There are places where the code is ugly, and definitely places where PEP-8 is currently not met.

Fix misuse of parametrize?

From the pytest documentation:

To get all combinations of multiple parametrized arguments you can stack parametrize decorators:

Currently using product calls in multiple places. It works ok, but maybe it should be fixed. Get advice on this.

Add better logging functionality to VM

Need to decide where to put it as well. Is the logging functionality what I want to use? How much thought do I want to put into curses/urwid at the moment?

Key input support on the VM

  • Ex9E - Skip the next instruction if the key with the value in Vx is pressed
  • ExA1 - Skip the next instruction if the key with value in VX ISN'T pressed
  • Fx0A - LD Vx, K - wait until a key is pressed, then put its value in Vx. VM performs no instructions until a key has been received.

Handle Bnnn when nnn + v0 is greater than 0xFFF

This condition puts the interpreter past the end of memory, which needs some sort error handling to be implemented. Maybe set an error flag? raise exception?
this should probably be thought of in concert with debugger / UI. Asking the emudev discord suggests that it's rare in practice, so it might not be worth handling immediately.

Implement stack-like operators, Fx55 and Fx65

  • Fx55 - LD [I], Vx - Store V0 through Vx to mem, starting the write at position in I register
  • Fx65 - LD Vx, [I] - Read mem into V0-VX, starting the read at the position in I register

Video-related operators

  • 00EE - CLR, turn all pixels in the screen off
  • Dxyn - DRW Vx, Vy, nibble - draw sprite of length n to the screen at position (VX, VY)

Implement IXYI math

  • 8xy1 - Set Vx = Vx OR Vy.
  • 8xy2 - Set Vx = Vx AND Vy.
  • 8xy3 - Set Vx = Vx XOR Vy.
  • 8xy4 - Set Vx = Vx + Vy, set VF = 1 if sum greater than 255
  • 8xy5 - Set Vx = Vx - Vy, VF = 1 if Vx > Vy, else VF = 0
  • 8xy6 - shift right . If the least-significant bit of Vx is 1, then VF is set to 1, otherwise 0. Then Vx is divided by 2.
  • 8xy7 - If Vy > Vx, then VF is set to 1, otherwise 0. Then Vx is subtracted from Vy, and the results stored in Vx.
  • 8xyE - shift left - If the most-significant bit of Vx is 1, then VF is set to 1, otherwise to 0. Then Vx is multiplied by 2.

Implement IXYI skips

  • 5xy0 - Skip next instruction if Vx ==Vy
  • 9xy0 - Skip next instruction if Vx != Vy.

Fix endianess , i have it wrong

Used "<" in the bytecode tests instead of ">" for big endan. Tests should use clearer language to specify endianness, and implementation needs to be fixed.

Reorganize tests

They are getting messy with a lot of tests under the test folder.

Add INNN instructions + return instructions

  • 00EE, return from subroutine: pop location off of the stack and set pc to it
  • 1nnn, jump to nnn: set pc to nnn
  • 2nnn, call routine at nnn: push current location to stack, jump to nnn
  • Annn, set I to nnn
  • Bnnn, Jump to nnn + v0: set pc to nnn + v0

Make multiple instructions run per frame

Other Chip-8 implementations (Octo) run multiple instructions per frame. Arcade appears to be limited to screen refresh rate for the number of frames it can render at once, so getting good performance means skipping frames for redraw is a must.

Fix Program Counter Behavior to match standard

The standard for the Program Counter across architectures is that it points to the next instruction to be executed. The current implementation runs correctly, but it doesn't follow this standard. This makes it confusing for other people to read and should be fixed.

Try replacing property abuse with field-clamping descriptors

This should apply to the instruction decoder and maybe a few fields on the VM. For the instruction decoder, there might be a subclass of clamped that uses a mask as a constructor argument when initializing the descriptor. A more complicated implementation might be able to use a bit-mask as the only argument and infer the min and max from there, if also given a negatives allowed or minimum argument.

Maybe something like the following?

class Instruction:
    x : int = MaskedField(mask=0x0F00, signed=False)
    
    def __init__(self, **kwargs):

The result should be shorter and cleaner code than the current property and clamping decorators used.

Add key input + mapping to frontends

Keymapping needs to be added to get the full range of input from the frontends. The local arcade frontend is working again now that paths are fixed, so this shouldn't be too hard of an addition.

Should instruction class storage be reworked to be lazier, and if so, how?

Right now, decode sniffs not only the type of instruction, but every variable that the class has. Variables are also created locally that may not be needed.

In the future, a lazier approach may be better. If a memoryview and/or bytearray are used to store the location of the passed bytestring, then changes can be written directly to the underlying bytes variables, and values can be read only as needed. No more _lo_byte or _hi_byte as discrete variables, just access to them through properties. The downside is that this might eliminate caching of variables that would be useful during execution.

Figuring out how to cache object properties efficiently in python may be worth looking into.

Resolve 8XYE test issues

Currently fails, may be due to test breaking with spec rather than the code being broken as the corax rom has no issue with this.

Add setters to the instruction class in bytecode.py

wrapping bit ops in functions inside the tests isn't as elegant as things could be:

def prep_and_execute_ixii_instruction(
        vm: Chip8VirtualMachine,
        x_value: int,
        lo_byte: int,
        type_nibble: int = 0xF0,
        load_point=EXECUTION_START
):
    """
    Set a memory location to an ixii instruction & execute it
    This helper is useful for testing.
    :param vm: the vm to set memory on
    :param x_value: the x value that will specify the v-register targeted
    :param lo_byte: the last two hex digits of the instruction
    :param type_nibble: sets the type for this var
    :param load_point: where the instruction will be loaded into memory
    :return:
    """
    if load_point != EXECUTION_START:
        vm.program_counter = load_point

    vm.memory[load_point] = lo_byte
    vm.memory[load_point + 1] = type_nibble | x_value
    vm.tick(TWO_HUNDREDTH)

Code like this would be better encapsulated in setters on the instruction class in bytecode.py instead of clogging up test file space.

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.