This is my first experience with GCBasic, in fact my first experience coding the PIC with a high level language - and so far I'm pretty impressed with what you guys have put together!
I think I might have found a bug though - sorry.
I'm writing some for the 12F508, and the ASM generated contains the following line...
ADDLW 1
which the MASKASM throws out. Well acutally a little weirdly it throws out the 1 as an illegal character.
I've checked the Microchip datasheet for for the 12F505/8/9 and ADDLW is not in the instruction list. I therefore creted a project in MPLAB (8.15a) for the 508 and it doesn't recognise ADDLW (code highlighting) and when you try to compile it comes back saying:
Warning[207]......Found label after column 1. (addlw)
Error[108].....Illegal character (1)
or if you use .1 the error line is
Error{127].....Illegal opcode(.1)
If I create a project in MPLAB for the 16F877a - which does have ADDLW listed as an instruction, then the highlighting is correct, and all compiles.
Tom
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The code inquestion seems to that created by GCBasic to handle the overflow into the upper byte of word variable.
The code generated is...
MAIN
bcf STATUS, C
movlw 1
addwf COUNT_1,W
movwf SysTemp1
movlw 0
btfsc STATUS,C
addlw 1 <------------------This is the line the MAKEASM doesn't like
addwf COUNT_1_H,W
movwf SysTemp1_H
movf SysTemp1,W
The original basic code was
main:
count_1 += 1
I originall had count_1 = count_1 + 1, gives the same result.
Tom
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looks like GCbasic likes the more expanded instruction set of the newer devices. The addlw is not in the 12F508, but is in other devices in the 12F family. If you want to use word variables, probably best just to pick a newer device. Free samples are great for those small jobs.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good catch. The high byte should be like the low byte with the "movlw 1" instruction. As a work around (until a fix arrives), try substituting the "doctered" assembly output for the "count_1 += 1". Seems to compile O.K.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is my first experience with GCBasic, in fact my first experience coding the PIC with a high level language - and so far I'm pretty impressed with what you guys have put together!
I think I might have found a bug though - sorry.
I'm writing some for the 12F508, and the ASM generated contains the following line...
ADDLW 1
which the MASKASM throws out. Well acutally a little weirdly it throws out the 1 as an illegal character.
I've checked the Microchip datasheet for for the 12F505/8/9 and ADDLW is not in the instruction list. I therefore creted a project in MPLAB (8.15a) for the 508 and it doesn't recognise ADDLW (code highlighting) and when you try to compile it comes back saying:
Warning[207]......Found label after column 1. (addlw)
Error[108].....Illegal character (1)
or if you use .1 the error line is
Error{127].....Illegal opcode(.1)
If I create a project in MPLAB for the 16F877a - which does have ADDLW listed as an instruction, then the highlighting is correct, and all compiles.
Tom
A bit more info...
The code inquestion seems to that created by GCBasic to handle the overflow into the upper byte of word variable.
The code generated is...
MAIN
bcf STATUS, C
movlw 1
addwf COUNT_1,W
movwf SysTemp1
movlw 0
btfsc STATUS,C
addlw 1 <------------------This is the line the MAKEASM doesn't like
addwf COUNT_1_H,W
movwf SysTemp1_H
movf SysTemp1,W
The original basic code was
main:
count_1 += 1
I originall had count_1 = count_1 + 1, gives the same result.
Tom
Looks like GCbasic likes the more expanded instruction set of the newer devices. The addlw is not in the 12F508, but is in other devices in the 12F family. If you want to use word variables, probably best just to pick a newer device. Free samples are great for those small jobs.
Good catch. The high byte should be like the low byte with the "movlw 1" instruction. As a work around (until a fix arrives), try substituting the "doctered" assembly output for the "count_1 += 1". Seems to compile O.K.
Maybe I'm missing something here, but can't the corrected assembler...
bcf STATUS, C
movlw 1
addwf COUNT_1,W
movwf SysTemp1
movlw 0
btfsc STATUS,C
movlw 1
addwf COUNT_1_H,W
movwf SysTemp1_H
movf SysTemp1,W
be reduced to...
bcf STATUS, C
movlw 1
addwf COUNT_1
movlw 0
btfsc STATUS,C
movlw 1
addwf COUNT_1_H
The SysTemp1 and SysTemp1_H just seem to be shuffling the values around but not performing any purpose?
Tom
or just (for count += 1)
incfsz COUNT_1
goto no_overflow
incf COUNT_1_H
no_overflow:
of just (for count += x (8bit val))
movlw x
addwf COUNT_1
btfsc STATUS,C
incf COUNT_1_H
of just (for count += x (16bit val))
movlw x&255
addwf COUNT_1
btfsc STATUS,C
incf COUNT_1_H
movlw x>>8
addwf COUNT_1_H