From: Alan Cox Date: Mon, 9 Mar 2015 21:39:45 +0000 (+0000) Subject: libs: Add enter.s for __enter and __enter_s for the modified sdcc X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=78a657370af64d7c0ee2c09e53f4316e0a2ac830;p=FUZIX.git libs: Add enter.s for __enter and __enter_s for the modified sdcc --- diff --git a/Library/libs/Makefile b/Library/libs/Makefile index 2bcb8ed3..665ccfdf 100644 --- a/Library/libs/Makefile +++ b/Library/libs/Makefile @@ -14,7 +14,7 @@ ASM_OPT = -l -o -s LINKER_OPT = -m -i -o SRC_CRT0 = crt0$(PLATFORM).s OBJ_CRT0 = $(SRC_CRT0:.s=.rel) -SRC_ASM = +SRC_ASM = enter.s OBJ_ASM = $(SRC_ASM:.s=.rel) SRC_C = __argv.c abort.c asctime.c assert.c atexit.c SRC_C += bcmp.c bcopy.c bsearch.c bzero.c calloc.c cfree.c clock.c closedir.c diff --git a/Library/libs/enter.s b/Library/libs/enter.s new file mode 100644 index 00000000..b5d08f14 --- /dev/null +++ b/Library/libs/enter.s @@ -0,0 +1,25 @@ +; +; These are used for space saving with the modified sdcc +; + .globl __enter, __enter_s + +__enter: + pop hl ; return address + push ix ; save frame pointer + ld ix, #0 + add ix, sp ; set ix to the stack frame + jp (hl) ; and return + +__enter_s: + pop hl ; return address + push ix ; save frame pointer + ld ix, #0 + add ix, sp ; frame pointer + ld e, (hl) ; size byte + ld d, #0xFF ; always minus something.. + inc hl + ex de, hl + add hl, sp + ld sp, hl + push de + ret