0% found this document useful (0 votes)
4 views7 pages

Microprocessor Assignment

The document outlines a graded lab assignment for the subject ETC2053 Microprocessor Systems, focusing on creating an Intel 8086 assembly language program to evaluate password strength based on specific criteria. It includes the program code, explanations of registers and instructions used, and a verification section with test cases demonstrating the program's effectiveness. The conclusion confirms the successful validation of password requirements and the program's alignment with the assignment objectives.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views7 pages

Microprocessor Assignment

The document outlines a graded lab assignment for the subject ETC2053 Microprocessor Systems, focusing on creating an Intel 8086 assembly language program to evaluate password strength based on specific criteria. It includes the program code, explanations of registers and instructions used, and a verification section with test cases demonstrating the program's effectiveness. The conclusion confirms the successful validation of password requirements and the program's alignment with the assignment objectives.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

__________________________________________________________________________

SCHOOL OF ENGINEERING AND TECHNOLOGY


SUBJECT CODE AND NAME: ETC2053 MICROPROCESSOR SYSTEMS
ASSESSMENT NAME: GRADED LAB 2
DUE DATE: 31 DECEMBER 2025

NO. STUDENT ID STUDENT NAME


1 24083826 OGOOLUWA EMMANUEL ADEGOKE
2 23092679 KAZUKI LOH LINTON

Aim and objective


To create an Intel 8086 assembly language program that determines whether a user-written password
is strong or not by a set of criteria, which includes containing at least 10 characters, and 1 of the four
special characters: #, $, %, and &.

Code
.MODEL SMALL
.STACK 100h

.DATA
promptMsg DB 'Enter password: $'
strongMsg DB 0Dh,0Ah,'Strong password$'
weakMsg DB 0Dh,0Ah,'Weak password$'

; DOS buffered input structure


pwdBuffer DB 20
DB ?
DB 20 DUP(?)

foundSpec DB 0

.CODE
MAIN PROC
; Initialize data segment
MOV AX, @DATA
MOV DS, AX

; Display prompt
MOV AH, 09h
LEA DX, promptMsg
INT 21h
; Read password input
MOV AH, 0Ah
LEA DX, pwdBuffer
INT 21h

; Check password length (must be >= 10)


MOV CL, pwdBuffer + 1
CMP CL, 10
JL WEAK_PASSWORD

; Prepare to scan characters


MOV SI, OFFSET pwdBuffer + 2
MOV CX, pwdBuffer + 1

CHECK_CHAR:
MOV AL, [SI]

CMP AL, '#'


JE FOUND_SPECIAL
CMP AL, '$'
JE FOUND_SPECIAL
CMP AL, '%'
JE FOUND_SPECIAL
CMP AL, '&'
JE FOUND_SPECIAL

INC SI
LOOP CHECK_CHAR
JMP CHECK_RESULT

FOUND_SPECIAL:
MOV foundSpec, 1

CHECK_RESULT:
CMP foundSpec, 1
JE STRONG_PASSWORD

WEAK_PASSWORD:
MOV AH, 09h
LEA DX, weakMsg
INT 21h
JMP EXIT

STRONG_PASSWORD:
MOV AH, 09h
LEA DX, strongMsg
INT 21h

EXIT:
MOV AH, 4Ch
INT 21h

MAIN ENDP
END MAIN
List of registers and instructions adopted and the purpose of each
Registers:
AX (Accumulator Register)
AX is mostly invoked to make calls to DOS services by INT 21h. The value inserted in AH denotes
the number of the function (e.g. display string, read input, terminate program).
Example:
 MOV AH, 09h (Prepares AX to display a string)
 MOV AH, 4Ch (Terminates the program)
BX (Base Register)
BX serves as a general-purpose register, usually serving as a flag or temporary storage to signal that a
necessary condition has been fulfilled (e.g. some indicator of a special character).
Example:
 MOV BX, 0 (Initializes a flag indicating no special character found)
 MOV BX, 1 (Sets the flag once a special character is detected)
CX (Count Register)
CX is taken as a loop counter in the iterating process of the password characters. CX is automatically
decremented by the LOOP instruction and repeated until CX is equal to zero.
Example:
 MOV CL, [password_length] (Loads the number of characters entered)
 LOOP CHECK_CHAR (Continues checking characters until all are examined)
DX (Data Register)
DX puts the offset address of strings or buffers when transmission of messages or input through DOS
interrupts.
Example:
 LEA DX, promptMsg (Loads the address of the prompt message)
 INT 21h (Displays the message on screen)
SI (Source Index Register)
When scanning, SI is used to indicate the character that is presently in the password buffer. It
facilitates indexed addressing, enabling one to access sequentially every character.
Example:
 MOV SI, OFFSET password+2 – (Skips buffer metadata and points to the first character)
 MOV AL, [SI] (Loads the current character for comparison)
