-
Notifications
You must be signed in to change notification settings - Fork 0
/
npr.asm
74 lines (73 loc) · 1.11 KB
/
npr.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
DATA SEGMENT
n db 5
r db 1
ncr db 0
DATA ENDS
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov ncr,0
mov al,n
mov bl,r
call encr
call display
mov ah,4ch
int 21h
encr proc
cmp al,bl
je ncr1
cmp bl,0
je ncr1
cmp bl,1
je ncrn
dec al
cmp bl,al
je ncrn1
push ax
push bx
call encr
pop bx
pop ax
dec bl
push ax
push bx
call encr
pop bx
pop ax
ret
ncr1: inc ncr
ret
ncrn1: inc al
ncrn: add ncr,al
ret
encr endp
display proc
push cx
mov al,ncr
mov ch,al
and al,0f0h
mov cl,04
shr al,cl
cmp al,09h
jbe next
add al,07h
next:add al,30h
mov dl,al
mov ah,02h
int 21h
mov al,ch
and al,0fh
cmp al,09h
jbe next2
add al,07h
next2:add al,30h
mov dl,al
mov ah,02h
int 21h
pop cx
ret
display endp
hlt
code ends
end start