-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMP_no_ns.asm
82 lines (65 loc) · 960 Bytes
/
MP_no_ns.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
%macro write 2
mov ecx, %1
mov edx, %2
mov eax, 4
mov ebx, 1
int 80h
%endmacro
section .data
global x
space: db ' '
x:
db 0xAB
db 0x14
db 0x5C
c: db 0x2
countA: dw 03h
section .bss
y resb 1
z resb 3
section .text
global _start
_start:
lea esi,[x]
mov edi,[countA]
call print
lea esi,[x]
lea edi,[z]
mov ecx, 03h
l:
mov eax, [esi]
mov [edi], eax
inc edi
inc esi
dec ecx
jnz l
lea esi,[z]
mov edi,03h
call print
mov eax, 1
mov ebx, 0
int 80h
print:
temp:
mov bl, [esi] ; take value from array
rol bl, 04 ; to get higher nibble
l1:
mov al, bl
AND al, 0x0F ; to make upper 4 bits zero
add al, 30h
cmp al, 39h
jbe next
add al, 07h
next:
mov byte[y], al ; to print
write y, 1
mov bl, byte[esi]
dec byte[c] ; run the loop twice
mov al, byte[c]
jnz l1
write space, 1
mov byte[c], 02
inc esi
dec edi
jnz temp
ret