Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please explain each code and what does it do, I dont want to explain it in general please name keycount org 100h ; print welcome

Please explain each code and what does it do, I dont want to explain it in general please

name "keycount"

org 100h

; print welcome message: mov dx, offset msg mov ah, 9 int 21h

xor bx, bx ; zero bx register.

wait: mov ah, 0 ; wait for any key.... int 16h

cmp al, 27 ; if key is 'esc' then exit. je stop

mov ah, 0eh ; print it. int 10h

inc bx ; increase bx on every key press.

jmp wait

; print result message: stop: mov dx, offset msg2 mov ah, 9 int 21h

mov ax, bx call print_ax

; wait for any key press: mov ah, 0 int 16h

ret ; exit to operating system.

msg db "I'll count all your keypresses. press 'Esc' to stop...", 0Dh,0Ah, "$" msg2 db 0Dh,0Ah, "recorded keypresses: $"

print_ax proc cmp ax, 0 jne print_ax_r push ax mov al, '0' mov ah, 0eh int 10h pop ax ret print_ax_r: pusha mov dx, 0 cmp ax, 0 je pn_done mov bx, 10 div bx call print_ax_r mov ax, dx add al, 30h mov ah, 0eh int 10h jmp pn_done pn_done: popa ret endp

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions