Git Product home page Git Product logo

shooshx / corewars8086_js Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 11.0 10.81 MB

A JavaScript version of corewars8086 from codeguru xtreme

Home Page: https://shooshx.github.io/corewars8086_js/war/page.html

License: GNU General Public License v2.0

Java 7.65% Makefile 1.11% C 39.11% Perl 2.30% Shell 0.10% M4 0.07% PostScript 0.10% CSS 0.30% Assembly 15.47% Slash 0.09% Batchfile 0.04% AGS Script 0.12% Roff 0.23% NSIS 0.20% Python 0.03% HTML 0.22% sed 0.01% JavaScript 32.84%
assembly

corewars8086_js's Introduction

corewars_js

This is a javascript version of corewars8086

https://shooshx.github.io/corewars8086_js/war/page.html

Features include:

  • assembler, runner and debugger compiled to javascript
  • integrated nasm assembler that runs as you type code
  • easy management of players
  • step by step debugger
    • allows editing of registers on the fly
  • disassembly of code as it is executed
  • breakpoints in code
  • ability to set the program load address manually in the debugger
  • view of the stack and shared memory
  • watch view with full featured watch language
    • all operators: +,-,*,/,%,|,&,~,**(power)
    • all operations are 16 bit math
    • register access by the names
    • memory access using square brackets
      • [bx] to access byte,
      • [bx]w to access a word,
      • [ds:bx] to access fully qualified address
    • numbers in hex (0xA3F), binary (0b110111) and octal (0o14427)
  • zoomable memory canvas
    • show memory content at zoom factor 4
    • edit memory content in canvas by setting a cursor with a click
    • move the cursor using arrows and scroll around
  • it is possible to inspect the state of warriors in the debugger after a war is over and even continue running the war with just the winner running.
  • implementes all features of the original Java GUI
  • Load a batch of survivors or zombies binaries from a zip file
  • load and save all players code from and to a json file
  • Change the size of panels layout using splitters
  • Options in menu:
    • reset the layout to its default state
    • move the players panel to be on the left (for wide screens) or at the top (for 4:3 screens)
    • Open options dialog
    • clear all current players, reset to initial test players
  • Options in options dialog
    • change the width of the memory display for better visibility
    • Alternate opcode colors for better visibility of where opcodes start and end in the memory view
    • enable register pointers pointing to the memory canvas
    • enable Auto-save state. when enabled the editor state is saved to localStorage and loaded on page reload
  • Competition: run many games one after the other with the same set of warriors
    • Copy the textual table of result
    • Detailed control over the visualization of competition graph
      • change orientation, sorting, name apperance, rank numbers

tips and tricks

  • When debugging, you can always return to a warrior running point by clicking its name on the left pane
  • You can set value of any register manually by writing a value in its box. This includes IP and Flags registers.

Coming up features:

  • data breakpoints
  • fixed randomization bug
  • online competition

references:
https://codeguru.co.il/Xtreme/
https://github.com/codeguru-il/corewars8086
https://github.com/YoavKa/corewars8086 (disassembler)
https://github.com/kimwalisch/calculator (watch language)
nice disassembler: https://onlinedisassembler.com/odaweb/

corewars8086_js's People

Contributors

shooshx avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

corewars8086_js's Issues

UI bug with long last line

code:

PUSH DS
POP ES
MOV DI, AX
MOV AX, 0xCCCC
again:
STOSW
ADD WORD DI, 0xB
JMP agaijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj

without newline at the end

CS Live editing was removed?

A few months ago it was possible to edit the CS by clicking on a byte in the arena and start typing. Was it removed?

Incorrect assembly & disassembly of ADD when MOD == 0

The instruction set of "ADD [disp], reg" (e.g. "ADD [0x50], AL") is compiled as "00 06 50 00 " instead of "00 05 50 00 00 00".
An ADD instruction where the reg or rm is only a displacement without a register should have the rem section set to 101 (binary), not 110. (Reference: x86 Encoding Add edx, displacement )

I think the bug arises from this function:

private String getMem8() throws DisassemblerException

Macros are not supported

When debugging, macros are not shown correctly.
For example:
image

Will be shown as:
image

Note: the instructions are executed but it's just shown as 0xCC.

Enhancement: Simple tutorial

IMHO a simple, interactive user friendly, step-by-step tutorial (Something you can give a middle-schooler who has minimal experience with programming and he'll be able to find his way around the simulator and create a basic survivor) will provide a lot of value to this simulator.

Perhaps we can use something like https://introjs.com/ or https://tourjs.github.io/tour/

`sw x1, 128(x2)` unexpected behavior

This command should write the contents of x1 into the address that comes 128 bytes after the address x2 point to, but instead, it writes it exactly to the address x2 points to.

I also tried to use 64 instead of 128 but the same behaviour was observed.

בעיה בהעלאת קבצים מקומפלים

כשמעלים קובץ מקומפל הדיבאגר עושה לו דיקומפילציה ומריץ אותו בתור קוד שונה מהקוד מקור (בלי דיפיינס וכו') בניגוד לדיבאגר של קוד גורו שבו אפשר להריץ קודים מקומפלים.

Debugging Issue, urgent!

image
while debugging - I cannot see the instruction being executed, nor can I view the code I debug, (the address in the arena in the disassembly window start with 0000, and I cannot view the code of the survivors/zombies).
Thanks

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.