Commit Graph

12 Commits

Author SHA1 Message Date
Lephenixnoir a416d40eea
Organize folders and build system to prepare for small revamp
Goals include:
* To recover emulator code into a working state (using SDL2 as I cannot
  use the Windows library)
* To allow memory management in emulator to not mirror the intricacies
  of the calculator version (eg. aSystemStack, aVRAMBuffer, etc)
* To recover actual printf-style error messages on the calculator
* To use the standard library and avoid random reimplementations of
  functions
* And other code cleanups that are only possible with CGDoom-specific
  header files, instead of the mix in platform.h and os.h
2021-08-14 09:42:57 +02:00
Lephenixnoir 4832390802
Add secondary VRAM as heap when using direct-DD access
Ultimate Doom E1M6 now loads!
2021-08-04 15:58:40 +02:00
Lephenixnoir 57624763e3
Add a compile-time option to use direct-DD access 2021-08-04 14:53:24 +02:00
Lephenixnoir dce39fcbf5
Offer Bfile vs. mmap dynamically 2021-08-02 21:55:39 +02:00
Lephenixnoir b1f8a97983
UI improvements and sprintf 2021-08-02 21:11:13 +02:00
Lephenixnoir 55f9d43237
Optimize loading speed (x2.7) and game speed (+35%)
Loading is measured by RTC_GetTicks().

* Initial version: 9.8s
  This was a regression due to using 512-byte sectors instead of 4 kiB
  clusters as previously.

* Do BFile reads of 4 kiB: 5.2s (-47%)
  Feels similar to original code, I'll take this as my baseline.

* Test second half of Flash first: 3.6s (-31%)
  By reading from FLASH_FS_HINT to FLASH_END first many OS sectors can
  be skipped (without missing on other sectors just in case).

* Load to XRAM instead or RAM with BFile
  The DMA is 10% slower to XRAM than to RAM, but this benefits memcmp()
  because of faster memory accesses through the operand bus. No effect
  at this point, but ends up saving 8% after memcmp is optimized.

* Optimize memcmp for sectors: 3376 ms (-8%)
  The optimized memcmp uses word accesses for ROM (which is fastest),
  and weaves loop iterations to exploit superscalar parallelism.

* Search sectors most likely to contain data first: 2744 ms (-19%)
  File fragments almost always start on 4-kiB boundaries between
  FLASH_FS_HINT and FLASH_END, so these are tested first.

* Index most likely sectors, improve FLASH_FS_HINT: 2096 ms (-24%)
  Most likely sectors are indexed by first 4 bytes and binary searched,
  and a slightly larger region is considered for hints. The cache hits
  119/129 fragments in my case.

* Use optimized memcmp for consecutive fragments: 1408 ms (-33%)
  I only set it for the search of the first sector in each fragment and
  forgot to use it where it is really needed. x)

Game speed is measured roughly by the time it takes to hit a wall by
walking straight after spawning in Hangar.

* Initial value: 4.4s

* Use cached ROM when loading data from the WAD: 2.9s (-35%)
  Cached accesses are quite detrimental for sector search, I assume
  because everything is aligned like crazy, but it's still a major help
  when reading sequential data in real-time.
2021-07-28 23:06:42 +02:00
Lephenixnoir d7ee5a1bbb
Restore video system screens and memcpy bug in V_CopyRect
* Restore screen numbers; BG is 4, at least in the ST module.
* Let ST module allocate BG, which is just 32 pixels high and not a full
  VRAM (huge memory gain!)
* Fix V_CopyRect() not working because memcpy is still broken (this will
  be changed later with a proper memcpy)
2021-07-27 14:20:14 +02:00
Lephenixnoir 91f8dca1cb
Clean up more very old or unusable code 2021-07-27 11:19:39 +02:00
Lephenixnoir f477b87e50
Clean up file access + allow using BFile as an option
BFile can now be selected in <platform.h> by defining CGDOOM_WAD_BFILE
instead of CGDOOM_WAD_MAPPING. The DMA option is not implemented yet.

BFile works as expected - a lot of stuttering due to reads during
gameplay. But the status bar texture still doesn't load properly!
2021-07-27 11:12:31 +02:00
Lephenixnoir f869f45d0d
Split in ROM sectors of 512 bytes instead of clusters of 4 kiB
This makes the search quite a bit slower, I'll look into that later.
2021-07-26 17:25:26 +02:00
Lephenixnoir e52f315de2
Silence some warnings 2021-07-26 10:18:52 +02:00
Lephenixnoir 34e09b4cbf
Add CGDOOM's original platform.h file 2021-07-17 10:40:12 +02:00