-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProg 3-1.asm
52 lines (39 loc) · 888 Bytes
/
Prog 3-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
; check if the 8-bit data is 2out of 5 code and/or Bitwise palindrome and/or nibblewise palindrome
.MODEL SMALL
.DATA
NUM DB 0BBH
RES DB 3 DUP(0)
COUNT DB 0
.CODE
START: MOV AX,@DATA
MOV DS,AX
MOV AH,0H
MOV CX,5H
MOV AL, NUM
TEST AL,0E0H
JNZ N2O5
LOOP1: ROR AL,1H
JNC LOOP2
INC COUNT
LOOP2: LOOP LOOP1
CMP COUNT,2H
JZ BPAL1
N2O5: MOV RES,0FFH
BPAL1: MOV AL,NUM
MOV CX,8H
BPAL2: ROR AL,1H
RCL AH,1H
LOOP BPAL2
CMP AH,AL
JE NPAL
MOV 1[RES],0FFH
NPAL: MOV BL,AL
AND AL,0F0H
AND BL,0FH
ROL BL,4H
CMP BL,AL
JE ED
MOV 2[RES],0FFH
ED: MOV AH,04CH
INT 21H
END START