Git Product home page Git Product logo

asm-editor's Introduction

Asm editor

A webapp made with sveltekit and rust webassembly to learn, write and run m68k assembly code. Uses monaco-editor for the editor, and my WASM M68K interpreter to run the code.

Mainly made to help people approaching assembly by providing the tools necessary to write and debug code more easily. localImage

Features recap

  • Simple code completition and full syntax highlighting
  • Run the program or step through it
  • Code breakpoints, settings, input/output interrupts, undo, formatter and more
  • Inspect the value of each register and memory address to see which was changed with each instruction
  • Create new projects and manage them all in the webapp
  • Integrated IDE with semantic checks and useful errors to help you learn assembly
  • Integrated documentation and intellisense with addressing modes, descriptions and examples
  • Customisable settings and shortcuts, including theme customization

Code completion and syntax highlighting

The editor suggests you with the available instructions and the valid addressing modes for each operand, while also giving a simple description and example.

Step and undo

The code can be run completely or step by step, the changes to the state of the interpreter is kept in memory so that it can be undone. Breakpoints can be set to stop the execution at a specific line while running, to then proceed with stepping.

Documentation

The webapp comes with a built-in documentation, both available inside the editor and as a separate page. It explains brefly how each instruction works and the addressing modes, further documentation is coming in the future.

Settings and shortcuts

Settings to choose from to customise the editor and the interpreter, like how to view the registers, how many steps to keep in history, themes, etc. There are also some shortcuts to ease the use of the editor, which can be changed in the settings.

Projects

Projects are stored locally on your browser, and with the app also working offline, you can create and manage them all in the webapp. Export and import to come in the future.

Tools

Once running the program there are many tools to help you understand what instructions did and debug the code.

  • Values which changed between each instructions are highlighted and the old value is also visible. registers and memory have tooltips to show the decimal/hexadecimal value.
  • Follow the stack pointer with the dedicated tab, it's split in rows of 4 bytes to make it easier to see the changes
  • Whenever a jsr / bsr / rts instruction is executed, the callstack is saved so that it can be seen
  • A view of the changes to the state of the interpreter is visible to see what each instruction did, like register / memory writes and changes to the ccr, it is alsoo possible to jump back to a previous state
  • Full memory viewer to inspect a memory region, with also string conversion.

Assembler features

The assembler has a few directives and features to simplify writing code.

  • equ directive to define constants
  • dc, ds, dcb directives to define data regions
  • org directive to set the origin of the code
  • expressions (like $FF*10) and many immediate representations.

Benchmarks

The interpreter runs at round 30mhz on the browser and 50mhz natively (on my machine). You can benchmark your own machine by running a loop, the time it took to run is shown in the bottom right of the console in the editor, the total time of each execution is shown. example code:

limit equ 10000000
move.l #limit, d0
move.l #0, d1
for:
    add.l #1, d1
    sub.l #1, d0
    bne for

This runs 30 million instructions, make sure you set the Maximum instructions iteration, Maximum history size and Maximum visible history size to 0, as well as not having any breakpoints, this will turn off the debugging tools and run the code as fast as possible.

asm-editor's People

Contributors

specy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

asm-editor's Issues

Add quick instructions

Currently none of the quick instructions are supported, even tho they would run the same code in the interpreter, allowing the syntax will be useful

Double pre decrement/post increment

When using post increment/pre decrement operands, if the destination register is both read and written to, the increment/decrement will be executed twice, ex: add.l d0, (a0)+ will increment a0 by 4 twice, so the result will be 8 instead of 4

post increment addressing mode works correctly?

Does post increment addressing mode works properly?
When traced execution of a program
LEA $1200,A0
MOVEQ #$55,D2
EOR.B D2,(A0)+
and changed memory view to address $1200, noticed that the last instruction worked as "pre increment", not "post increment", because of changing value under $1201, not $1200 address.

Add movem instruction

Add movem instruction to allow for e.g.

movem.l d0-d7/a0-a6,-(sp)

Great tool, thank you very much!

Add LEA instruction

Given the operand that points to memory, it sets the address of the memory region to read for example

lea (d0), A0

Loads the content of d0 into A0, it doesn't read the memory

Does this work locally?

I downloaded this locally... how do I run it? When I open 'app.html' in the browser I just get

%sveltekit.head%
%sveltekit.body%

Add some "Hardware"

Would be great if you could add some "hardware" like LEDs, 7 Segment Display, Matrix Display, Switches, Framebuffer, Serial Terminal .... for interaction.

Using wordlengths as index

Hi there,

Bit of a 68k newbie, but I'm trying to run a snippet of some Atari Jaguar 68K code from Tempest 2000. See below.

It doesn't like this:

    move.b 0(a1,d0.w),d1

where I'm indexing into the sine table using word lengths rather than byte lengths. Is this a bug?

