aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-07-09 23:21:18 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-07-09 23:21:18 +0100
commitfcde38e508cd381ad17e0f73946fa551ac683c81 (patch)
tree67f1a234760d32a503572929179e2112d79206d9
parentd4e9908bf65c080ee2d0e3d143720e0b72bb210d (diff)
downloadgold-mine-run-fcde38e508cd381ad17e0f73946fa551ac683c81.tar.gz
gold-mine-run-fcde38e508cd381ad17e0f73946fa551ac683c81.zip
Height can be a parameter too
-rw-r--r--src/entities.c2
-rw-r--r--src/vga.c11
-rw-r--r--src/vga.h4
3 files changed, 8 insertions, 9 deletions
diff --git a/src/entities.c b/src/entities.c
index 0471fbc..b2ee7fd 100644
--- a/src/entities.c
+++ b/src/entities.c
@@ -61,7 +61,7 @@ void entities_draw()
{
dst.x = e->ox;
dst.y = e->oy + MAP_OFFS_Y;
- blit_copy16x16(&dst);
+ blit_copy16(&dst);
e->erase = 0;
}
diff --git a/src/vga.c b/src/vga.c
index c78fcec..a82fca9 100644
--- a/src/vga.c
+++ b/src/vga.c
@@ -197,16 +197,15 @@ void blit_copy(const Rect *dst)
}
}
-void blit_copy16x16(const Rect *dst)
+void blit_copy16(const Rect *dst)
{
uint8_t *src = buffer + dst->x + dst->y * 320;
uint8_t *dtarget = screen + dst->x + dst->y * 320;
asm volatile (
- "movl $16, %%eax\n\t"
"movl $0x130, %%ebx\n\t"
"cld\n\t"
- "blit_copy16x16_loop:\n\t"
+ "blit_copy16_loop:\n\t"
"movsl\n\t"
"movsl\n\t"
"movsl\n\t"
@@ -215,9 +214,9 @@ void blit_copy16x16(const Rect *dst)
"addl %%ebx, %%edi\n\t"
"decl %%eax\n\t"
"orl %%eax, %%eax\n\t"
- "jne blit_copy16x16_loop\n\t"
+ "jne blit_copy16_loop\n\t"
: /* no output */
- : "S" (src), "D" (dtarget)
- : "ecx", "ebx", "eax"
+ : "S" (src), "D" (dtarget), "a" ((uint32_t)dst->h)
+ : "ecx", "ebx"
);
}
diff --git a/src/vga.h b/src/vga.h
index 1809c46..745018d 100644
--- a/src/vga.h
+++ b/src/vga.h
@@ -36,7 +36,7 @@ void blit_erase(uint8_t c);
/* copy from back buffer to screen */
void blit_copy_all();
void blit_copy(const Rect *dst);
-/* only fot 16x16 rects, w and h are ignored */
-void blit_copy16x16(const Rect *dst);
+/* only for 16 width, w is ignored */
+void blit_copy16(const Rect *dst);
#endif /* _VGA_H */