Blog
This study aims to develop a system for controlling the clock of a system for filing in a cabinet.
CABINET LOCK CONTROLLER
[Name of Student]
[Name of Instructor]
[University]
[Name of Course]
[Date]
TASK 1
Introduction
This study aims to develop a system for controlling the clock of a system for filing in a cabinet. The program is an assembly language code, which can run in picsim.
Functionality of the program
The program is written with an intention for it to operate in an interactive manner. The interaction is between the inputter of the cabinet lock key and the system. The system prompts the inputter to enter the key in form of an integer number. Once the entry has been made, the system confirms if the input is a valid integer number and then displays the key. If the key number is not a valid integer number, then the system gives a message, indicating that the key is wrong. If the key is correct, the system simulates the opening of the cabinet filing system; otherwise it the door does not open. It remains closed and sends a failed operation message. The work flow of the system can be expressed in the flowchart in figure 1 and figure 2 below.
Flowcharts
Figure 1: Flowchart for Program Execution Sequence
Figure 2: Flowchart for Testing the Cabinet Lock Key
Program Code
The program code is as presented below
;***************************************************
.model small
.stack 101h
.data
prompt db ‘Enter the key number: $‘
msgout db ‘The key entered is : $‘
.code
start:
mov ax, @data
mov ds, ax
; copying the message address to memory location dx
mov dx, offset prompt
call puts ; displaying the prompt
call getc ; reading the character to al
mov bl, al ; saving the character to bl
;displaying the next message
mov dx, offset msgout
call puts ; Displaying the message out
;Displaying the character from the keyboard
mov dl, bl ; Copy the character into dl
call putc
mov ax, 4c00h ; Returning to Command Prompt
int 27h
; Subprograms
putc: ; Display key in dl
mov ah, 2h
int 27h
ret
getc: ; reading the key into al
mov ah, 1h
int 27h
ret
puts: ; Displaying the key ended by $
;dx carries the address of the key
mov ah, 9h
int 22h
ret
end start
;*******************************************************
Program Output
42862556515—— FPU Stack ——
Enter the key number: $ 777
The key entered is : $ 777
—— FPU Stack ——
Enter the key number: $ 777
The key entered is : $ 777
