Skip to content

natalianykiel/Low-level-programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Low-level-programming

This repository contains different programs in assembly.

============================================================================= Assembly Language Program 1

File Format: COM Authors: Hanna Mikołajczyk, Natalia Nykiel

Description: This program calculates the expression: 3*a+b/c, where 'a', 'b', and 'c' are taken from predefined arrays. It sorts the array elements in ascending order and then performs the calculation on each element of the array.

Program Structure:

  • Defines data segment for declaring variables and arrays.
  • Initializes the data including an array, its length, and flag variables.
  • Defines code segment for program execution.
  • Implements sorting algorithm to sort the array elements.
  • Calculates the expression for each element of the sorted array.
  • Ends the program execution.

Usage: This program is meant to be assembled and run in an MS-DOS environment using an assembler like Turbo Assembler (TASM) and a linker like TLINK.

Instructions for Compilation and Execution:

  1. Assemble the program using TASM;
  2. Link the object file using TLINK;
  3. Run the generated executable file;

============================================================================= Assembly Language Program 2

Authors: Natalia Nykiel

This assembly language program, named "arch.asm", is designed to run in a 16-bit DOS environment. It prompts the user to input two numbers within the range of [-32768...32767], validates the input, performs arithmetic operations on the input numbers, and displays the result.

Program Structure:

  • The program consists of several sections, including the main code segment labeled "Kod".
  • It begins with a prompt to the user to input two numbers.
  • The program then enters a loop to handle the input process for each number.
  • Input validation is performed to ensure that the input is within the allowed range and is a valid number.
  • After both numbers are entered, the program performs arithmetic operations, including addition and negation if necessary.
  • Error messages are displayed for invalid input.
  • The result is then printed to the console.

Usage:

  1. Assemble the program using an assembler compatible with 16-bit DOS programs, such as TASM (Turbo Assembler).
  2. Link the object file generated by the assembler.
  3. Run the generated executable file in a DOS environment.

Note:

  • This program assumes a DOS environment and may not run correctly on modern operating systems without a DOS emulator.
  • Care must be taken to ensure that the input numbers fall within the specified range, as the program does not handle out-of-range inputs gracefully.

Assembly Instructions:

  • The assembly code is written using Intel syntax and is meant to be assembled with an assembler compatible with Intel 8086 architecture.
  • The code is heavily commented to explain the purpose and functionality of each section and instruction.

============================================================================= C++ and Assembly Language Program 3

Authors: Natalia Nykiel

This program is a combination of C++ and assembly language. The C++ portion of the program provides a menu for the user to choose between two functions:

  1. Calculating the arithmetic mean of numbers in an array.
  2. Counting occurrences of a specific character in a string.

The user selects the desired function, provides input as required, and the program calls corresponding assembly language functions to perform the calculations. Below is a brief overview of each function:

  1. Arithmetic Mean Function (sredniatablicy):

    • The assembly function receives a double precision array and its size as parameters.
    • It calculates the arithmetic mean of the numbers in the array.
    • The function returns the computed mean value.
  2. Character Count Function (liczbaznakow):

    • The assembly function receives a character array (string) and a character to count as parameters.
    • It counts the occurrences of the specified character in the string.
    • The function returns the count of occurrences.

Usage:

  1. Compile the C++ program along with the assembly source file using a suitable compiler and linker.
  2. Ensure that the assembly language source file is properly linked with the C++ program.
  3. Run the compiled executable in a compatible environment.

Note:

  • The C++ program interacts with the user, providing a user-friendly interface to select and use the assembly functions.
  • The assembly functions are implemented to perform specific arithmetic and string manipulation tasks efficiently.
  • The program demonstrates the integration of assembly language routines with a higher-level language like C++ to leverage performance benefits and low-level hardware interactions.

============================================================================= Bitmap Image Manipulation Program 2

Authors: Natalia Nykiel

This program allows users to load and manipulate bitmap (BMP) image files in a graphical environment. Users can select from a menu to load different bitmap images and perform operations such as displaying the image, applying the negative effect, and adjusting the brightness.

Key Components:

  • The program is written in C++ and utilizes DOS graphics mode for image rendering and manipulation.
  • Bitmap image files (BMP) are loaded and processed using file I/O operations and direct memory access to the video buffer.
  • The program supports basic image operations such as displaying the image, applying the negative effect, and adjusting the brightness level.

Program Flow:

  1. Main Menu:

    • Users are presented with a main menu where they can select bitmap images to manipulate or exit the program.
  2. Image Manipulation Menu:

    • After selecting a bitmap image, users are presented with an image manipulation menu.
    • They can choose from options to display the image, apply the negative effect, adjust the brightness, or exit to the main menu.
  3. Image Manipulation Functions:

    • The program implements functions to handle each image manipulation option.
    • These functions directly access the video memory to render images and manipulate pixels.
    • Image brightness adjustment is performed by modifying pixel values based on user input.

Usage:

  1. Compile the program using a suitable compiler that supports DOS graphics mode.
  2. Ensure that the bitmap image files are available in the same directory as the executable.
  3. Run the compiled executable in a compatible DOS environment.

Limitations:

  • The program relies on DOS graphics mode and may not be compatible with modern operating systems.
  • It supports only 8-bit BMP image files with a fixed resolution of 320x200 pixels.
  • Advanced image processing features such as filtering and transformation are not implemented.

Note:

  • The program provides a basic demonstration of bitmap image manipulation techniques using low-level programming concepts and DOS graphics mode.
  • It serves as a learning exercise for understanding file I/O operations, memory manipulation, and graphics programming in a legacy environment.

About

This repository contains different programs in assembly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published