Question
write an assembly language to design an ectronic co with alarm functions

1. Electronic clock Using the four LED digital tubes on the JD51 development board, design the digital clock with alarm funct
0 0
Add a comment Improve this question Transcribed image text
Answer #1

.model small
.stack 1024
.data
.code
start:
mov ax,@data
   mov ds,ax
   extrn writesint:proc
   mov ah,2ch
   int 21h
   mov dl,ch
   add dl,48
   mov ah,2h
   int 21h
   mov ah,00h
   mov al,cl
   mov bl,cl
   call writesint
   mov dl,dh
   mov al,dh
   call writesint
   add bl,10
   looper:
       mov ah,2ch
       int 21h
       mov ah,00h
       mov al,ch
       call writesint
       mov ah,00h
       mov al,cl
       call writesint
       mov dl,dh
       mov al,dh
       call writesint
       mov cx,01
       mov dx,00
       mov ah,86h
       int 15h
       mov ax,00h
       int 10h
       cmp cl,bl
       jnz looper
   mov ah,4ch
   int 21h
   end start
end


.MODEL SMALL
.DATA
TempStr db 1,2 ; temporary storage for STDIN input
t2 db 80 dup (0)   
t3 db 13,10,'$'
Letters db '0123456789' ; possible characters
CrLf db 13,10,'$' ; carriage return and linefeed
.CODE
PUBLIC readsint,writesint
readsint PROC ; reads an integer into the AX register
push bx ; save all registers used
push cx
push dx
push si
mov TempStr,80 ; read in string using buffered STDIN function
mov ah,0Ah
lea dx,TempStr
int 21h
mov cl,TempStr+1 ; get length of string
xor ch,ch
mov bx,0 ; initialize digit index
mov ax,0 ; initialize running total
mov si,10 ; radix = decimal = 10
startmul:
mul si ; move total one place to the left
xor dh,dh
mov dl,[bx+t2] ; get next digit
sub dl,48 ; ascii --> integer value
add ax,dx ; add digit to total
inc bx ; increment digit index
loop startmul
push ax
mov ah,09h ; output carriage return/linefeed
lea dx,CrLf
int 21h
pop ax
pop si ; restore registers
pop dx
pop cx
pop bx
ret ; return to point of call
readsint ENDP
writesint PROC ; outputs the integer in the AX register
push ax ; save all registers used
push bx
push cx
push dx
push si
mov bx,10 ; radix = decimal = 10
xor si,si ; initialize digit counter
startdiv:
xor dx,dx
div bx ; divide no by 10
push dx ; save remainder
inc si ; increment digit counter
cmp ax,0 ; check for end of divisions
jne startdiv
mov cx,si ; set digit counter
mov bx,0 ; initialize position counter
makeletters:
pop ax ; get digit
add al,48 ; make integer --> ascii value
mov [t2+bx],al ; insert digit into string
inc bx ; increment position counter
loop makeletters
mov [t2+bx],'$' ; put end-of-string marker
mov ah,09h ; output integer as string
lea dx,t2
int 21h
mov ah,09h ; output carriage return/linefeed
lea dx,CrLf
int 21h
pop si ; restore registers
pop dx
pop cx
pop bx
pop ax
ret ; return to point of call
writesint ENDP
END

Add a comment
Know the answer?
Add Answer to:
write an assembly language to design an ectronic co with alarm functions 1. Electronic clock Using the four LED dig...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT