From e987c5589f3cf37eee8b7ef0e8d4a1eaa3443065 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 27 Dec 2014 00:40:22 +0000 Subject: [PATCH] syscall-z88dk: initial fix ups It now looks plausible but isn't yet tested --- Library/tools/syscall-z88dk.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Library/tools/syscall-z88dk.c b/Library/tools/syscall-z88dk.c index 9a266758..6d466cd1 100644 --- a/Library/tools/syscall-z88dk.c +++ b/Library/tools/syscall-z88dk.c @@ -34,6 +34,7 @@ static void write_call(int n) case 0: fprintf(fp, "\tld hl, %d\n", n); fprintf(fp, "\tjp syscall\n"); + break; case 1: fprintf(fp, "\tpush hl\n"); fprintf(fp, "\tld hl, %d\n", n); @@ -42,25 +43,25 @@ static void write_call(int n) fprintf(fp, "\tret\n"); break; case 2: - fprintf(fp, "\tpop de\n\tpop bc\n\tpush de\n\tpush bc\n"); + fprintf(fp, "\tpop hl\n\tpop de\n\tpop bc\n\tpush de\n\tpush bc\n\tpush hl\n"); fprintf(fp, "\tld hl, %d\n", n); fprintf(fp, "\tcall syscall\n"); - fprintf(fp, "\tpop de\n\tpop bc\n\tpush de\n\tpush bc\n"); - fprintf(fp, "\tret\n"); + fprintf(fp, "\tpop ix\n\tpop de\n\tpop bc\n\tpush de\n\tpush bc\n"); + fprintf(fp, "\tjp (ix)\n"); break; case 3: - fprintf(fp, "\tpop de\n\tpop bc\n\tpop hl\n\tpush de\n\tpush bc\n\tpush hl\n"); + fprintf(fp, "\tpop ix\n\tpop de\n\tpop bc\n\tpop hl\n\tpush de\n\tpush bc\n\tpush hl\n\tpush ix\n"); fprintf(fp, "\tld hl, %d\n", n); fprintf(fp, "\tcall syscall\n"); - fprintf(fp, "\tpop de\n\tpop bc\n\tpop ix\n\tpush de\n\tpush bc\n\tpush ix\n"); - fprintf(fp, "\tret\n"); + fprintf(fp, "\tpop ix\n\tpop de\n\tpop bc\n\tpop iy\n\tpush de\n\tpush bc\n\tpush iy\n"); + fprintf(fp, "\tjp (ix)\n"); break; case 4: - fprintf(fp, "\tpop de\n\tpop bc\n\tpop hl\n\tpop ix\n\tpush de\n\tpush bc\n\tpush hl\n\tpush ix\n"); + fprintf(fp, "\tpop ix\n\tpop de\n\tpop bc\n\tpop hl\n\tpop iy\n\tpush de\n\tpush bc\n\tpush hl\n\tpush iy\n\tpush ix\n"); fprintf(fp, "\tld hl, %d\n", n); fprintf(fp, "\tcall syscall\n"); - fprintf(fp, "\tpop de\n\tpop bc\n\tpop ix\n\tpop iy\n\tpush de\n\tpush bc\n\tpush ix\n\tpush iy\n"); - fprintf(fp, "\tret\n"); + fprintf(fp, "\tpop ix\n\tpop de\n\tpop bc\n\tpop iy\n\tpop af\n\tpush de\n\tpush bc\n\tpush iy\n\tpush af\n"); + fprintf(fp, "\tjp (ix)\n"); break; } fclose(fp); -- 2.34.1