flat assembler
Message board for the users of flat assembler.
Index
> DOS > x386 program,, please help |
Author |
|
LocoDelAssembly 20 Sep 2010, 16:18
I think it will be better if you show us the original code, this one is somewhat hard to follow.
|
|||
20 Sep 2010, 16:18 |
|
anurag001 20 Sep 2010, 16:22
all right---
Code: disp macro msg push ax push dx mov ah,09h lea dx,msg int 21h pop dx pop ax endm .data passs db 'password' passd db 10 dup('$') counts db 8 countd db 0 countt db 3 msg_ent db 10,13,'Enter pass: $',10,13 msg_err db 10,13,'Wrong enter again: $',10,13 msg_suc db 10,13,'Pass validated $',10,13 msg_aga db 10,13,'Turn over: $',10,13 .code mov ax,@data mov ds,ax next_tr: displaylay msg_ent mov cl,0 mov countd,cl mov di,offset up: mov ah,08h int 21h cmp al,0dh je exit mov [di],al inc di inc countd mov ah,02h mov dl,'*' int 21h jmp up exit mov al,countd cmp al,counts jne next_try lea si,passs lea di,passd next_char: mov al,[si] cmp al,[di] jne next try inc si inc di dec countd jnz next_char display msg_err dec countt jnz next_tr display msg_aga exit_1: mov ah,4ch int 21h ends end |
|||
20 Sep 2010, 16:22 |
|
DJ Mauretto 20 Sep 2010, 16:43
Hello, try this
Code: ORG 100H use16 ;============================================================================= ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MAIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;============================================================================= mov ax,3 int 10h mov dx,msg_ent call Display_msg next_try: mov [countd],0 mov di,passd up: mov ah,08h int 21h cmp al,0dh je exit mov [di],al inc di inc [countd] cmp [countd],9 jnc exit mov ah,02h mov dl,'*' int 21h jmp up exit: mov si,passs mov di,passd next_char: mov al,[si] cmp al,[di] jne pass_err inc si inc di dec [countd] jnz next_char mov dx,msg_suc call Display_msg mov dx,msg_aga call Display_msg ret pass_err: dec [countt] jz bye_bye mov dx,msg_err call Display_msg jmp next_try bye_bye: mov dx,msg_seeyou call Display_msg ret ;============================================================================= ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PROC ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;============================================================================= Display_msg: mov ah,09h int 21h ret ;============================================================================= ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;============================================================================= msg_ent db 13,10,'Enter pass:',24h msg_err db 13,10,'Wrong enter again:',24h msg_seeyou db 13,10,'Bad password!! See you next time',24h msg_suc db 13,10,'Pass validated',24h msg_aga db 13,10,'Turn over:',24h passs db 'password' passd db 8 dup('24h') countd db 0 countt db 4 save as pass.asm compile with fasm in this way: fasm pass.asm bye _________________ Nil Volentibus Arduum |
|||
20 Sep 2010, 16:43 |
|
LocoDelAssembly 20 Sep 2010, 16:50
Code: macro disp msg { push ax push dx mov ah,09h lea dx, [msg] int 21h pop dx pop ax } format mz entry @code:start segment @data passs db 'password' passd db 10 dup('$') counts db 8 countd db 0 countt db 3 msg_ent db 10,13,'Enter pass: $',10,13 msg_err db 10,13,'Wrong enter again: $',10,13 msg_suc db 10,13,'Pass validated $',10,13 msg_aga db 10,13,'Turn over: $',10,13 segment @code start: mov ax,@data mov ds,ax next_try: disp msg_ent mov cl,0 mov [countd],cl mov di, passd ; <<<<<<< I added this, original was "mov di, offset" which means nothing (because it is incomplete). This is fasm's way of "mov di, offset passd" up: mov ah,08h int 21h cmp al,0dh je exit mov [di],al inc di inc [countd] mov ah,02h mov dl,'*' int 21h jmp up exit:disp passd mov al,[countd] cmp al,[counts] jne next_try lea si,[passs] lea di,[passd] next_char: mov al,[si] cmp al,[di] jne next_try inc si inc di dec [countd] jnz next_char disp msg_err dec [countt] jnz next_try disp msg_aga exit_1: mov ah,4ch int 21h |
|||
20 Sep 2010, 16:50 |
|
janequorzar 22 Sep 2010, 03:12
keep in mind too, your code has lines like .data in it. Some assemblers complain about that. If your using it as a label, then add the colon at the end of it, .data: like that. Again, that is if your using it as a label.
Otherwise, just take that line out. Same thing with .code |
|||
22 Sep 2010, 03:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.