??? 01/19/10 11:00 Read: times |
#172592 - absolutely-locating xdata at 256 byte boundary Responding to: ???'s previous message |
Andy Neil said:
Frieder Ferlemann said:
unsigned char __xdata __at(0x0000) table_P2_over_time[200 + 1]; I guess that's SDCC syntax? Yes it's SDCC syntax. Keil would be somewhat different. What is the point in absolutely-locating it? Seems unnecessary to me... The point is to tell the compiler that it's located at a 256 byte boundary. So it does not need a full 16 bit addition of array base address and index but instead can directly load dpl with the high byte of the address and dpl with the index. So you the 8bit indexed xdata array access is only: 0006 85*00 82 383 mov dpl,_ms_tenth_countdown 0009 75 83 00 384 mov dph,#(_table_P2_over_time >> 8) 000C E0 385 movx a,@dptr instead of: 000B E5*00 386 mov a,_ms_tenth_countdown 000D 24r00 387 add a,#_table_P2_over_time 000F F5 82 388 mov dpl,a 0011 E4 389 clr a 0012 34s00 390 addc a,#(_table_P2_over_time >> 8) 0014 F5 83 391 mov dph,a 0016 E0 392 movx a,@dptr AFAIK you'd tell Keil the absolute location of the variable at the linking stage (which is to late for code generation so the 16 bit addition has been generated). So out of the box Keil probably cannot do it. void Timer0_ISR (void) interrupt 1 { For Keil, consider adding a using option to specify a Register Bank - this can significantly reduce the overhead on entering & leaving the ISR... For SDCC you can consider using using as well. But as SDCC doesn't use R0..R7 in the proposed code snippet there is no overhead to reduce:^) |