Assembly Code For Intel 8086 Yearly Calendar
Assembly Code For Intel 8086 Yearly Calendar
Group8
Design an Intel 8086 program based yearly calendar.
.model small
.data
month_lengths db 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
month_header db "Sun Mon Tue Wed Thu Fri Sat$"
linefeed db 13, 10, "$"
command_prompt db "Enter 'd' to get date, 't' for time or 'q' to quit:
$"
close_message db "Goodbye!$"
raw_year db "2023$"
year dw ?
month db ?
day db ?
hour db ?
minute db ?
second db ?
adjust_byte db ?
adjust_word dw ?
.code
display_ascii_adjust:
aam
mov bx, ax
mov dl, bh
add dl, 30h
mov ah, 02h
int 21h
mov dl, bl
add dl, 30h
mov ah, 02h
int 21h
ret
get_system_date:
call new_line
mov ah, 09h
mov dx, offset date_pre
int 21h
mov ah, 2ah
int 21h
mov month, dh
mov day, dl
call new_line
mov ah, 09h
mov dx, offset year_pre
int 21h
mov ah, 09h
mov dx, offset raw_year
int 21h
mov ah, 09h
mov dx, offset month_pre
int 21h
mov al, month
call display_ascii_adjust
mov ah, 09h
mov dx, offset day_pre
int 21h
mov al, day
call display_ascii_adjust
call new_line
call new_line
jmp get_command
get_system_time:
call new_line
mov ah, 09h
mov dx, offset time_pre
int 21h
mov ah, 2ch
int 21h
mov hour, ch
mov minute, cl
mov second, dh
call new_line
mov ah, 09h
mov dx, offset hour_pre
int 21h
mov al, hour
call display_ascii_adjust
mov ah, 09h
mov dx, offset minute_pre
int 21h
mov al, minute
call display_ascii_adjust
mov ah, 09h
mov dx, offset second_pre
int 21h
mov al, second
call display_ascii_adjust
call new_line
call new_line
jmp get_command
get_date:
call get_system_date
get_time:
call get_system_time
new_line:
mov ah, 09h
mov dx, offset linefeed
int 21h
ret
get_command:
lea dx, command_prompt
mov ah, 09h
int 21h
mov ah, 01h
int 21h
mov bl, al
call new_line
cmp bl, date_command
je get_system_date
cmp bl, time_command
je get_system_time
jmp close
close:
call new_line
lea dx, close_message
mov ah, 09h
int 21h
mov ah, 00
int 20h
start:
mov ax,@data
mov ds, ax
jmp get_command
;call get_system_date
;call get_system_time
end start