
Originally Posted by
Mike, K8LH
3v0,
May I see the BoostC and MCC18 instructions you used please (sorry for off-topic)?
Mike
Please note that I feel this needs further study. This is the first boostC program I ever compiled. I am not saying it is a bad compiler. I still need to work through each instrucion to see what is going on but it looks like BoostC is testing the bit and setting or clearing it based on the test. What you would do if the bit toggle instruction did not exist.
BoostC
Code:
23: while(1)
004C D7F4 BRA 0x36
24: {
25: lata.7 = ! lata.7;
0036 6A01 CLRF 0x1, ACCESS
0038 AE89 BTFSS 0xf89, 0x7, ACCESS
003A 2A01 INCF 0x1, F, ACCESS
003C B001 BTFSC 0x1, 0, ACCESS
003E 8E89 BSF 0xf89, 0x7, ACCESS
0040 A001 BTFSS 0x1, 0, ACCESS
0042 9E89 BCF 0xf89, 0x7, ACCESS
26: delay_ms(500);
0044 0EF4 MOVLW 0xf4
0046 6E01 MOVWF 0x1, ACCESS
0048 EC02 CALL 0x4, 0
004A F000 NOP
MCC18
Code:
17: while(1)
012A D7F9 BRA 0x11e
18: {
19: LATAbits.LATA7 = ! LATAbits.LATA7;
011E 7E89 BTG 0xf89, 0x7, ACCESS
20: Delay10KTCYx(50);
0120 0E32 MOVLW 0x32
0122 6EE6 MOVWF 0xfe6, ACCESS
0124 EC65 CALL 0xca, 0
0126 F000 NOP
0128 52E5 MOVF 0xfe5, F, ACCESS
I was working on an article for JPUG when I ran into this. I was attempting to show how procedural languages generated similar code. In this case Swordfish and C18. I was curious what BoostC would look like.
LATA.7 is undefined so I used PORTA
Swordfish LATA.7 is undefined so I used PORTA
Code:
7: While True
8: Toggle(PORTA.7)
0058 7E89 BTG 0xf89, 0x7, ACCESS
005A 9E92 BCF 0xf92, 0x7, ACCESS
9: DelayMS(500)
005C 0E01 MOVLW 0x1
005E 6E05 MOVWF 0x5, ACCESS
0060 0EF4 MOVLW 0xf4
0062 DFD3 RCALL 0xa
0064 D7F9 BRA 0x58