Ensamblador - Problema al tratar de escribir un archivo por 2da vez

 
Vista:
sin imagen de perfil
Val: 2
Ha aumentado su posición en 4 puestos en Ensamblador (en relación al último mes)
Gráfica de Ensamblador

Problema al tratar de escribir un archivo por 2da vez

Publicado por Alejandro (2 intervenciones) el 09/04/2018 02:47:43
Buena, mi problema es el siguiente:

Tengo esto:
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
salto 	db 	13,10,'$'
user_in 	db 255 dup('$')
pass_in 	db 255 dup('$')
tamanouser  dw ?
tamanopass	dw ?
 
ESCRIBIR_ARCHIVO_USUARIOS MACRO vec, tam
			mov ah,3dh
			mov al,1h
		 	mov dx,offset archivo_usuarios
			int 21h
 
			;Escritura de archivo
			mov bx,ax ; mover hadfile
			mov cx,tam ;num de caracteres a grabar
			mov dx,offset vec
			mov ah,40h
			int 21h
 
			mov bx,ax ; mover hadfile
			mov cx,1 ;num de caracteres a grabar
			mov dx,offset salto
			mov ah,40h
			int 21h
 
			mov bx,ax
  			mov ah,3eh ;cierra el archivo
  			int 21h
	ENDM


Y lo que quiero hacer es ir guardando usuarios y contraseñas que voy ingresando en mi programa de la siguiente forma:

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
REGISTRO_USUARIO:
			call LEER_ENTRADA
 
			cmp al, 0dh
			je ESCRIBIR_USUARIO
 
			cmp al, 08h
			je ELIMINAR_CAR_REG
 
			mov user_in[si], al
			inc si
			jmp REGISTRO_USUARIO
 
		ELIMINAR_CAR_REG:
			COPIAR ' '
			COPIAR 8
			dec si
			mov user_in[si], '$'
			jmp REGISTRO_USUARIO
 
		ESCRIBIR_USUARIO:
 
			mov tamanouser, si
 
			ESCRIBIR_ARCHIVO_USUARIOS user_in, tamanouser
 
  			jmp REGISTRO_PASSWORD
 
 
REGISTRO_PASSWORD:
			call LEER_ENTRADA
 
			cmp al, 0dh
			je ESCRIBIR_PASS
 
			cmp al, 08h
			je ELIMINAR_CAR_REG_PASS
 
			mov pass_in[si], al
			inc si
			jmp REGISTRO_PASSWORD
 
		ELIMINAR_CAR_REG_PASS:
			COPIAR ' '
			COPIAR 8
			dec si
			mov pass_in[si], '$'
			jmp REGISTRO_PASSWORD
 
		ESCRIBIR_PASS:
 
			mov tamanopass, si
 
			ESCRIBIR_ARCHIVO_USUARIOS pass_in, tamanopass
 
  			jmp INICIO
 
LEER_ENTRADA:
			mov ah, 01h
			int 21h
			ret

Solo logra escribir el usuario que ingresé, no escribe la contraseña. No sé si estaré utilizando mal las funciones para el manejo de archivos. Agradezco cualquier ayuda.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder