-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLB2.1.ASM
92 lines (68 loc) · 1.61 KB
/
LB2.1.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
org 100h
start:
;âûâîä ñòðîêè
mov ah, 09h
mov dx, writeln
int 21h
;ââîä ñòðîêè
mov ah, 0ah
mov dx, readln
int 21h
;âûâîä
mov ah, 02h
mov dl, 10
int 21h
;âûâîä
mov ah, 02h
mov dl, 13
int 21h
;ïðîâåðêà âòîðîãî è ÷åòâåðòîãî ñèìâîëà
mov al, [readln+3]
mov bl, [readln+5]
cmp al, bl
jne skip
;ïðîâåðêà íà äëèííó
mov al, [readln+1]
cmp al, 5h
jl skip
;íàõîæäåíèå ñèìâîëà N-1
mov bh, [readln+1]
mov [var], bh
mov bp, readln-2
mov dx, 0
mov dl, [var]
add bp, dx
mov bh, [bp]
jmp testNum
set3:
mov bh, [readln+4]
mov bl, 3
;îøèáêà åñëè N-1 íå áóêâà
testNum:
;îò ASCII-48 = 0
cmp bh, 48
jl skip
;äî ASCII-57 = 9
cmp bh, 57
jg skip
cmp bl, 3
jne set3
;åñëè âñå â ïîðÿäêå
mov ah, 09h
mov dx, yes
int 21h
mov ah, 08h
int 21h
ret
skip:
mov ah, 09h
mov dx, no
int 21h
mov ah, 08h
int 21h
ret
writeln: db "Enter the text: $"
readln db 9, 0, 10 dup ('$')
yes db 'Yes$'
no db 'No$'
var db 0