Now up to 174 d/s.
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@74
4a8a32a2-be11-0410-ad9d-
d568d2c75423
SCC = $(TOPDIR)/bin/sdcc -mz80 -v
SAS = as-z80
SCC = $(TOPDIR)/bin/sdcc -mz80 -v
SAS = as-z80
-OBJ = div.o mul.o putchar.o string.o printf.o
+OBJ = div.o mul.o putchar.o string.o printf.o asm_strings.o
LIB = z80.lib
CC = $(SCC)
AS = $(SAS)
LIB = z80.lib
CC = $(SCC)
AS = $(SAS)
+; void *memcpy(void *dest, const void *source, int count)
+_memcpy::
+ push de
+ push bc
+ push ix
+ ld ix,#0
+ add ix,sp
+ ld l,8(ix)
+ ld h,9(ix)
+ ld e,10(ix)
+ ld d,11(ix)
+ ld c,12(ix)
+ ld b,13(ix)
+
+ inc b
+ inc c
+ push hl
+
+ jr 2$
+1$:
+ ld a,(de)
+ ld (hl),a
+ inc de
+ inc hl
+2$:
+ dec c
+ jr nz,1$
+ dec b
+ jr nz,1$
+
+ pop hl
+ pop ix
+ pop bc
+ pop de
+ ret
+
+; int strcmp(const char *s1, const char *s2)
+_strcmp::
+ push de
+ push ix
+ ld ix,#0
+ add ix,sp
+ ld e,6(ix)
+ ld d,7(ix)
+ ld l,8(ix)
+ ld h,9(ix)
+
+ jr 1$
+2$:
+ ld a,(de)
+ sub (hl)
+ jr nz,4$
+ ;; A == 0
+ cp (hl)
+ jr z,3$
+1$:
+ inc de
+ inc hl
+ jr 2$
+
+3$:
+ ld hl,#0
+ jr 5$
+4$:
+ ld hl,#1
+ jr nc,5$
+ ld hl,#-1
+5$:
+ pop ix
+ pop de
+ ret
\ No newline at end of file
\ No newline at end of file
.org 0x150
init:
;; Stack at the top of memory.
ld sp,#0xffff
.org 0x150
init:
;; Stack at the top of memory.
ld sp,#0xffff
+ ld a,#0x01
+ out (0x09),a
+ ld a,#0xEF
+ out (0x07),a
+
;; Use _main instead of main to bypass sdcc's intelligence
;; Use _main instead of main to bypass sdcc's intelligence
+__int:
+ push af
+ push hl
+ ld hl,#__ticks
+ inc (hl)
+ jr nz,1$
+ inc hl
+ inc (hl)
+1$:
+ pop hl
+ pop af
+ ei
+ ret
+
+_clock::
+ ld hl,#__ticks
+ ld a,(hl)
+ inc hl
+ ld h,(hl)
+ ld l,a
+ ret
+
_getsp::
ld hl,#0
add hl,sp
_getsp::
ld hl,#0
add hl,sp
/* Dumb strings stub.
Wanted a quick hack for now - will use the libc version later.
*/
/* Dumb strings stub.
Wanted a quick hack for now - will use the libc version later.
*/
char *strcpy(char *dest, const char *source)
{
char *ret = dest;
while (*dest++ = *source++);
return ret;
}
char *strcpy(char *dest, const char *source)
{
char *ret = dest;
while (*dest++ = *source++);
return ret;
}
void *memcpy(void *dest, const void *source, int count)
{
char *d = dest;
void *memcpy(void *dest, const void *source, int count)
{
char *d = dest;
-int strcmp(const char *s1, const char *s2)
+int __strcmp(const char *s1, const char *s2)
void printf(const char *format, ...);
void exit(int val);
void printf(const char *format, ...);
void exit(int val);
/*#define DPRINTF(_a) printf _a*/
#define DPRINTF(_a)
/*#define DPRINTF(_a) printf _a*/
#define DPRINTF(_a)
Str_30 Str_2_Loc;
REG int Run_Index;
REG int Number_Of_Runs;
Str_30 Str_2_Loc;
REG int Run_Index;
REG int Number_Of_Runs;
/* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */
/* overflow may occur for this array element. */
/* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */
/* overflow may occur for this array element. */
+ Number_Of_Runs = 32000;
+ clock();
/* Main test loop */
for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index) {
/* Main test loop */
for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index) {
printf("Run_Index = %d\n", Run_Index);
printf("Run_Index = %d\n", Run_Index);
printf ("Execution ends\n");
printf ("\n");
printf ("Final values of the variables used in the benchmark:\n");
printf ("Execution ends\n");
printf ("\n");
printf ("Final values of the variables used in the benchmark:\n");
printf ("Str_2_Loc: %s\n", Str_2_Loc);
printf (" should be: DHRYSTONE PROGRAM, 2'ND STRING\n");
printf ("\n");
printf ("Str_2_Loc: %s\n", Str_2_Loc);
printf (" should be: DHRYSTONE PROGRAM, 2'ND STRING\n");
printf ("\n");
+
+ printf("Time: %u secs\n", endTime);
+ printf("Dhrystones/tick = %u\n", Number_Of_Runs / endTime);
}
void Proc_1 (REG Rec_Pointer Ptr_Val_Par)
}
void Proc_1 (REG Rec_Pointer Ptr_Val_Par)