aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2024-07-01 12:13:56 +0100
committerJuan J. Martinez <jjm@usebox.net>2024-07-01 12:13:56 +0100
commitbdeec2132d0c4b227ccd457114531f84956a188a (patch)
tree4b6a1f88fa9781e73179ff6c93d951ee52108fba /src
parentb24f453a7d19181b1c9ee2909b66e6c3aa1f6fa1 (diff)
downloaduboxlib-dos-bdeec2132d0c4b227ccd457114531f84956a188a.tar.gz
uboxlib-dos-bdeec2132d0c4b227ccd457114531f84956a188a.zip
According to DJGPP's docs, we better save ebpHEADmain
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 fc041d6..12d5928 100644
--- a/src/vga.c
+++ b/src/vga.c
@@ -125,6 +125,7 @@ void ubox_blit_c(const uint8_t *sprite, const ubox_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 ubox_blit_c(const uint8_t *sprite, const ubox_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" (UBOX_TRANSPARENT)
- : "eax", "ebp"
+ : "eax"
);
}
@@ -161,6 +163,7 @@ void ubox_blitrc(const uint8_t *sprite, const ubox_rect *src, const ubox_rect *d
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 ubox_blitrc(const uint8_t *sprite, const ubox_rect *src, const ubox_rect *d
"addl %%ebp, %%edi\n\t"
"decl %%ebx\n\t"
"jne blitrc_w\n\t"
+ "push %%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" (UBOX_TRANSPARENT)
- : "eax", "ebp"
+ : "eax"
);
}