-
Notifications
You must be signed in to change notification settings - Fork 1
/
final.asm
85 lines (74 loc) · 939 Bytes
/
final.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
include macros2.asm
include number.asm
include numbers.asm
.MODEL LARGE
.STACK 200h
.386
.387
.DATA
MAXTEXTSIZE equ 50
@_a DD 0.0
@_5 DW 5
.CODE
.startup
mov AX,@DATA
mov DS,AX
FINIT
mov ah, 4ch
int 21h
;FIN DEL PROGRAMA DE USUARIO
strlen proc
mov bx, 0
strl01:
cmp BYTE PTR [si+bx],'$'
je strend
inc bx
jmp strl01
strend:
ret
strlen endp
copiar proc
call strlen
cmp bx , MAXTEXTSIZE
jle copiarSizeOk
mov bx , MAXTEXTSIZE
copiarSizeOk:
mov cx , bx
cld
rep movsb
mov al , '$'
mov byte ptr[di],al
ret
copiar endp
concat proc
push ds
push si
call strlen
mov dx , bx
mov si , di
push es
pop ds
call strlen
add di, bx
add bx, dx
cmp bx , MAXTEXTSIZE
jg concatSizeMal
concatSizeOk:
mov cx , dx
jmp concatSigo
concatSizeMal:
sub bx , MAXTEXTSIZE
sub dx , bx
mov cx , dx
concatSigo:
push ds
pop es
pop si
pop ds
cld
rep movsb
mov al , '$'
mov byte ptr[di],al
ret
concat endp
end