Author Topic: use of register assumed to ERROR  (Read 5612 times)

Magnum

  • Member
  • *****
  • Posts: 2354
use of register assumed to ERROR
« on: December 06, 2012, 01:11:29 PM »
I have never seen this Error on a .While statement.

Code: [Select]
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

  • Member
  • *****
  • Posts: 2354
Re: use of register assumed to ERROR
« Reply #1 on: December 07, 2012, 02:26:33 PM »
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

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: use of register assumed to ERROR
« Reply #2 on: December 07, 2012, 11:08:38 PM »
Code: [Select]
1st error here .IF al AND al, 0Fh
i think you mean this...
Code: [Select]
.if al&0Fhwhich is essentially the same as
Code: [Select]
test al,0Fh
jz  @F

this one - i am not sure what you are trying to do
Code: [Select]
2nd error here  .IF al SUB al, 55    ; problem herebut - see if this makes sense...
Code: [Select]
sub al,55
.if !ZERO?
which is the same as
Code: [Select]
sub al,55
jz @F


maybe i am reading you wrong, and you want these...
Code: [Select]
.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

Code: [Select]
.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

  • Member
  • *****
  • Posts: 2354
Re: use of register assumed to ERROR
« Reply #3 on: December 07, 2012, 11:37:26 PM »
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


Code: [Select]
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

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: use of register assumed to ERROR
« Reply #4 on: December 08, 2012, 12:21:35 AM »
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...
Code: [Select]
; 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
Code: [Select]
        .ELSE

            .IF al > 64

Code: [Select]
        .ELSEIF al > 64