From 75c8730451a7d5e75ef937319d3f4ac13640599e Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Tue, 27 Jul 2021 15:04:03 +0200 Subject: [PATCH] Restore fast copies using the fxlibc memcpy() --- README | 4 ++-- cgdoom/cgdoom.c | 5 +---- cgdoom/v_video.c | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/README b/README index 61f254f..c1e4f9f 100644 --- a/README +++ b/README @@ -2,13 +2,12 @@ This repository is a fork of CGDOOM which was ported originally by MPoupe. Credit goes to: * MPoupe for the original fx-CG 10/20 port of DOOM. -* ProgrammerNerd for attempts at an fx-CG 50 port, which this repository is +* ComputerNerd for attempts at an fx-CG 50 port, which this repository is based on. * Lephenixnoir for the final fixes and fx-CG 50 version. TODO: -> Reenable LTO if possible --> Include a proper fast, version of memcpy -> Try and use more memory regions in z_zone.c -> Overclocking etc. -> Improve file mapping speed (DMA) @@ -26,5 +25,6 @@ The differences are (I might push it later): * Linker script outputs in elf32-sh format * Linker script sets 500k of RAM instead of 64k * LTO disabled (hopefully it could be reenabled later) +* Syscall memcpy() (apparently broken) replaced by fxlibc memcpy() [1] https://github.com/Jonimoose/libfxcg/ diff --git a/cgdoom/cgdoom.c b/cgdoom/cgdoom.c index 731a1a9..a477eb7 100644 --- a/cgdoom/cgdoom.c +++ b/cgdoom/cgdoom.c @@ -459,10 +459,7 @@ int Flash_ReadFile(void *buf, int size, int readpos) I_ErrorI ("Flash_ReadFile", size, readpos, 0, i); return i; } - for(int n = 0; n < i; n++) { - ((char *)buf)[n] = ((char *)pSrc)[n]; - } -// memcpy(buf,pSrc,i); + memcpy(buf,pSrc,i); buf = ((char*)buf)+i; readpos +=i; size -=i; diff --git a/cgdoom/v_video.c b/cgdoom/v_video.c index c3d0ca6..04e78a5 100644 --- a/cgdoom/v_video.c +++ b/cgdoom/v_video.c @@ -171,8 +171,7 @@ void V_CopyRect(int srcx,int srcy,int srcscrn,int width,int height,int destx,int dest = screens[destscrn]+SCREENWIDTH*desty+destx; for ( ; height>0 ; height--) { - for(int n = 0; n < width; n++) dest[n] = src[n]; -// memcpy (dest, src, width); + memcpy (dest, src, width); src += SCREENWIDTH; dest += SCREENWIDTH; }