-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patha1.asm
62 lines (50 loc) · 953 Bytes
/
a1.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
;nasm 2.11.08
%macro write 2
mov eax,4
mov ebx,1
mov ecx,%1
mov edx,%2
int 80h
%endmacro
section .data
msg: db 'positive numbers '
len: equ $-msg
msg2: db 10,'negative numbers '
len2: equ $-msg2
x: db 5h, 23h, 10, 0Ah, 84h, 4Ch, 99h, 81h, 88h,0Ah
cp: db 00h
cn: db 00h
section .text
global _start
_start:
lea esi, [x]
mov di, 0Ah
mov bl, 00h
mov cl, 00h
l:
mov al, byte[esi]
shl al, 01
jnc pos
neg:
inc cl
inc si
dec di
jnz l
jmp display
pos:
inc bl
inc esi
dec edi
jnz l
display:
add bl, '0'
add cl, '0'
mov byte[cp], bl
mov byte[cn], cl
write msg, len
write cp,1
write msg2, len2
write cn,1
mov eax,1
mov ebx,0
int 80h;