MP Project
MP Project
ATM
Creating a full ATM machine program for the 8086 microprocessor involves a complex set of tasks
including user interface, input handling, data storage, and transaction processing. Below, I'll outline a
simplified version focusing on basic functionalities like balance inquiry, withdrawal, and deposit. Note
that real ATM software involves extensive security measures and error handling, which are not fully
covered here.
data segment
data ends
; Code segment
code segment
start:
int 21h
int 21h
repe cmpsb
int 21h
PIN_correct:
int 21h
; Display balance
call display_number
; Display newline
int 21h
; Menu options
int 21h
int 21h
mov amount, ax
jnc insufficient_balance
; Withdraw amount
sub balance, ax
int 21h
; Display updated balance
call display_number
; Display newline
int 21h
; End program
jmp exit_program
insufficient_balance:
int 21h
exit_program:
; Exit program
int 21h
display_number:
; Display AX as a number
push ax
mov cx, 10
mov bx, 0
l1:
mov dx, 0
div cx
add dl, 30h
push dx
inc bx
cmp ax, 0
jne l1
l2:
pop dx
mov ah, 02
int 21h
pop dx
loop l2
ret
code ends
end start
```
### Explanation:
2. **Code Segment**:
- **insufficient_balance**: Handles the case when the user tries to withdraw more than the
available balance.
3. **Functions**:
### Notes:
- This program assumes a simple interface using text output and keyboard input.
- Error handling and security measures (like locking after multiple incorrect PIN attempts) are not
implemented for brevity.
- Handling of edge cases (like negative amounts, non-numeric input) is minimal or absent.
- For a complete ATM program, extensive testing and additional features (such as deposit handling,
transaction logs, receipt printing) would be necessary.
Creating a fully functional ATM program for the 8086 microprocessor is a significant task requiring
detailed planning, especially concerning security and transaction integrity.
2.TEMPERATURE CONTROL
Creating a temperature control program in 8086 assembly involves simulating temperature reading
and control logic. Since 8086 assembly doesn't directly interface with real-world temperature sensors
or HVAC systems, we'll simulate a simple scenario where the program checks a predefined
temperature value and controls a hypothetical heater based on that.
```assembly
.model small
.stack 100h
.data
.code
start:
mov ds, ax
int 21h
call print_number
int 21h
call print_number
mov heater_status, 0
jmp display_heater_status
turn_on_heater:
mov heater_status, 1
display_heater_status:
cmp heater_status, 1
je heater_on
jmp print_message
heater_on:
print_message:
int 21h
exit_program:
int 21h
push ax bx cx dx
mov cx, 0 ; Number of digits counter
L1:
xor dx, dx
3.PARKING SYSTEM
Creating a parking system program for the 8086 microprocessor involves simulating the process of
managing parking spaces, allocating them, displaying availability, and calculating fees based on
duration. Below is a detailed example outlining the structure and key functionalities of such a
program.
```assembly
data segment
; Constants
; Variables
parked_cars dw 10 dup(?) ; Array to track parked cars (0 means space is free, non-zero means
space is occupied)
data ends
; Code segment
code segment
start:
mov ds, ax
mov car_count, 0
mov cx, 0
rep stosw
jmp main_menu
main_menu:
int 21h
int 21h
cmp al, 1
je park_car
cmp al, 2
je remove_car
cmp al, 3
je display_status
cmp al, 4
je exit_program
jmp invalid_option
park_car:
int 21h
mov selected_space, ax
cmp ax, 1
jl invalid_space
jg invalid_space
cmp parked_cars[bx], 0
jne space_occupied
int 21h
int 21h
mov parking_duration, ax
; Calculate fee
mul rate_per_hour
mov total_fee, ax
; Update arrays and counters
inc car_count
dec spaces_available
int 21h
call display_number
; Display newline
int 21h
jmp main_menu
remove_car:
int 21h
int 21h
sub al, '0' ; Convert ASCII to number
mov selected_space, ax
cmp ax, 1
jl invalid_space
jg invalid_space
cmp parked_cars[bx], 0
je space_empty
dec car_count
inc spaces_available
int 21h
jmp main_menu
display_status:
int 21h
int 21h
; Display newline
int 21h
int 21h
; Display newline
int 21h
mov si, 0
loop1:
```assembly
data segment
data ends
; Code segment
code segment
start:
mov ds, ax
mov time_counter, 0
; Start traffic light sequence
jmp green_light
green_light:
int 21h
call delay_seconds
mov current_light, 1
jmp yellow_light
yellow_light:
int 21h
call delay_seconds
mov current_light, 2
jmp red_light
red_light:
int 21h
call delay_seconds
mov current_light, 0
jmp green_light
delay_seconds:
; Delay subroutine using timer interrupt 1Ch (18.2 ticks per second)
mov ax, 0
delay_loop:
delay_inner:
mov dx, 0
div cx
sub bx, ax
jnz delay_inner
; Check if CX has reached zero (end of delay)
dec cx
jnz delay_loop
ret
code ends
end start
```
### Explanation:
1. **Data Segment**:
- Defines variables such as timing for each traffic light state (green, yellow, red), delay time for each
timer tick, and messages for each light state.
2. **Code Segment**:
- **green_light, yellow_light, red_light**: Sequences through the traffic light states (green ->
yellow -> red) using jump instructions.
- **delay_seconds**: Subroutine to implement a delay using the timer interrupt 1Ch. It calculates
the delay based on the number of seconds specified in CX register.
### Notes:
- This program assumes a simplified approach where each traffic light state has a fixed duration
specified in seconds.
- The delay subroutine (`delay_seconds`) uses the BIOS interrupt `1Ah` to get the current time and
then calculates the delay based on the number of seconds specified.
- For a more realistic traffic light controller, additional features could be added such as pedestrian
signals, synchronization with traffic sensors, and more complex timing logic.
- Error handling and interrupt management are not extensively covered in this simplified example.
This program provides a basic framework for simulating the timing and sequencing of traffic lights
using assembly language on the 8086 microprocessor. For real-world applications, additional
considerations and features would be necessary to handle various traffic scenarios effectively.
5.ACCIDENT
Creating an accident simulation program for the 8086 microprocessor involves modeling the
sequence of events after an accident, such as emergency response and data logging. Below is a
simplified outline of such a program. Please note that this program is for educational purposes and
does not cover real-time data acquisition or advanced simulation features.
```assembly
data segment
data ends
; Code segment
code segment
start:
int 21h
call emergency_response
int 21h
; End program
int 21h
; Exit to DOS
int 21h
emergency_response:
int 21h
ret
code ends
end start
```
### Explanation:
1. **Data Segment**:
- `msg_clearance`: Message indicating that the accident site has been cleared.
2. **Code Segment**:
### Notes:
- This program provides a basic framework for simulating the sequence of events after an accident
using assembly language on the 8086 microprocessor.
- In a real-world scenario, this program would be integrated with sensors or user inputs to trigger the
accident reporting and response process.
- Error handling and complex decision-making processes (such as routing emergency services) are
not covered in this simplified example.
- Assembly language programming on the 8086 microprocessor can be extended to include more
sophisticated features depending on specific requirements, such as logging accident details,
interacting with external devices, or simulating multiple accident scenarios.
This example serves as a foundational program to understand how assembly language can be used to
simulate and respond to an accident scenario using basic messaging and subroutine calls on the 8086
microprocessor.
6.MOBLE APPLICATION
Creating a mobile application simulation on the 8086 microprocessor involves designing a program
that emulates basic functionalities typically found in mobile apps. Given the limitations of the 8086
architecture, we'll focus on a simplified version that includes a basic user interface, a few essential
features, and interaction through text-based menus. Below is an outline of such a program:
```assembly
data segment
msg_menu db '1. Calculator', 0Dh, 0Ah, '2. Contact List', 0Dh, 0Ah, '3. Notes', 0Dh, 0Ah, '4. SMS',
0Dh, 0Ah, '5. Settings', 0Dh, 0Ah, '6. Exit', 0Dh, 0Ah, '$'
; Calculator variables
num1 dw ?
num2 dw ?
result dw ?
; Notes variables
notes db 500 dup('$') ; Array to store notes
data ends
; Code segment
code segment
start:
mov ds, ax
main_menu:
int 21h
int 21h
int 21h
cmp al, 1
je calculator
cmp al, 2
je contact_list
cmp al, 3
je notes
cmp al, 4
je sms
cmp al, 5
je settings
cmp al, 6
je exit_program
jmp invalid_option
calculator:
mov result, 0
int 21h
int 21h
mov num1, ax
int 21h
; Read second number
int 21h
mov num2, ax
; Perform addition
mov result, ax
; Display result
int 21h
mov dl, ah
int 21h
jmp main_menu
contact_list:
int 21h
int 21h
jmp main_menu
notes:
int 21h
int 21h
jmp main_menu
sms:
int 21h
int 21h
jmp main_menu
settings:
int 21h
int 21h
jmp main_menu
exit_program:
; Exit program
int 21h
invalid_option:
int 21h
jmp main_menu
code ends
end start
```
### Explanation:
1. **Data Segment**:
- `notes`: Array to store notes, assuming each note can be up to 500 characters.
2. **Code Segment**:
- **main_menu**: Loop that displays the main menu, reads user input, and processes the selected
option.
- **contact_list, notes, sms, settings**: Subroutines to simulate accessing contact list, notes,
sending SMS, and accessing settings.
- **invalid_option**: Handles invalid user inputs by displaying an error message and returning to
the main menu.
### Notes:
- This program provides a basic framework for simulating a simple mobile application-like interface
using assembly language on the 8086 microprocessor.
- Each menu option (`calculator`, `contact_list`, `notes`, `sms`, `settings`) can be expanded with more
functionalities based on specific requirements.
- Error handling and complex functionalities such as actual data storage, user authentication, or
interactive UI elements are not implemented in this simplified example.
- Assembly language programming on the 8086 microprocessor can be extended with additional
features like file handling, graphics simulation, or more advanced calculations to enhance the
simulation.
7.LIBRARY MANGMENT
This example serves as a starting point to understand how assembly language can be used to
simulate basic mobile application operations on the 8086 microprocessor, providing a foundation for
further development and customization based on specific educational or demonstration needs.