aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2024-07-01 12:16:43 +0100
committerJuan J. Martinez <jjm@usebox.net>2024-07-01 12:16:43 +0100
commitd294ffa4bb4b95402a470e82ca269c7fc0abfcc4 (patch)
tree6f7122eaf0d052fd52ca64a1c843796134d7f495 /src
parent85cf68c29d6a3be585e7e1b2104a115956bc00c4 (diff)
downloadgold-mine-run-d294ffa4bb4b95402a470e82ca269c7fc0abfcc4.tar.gz
gold-mine-run-d294ffa4bb4b95402a470e82ca269c7fc0abfcc4.zip
According to DJGPP's docs, better save ebp
Diffstat (limited to 'src')
-rw-r--r--src/vga.c8
1 files 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"
);
}