Results 1 to 2 of 2

Thread: password progg written in assembly

  1. #1

    password progg written in assembly

    Ive been trying to write a password program im assembly and ive written most of it but some of it i justcant do could anyone finish it of if they could below is the pseudocode for the program and on the next thread is what i have already done


    .MODEL small

    .STACK 200h



    make ds point to data segment
    make bx point to buffer

    Call the procedures

    procedure passprompt

    prompt for password
    test immediately after coding

    end proc

    procedure checkfirst


    get an input
    jump to error if input < 65 'A' = ASCII 65
    Jump to error if input >122 'z' = ASCII 122
    jump to check90to96 if input > 90 ASCII 90-96 sre not letters
    mov input to the location pointed to by the bx


    jump to error if input < 97 97 is ACII 'a'
    mov input to the locationpointed to by the bx

    output appropriate error message
    jump to get first

    test immediately after coding
    @,[,',{ should be reject
    A,L,Z,a,l,z should be accepted

    end checkfirst

    Procedure checkrest

    mov 11 to the cx a maximum of 11 characters more expected

    jump to exitproc if input = CR
    jump to error2 if input <48 48 is ASCII 0 input must be valid
    jump to error2 if input >122
    jump to check uppercase if input >57
    jump to update buffer input is between 0-9 and valid


    jump to error2 if input < 65 cannot be a letter
    jump to checklowercase if input > 90 not upper but could be lower case
    jump to update buffer input is uppercase letter


    jump to error2 if input<97 not a letter
    jump to updatebuffer inputis lower case letter


    increment the bx
    move contents of al to location held by bx
    loop getdataloop get next input
    ret procedure terminates after 11 inputs


    output error message
    jump to getdataloop jump does not decrement the cx

    exit proc:

    test before proceeding to next procedure

    end checkrest

    procedure checklength

    output error message if contents of cx>6

    end checklength

    procedure quit

    usual exit routine

    end quit


  2. #2

    heres my code not finished

    .MODEL small

    .STACK 100H


    CR EQU 0dh
    LF EQU 0ah

    user_input DB 12 DUP(0)

    prompt_message DB ' Please enter a new password - ',CR,LF,'$'

    error_message_1 DB ' First character must be alphabetic - Re-enter ',CR,LF,'$'

    ;error_message_2 DB

    ;error_message_3 DB


    call initialise
    call password_prompt
    call check_first
    ;call check_rest
    ;call check_length
    call exit

    initialise proc

    mov ax,@data
    mov ds,ax
    mov bx,OFFSET user_input

    initialise endp

    password_prompt proc

    mov bx, OFFSET user_input

    ;now put the password message on the screen

    mov dx, OFFSET prompt_message
    mov ah,9

    int 21h

    password_prompt endp

    mov bx, OFFSET user_input

    check_first proc


    mov ah, 1
    int 21h
    cmp al,65
    jl error
    cmp al,122
    jg error
    cmp al,64
    je error ;testline
    mov[bx], al

    mov dx,OFFSET error_message_1
    mov ah,9
    int 21h
    jmp getfirst

    check_first endp

    exit proc

    mov AH,4Ch
    int 21h

    exit endp


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts