libs: Add enter.s for __enter and __enter_s for the modified sdcc
authorAlan Cox <alan@linux.intel.com>
Mon, 9 Mar 2015 21:39:45 +0000 (21:39 +0000)
committerAlan Cox <alan@linux.intel.com>
Mon, 9 Mar 2015 21:39:45 +0000 (21:39 +0000)
Library/libs/Makefile
Library/libs/enter.s [new file with mode: 0644]

index 2bcb8ed..665ccfd 100644 (file)
@@ -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 (file)
index 0000000..b5d08f1
--- /dev/null
@@ -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