Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/omerap12/pstrings
https://github.com/omerap12/pstrings
assembly biu
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/omerap12/pstrings
- Owner: omerap12
- Created: 2021-11-29T16:50:32.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-28T13:48:20.000Z (about 3 years ago)
- Last Synced: 2024-10-29T23:44:20.804Z (2 months ago)
- Topics: assembly, biu
- Language: Assembly
- Homepage:
- Size: 1.26 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pStrings Project
Assembly implementation of basic pString functions.
A project from Computer Structure course in my second year at Bar-Ilan university## Abstract
We were assigned a task to implement basic functions regarding pStrings in the assembly language, as described in pstring.h:
* char pstrlen(Pstring* pstr) - return the length of a pString
* Pstring* replaceChar(Pstring* pstr, char oldChar, char newChar) - replace every occourance of the oldChar in the pString with the newChar given.
* Pstring* pstrijcpy(Pstring* dst, Pstring* src, char i, char j) - given a range, copy the the content of src to dst.
* Pstring* swapCase(Pstring* pstr) - itterate through the pString and change upper case letter to lower case, and vise verca, whilst ignoring non-letter characters.
* int pstrijcmp(Pstring* pstr1, Pstring* psrt2, char i, char j) - in a given range, determine the lexical relation between two pString.In this project we used GAS/AT&T x86 Assembly.
# pString Structure Defenition
'''c
typedef struct{
char size;
char strign[255];
}pString;
'''## Project Files
# run_main.s
The engine of the project. We are reciveing two pStrings from the user, allocating memory on the stack frame.
Also we scan an int from the user, which will be used as a case for our switch case implementation in func_select.sThe function passes as parameters pointers to each pString and to the choice scaned from the user.
# func_select.s
Implementation of switch case using a jump table.
First we make sure to clear the offset between the user's choice and the cases on the jump table (In our case an off set of 50).Each choice from the user can result in two outcomes: invoking a proper function from pstring.s or a default case which will print the prompt 'invalid option!'
# pstring.s
Assembly implementation of the functions declared in pstring.h file