News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

use of register assumed to ERROR

Started by Magnum, December 06, 2012, 01:11:29 PM

Previous topic - Next topic

Magnum

I have never seen this Error on a .While statement.


invoke RegisterClassEx, addr wc ; register our window class

invoke CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,
CW_USEDEFAULT,280,150,NULL,NULL,hInstance,NULL ; Create the window
mov hwnd,eax

invoke ShowWindow, hwnd,CmdShow ; display our window
invoke UpdateWindow, hwnd

.WHILE TRUE ;  use of register assumed to ERROR

invoke GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

Magnum

I have two errors.

Can someone help me ?

                MOV al, [esi]

               .IF al > 29h

1st error here .IF al AND al, 0Fh

2nd error here  .IF al SUB al, 55    ; problem here
                ADD byte ptr [edx+ecx], al


C:\masm32\SOURCE\fixer1.asm(365) : error A2008: syntax error : ,

C:\masm32\SOURCE\fixer1.asm(400) : error A2008: syntax error : SUB
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

1st error here .IF al AND al, 0Fh

i think you mean this...
.if al&0Fh
which is essentially the same as
test al,0Fh
jz  @F


this one - i am not sure what you are trying to do
2nd error here  .IF al SUB al, 55    ; problem here
but - see if this makes sense...
sub al,55
.if !ZERO?

which is the same as
sub al,55
jz @F



maybe i am reading you wrong, and you want these...
.if al
and al,0Fh
.endif

that doesn't really make sense
because, if AL is 0 to begin with, ANDing it won't change its' value

.if al
sub al,55
.endif



i had trouble with these - and i am still not super-comfortable with .IF/.ELSEIF/.ELSE/.ENDIF syntax
what i do is write what i think it should be, then look at the disassembled code

Magnum

Thanks Dave.

I am down to one error.
Sorry it looks sloppy right now.

Stayed up late.

C:\masm32\SOURCE\reparieren.asm(438) : fatal error A1010: unmatched block nesting : .if-.repeat-.while



WndProc endp

; Change a string to its byte equivalent.
; Use only numbers, and uppercase letters

Convert proc LpBuffer:DWORD,LpString:DWORD

push eax
push esi
push ecx
push edx
mov esi, LpBuffer
mov edx, LpString
xor ecx, ecx

MORE :

MOV al, [esi]

.IF al > 29h

;.IF al AND al, 0Fh
.if al&0Fh


IMUL eax, 10h

.ELSE

.IF al>64

.IF al

SUB al, 55

IMUL eax, 10h

.ENDIF

.ENDIF

.ENDIF

;.ENDIF

MOV byte ptr [edx+ecx], al
INC esi
mov al, [esi]

.IF al >29h

;.IF al AND al, 0Fh

.if al&0Fh

ADD byte ptr [edx+ecx], al

.ELSE

.IF al > 64

;.IF al SUB al, 55    ; problem here

sub al,55
.if !ZERO?

ADD byte ptr [edx+ecx], al

.ENDIF

.ENDIF

;.ENDIF

;.ENDIF

.IF byte ptr [edx+ecx] != NULL

INC esi
INC ecx
JMP MORE

.ENDIF
mov StrLen2, ecx

pop edx


Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

dedndave

yah - that's why they use indentation - so you can see them matched up
i am not crazy about IF/ELSE or indentation - lol

not sure where you want the .ENDIF's
but, maybe this will help...
; Change a string to its byte equivalent.
; Use only numbers, and uppercase letters

Convert proc LpBuffer:DWORD,LpString:DWORD

    push eax
    push esi
    push ecx
    push edx
    mov esi, LpBuffer
    mov edx, LpString
    xor ecx, ecx

MORE :

    MOV al, [esi]

    .IF al > 29h

        ;.IF al AND al, 0Fh
        .if al&0Fh


            IMUL eax, 10h

        .ELSE

        .IF al>64

            .IF al

                SUB al, 55

                IMUL eax, 10h

            .ENDIF

        .ENDIF

    .ENDIF

    ;.ENDIF

    MOV byte ptr [edx+ecx], al
    INC esi
    mov al, [esi]

    .IF al >29h

        ;.IF al AND al, 0Fh

        .if al&0Fh

            ADD byte ptr [edx+ecx], al

        .ELSE

            .IF al > 64

                ;.IF al SUB al, 55    ; problem here

                sub al,55
                .if !ZERO?

                    ADD byte ptr [edx+ecx], al

                .ENDIF

            .ENDIF

        ;.ENDIF

        ;.ENDIF

            .IF byte ptr [edx+ecx] != NULL

                INC esi
                INC ecx
                JMP MORE

            .ENDIF
            mov StrLen2, ecx

            pop edx
            pop ecx
            pop esi
            pop eax
            ret

Convert endp


notice that, when you have an .ELSE immediately followed by an .IF, they can be combined to .ELSEIF
        .ELSE

            .IF al > 64


        .ELSEIF al > 64