Skip to content

Chris-1101/simple-assembler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Assembler License

A personal project via which I aim to learn a bit about assembly by programming an interpretive implementation of select opcode mnemonics.

Implemented Instructions

  • MOV x, y Move the contents of register y into register x (x = y)

  • INC x Increment register x by one (x++)

  • DEC x Decrement register x by one (x--)

  • ADD x, y Add the contents of register y to x (x += y)

  • SUB x, y Subtract the contents of register y from x (x -= y)

  • MUL x, y Multiply the contents of register x and y, store result in x (x *= y)

  • DIV x, y Integer divide the contents of register x by y, store result in x (x /= y)

  • JNZ x, y Jump y instructions if register x is Not Zero

  • ; Comment, ignored by the interpreter

Planned Instructions

  • label: Define a position within the code reachable by the label identifier

  • call lbl Procedure call to the subroutine identified by the label lbl

  • ret Return to the instruction that called the current subroutine

  • CMP x, y Compare the contents of registers x and y (result used by other instructions)

  • JNE lbl Jump to the label lbl if the values of the previous CMP were Not Equal

  • JE lbl Jump to the label lbl if the values of the previous CMP were Equal

  • JGE lbl Jump to the label lbl if register x was Greater than or Equal to y in the previous CMP

  • JG lbl Jump to the label lbl if register x was Greater than y in the previous CMP

  • JLE lbl Jump to the label lbl if register x was Lesser than or Equal to y in the previous CMP

  • JL lbl Jump to the label lbl if register x was Lesser than y in the previous CMP

Further Instructions

Reference: Intel 80x86 ASM Opcodes

Releases

No releases published

Packages

No packages published