here my code ...anyone can help me solve the error?urgent

Assembling: pw.asm
pw.asm(152) : error A2022: instruction operands must be the same size
pw.asm(157) : error A2032: invalid use of register
Press any key to continue . . .




.model small
.stack 64
.data

msg4 db 'ASCII CHARACTERS'

msg3 db 'PASSWORD INCORRECT!DENIED ACCESS!$'
msg2 db 'PASSWORD: $'
msg1 db 'RETRY: $'

ask db '#$'
.code

clear:


main proc
mov ax,@data
mov ds,ax
call clearScreen ;clear the screen
call resetCursor

mov ah,09h ;display string
lea dx,msg2 ;prints Enter password
int 21h

mov bl,3

again:
        mov ah,07 ;direct keyboard input
        int 21h
        mov bh,al ;move the input al to bh
        cmp bh,0dh
        je again
        call asterisk
        cmp bh,'a' ;compare bh with J
        je again1 ;if equal jump to again
        jne wrong ;if not to wrong

again1:
        mov ah,07
        int 21h
        mov bh,al
        cmp bh,0dh
        je invalid9
        call asterisk
        cmp bh,08h
        je again
        cmp bh,'b' ;compare bh with P
        je again2
        jne wrong
again2:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,'c' ;compare bh with h
        je again3
        jne wrong

invalid9:
        call invalid8

again3:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,'d' ;compare bh with I
        je again4
        jne wrong

again4:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,'P' ;compare bh with C
        je again5
        jne wrong
again5:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,'e' ;compare bh with E
        je again6
        jne wrong
again6:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,'f' ;compare bh with s
        je again7
        jne wrong

invalid8:
        call invalid

again7:
        mov ah,07
        int 21h
        mov bh,al
        cmp bh,0dh ;compare the input with the enter key
        je exit
        jne wrong

wrong:
        mov ah,07
        int 21h
        mov bh,al
        call asterisk
        cmp bh,0dh ;compare the input with the enter key
        je invalid
        jne wrong

invalid:
        call clearScreen
        call resetCursor
        mov ah,09
        lea dx,msg1 ;prints retry password
        int 21h
        dec bl ;decrements bl until 3 attempts
        cmp bl,0
        je invalid2
        jmp again

invalid2:
        call clearScreen
        call resetCursor
        mov ah,09 ;print password failed!!!
        lea dx,msg3
        int 21h
        int 20h

exit:
        call clearScreen
        call resetCursor
       
        ;ASCII program

mov ax,0600 ;setting background
mov bh, 30h ;color of the attribute
mov cx,0000h ;where the color starts to point
mov dx,184fh ;where the color ends to point
int 10h

mov ax,0b80h ;location of the screen
mov es,ax ;location of the screen move to es register
mov bx,60+(160*4) ;where the title starts to display and move to bx register
mov si,msg4 ;the message move to si register
mov cx,16 ;the numbers of letters that will display

print:

mov al,bl ;the value of si is move to al register
mov es:,al ;move the value of al to the location of es:
inc si ;increment the si
add bx,2 ;add bx by 1 for the attribute
loop print ;looping
int 21h ;to terminate the loop

mov bh,0 ;holds the characters
mov di,160*8 ;where the characters will display and move to di register
mov cx,255 ;the number of characetrs that will display

char:
        mov al,bh ;moving bh to the al register
        mov es:,al ;move the value of al is move to the location of es:
        inc bh ;increment the bh
        add di,8 ;to make 20 columns
        loop char ;looping
int 20h ;to terminate the loop



asterisk: ;prints asterisk
        mov ah,09h
        lea dx,ask
        int 21h
        ret
       
mov ax,4c00h
int 21h

main endp

clearScreen proc
MOV AX, 0600H  ;AH = 06 (scroll)
;AL = 00 (full screen)
MOV BH, 0BH      ;White background (0)
;Blue foreground (1)

MOV CX, 0000H ;Upper left row:column
MOV DX, 184FH ;Lower right row:column

INT 10H ;Call interrupt service

retn
clearScreen endp

resetCursor proc
MOV AH, 02H ;Request set cursor
MOV BH, 00 ;Page number 0

MOV DX, 0000H ;Row 0, column 0

INT 10H ;Call interrupt service
retn
resetCursor endp
end main




Posted on 2011-11-29 00:49:23 by jove2493
I don't have PC/Windows or PC/DOS laying around nor do I use MASM very often, but let me see if I can give you some hints. The two offending lines are:

mov si, msg4


and
mov al, bl


The first error looks okay to me, but I believe MASM makes various assumptions about your labels so I would say to try and prepend 'msg4' with OFFSET. Or since you have done it elsewhere in the code, try using the LEA instruction instead.

mov si, OFFSET msg4

lea si, msg4


As for the second problem, I don't even know what you're trying to do here! I think you made a mistake and just added an extra "bl" but in case you were actually trying to use SI as an index into the address located in BL (which won't work because BL can't hold an address) then you might try using the '' notation. But I think what you really want is to just use:

mov al, 


That should handle your error messages.

Regards,
Bryant Keller
Posted on 2011-11-30 22:43:49 by Synfire
thx, i get it .~!
Posted on 2011-12-01 06:13:33 by jove2493
bry !! hope ur world is better than last we spoke mate
Posted on 2011-12-02 02:32:59 by Homer
About the same actually mate, but still not complaining. :)
Posted on 2011-12-02 03:39:23 by Synfire