From 52fa41760cd0a061128bef050232abf992fb4148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= Date: Sun, 5 Oct 2025 16:22:23 +0200 Subject: [PATCH] Don't pass the first 16-bit argument via xdata. Calling confention already uses the DPTR registers as the first two byte arguments. So adds a lot of code to put the 16-bit value on xdata, still passes the 16-bit xdata ptr in DPTR registers, then read the xdata value. So it doesn't save any sram bytes. --- httpd/httpd.c | 20 ++++++++++---------- httpd/page_impl.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/httpd/httpd.c b/httpd/httpd.c index cf396a3..704a3dd 100644 --- a/httpd/httpd.c +++ b/httpd/httpd.c @@ -61,9 +61,9 @@ void httpd_init(void) __banked } -uint8_t find_entry(__xdata uint8_t * __xdata e) +uint8_t find_entry(__xdata uint8_t *e) { - __xdata uint8_t i, j; + uint8_t i, j; for (i = 0; f_data[i].len; i++) { j = 0; @@ -78,9 +78,9 @@ uint8_t find_entry(__xdata uint8_t * __xdata e) } -char strcmp(__xdata uint8_t * __xdata c, __code uint8_t * __xdata d) +char strcmp(__xdata uint8_t *c, __code uint8_t * __xdata d) { - register uint8_t i = 0; + uint8_t i = 0; while (d[i] && (d[i] == c[i])) i++; @@ -93,9 +93,9 @@ char strcmp(__xdata uint8_t * __xdata c, __code uint8_t * __xdata d) } -char is_word(__xdata uint8_t * __xdata c, __code uint8_t * __xdata d) +char is_word(__xdata uint8_t *c, __code uint8_t * __xdata d) { - register uint8_t i = 0; + uint8_t i = 0; while (d[i] && (d[i] == c[i])) i++; @@ -108,7 +108,7 @@ char is_word(__xdata uint8_t * __xdata c, __code uint8_t * __xdata d) } -char is_word_x(__xdata uint8_t * __xdata c, __xdata uint8_t *d) +char is_word_x(__xdata uint8_t *c, __xdata uint8_t *d) { register uint8_t i = 0; @@ -197,7 +197,7 @@ __xdata uint8_t *scan_header(__xdata uint8_t *p) * Input: the current position in the TCP buffer (uip_appdata) * Returns 1: More data to read, 0: Upload complete, all parts reads */ -uint8_t stream_upload(__xdata uint16_t bptr) +uint8_t stream_upload(uint16_t bptr) { __xdata uint8_t *p = uip_appdata; __xdata struct httpd_state * __xdata s = &(uip_conn->appstate); @@ -261,11 +261,11 @@ void handle_post(void) // Find end of request path while (*p && !is_separator(*p)) p++; - *p = '\0'; + *p++ = '\0'; // Find end of request header boundary[0] ='\0'; - p = scan_header(p + 1); + p = scan_header(p); print_string("Boundary: >"); print_string_x(boundary); print_string("<\n"); if (!*p || !content_type) { print_string("Bad Request!\n"); diff --git a/httpd/page_impl.c b/httpd/page_impl.c index 3a66242..dce8843 100644 --- a/httpd/page_impl.c +++ b/httpd/page_impl.c @@ -165,7 +165,7 @@ void send_basic_info(void) } -void send_vlan(__xdata uint16_t vlan) +void send_vlan(uint16_t vlan) { slen = strtox(outbuf, HTTP_RESPONCE_JSON); print_string("sending VLAN\n");