flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Macroinstructions > Can't see error in struct definition. | 
  
| Author | 
  | 
              
| 
                  
                   Tomasz Grysztar 11 Aug 2005, 15:13 
                  The "version" is a macroinstruction (one of the resource ones) and thus line "version dd 0" is interpreted as macro. (Hmmm, maybe I should rename this macro to "versioninfo"?) 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   madmatt 11 Aug 2005, 15:57 
                  ok, I see now, thanks.  But now have another problem, the .if macro doesn't except the "jl" instruction, example:
 
                  
                .if dword [eax + lnx.x], l, 1 gives me an illegal instruction error  | 
              |||
                  
  | 
              
| 
                  
                   Tomasz Grysztar 11 Aug 2005, 16:02 
                  Works for me, perhaps you've got another conflict?
 
                  
                PS. Changed that macro to "versioninfo" - more descriptive, less conflicting.  | 
              |||
                  
  | 
              
| 
                  
                   madmatt 11 Aug 2005, 17:27 
                  ok thanks, I have another look at my code and see. 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   madmatt 11 Aug 2005, 17:31 
                  I've tried the code with different parameters for the .if macro: a, b, ae, be, g, ge, le, all work ok except l (the letter "L" 'l')  
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   Tomasz Grysztar 11 Aug 2005, 17:44 
                  Post some minimum source that shows the problem. 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   madmatt 11 Aug 2005, 19:24 
                  The struct:
 
                  
                Code: struct IntersectPoints x dd 0 y dd 0 dx dd 0 dy dd 0 ends struct definition: Code: lnx IntersectPoints times 60 * sizeof.IntersectPoints db 0 code block giving me the illegal instruction error Code: .repeat mov eax, sizeof.IntersectPoints mul [l] mov [addr], eax .if dword [eax + lnx.x], l, 1 ;<------ ** HERE **> invoke RndInt32Range, 0, 3 add eax, 2 mov ecx, [addr] mov dword [ecx + lnx.dx], eax .endif mov eax, [addr] .if dword [eax + lnx.y], l, 1 invoke RndInt32Range, 0, 3 add eax, 2 mov ecx, [addr] mov dword [ecx + lnx.dy], eax .endif mov eax, [addr] .if dword [eax +lnx.x], g, SCREENWIDTH-2 invoke RndInt32Range, 0, 3 add eax, 2 neg eax mov ecx, [addr] mov dword [ecx + lnx.dx], eax .endif mov eax, [addr] .if dword [eax + lnx.y], g, SCREENHEIGHT-2 invoke RndInt32Range, 0, 3 add eax, 2 mov ecx, [addr] mov dword [ecx + lnx.dy], eax .endif mov ecx, [addr] mov eax, [ecx + lnx.x] add eax, [ecx + lnx.dx] mov [ecx + lnx.x], eax mov eax, [ecx + lnx.y] add eax, [ecx + lnx.dy] mov [ecx + lnx.y], eax inc [l] .until [l], a, 5  | 
              |||
                  
  | 
              
| 
                  
                   Tomasz Grysztar 11 Aug 2005, 19:35 
                  I guess you are using local variable of the name "l", thus "l" inside the procedure gets replaced with the address of that variable. Possible solution: use other case to avoid conflict:
 
                  
                Code: .if dword [eax], L, 1  | 
              |||
                  
  | 
              
| 
                  
                   madmatt 11 Aug 2005, 20:57 
                  Yeh, that's right, DOOOOOH!  
                  
                Thanks for all your help Tomasz! MadMatt  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.