Code Monkey home page Code Monkey logo

asenzt's Introduction

Asenzt - Two-pass Assembler

Simple two-pass assembler for the pre-defined assembly language - Project for System Software Course (School of Electrical Engineering 2021)

Make

Compiling the assembler:

make

Run

For defualt run assembler -o izlaz.o ulaz.s:

make run

For arbitrary run:

assembler -o output_object_file.o input_file.s

Run tests:

make test

Input sample

# file: interrupts.s 
.section ivt 
   .word isr_reset 
   .skip 2 # isr_error 
   .word isr_timer 
   .word isr_terminal 
   .skip 8 
.extern myStart, myCounter 
.section isr 
.equ term_out, 0xFF00 
.equ term_in, 0xFF02 
.equ asciiCode, 84 # ascii(’T’) 
# interrupt routine for reset 
isr_reset: 
   jmp myStart 
# interrupt routine for timer
isr_timer: 
   push r0 
   ldr r0, $asciiCode 
   str r0, term_out 
   pop r0 
   iret 
# interrupt routine for terminal
isr_terminal: 
   push r0 
   push r1 
   ldr r0, term_in 
   str r0, term_out 
   ldr r0, %myCounter # pcrel 
   ldr r1, $1 
   add r0, r1 
   str r0, myCounter # abs 
   pop r1 
   pop r0 
   iret 
.end 

# file: main.s 
.global myStart 
.global myCounter 
.section myCode 
.equ tim_cfg, 0xFF10 
myStart: 
   ldr r0, $0x1 
   str r0, tim_cfg 
wait: 
   ldr r0, myCounter 
   ldr r1, $5 
   cmp r0, r1 
   jne wait 
   halt 
.section myData 
myCounter: 
   .word 0 
.end 

Assembler directives

List of assembler directives:

  • .global list_of_symbols
  • .extern list_of_symbols
  • .section section_name
  • .word list_of_symbols_or_literals
  • .skip literal
  • .equ new_symbol, literal
  • .end

Assembler instructions

asenzt's People

Contributors

nzt48 avatar

Watchers

 avatar

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.