测试了一下指针操作:
long La, Lb, Lc;
long *p, *p1;
......
p = &La;
p1 = &Lb;
Lc = *p + *p1;
编译结果超级长,无用功很多,最后结尾调用不存在的 CALL #0xfff ,CALL #0xffe ,CALL #0xffd 地址,更搞不清了!
个人认为,随便优化一下,程序长度便能缩短一大半。
编译结果如下,
; op : GET_VALUE_AT_ADDRESS
; .line 23; "../main.c" Lc = *p + *p1;
000f40 6d03 SET 0x3, 5 BANKSEL r0x1008
000f41 0e95 MOVZ R0, 0x95 MOVZ R0, r0x1008
000f42 6d03 SET 0x3, 5 BANKSEL STK01
000f43 518b MOV 0x8b, R0 MOV STK01, R0
000f44 6d03 SET 0x3, 5 BANKSEL r0x1009
000f45 0e96 MOVZ R0, 0x96 MOVZ R0, r0x1009
000f46 6d03 SET 0x3, 5 BANKSEL STK00
000f47 518c MOV 0x8c, R0 MOV STK00, R0
000f48 9800 MOV R0, #0 MOV R0,# 0x00
PAGESEL __gptrget4
000f49 d1b1 CALL #0x1b1 CALL __gptrget4
PAGESEL $
000f4a 6d03 SET 0x3, 5 BANKSEL r0x100E
000f4b 519e MOV 0x9e, R0 MOV r0x100E, R0
000f4c 6d03 SET 0x3, 5 BANKSEL STK00
000f4d 508c MOV R0, 0x8c MOV R0, STK00
000f4e 6d03 SET 0x3, 5 BANKSEL r0x100F
000f4f 519d MOV 0x9d, R0 MOV r0x100F, R0
000f50 6d03 SET 0x3, 5 BANKSEL STK01
000f51 508b MOV R0, 0x8b MOV R0, STK01
000f52 6d03 SET 0x3, 5 BANKSEL r0x1010
000f53 519c MOV 0x9c, R0 MOV r0x1010, R0
000f54 6d03 SET 0x3, 5 BANKSEL STK02
000f55 508a MOV R0, 0x8a MOV R0, STK02
000f56 6d03 SET 0x3, 5 BANKSEL r0x1011
000f57 519b MOV 0x9b, R0 MOV r0x1011, R0
; op : GET_VALUE_AT_ADDRESS
000f58 6d03 SET 0x3, 5 BANKSEL r0x100B
000f59 0e98 MOVZ R0, 0x98 MOVZ R0, r0x100B
000f5a 6d03 SET 0x3, 5 BANKSEL STK01
000f5b 518b MOV 0x8b, R0 MOV STK01, R0
000f5c 6d03 SET 0x3, 5 BANKSEL r0x100D
000f5d 0e99 MOVZ R0, 0x99 MOVZ R0, r0x100D
000f5e 6d03 SET 0x3, 5 BANKSEL STK00
000f5f 518c MOV 0x8c, R0 MOV STK00, R0
000f60 6d03 SET 0x3, 5 BANKSEL r0x100C
000f61 0e9a MOVZ R0, 0x9a MOVZ R0, r0x100C
PAGESEL __gptrget4
000f62 d1b1 CALL #0x1b1 CALL __gptrget4
PAGESEL $
000f63 6d03 SET 0x3, 5 BANKSEL r0x1012
000f64 519f MOV 0x9f, R0 MOV r0x1012, R0
000f65 6d03 SET 0x3, 5 BANKSEL STK00
000f66 508c MOV R0, 0x8c MOV R0, STK00
000f67 6d03 SET 0x3, 5 BANKSEL r0x100A
000f68 5197 MOV 0x97, R0 MOV r0x100A, R0
000f69 6d03 SET 0x3, 5 BANKSEL STK01
000f6a 508b MOV R0, 0x8b MOV R0, STK01
000f6b 6d03 SET 0x3, 5 BANKSEL r0x1009
000f6c 5196 MOV 0x96, R0 MOV r0x1009, R0
000f6d 6d03 SET 0x3, 5 BANKSEL STK02
000f6e 508a MOV R0, 0x8a MOV R0, STK02
000f6f 6d03 SET 0x3, 5 BANKSEL r0x1008
000f70 5195 MOV 0x95, R0 MOV r0x1008, R0
; op : +
000f71 6d03 SET 0x3, 5 BANKSEL r0x1011
000f72 509b MOV R0, 0x9b MOV R0, r0x1011
000f73 6d03 SET 0x3, 5 BANKSEL r0x1008
000f74 2095 ADD R0, 0x95 ADD R0, r0x1008
000f75 6d03 SET 0x3, 5 BANKSEL r0x100B
000f76 5198 MOV 0x98, R0 MOV r0x100B, R0
000f77 6d03 SET 0x3, 5 BANKSEL r0x1010
000f78 509c MOV R0, 0x9c MOV R0, r0x1010
000f79 6d03 SET 0x3, 5 BANKSEL r0x100D
000f7a 5199 MOV 0x99, R0 MOV r0x100D, R0
000f7b 6d03 SET 0x3, 5 BANKSEL r0x1009
000f7c 0e96 MOVZ R0, 0x96 MOVZ R0, r0x1009
000f7d 7003 JNB 0x3, 0 JNB PSW, 0
000f7e ff10 INC R0 INC R0
000f7f 7203 JNB 0x3, 2 JNB PSW, 2
000f80 cf83 JMP #0xf83 JMP _00006_DS_
000f81 6d03 SET 0x3, 5 BANKSEL r0x100D
000f82 2199 ADD 0x99, R0 ADD r0x100D, R0
_00006_DS_
000f83 6d03 SET 0x3, 5 BANKSEL r0x100F
000f84 509d MOV R0, 0x9d MOV R0, r0x100F
000f85 6d03 SET 0x3, 5 BANKSEL r0x100C
000f86 519a MOV 0x9a, R0 MOV r0x100C, R0
000f87 6d03 SET 0x3, 5 BANKSEL r0x100A
000f88 0e97 MOVZ R0, 0x97 MOVZ R0, r0x100A
000f89 7003 JNB 0x3, 0 JNB PSW, 0
000f8a ff10 INC R0 INC R0
000f8b 7203 JNB 0x3, 2 JNB PSW, 2
000f8c cf8f JMP #0xf8f JMP _00007_DS_
000f8d 6d03 SET 0x3, 5 BANKSEL r0x100C
000f8e 219a ADD 0x9a, R0 ADD r0x100C, R0
_00007_DS_
000f8f 6d03 SET 0x3, 5 BANKSEL r0x100E
000f90 509e MOV R0, 0x9e MOV R0, r0x100E
000f91 6d03 SET 0x3, 5 BANKSEL r0x1013
000f92 51a0 MOV 0xa0, R0 MOV r0x1013, R0
000f93 6d03 SET 0x3, 5 BANKSEL r0x1012
000f94 0e9f MOVZ R0, 0x9f MOVZ R0, r0x1012
000f95 7003 JNB 0x3, 0 JNB PSW, 0
000f96 ff10 INC R0 INC R0
000f97 7203 JNB 0x3, 2 JNB PSW, 2
000f98 cf9b JMP #0xf9b JMP _00008_DS_
000f99 6d03 SET 0x3, 5 BANKSEL r0x1013
000f9a 21a0 ADD 0xa0, R0 ADD r0x1013, R0
; op : INLINEASM
.code
0001b1 a800 XOR R0, #0
0001b2 7203 JNB 0x3, 2
0001b3 c1b8 JMP #0x1b8
0001b4 a880 XOR R0, #0x80
0001b5 7203 JNB 0x3, 2
0001b6 c1da JMP #0x1da
0001b7 c1f6 JMP #0x1f6
0001b8 6d03 SET 0x3, 5
0001b9 528b MOV R1, 0x8b
0001ba 508c MOV R0, 0x8c
0001bb 5186 MOV 0x86, R0
0001bc 6d03 SET 0x3, 5
0001bd 6503 CLR 0x3, 5
0001be 7086 JNB 0x86, 0
0001bf 6d03 SET 0x3, 5
0001c0 f708 LD R0, [R1]
0001c1 6d03 SET 0x3, 5
0001c2 518a MOV 0x8a, R0
0001c3 ff11 INC R1
0001c4 6d03 SET 0x3, 5
0001c5 6503 CLR 0x3, 5
0001c6 7086 JNB 0x86, 0
0001c7 6d03 SET 0x3, 5
0001c8 f708 LD R0, [R1]
0001c9 6d03 SET 0x3, 5
0001ca 518b MOV 0x8b, R0
0001cb ff11 INC R1
0001cc 6d03 SET 0x3, 5
0001cd 6503 CLR 0x3, 5
0001ce 7086 JNB 0x86, 0
0001cf 6d03 SET 0x3, 5
0001d0 f708 LD R0, [R1]
0001d1 6d03 SET 0x3, 5
0001d2 518c MOV 0x8c, R0
0001d3 ff11 INC R1
0001d4 6d03 SET 0x3, 5
0001d5 6503 CLR 0x3, 5
0001d6 7086 JNB 0x86, 0
0001d7 6d03 SET 0x3, 5
0001d8 f708 LD R0, [R1]
0001d9 c1f6 JMP #0x1f6
0001da d208 CALL #0x208
0001db 6d03 SET 0x3, 5
0001dc 518a MOV 0x8a, R0
0001dd 0d8b INCJZ 0x8b
0001de 078c DEC 0x8c
0001df 0b8c INC 0x8c
0001e0 d208 CALL #0x208
0001e1 6d03 SET 0x3, 5
0001e2 5189 MOV 0x89, R0
0001e3 0d8b INCJZ 0x8b
0001e4 078c DEC 0x8c
0001e5 0b8c INC 0x8c
0001e6 d208 CALL #0x208
0001e7 6d03 SET 0x3, 5
0001e8 5188 MOV 0x88, R0
0001e9 0d8b INCJZ 0x8b
0001ea 078c DEC 0x8c
0001eb 0b8c INC 0x8c
0001ec d208 CALL #0x208
0001ed 6d03 SET 0x3, 5
0001ee 5187 MOV 0x87, R0
0001ef 508a MOV R0, 0x8a
0001f0 518a MOV 0x8a, R0
0001f1 5089 MOV R0, 0x89
0001f2 518b MOV 0x8b, R0
0001f3 5088 MOV R0, 0x88
0001f4 518c MOV 0x8c, R0
0001f5 5087 MOV R0, 0x87
0001f6 0008 CRET
0001f7 a800 XOR R0, #0
0001f8 7203 JNB 0x3, 2
0001f9 c1fe JMP #0x1fe
0001fa a880 XOR R0, #0x80
0001fb 7203 JNB 0x3, 2
0001fc c208 JMP #0x208
0001fd c20c JMP #0x20c
0001fe 6d03 SET 0x3, 5
0001ff 528b MOV R1, 0x8b
000200 508c MOV R0, 0x8c
000201 5186 MOV 0x86, R0
000202 6d03 SET 0x3, 5
000203 6503 CLR 0x3, 5
000204 7086 JNB 0x86, 0
000205 6d03 SET 0x3, 5
000206 f708 LD R0, [R1]
000207 c20c JMP #0x20c
000208 6d03 SET 0x3, 5
000209 528c MOV R1, 0x8c
00020a 508b MOV R0, 0x8b
00020b d20d CALL #0x20d
00020c 0008 CRET
00020d 530a MOV 0xa, R1
00020e 5102 MOV 0x2, R0
00020f dfff CALL #0xfff
000210 5130 MOV 0x30, R0
000211 ffff NOPZ
000212 ffff NOPZ
000213 dffe CALL #0xffe
000214 5137 MOV 0x37, R0
000215 ffff NOPZ
000216 ffff NOPZ
000217 dffd CALL #0xffd
000218 511c MOV 0x1c, R0
000219 ffff NOPZ
00021a ffff NOPZ
00021b 0008 CRET
|