see below, please. regards,
Richard Erlacher ----- Original Message ----- From: "Frieder Ferlemann" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, August 13, 2008 2:27 PM Subject: Re: [Sdcc-user] 805x Simulation? > Hi Richard, > > Richard Erlacher schrieb: >> What is it that you fellows use to simulate 805x ASM code? I've found >> that >> the simulator bundled with SDCC for Windows doesn't operate on code that >> spans over 2 KB of memory, and I find I can't buy a "full" version of >> that >> simulator, as the company that owns/owned it no longer exists. > > Can you be more explicit? - which simulator? > TS Controls under the MIDE. There was a link in the SDCC context, so I loaded it up. It works very nicely, AFAIK, but ... it only works if the address range doesn't exceed 2048 bytes. I'd consider buying the thing, as it supports those Maxim/Dallas parts that I like, but one can't do that. There's a DOS-based simulator to which there's reference, also, but I've never been able to find a working version of that. The link on SourceForge apparently points off to nowhere (I havent looked lately ... maybe there was just some temporary trouble). In fact, I've never been able to find a decipherable manual for SDCC and its components. There is LOTS of info on how to install it, recompile it, etc, but little about how to use it under Windows. Since I'm not really a big HLL fan for small (< 250kB) code bodies, this doesn't matter ... much ... but I do occasionally want to see how the compiler does with certain code segments. > >> I'm trying to produce some precisely timed code that uses large tables, >> don't want a compiler fiddling with my cycle counts, yet want, later, to >> be >> able to incorporate this code with other code written in 'C'. > > Don't know whether you like it/whether the proposal below meets > your requirements (could f.e. be good enough for 1-wire timing). > Somewhat ugly but would this do? > I don't follow ... The 805x versions that interest me currently are all 1-clockers. I haven't been able to get information from Maxim/Dallas about how timing of their UART works, considering that their parts are one-clockers, particularly in Mode 0. I'm inclined to operate in complete synchronization with the UART, and read/write the DBUF at the precise time that next byte should become available in order to avoid a clock-stretch. I'm not sure how this works out, but it takes a lot of effort to tease out such internal details. AFAIK, no simulator gets down to the bitwise/countwise details of the UART and timer/counters. > > > -------8<----------------------------------------------------------------- > > /* 8051 timer example. noninvasive. no cumulative errors. untested. > untested. > */ > #include <8052.h> > > extern void timer0_init ( void ); > > #define DELTA_T_SHORT 32; > #define DELTA_T_LONG 48; > > /* Macro loops while (signed char)(x - TL0) is >= 0 > So longest interval is about 0x80 TL0 units. > Macro introduces a jitter of about y instructions > (z cycles), depending on memory area of (x). */ > #define WAIT_EXPIRED_TL0(x) do{ while(!(0x80 & (char)((x)-TL0))) ; } > while(0) > > > void main() > { > unsigned char next_event_tl0; > > timer0_init(); > > /* next event to happen DELTA_T_SHORT (in TL0 ticks) from NOW */ > next_event_tl0 = TL0 + DELTA_T_SHORT; > > while ( 1 ) > { > WAIT_EXPIRED_TL0( next_event_tl0 ); > > /* just to do something */ > P3_1 = 1; > > /* by adding to next_event_tl0 there is NO cumulative error. > Things look nice on an oscilloscope even if a (short) > IRQ interfered */ > next_event_tl0 += DELTA_T_SHORT; > > > WAIT_EXPIRED_TL0( next_event_tl0 ); > P3_1 = 0; > next_event_tl0 += DELTA_T_LONG; > > /* note, we have NOT reset or otherwise modified > Timer0, or claimed usage of its overflow bit, > so actually we are pretty harmless while still > achieving "reasonable" accuracy. */ > } > } > ------->8----------------------------------------------------------------- > > -------8<----------------------------------------------------------------- > 361 _main: > 370 ; timer.c:21: timer0_init(); > 0000 12s00r00 371 lcall _timer0_init > 372 ; timer.c:24: next_event_tl0 = TL0 + > DELTA_T_SHORT; > 0003 74 20 373 mov a,#0x20 > 0005 25 8A 374 add a,_TL0 > 0007 FA 375 mov r2,a > 376 ; timer.c:28: WAIT_EXPIRED_TL0( > next_event_tl0 ); > 0008 377 00101$: > 0008 EA 378 mov a,r2 > 0009 C3 379 clr c > 000A 95 8A 380 subb a,_TL0 > 000C 30 E7 F9 381 jnb acc.7,00101$ > 382 ; timer.c:31: P3_1 = 1; > 000F D2 B1 383 setb _P3_1 > 384 ; timer.c:36: next_event_tl0 += > DELTA_T_SHORT; > 0011 74 20 385 mov a,#0x20 > 0013 2A 386 add a,r2 > 0014 FA 387 mov r2,a > 388 ; timer.c:39: WAIT_EXPIRED_TL0( > next_event_tl0 ); > 0015 389 00107$: > 0015 EA 390 mov a,r2 > 0016 C3 391 clr c > 0017 95 8A 392 subb a,_TL0 > 0019 30 E7 F9 393 jnb acc.7,00107$ > 394 ; timer.c:40: P3_1 = 0; > 001C C2 B1 395 clr _P3_1 > 396 ; timer.c:41: next_event_tl0 += > DELTA_T_LONG; > 001E 74 30 397 mov a,#0x30 > 0020 2A 398 add a,r2 > 0021 FA 399 mov r2,a > 0022 80 E4 400 sjmp 00101$ > ------->8----------------------------------------------------------------- > > > If you have to do cycle counting you are probably aware of > http://www.8052.com/users/disasm/ > which can produce disassembled code along with the needed > instruction cycles (at least as long no prefetch/cache/spi > reads are involved). > > Greetings, > Frieder > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the > world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Sdcc-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/sdcc-user ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sdcc-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sdcc-user
