Need some help in motorola 68k assembly language. First, the program will print
ID: 3733578 • Letter: N
Question
Need some help in motorola 68k assembly language.
First, the program will print the programming assignment number, your name, and your class account, all on one line. Your program is going to calculate the day of the week that a user entered number falls on in March 2018. Your program will prompt the user to enter a single number of one or two characters in length. Your program will then print the day of the week that day falls on using the provided strings. If the user enters 3, your program will print “The 3th day is Saturday.” You can assume that all day endings are “th”. Your program will not display additional spaces at the beginning of or in the middle of the string
Explanation / Answer
.data
prompt db 13, 10, 'assignment number , your name , your class account ', '$'
prompt db 13, 10, 'Enter day: ' , '$'
day db ?
.code
main proc
mov ax,@data ;get data segment address
mov ds,ax ;initialize ds
;Display Prompt
mov ah,9 ;print string function
mov dx,offset prompt; ds:dx points to string
int 21h
;Day from user
mov ah,9
lea dx, prompt ;print prompt
int 21h
mov ah,2 ;input day from user
int 21h
mov bh,al ;save the value from user
mov day,al
mov ax, bh
mov bl, '7'
div bl
cmp dx, 00
je L7
cmp dx, 01
je L8
cmp dx, 02
je L9
cmp dx, 03
je L10
cmp dx, 04
je L11
cmp dx, 05
je L12
cmp dx, 06
je L13
L7:
mov ah,2
mov dl,bh
int 21h
mov dl,'th day is wednesday'
int 21h
mov ah,4ch
int 21h
L8:
mov ah,2
mov dl,bh
int 21h
mov dl,'th day is thrusday'
int 21h
mov ah,4ch
int 21h
L9:
mov ah,2
mov dl,bh
int 21h
mov dl,'th day is friday'
int 21h
mov ah,4ch
int 21h
L10:
mov ah,2
mov dl,bh
int 21h
mov dl,'th day is saturday'
int 21h
mov ah,4ch
int 21h
L11:
mov ah,2
mov dl,bh
int 21h
mov dl,'th day is sunday'
int 21h
mov ah,4ch
int 21h
L12:
mov ah,2
mov dl,bh
int 21h
mov dl,'th day is monday'
int 21h
mov ah,4ch
int 21h
L13:
mov ah,2
mov dl,bh
int 21h
mov dl,'th day is tuesday'
int 21h
mov ah,4ch
int 21h
main endp
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.