Instructions:
1. MOV (Move Instruction)
Move information between registers and memory. This is the most common teaching in the program.
Example: MOV AL, [SI] (Moves the current password character into AL)
2. LEA (Load Effective Address)
Loads the offset address of a variable or a string to a register usually DX when you want to output.
Example: LEA DX, strongMsg (Prepares the strong password message for display)
3. INT 21h (DOS Interrupt)
Provides input/output services such as displaying strings, reading user input, and exiting the program.
Example: 09h (Display string)
4. CMP (Compare Instruction)
Compares two values by subtracting them internally and setting processor flags for conditional jumps.
Example: CMP CL, 10 (Checks if the password length is at least 10 characters)
5. JE / JNE / JL / JGE (Conditional Jump Instructions)
Controls program flow based on comparison results.
Example: JL WEAK_PASS (Jumps if length is less than required)
6. INC / DEC (Increment / Decrement)
Updates counters and move through memory locations.
Example: INC SI (Moves to the next character in the password)
7. LOOP
Automatically decrements CX and repeat execution until CX becomes zero, making it ideal for
character scanning.
Explanation and logic of the assembly program:
The program starts with setting up the data portion and putting a prompt whereby the user is required
to input a password. Password reading is done through the DOS interrupt 21h function 0Ah that stores
the user input in a defined buffer. This buffer contains the maximum available length, the number of
characters typed as well as the typed characters.
The program validates the length requirement first. The entered number of characters is checked with
the minimal length of characters required that is 10. The password length should be at least 10, so in
case the length is less, the program will automatically define the password as a weak one and will not
conduct any additional search.
When the length requirement is met, then the program continues to test the existence of at least one
special character. Every character in the password buffer is examined on a loop. The current character
is identified by the index register SI and countered by CX which is the number of characters to be
checked.
All the characters are checked against the ASCII value of the four special characters that are used: #,
$, %, and &. When a match has been reached, a flag (an element of a register or memory variable) is
set to reflect that the special character requirement has been met. Depending on implementation, the
loop can either stop prematurely or run to completion by checking all characters.
The results are evaluated by the program after the two checks. In case the password fulfilling both
constraints (minimal length and the presence of special characters), it is shown that the password is
strong. Otherwise, it shows a message which states that the password is weak. The program then
gracefully ends by means of INT 21h function 4Ch.

Presentation and Verification of Result:


To ensure that the password checker program is properly enforcing the requirements of minimum
length and the use of special character, various input cases were utilized to test the program. The
results obtained were compared to the anticipated results.

Input Password Characters Special Characters Expected Results Actual Results


abcdefghi 9 No Weak Weak
abcdefghij 10 No Weak Weak
abcde#fghi 10 Yes Strong Strong
abcdefghij& 11 Yes Strong Strong

The findings indicate that the program is accurate in determining weak passwords when neither of the
two conditions is met and it determines passwords as strong only where all the two conditions are
fulfilled. Thus, the behavior of the program is as expected.
List of addressing modes used:
1. Immediate Addressing Mode
An immediate addressing mode is an addressing mode where a fixed value is given directly in an
instruction. It is a mode that is primarily employed in comparisons and control values.
In the initial command the number 10 is the fixed value of minimum length of passwords. The 09h in
the second command defines the DOS command to show a string. Immediate addressing enhances
readability and speed of execution because no memory access is done.
2. Register Addressing Mode
Register addressing mode involves the use of CPU registers which store operands. This mode is
common in the program to use counters, flags and even temporary storage of data.
In this case, CL contains the length of the password, and AL contains the character under the
investigations. Register addressing is also quick and effective, hence it is applicable in repetitive tasks
within loops.
3. Direct Memory Addressing Mode
Direct memory addressing mode reads data stored at a particular memory address which is defined in
the data segment
The direct address that contains the actual number of characters typed by the user is accessed by the
instruction pwdBuffer + 1. Likewise, foundSpec is an element of memory that serves as a flag. This
mode is applicable in the access of stationary information structures like buffers and variables.
4. Indexed Addressing Mode
The array-like data structures are accessed using indexed addressing mode based on combining a base
address and an index register. Scanning one character at the time of the password is necessary in this
program.
The character at the password buffer is SI. The program is executing the program sequentially with SI
being called. In this mode, the efficient memory location analysis can be done by the character-by-
character analysis without hard coding.

All physical memory addresses utilized:


The program is executed in the real-mode 8086 model of memory, in which the physical memory
address is computed as:
Physical Address = Segment * 16 + Offset
Data Segment (DS): Holds the password buffer, prompt message and the result messages
Code Segment (CS): This consists of all program code and control actions
Stack Segment (SS): This is a nonvolatile storage utilized in temporary storage of information during
interrupt calls and execution of a program
Exact physical addresses are defined by the location of program load, but all the memory accesses are
inside the assigned code, data and stack segments.
Conclusion:
The laboratory exercise, which is a success, proved the ability to use Intel 8086 assembly language to
create a simple password strength checker. The program has properly validated password length and
special character requirements by making use of registers, addressing modes and DOS interrupt
services. The findings achieved correspond to the desired results, which satisfy all the mentioned
aims.

You might also like