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
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