In SX Microcontrollers, SX/B Compiler and SX-Key Tool, IsmStudios wrote: Hello, I'm using the latest version of the SX-Key IDE and SASM crashes when I do the following: [code] rept 5 rept 3 jmp $+1 endr rept 3 nop endr endr [/code] If I were to remove the rept 5 encasing the inner two rept's, it will assemble with no problem. But here's another weird scenario: [code] REPT 5 mov rc, #CBURST_HIGH rept 3 nop endr ENDR [/code] This has an embedded rept and it assmebles without an issue but once I embedded another one in there, it crashes. My problem is that I'm working with a Delay MACRO written for the XGS and it seems to crash on me when the logic embeds 2 or more [b]rept's[/b] inside another [b]rept[/b] block. Here's the Delay MACRO: [code] DELAY MACRO clocks ; the preprocessor can NOT do floating point math, so another construction would be to scale ; all values by 10 then multiply by 8 rather than 80, for example, a 4.5 uS delay could be ; written ; DELAY(8*45) ; first compute fractional remainder of 10 and delay IF (((clocks) // 10) > 0) ; first 3 clock chunks REPT (((clocks) // 10)/3) JMP $ + 1 ENDR ; now the remainder if any REPT (((clocks) // 10)//3) NOP ENDR ENDIF ; next multiples of 100 IF (((clocks) / 100) >= 1) ; truncated for brevity ENDIF ; last compute whole multiples of 10, and delay IF (( ((clocks) // 100) / 10) >= 1) ; truncated for brevity ENDIF ENDM [/code] And the code that I'm trying to write is this: [code] REPT 5 mov RC, #CBURST_HIGH ; ( 2 cycles ) Delay(11-2) mov RC, #CBURST_LOW ; ( 2 cycles ) Delay(11-2) ENDR [/code] If you follow the logic of the MACRO, you will find that 9 or (11-2) causes the assembler to create two rept blocks in place of this Delay instruction--which happens to be within the outter [b]REPT 5[/b] block. Please point me in the right direction :smile: This is driving me nuts. I hope there's a workaround or a bugfix patch somewhere. Thanks, - Lewis [m80] - ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=157382 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)