packet_length = uip_len - UIP_LLH_LEN + UIP_TCPIP_HLEN;
packet_length = uip_len - (UIP_LLH_LEN + UIP_TCPIP_HLEN);
void lan91c96_send(void){  /* First 14+40 (IP and TCP header) is send from uip_buf */  /* than data from uip_appdata */#ifdef DEBUG  printf("SND: send packet\n");#endif  asm("lda %v+1", uip_len);  asm("ora #%%00100000");        /* Allocate memory for TX */  asm("sta %w", ETHMMUCR);  asm("ldy #8");                 /* Wait... */L1:                              /* Wait for allocation ready */  asm("lda %w", ETHIST);  asm("and #%%00001000");        /* ALLOC INT */  asm("bne %g", L2);  asm("dey");  asm("bne %g", L1);#ifdef DEBUG    printf("SND: ERR: memory alloc timeout\n");#endif    return;L2:#ifdef DEBUG  printf("SND: packet memory allocated\n");#endif  asm("lda #%%00001000");        /* Acknowledge int, is it necessary ??? */  asm("sta %w", ETHACK);  asm("lda %w", ETHARR);  asm("sta %w", ETHPNR);         /* Set packet address */  asm("lda #0");  asm("sta %w", ETHPTR);  asm("lda #%%01000000");        /* AUTO INCR. */  asm("sta %w", ETHPTR+1);#ifdef DEBUG  printf("SND: L:%d ", uip_len);#endif  asm("lda #0");                 /* Status written by CSMA */  asm("sta %w", ETHDATA);  asm("sta %w", ETHDATA);  asm("lda %v", uip_len);  asm("and #$01");  asm("beq %g", L3);  packet_length = uip_len + 5;  asm("jmp %g", L4);L3:  packet_length = uip_len + 6;   /* +6 for status word, length and ctl byte */L4:#ifdef DEBUG  printf("SND: L:%d ", packet_length);#endif  asm("lda %v", packet_length);  asm("sta %w", ETHDATA);  asm("lda %v+1", packet_length);  asm("sta %w", ETHDATA);#ifdef DEBUG  print_packet(uip_buf, uip_len);#endif  /* Send 14+40=54 bytes of header */  if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN) {#ifdef DEBUG    printf("SND: short packet sent.\n");#endif    asm("ldy #0");L5:    asm("lda %v,y", uip_buf);    asm("sta %w", ETHDATA);    asm("iny");    asm("cpy %v", uip_len);    asm("bne %g", L5);  } else {    asm("ldy #0");L6:    asm("lda %v,y", uip_buf);    asm("sta %w", ETHDATA);    asm("iny");    asm("cpy #%b", UIP_LLH_LEN + UIP_TCPIP_HLEN);    asm("bne %g", L6);    packet_length = uip_len - UIP_LLH_LEN + UIP_TCPIP_HLEN;    asm("lda %v", uip_appdata);  /* uip_appdata is pointer */    asm("sta ptr1");    asm("lda %v+1", uip_appdata);    asm("sta ptr1+1");    asm("ldy #0");L7:    asm("lda (ptr1),y");    asm("sta %w", ETHDATA);    asm("iny");    asm("bne %g", L8);    asm("inc ptr1+1");L8:    asm("cpy %v", packet_length);    asm("bne %g", L7);    asm("dec %v+1", packet_length);    asm("bpl %g", L7);  }  asm("lda %v", packet_length);  asm("and #$01");  asm("beq %g", L9);  asm("lda #%%00100000");  asm("sta %w", ETHDATA);        /* Control byte */  asm("lda #%%11000000");        /* ENQUEUE PACKET - transmit packet */  asm("sta %w", ETHMMUCR);#ifdef DEBUG  printf("\n## %02x", *(unsigned char *)(ETHIST));#endif  return;L9:  asm("lda #0");  asm("sta %w", ETHDATA);        /* Fill byte */  asm("sta %w", ETHDATA);        /* Control byte */  asm("lda #%%11000000");        /* ENQUEUE PACKET - transmit packet */  asm("sta %w", ETHMMUCR);#ifdef DEBUG  printf("\n## %02x\n", *(unsigned char *)(ETHIST));#endif  return;}