• Packages
  • Themes
  • Documentation
  • Blog
  • Discuss
Sign in

language-toy-assembly

TOY assembly language syntax-highlighting in Atom.
Alexander-Erlacher
0.2.2 86
0
  • Repo
  • Bugs
  • Versions
  • License
Flag as spam or malicious

Description

This atom-editor-package, contains a grammar for the assembly language of the Visual-X-TOY-CPU. The grammar is used to provide a syntax-highlighting, in order to improve the overview and correctness, while programming in assembly language, for Visual-X-TOY.

Supported TOY instructions

# Assembly Register-Transfer C-Language
0 HLT halt
1 ADD Rd Rs Rt Rd ← Rs + Rt Rd = Rs + Rt
2 SUB Rd Rs Rt Rd ← Rs - Rt Rd = Rs - Rt
3 AND Rd Rs Rt Rd ← Rs & Rt Rd = Rs & Rt
4 XOR Rd Rs Rt Rd ← Rs ^ Rt Rd = Rs ^ Rt
5 SHL Rd Rs Rt Rd ← Rs << Rt Rd = Rs << Rt
6 SHR Rd Rs Rt Rd ← Rs >> Rt Rd = Rs >> Rt
7 LDA Rd imm Rd ← imm Rd = imm
8 LD Rd addr Rd ← mem[addr] Rd = a
9 ST Rd addr mem[addr] ← Rd a = Rd
A LDI Rd Rt Rd ← mem[Rt] Rd = *Rt
B STI Rd Rt mem[Rt] ← Rd *Rt = Rd
C BZ Rd addr if(RD==0) IP ← addr if(RD==0) goto addr
D BP Rd addr if(RD>0) IP ← addr if(RD>0) goto addr
E JR Rd IP ← addr returning from a function
F JL Rd addr Rd ← IP; IP ← Rd calling a function

Modified HLT: Extended Instruction Set

Note that the stack in TOY grows with decreasing addresses and shrinks with encreasing addresses.
Register-Transfer-Statements:

Instruction RT-Statements Explanation
CALL ADDR; RF ← RF - 1; Increase stack size.
mem[RF] ← ADDR; Safe return-address on stack.
PC ← ADDR; PC loads subroutine address.
RET; PC ← RE; PC loads callee-return-address.
RF ← RF + 1; Decrease stack size.
PUSH Rd; RF ← RF - 1; Increase stack size.
mem[RF] ← Rd; Safe value of Rd on stack.
POP Rd; Rd ← mem[RF]; Safe value from stack on Rd.
RF ← RF + 1; Decrease stack size.

Syntax Highlighting Sample

syntax-highlight-sample

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.

  • Terms of Use
  • Privacy
  • Code of Conduct
  • Releases
  • FAQ
  • Contact
with by