A couple of points: 1: There is no reason to include the H'0A' bytes. HTML doesn't require them. 2: Rather than try to prevent the zero bytes from being embedded, just ignore them when copying your data. In this case you'd need to use a different value as your 'end-of-text' marker (perhaps 0xFF). Bob Ammerman RAm Systems ----- Original Message ----- From: "Jan Wagemakers" To: "Microcontroller discussion list - Public." Sent: Friday, April 29, 2005 11:40 AM Subject: Re: [PIC] db : odd number of expressions, last byte will be zero > Jan-Erik Soderholm schreef: > >>> The problem is that when I use a "db" line with an odd number of >>> expressions, a extra byte with value 0 will be added. >>> According to the documentation(*1) that I have read this is >>> normal behavior. >> And if so, what is the problem ? >> Why do you want to get rid of it ? >> What do you want to use the "odd" byte for ? > > Mmm, sorry if my question wasn't clear. > > I have connected a PIC18f452 to a 3COM 3C509b isa network card(*). I have > build a little webserver in this PIC18f452, but have some problems with > this > extra zero byte. > > I'll try to explain. > > The webpage is located in program-memory like this : > > web db "HTTP/1.0 200 OK", H'0A' > db "Server: PIC18F452 + 3COM 3C509b", H'0A' > db "Content-type: text/html", H'0A' > db H'0A', H'0A' > index db " Transitional//EN\">", H'0A' > db " ", H'0A' > db " ", H'0A' > db " content=\"text/html;charset=iso-8859-1\">", H'0A' > db "PIC18f452 + 3COM 3C509B - Webserver - ", H'0A' > db " webserver\">", H'0A' > db "", H'0A' > db " vlink=\"#800080\" alink=\"#FF0000\"> ", H'0A' > db "
", H'0A' > db "

PIC18f452 + 3COM 3C509B - Webserver -

", H'0A' > db "
", H'0A' > db "
", H'0A' > db "

", H'0A' > db "This website is brought to you by a webserver that is running > on a ", H'0A' > db "PIC18F452 connected to a 3COM 3C509B ethernet card.", H'0A' > db "

", H'0A' > db "", H'0A' > db "
", H'0A' > db "", H'0A' > db "", H'0A' > db " ", H'0A', D'000' > > To transmit this webpage I use the following code : > > ; Dataveld aanpassen : Webpagina in dataveld plaatsen > > lfsr 1, TCP_start + D'20' ; TCP-header = 20 > > movlw B'00001111' > andwf TCP_data_offset, f ; 4 hoogste bits = TCP_data_offset : reset > movlw B'01010000' > iorwf TCP_data_offset, f ; TCP_data_offset = 5 (5 32bitswords = 20 bytes) > > movlw LOW (web) > movwf TBLPTRL > movlw HIGH (web) > movwf TBLPTRH > movlw UPPER (web) > movwf TBLPTRU ; TBLPTR --> web > t1: > tblrd*+ ; Lees van adres TBLPTR in TABLAT / > TBLPTR++ > movf TABLAT, w ; w = het ingelezen karakter > iorlw D'0' ; End Of Text? ASCII 0 > btfsc STATUS, Z ; Als ASCII 0 dan ... > bra t2 ; ... stop. > movwf POSTINC1 ; kopieer karakter naar TCP_DATA / FSR1++ > bra t1 > t2: > > ; FSR1H:FSR1L = einde data > > Now, this works without problems, but only when each db-line contains a > even number of bytes. Thats why I have inserted a extra space in certain > lines. > > For example, if I change > > db " ", H'0A' > db " ", H'0A' > > to > > db "", H'0A' > db "", H'0A' > > it doesn't work anymore because of that extra zero byte. > > --------------------------------------------------------------------------- > > I'll give another example : > > A line with "db H'0A', H'0A'" gives : > > 063C 0A0A 01694 db H'0A', H'0A' > > But two lines with > > db H'0A' > db H'0A' > > becomes : > > 063C 000A 01694 db H'0A' > 063E 000A 01695 db H'0A' > > > I wonder if it is possible (with gpasm) that both gives the result of 0A0A > without that extra zero byte. > > --------------------------------------------------------------------------- > > > (*) > -- > Met vriendelijke groetjes - Jan Wagemakers - > > ... UNIX is user friendly. It's just selective about who it's friends are. > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist