diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-25 02:56:56 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-25 02:56:56 +0200 |
| commit | e801690e4fc177f063e2ae854b3f2a69bd1b9ba0 (patch) | |
| tree | 8eecbaf0197b418bfd26f667ca743eda183dc983 | |
| parent | 46783fd76b89ff4e444f4e62e9ce42180fe24eda (diff) | |
Bugfixes on startup routine
Memory addresses should be preceded by '#' when referring to them as integers
| -rw-r--r-- | src/stm8/main.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/stm8/main.c b/src/stm8/main.c index 5c48247..3226aae 100644 --- a/src/stm8/main.c +++ b/src/stm8/main.c @@ -278,23 +278,31 @@ stm8_genInitStartup (FILE *of) fprintf(of, "\t.global _start\n" "_start:\n" - "\t; Zeroing .bss\n" - "\tldw x, __bss_start\n" + "\t; Check if there is at least one byte allocated on .bss\n" + "\tldw x, #__bss_start\n" + "\tcpw x, #__bss_end\n" + "\tjreq 1$\n" "0$:\n" + "\t; Zeroing .bss\n" "\tclr (x)\n" "\tincw x\n" - "\tcpw x, __bss_end\n" + "\tcpw x, #__bss_end\n" "\tjrne 0$\n" - "\t; Transfer .data from ROM to RAM\n" - "\tldw x, __data_load_start\n" - "\tldw y, __data_start\n" "1$:\n" + "\t; Check if there is at least one byte allocated on .data\n" + "\tldw y, #__data_start\n" + "\tcpw y, #_edata\n" + "\tjreq 3$\n" + "\t; Transfer .data from ROM to RAM\n" + "\tldw x, #__data_load_start\n" + "2$:\n" "\tld a, (x)\n" "\tld (y), a\n" "\tincw x\n" "\tincw y\n" - "\tcpw y, _edata\n" - "\tjrne 1$\n"); + "\tcpw y, #_edata\n" + "\tjrne 2$\n" + "3$:\n"); } } |
