From: Rod B. <ro...@bo...> - 2002-10-24 02:35:39
|
Daryl, void handshake(void) { register unsigned char i; P3_7 = 1; while( P3_7 ) ; i = 0; do { i++; } while( i != 0xff ); } Why not use teh above 'C' code it compiles to a more afficent assembler fragment than you inline assembly and in more maintainable. Regards, Rod Boyce On Wed, 23 Oct 2002 16:14:00 -0500 "Daryl Gallatin" <dga...@ma...> wrote: > Hi, I'm trying to get a simple program to compile and I need the inline assembly code to work, but I keep getting this wierd error that doesn't make sense. I came across this user list on the internet looking up the error and saw a couple other people had similiar error on different type code but I didn't see anything that would help > > The error is ?ASxxxx-Error(o) in line 205 of hello2.asm > (o) .org in REL area or directive/mnemonic error > > and then it repeats that several times for different lines > > I'm compilling with sdcc -c hello2.c > Get same problem on NT and win98 > Thanks > > Daryl > > Here is the code > > > /*This program is for the 89S8252 on iguanalabs Experiamental Board > Before the 8252 starts executing code handshake signals to the 2051 > have to be completed. The inline assemble code is supposed to handle that > First by waiting for Port P37 to go low, then wait run delay then start the main > code by sending text to the serial port */ > > #include <8051.h> /* special function register declarations */ > #include <stdio.h> /* prototype declarations for I/O functions */ > > > > void handshake(void) > { > _asm > SETB P3_7 > 0001$:: JB P3_7, 0001$ > CLR P3_7 > ;DELAY > MOV R7,0 > 0002$: > INC R7 > MOV A, R7 > CJNE A,0xff,0002$ > > _endasm; > > } > > > /****************/ > /* main program */ > /****************/ > void main (void) > { /* execution starts here after stack init */ > SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */ > TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */ > TH1 = 0xf3; /* TH1: reload value for 2400 baud */ > TR1 = 1; /* TR1: timer 1 run */ > TI = 1; /* TI: set TI to send first char of UART */ > > handshake(); /* start handshake function that waits for handshake signal with the 2051 */ > > > > while (1) > { > printf ("Hello World\n"); /* the 'printf' function call */ > } > } > > > > ------------------------------------------------------- > This sf.net email is sponsored by: Influence the future > of Java(TM) technology. Join the Java Community > Process(SM) (JCP(SM)) program now. > http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0002en > > _______________________________________________ > Sdcc-user mailing list > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user > |