Discuss the Integrated Development Environment (IDE)
Moderators: David Barker, Jerry Messina
-
johngb
- Registered User
- Posts: 139
- Joined: Tue Oct 03, 2006 10:16 pm
Post
by johngb » Wed May 30, 2007 10:11 am
When I place commented assembler in code the comments are not seen by the IDE as comments: See example below.
Code: Select all
Public Function CheckCRC(ByRef pOWData() As Byte)As Boolean
Dim idx As Byte,
CRCVal As Byte,
TempData As Byte,
TestByte As Byte
For idx = 0 To Bound(pOWData) ' Run through the whole array
TmpDat = pOWData(idx)
ASM
movlw 8
movwf OW_Idx ; Do this For all 8 bits of CRCByte
CRCLOOP
movf CRCVal,0 ; Put CRC into W
xorwf TempData,0 ; Xor CRC with CRCData
movwf TestByte ; Put results in TestByte
rrcf TestByte,1 ; Shift TestByte.0 into Carry Bit
btfss STATUS,C ; If Carry = 1, account For EXOR feedback gates
GoTo CRCSHIFT ; Otherwise just shift CRC And CRCByte
movf CRCVal,0 ; Get latest copy of CRC
xorlw 0x18 ; Xor with 18Hex
movwf CRCVal ; Keep a copy of results
CRCSHIFT
rrcf CRCVal,1 ; Rotate CRC incorporating carry
rrcf TempData,1 ; Rotate CRCData, carry shifts in but Not important
decfsz OW_Idx,1 ; Keep track of #times through loop
GoTo CRCLOOP ; back To start If Not done all 8 bits
End ASM
Next ' Last byte is the received CRC value should
Result = (CRCVal = 0)
End Function
Paste the above into the IDE and you will find that the words in the comment such as Xor, For, And & Bit are all highlighted as Keywords.
Shouldn't the IDE recognise ; as a comment?
JohnB
-
David Barker
- Swordfish Developer
- Posts: 1214
- Joined: Tue Oct 03, 2006 7:01 pm
- Location: Saltburn by the Sea, UK
-
Contact:
Post
by David Barker » Wed May 30, 2007 1:35 pm
; is not a legal comment in Swordfish. Anything in a ASM block will just be displayed in the default ASM syntax highlighter colour that the user has selected.
-
johngb
- Registered User
- Posts: 139
- Joined: Tue Oct 03, 2006 10:16 pm
Post
by johngb » Wed May 30, 2007 2:13 pm
Is it safe to use the Swordfish syntax for comment on embedded assembler or will the Assembler reject it?
JohnB
-
johngb
- Registered User
- Posts: 139
- Joined: Tue Oct 03, 2006 10:16 pm
Post
by johngb » Wed May 30, 2007 4:35 pm
Just tried it - no it's not safe to use Swordfish comment syntax.
Also found there is no ASM Highlighter setting in the editor's highlight options. The assembler code and comment is presented with highlights as if it were Swordfish code.
This is not what is implied in the help file where the embedded asm example shows comments are shown colour and italicised.
JohnB
-
johngb
- Registered User
- Posts: 139
- Joined: Tue Oct 03, 2006 10:16 pm
Post
by johngb » Wed May 30, 2007 4:45 pm
The following workaround seems to the best compromise at the moment:
;//Comment
This allows you to view the comments as comments in the IDE yet does not conflict with the assembler.
JohnB