ORG $1000
START:
sines:
	DC.L	$00030609,$0C0F1215,$181B1E21,$24272A2D
	DC.L	$30333639,$3B3E4144,$46494B4E,$50535557
	DC.L	$595C5E60,$62646667,$696B6D6E,$70717274
	DC.L	$75767778,$797A7B7B,$7C7D7D7E,$7E7E7E7E
	DC.L	$7E7E7E7E,$7E7E7D7D,$7C7B7B7A,$79787776
	DC.L	$75737271,$6F6E6C6B,$69676563,$615F5D5B
	DC.L	$59575552,$504D4B48,$4643403E,$3B383533
	DC.L	$302D2A27,$24211E1B,$1815120F,$0C080502
	DC.L	$00FDFAF7,$F4F0EDEA,$E7E4E1DE,$DBD8D5D2
	DC.L	$CFCDCAC7,$C4C1BFBC,$B9B7B4B2,$B0ADABA9
	DC.L	$A6A4A2A0,$9E9C9A98,$97959392,$908F8D8C
	DC.L	$8B8A8988,$87868584,$84838382,$82828282
	DC.L	$82828282,$82838383,$84858586,$8788898A
	DC.L	$8B8D8E8F,$91929496,$97999B9D,$9FA1A3A5
	DC.L	$A7AAACAE,$B1B3B6B8,$BBBDC0C3,$C5C8CBCE
	DC.L	$D1D4D7D9,$DCDFE2E6,$E9ECEFF2,$F5F8FBFE
	DC.L	$00000192,$032304B5,$064507D5,$09630AF0
	DC.L	$0C7C0E05,$0F8C1111,$12931413,$158F1708
	DC.L	$187D19EF,$1B5C1CC5,$1E2A1F8B,$20E6223C
	DC.L	$238D24D9,$261F275F,$289929CC,$2AFA2C20
	DC.L	$2D402E59,$2F6B3075,$31783273,$33663452
	DC.L	$35353611,$36E437AE,$38703929,$39DA3A81
	DC.L	$3B1F3BB5,$3C413CC4,$3D3D3DAD,$3E143E70
	DC.L	$3EC43F0D,$3F4D3F83,$3FB03FD2,$3FEB3FFA
	DC.L	$3FFF3FFA,$3FEB3FD2,$3FB03F83,$3F4D3F0D
	DC.L	$3EC43E70,$3E143DAD,$3D3D3CC4,$3C413BB5
	DC.L	$3B1F3A81,$39DA3929,$387037AE,$36E43611
	DC.L	$35353452,$33663273,$31783075,$2F6B2E59
	DC.L	$2D402C20,$2AFA29CC,$2899275F,$261F24D9
	DC.L	$238D223C,$20E61F8B,$1E2A1CC5,$1B5C19EF
	DC.L	$187D1708,$158F1413,$12931111,$0F8C0E05
	DC.L	$0C7C0AF0,$096307D5,$064504B5,$03230192
	DC.L	$0000FF6E,$FDDDFC4B,$FABBF92B,$F79DF610
	DC.L	$F484F2FB,$F174EFEF,$EE6DECED,$EB71E9F8
	DC.L	$E883E711,$E5A4E43B,$E2D6E175,$E01ADEC4
	DC.L	$DD73DC27,$DAE1D9A1,$D867D734,$D606D4E0
	DC.L	$D3C0D2A7,$D195D08B,$CF88CE8D,$CD9ACCAE
	DC.L	$CBCBCAEF,$CA1CC952,$C890C7D7,$C726C67F
	DC.L	$C5E1C54B,$C4BFC43C,$C3C3C353,$C2ECC290
	DC.L	$C23CC1F3,$C1B3C17D,$C150C12E,$C115C106
	DC.L	$C101C106,$C115C12E,$C150C17D,$C1B3C1F3
	DC.L	$C23CC290,$C2ECC353,$C3C3C43C,$C4BFC54B
	DC.L	$C5E1C67F,$C726C7D7,$C890C952,$CA1CCAEF
	DC.L	$CBCBCCAE,$CD9ACE8D,$CF88D08B,$D195D2A7
	DC.L	$D3C0D4E0,$D606D734,$D867D9A1,$DAE1DC27
	DC.L	$DD73DEC4,$E01AE175,$E2D6E43B,$E5A4E711
	DC.L	$E883E9F8,$EB71ECED,$EE6DEFEF,$F174F2FB
	DC.L	$F484F610,$F79DF92B,$FABBFC4B,$FDDDFF6E


    lea sines,a1
    move #1,d0
    move.b 0(a1,d0.w),d1
    ext d1

END: * Jump here to end the program

Labels without colon

Labels with colons are not mandatory in 68000 assembler but it seems that they are in your asm-editor. Could this requirement be eliminated to avoid having to add the colon to all labels in order to adapt the code to your editor?

Thanks

Make interpreter run on a service worker

Currently the wasm thread is running on the same thread as the UI, whenever the code runs it blocks the UI and it must wait for the interpreter to finish execution, by running on another thread it will be able to be more "real time", the main issue is adapting the code to work with it and have the ability to kill/stop the wasm thread once it's running

Add other assembly language

The website wasn't made with only m68k in mind, i wanted to add more assembly languages, mips for example, the main issue is to find a decent assembler /emulator that runs on the browser and has the ability to step the code, read registers and memory etc.

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.