From d294ffa4bb4b95402a470e82ca269c7fc0abfcc4 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 1 Jul 2024 12:16:43 +0100 Subject: According to DJGPP's docs, better save ebp --- src/vga.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vga.c b/src/vga.c index d4f5943..ad12c9d 100644 --- a/src/vga.c +++ b/src/vga.c @@ -125,6 +125,7 @@ void blit_c(const uint8_t *sprite, const Rect *dst, uint8_t c) uint8_t *dtarget = target + dst->x + dst->y * 320; asm volatile ( + "push %%ebp\n\t" "movl $320, %%ebp\n\t" "subl %%ecx, %%ebp\n\t" "blit_c_w:\n\t" @@ -146,11 +147,12 @@ void blit_c(const uint8_t *sprite, const Rect *dst, uint8_t c) "addl %%ebp, %%edi\n\t" "decl %%ebx\n\t" "jne blit_c_w\n\t" + "pop %%ebp\n\t" : /*no output */ : "S" (sprite), "D" (dtarget), "b" ((uint32_t)dst->h), "d" ((uint32_t)c), "c" ((uint32_t)dst->w), "i" (TRANSPARENT) - : "eax", "ebp" + : "eax" ); } @@ -161,6 +163,7 @@ void blitrc(const uint8_t *sprite, const Rect *src, const Rect *dst) sprite += src->x + src->y * src->w; asm volatile ( + "push %%ebp\n\t" "movl $320, %%ebp\n\t" "subl %%ecx, %%ebp\n\t" "blitrc_w:\n\t" @@ -179,11 +182,12 @@ void blitrc(const uint8_t *sprite, const Rect *src, const Rect *dst) "addl %%ebp, %%edi\n\t" "decl %%ebx\n\t" "jne blitrc_w\n\t" + "pop %%ebp\n\t" : /*no output */ : "S" (sprite), "D" (dtarget), "b" ((uint32_t)dst->h), "d" ((uint32_t)(src->w - dst->w)), "c" ((uint32_t)dst->w), "i" (TRANSPARENT) - : "eax", "ebp" + : "eax" ); } -- cgit v1.2.3