From f7c861e94eb95579c725dcd5d403acd7b4b318e3 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 9 Jul 2023 21:55:17 +0100 Subject: Assembler optimised blit copy hardcoded to 16x16 --- src/vga.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/vga.c') diff --git a/src/vga.c b/src/vga.c index 70a9a67..c78fcec 100644 --- a/src/vga.c +++ b/src/vga.c @@ -196,3 +196,28 @@ void blit_copy(const Rect *dst) dtarget += 320; } } + +void blit_copy16x16(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" + "movsl\n\t" + "movsl\n\t" + "movsl\n\t" + "movsl\n\t" + "addl %%ebx, %%esi\n\t" + "addl %%ebx, %%edi\n\t" + "decl %%eax\n\t" + "orl %%eax, %%eax\n\t" + "jne blit_copy16x16_loop\n\t" + : /* no output */ + : "S" (src), "D" (dtarget) + : "ecx", "ebx", "eax" + ); +} -- cgit v1.2.3