Skip to content

Assembly Language Program to process and display a bitmap image into ARGB Bitmap Display.

License

Notifications You must be signed in to change notification settings

ghosteater1311/RISC-V_Bitmap_Image_Display

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

RISC-V_Bitmap_Image_Display

Explore the docs »

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. License
  5. Acknowledgments

About The Project

The program process the bitmap image display into ARGB Bitmap Display based on RARS.

Built With

  • RISC-V (RARS IDE)
  • RISC-V Assembly

(back to top)

Getting Started

Prerequisites

  • Basic knowledge about Assembly language.
  • Ability to understand Algorithms for solving problems.
  • Depth knowledge about General Computer Architecture and RISC-V Architecture & Instructions Set.
  • The program only execute the bitmap image with the format (.bmp or first 2 Hex Value BM), maximum resolution 512x512 and 24-bit depth color.

For more information about Assembly language and RISC-V instructions set: Documentation

Installation Guide

Environment

Java Development Kit Environment

Windows:

  • Download via link: Here
  • Run the installer.
  • To verify the installation:
  • Run PowerShell as Adminstrator
java --version

Mac OS:

  • Download DMG installer via link: Here
  • Run the DMG installer.
  • To verify the installation:
  • Open terminal
java -version

Linux:

Suggestion: In Linux, it's easier to download and install java via terminal instead of download through a file.

  • apt Package
    sudo apt update
    sudo apt upgrade
    sudo apt install default-jdk
    • To verify the installation:
    javac -version
  • pacman aarch Package
    sudo pacman -Syu
    sudo pacman -S jdk-openjdk
    • To verify the installation:
    jdk -v
  • Specific Linux (Red Hat) with Yum or Rpm packages management
    • For Yum
      sudo yum update
      sudo yum upgrade
      sudo yum install java
      • To verify the installation:
      yum info "java"
    • For Rpm
      • Download via link: Here
      • Installation:
      • Become root:
      su
      • Change to the directory in which you want to install:
      cd directory_path_name
      • For example, to install the software in the /usr/java/ directory:
      cd /usr/java
      • Uninstall any earlier installations of the Java packages:
      rpm -e package_name
      • Install the package:
      rpm -ivh jdk-24_linux-x64_bin.rpm
      • To upgrade a package:
      rpm -Uvh jdk-24_linux-x64_bin.rpm

RARS Installation

RARS 1.6 IDE and Simulator

Windows/Mac OS:

  • Download the rars1_6.jar via release link: Here
  • Run the rars1_6.jar

Linux:

  • Download the rars1_6.jar via release link: Here
  • To Use the IDE
    • Open File Manager
    • Open the Folder contain the rars1_6.jar
    • Open with terminal
    java rars1_6.jar

(back to top)

Usage

Download Program

  • Download the source code from Source code.

    • Extract the zip file.
  • Or using git:

    git clone https://github.com/ghosteater1311/RISC-V_Bitmap_Image_Display.git
  • Open rars1_6.jar.

If you don't know how to open rars1_6.jar, please read RARS Installation

Setting Up

  • In [File] options, choose [Open...] and open the [source.asm] in [src] Folder.

  • [Execute] the program.

  • In [Tools] options, choose [Bitmap Display].

  • Remain the Unit Width and Height in Pixels at 1, modify the Display Width and Height in Pixels to 512 (maximum resolution).

  • Press [Connect to Program].

  • [Run] the program after execution.

Initialize

  • Input the full path that contain the image file.

  • Press [Enter] to observe the result on the [Bitmap Display].

Explaination

  • Open File and Read File Header:

    • Opens the BMP file in read-only mode.
    • Reads the first 54 bytes (header) of the BMP file.
  • Validate the information of the image:

    • Validate File Format: Checks the first two bytes of the BMP header to ensure they are ’B’ and ’M’.
    • Validate Image Resolution: Validates the width and height of the image (both must be smaller or equal 512)
  • Read Pixel Data:

    • Extracts the offset to the pixel data from the header.
    • Calculates the total size of the pixel data.
  • Displaying Algorithm:

    • Initial the width and height of the image into 2 register labels.
    • Loop from bottom up for each rows (the purpose is to access first row of bitmap image).
    • For each rows, loop from left to right to access each columns refers for each pixels.
    • For each columns (aka pixels) in the row, process the color and display immediately to the display.
    • The default color format of bitmap image it's BGR. Implementation of pixel in a row of bitmap image: [B1 G1 R1] [B2 G2 R2] [B3 G3 R3] ...
    • To display image on Bitmap Display, we need to convert BGR color format into RGB color format, It means convert 0x00BBGGRR -> 0x00RRGGBB.
    • Each value on the hexadecimal value it's 4 bit.
    • To do that, we use shift left logic and bitwise operation to evaluate the exactly value of the color refers to RGB format to display the image with right color as accurately as possible.

Demo

demo.mp4

This demo displays a 512x512 .bmp image after processing.

For more information about how the program works, please read the Report

(back to top)

License

Distributed under the project_license. See LICENSE.txt for more information.

(back to top)

Acknowledgments

(back to top)

About

Assembly Language Program to process and display a bitmap image into ARGB Bitmap Display.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published