Commit Graph

45 Commits

Author SHA1 Message Date
Lucas Scharenbroich 869d80af1e Comment cleanup and minro refactoring 2023-04-28 00:13:05 -05:00
Lucas Scharenbroich 57f57ce533 Restore shadow reg instead of overwriting 2023-04-27 23:38:26 -05:00
Lucas Scharenbroich 3a78398ea7 Remove dead label 2023-03-09 00:26:31 -06:00
Lucas Scharenbroich 536959619f Refine the horizontal dispatch
Find small optimizations to improve the average performance of the
blitter, especially in the odd-aligned case.

 - Odd-aligned PEA exit is 2 cycles faster per line
 - Odd-aligned JMP exit is 2 cycles faster per line
 - Odd-aligned LDA exit is 6 cycles faster (eliminated long store)
 - Merged setting the entry opcode and offset to convert 2 8-bit
   store into a single 16-bit store (save 6 cycles per line)
 - Load and save the full word for the high bytes. Cost 2 cycles
   but enabled the 6 cycles saved for the LDA case.
2023-03-07 17:32:46 -06:00
Lucas Scharenbroich 6832c7f405 Update dynamic tile rendered to use fixed snippets. Add DAMAGES flag for the one render that doesn't fit the mold 2023-03-03 21:44:39 -06:00
Lucas Scharenbroich dd9ced08f1 Transition to fixed snippets 2023-03-02 23:24:03 -06:00
Lucas Scharenbroich 981182592e Shadow based rendering working in demo-5 2023-02-27 15:30:56 -06:00
Lucas Scharenbroich 3fce46872d Checkpoint; blitter failing 2022-08-14 07:45:58 -05:00
Lucas Scharenbroich 5883de1f71 Checkpoint 2022-08-01 21:46:00 -05:00
Lucas Scharenbroich d107365d79 Break up large source code files to help with dependency ordering 2022-04-25 11:32:06 -05:00
Lucas Scharenbroich e2710ace85 Refactor to support building a tool and new demo to try and use it [not working] 2022-04-23 00:47:13 -05:00
Lucas Scharenbroich 8bb17895a9 Rough outline of streamlined sprite subsystem
* Split the creation of the sprite stamps from adding the
  sprites themselves.  This allows for 48 stamps that can
  be pre-rendered and quickly reassigned to sprites for
  animations.

* Inlined all calls to PushDirtyTile.  This both removed
  significant overhead from calling the small function and,
  since almost all callers we checking multiple tiles, we
  were able to avoid incrementing the count each time and
  just add a single incrments at the end.

* Switched from recording each tile that a sprite intersects
  with each from to only recording the top-left tile and the
  overlap size.  This reduced overhead for larger sprites
  and removed the needs for an end-of-list marker.

* Much more aggressive caching of Sprite and Tile Store
  values in order to streamline the inner tile dispatch
  routines.

* Moving TileStore and Sprites (and other supporting
  data structures) into a separate data bank.  Needed just
  for size purposes and provide micro-optimizations by
  opening up the use of abs,y addressing modes.

* Revamped multi-sprite rendering code to avoid the need to
  copy any masks and all stacked sprites can be drawn
  via a sequence of and [addrX],y; ora (addrX),y where
  addrX is set once per tile.

* General streamlining to reduct overhead. This work was
  focused on removing as much per-tile overhead as possible.
2022-04-20 07:43:16 -05:00
Lucas Scharenbroich 260b2097c2 Continue fixing code issues; strange relocation error happening 2022-02-18 13:42:37 -06:00
Lucas Scharenbroich 95058fb969 Checkpoint for sprite rewrite
All of the sprite rendering has been deferred down to the level of
the tile drawing. Sprites are no longer drawn/erased, but instead
a sprite sheet is generated in AddSprite and referenced by the
renderer.

Because there is no longer a single off-screen buffer that holds
a copy of all the rendered sprites, the TileStore size must be
expanded to hold a reference to the sprite data address fo each
tile.  This increase in data structure size require the TileStore
to be put into its own bank and appropriate code restructuring.

The benefits to the rewrite are significant:

  1. Sprites are never drawn/erased off-screen.  They are only
     ever drawn directly to the screen or play field.
  2. The concept of "damaged" sprites is gone.  Every dirty tile
     automatically renders just to portion of a sprite that it
     intersects.

These two properties result in a substantial increase in throughput.
2022-02-18 12:12:32 -06:00
Lucas Scharenbroich 397df074ac Sprite state rework; have run out of bank space 2022-02-07 01:19:31 -06:00
Lucas Scharenbroich 8b852485ac Fix dirty sprite renderer when StartX and StartY are not zero 2022-02-03 23:44:46 -06:00
Lucas Scharenbroich d3b61f8de6 Merge branch 'toolbox-conversion' 2022-02-03 08:51:49 -06:00
Lucas Scharenbroich 16a3a385a9 Update some comments 2022-02-02 17:24:27 -06:00
Lucas Scharenbroich 5f492fd557 Save 1 cycle per line in the PEA fast-path for odd-aligned blits 2022-02-02 14:30:48 -06:00
Lucas Scharenbroich 1fe02e035c Checkpoint 2022-02-02 10:21:31 -06:00
Lucas Scharenbroich 027f9746ec Checkpoint of work 2022-01-19 20:58:57 -06:00
Lucas Scharenbroich 140126afd8 Optimize odd-aligned case in the blitter
The SEP/REP pairs that are used to move in and out
of 8-bit mode to do the single-byte pushed on the left
and right edges of the screen can also be used to clear
the necessary carry and overflow flags.
2021-11-22 16:13:29 -06:00
Lucas Scharenbroich 4c31a0d056 Reorg of exception handling code in the core blitter
* Moved V-flag handling outside of the 32-byte exception handler
* Switched relative branches to JMP to save a cycle per word
* Updated macros to create a full code snippet instead of assuming
  certain values exist in the exception handler buffer
2021-11-19 10:24:09 -06:00
Lucas Scharenbroich 4338b64338 First cut at a non-trivial overlay. Pallettes and tile indexes still to be fixed 2021-10-11 14:09:38 -05:00
Lucas Scharenbroich d5421afdbd Fix off-by-one issue in tile IDs and make the entry point consistent in the code field generator 2021-10-07 18:33:06 -05:00
Lucas Scharenbroich 87ded17e20 Initial Tiled tile animation export support
* Tiled tile animations read from TSX files
* Hooks for initialization generated by the tiled export tool
* Animated tiles implements with dynamic tiles backed by 2KB of direct
  page space in Bank 00
* Animation resolution limited to 1/60th incremenents

TODO
* Fix crasher in the _DoScriptSequ timer callback
* Fix single-line of garbage on the top line of the dynamic tiles
2021-10-06 07:10:09 -05:00
Lucas Scharenbroich 69c6104742 Small initialization and jsr/jsl updates 2021-08-26 16:12:08 -05:00
Lucas Scharenbroich 652729081e Stub in more tile rendering functions; does not crash but renders incorrectly 2021-08-13 11:38:06 -05:00
Lucas Scharenbroich 1936a0898c Sync up 2021-07-29 05:35:09 -05:00
Lucas Scharenbroich 4b390fef20 Fix extra push in mixed rendering 2021-07-17 20:38:07 -05:00
Lucas Scharenbroich bdf885dafd First implementation of BG0/BG1 mixed exception handling 2021-07-16 23:09:08 -05:00
Lucas Scharenbroich f2d82f810d Very simple asset pipeline to transform PNG impage into raw binary files to load in the engine 2021-07-16 13:09:16 -05:00
Lucas Scharenbroich 62233d4abc Remove dead code and fix right edge of BG1 rendering 2021-07-16 08:38:14 -05:00
Lucas Scharenbroich abfcde54c2 Initial addition of BG1 support 2021-07-16 00:34:58 -05:00
Lucas Scharenbroich 63bfe5e8e7 Resolve horizontal scrolling issue with PEA code 2021-07-15 21:00:35 -05:00
Lucas Scharenbroich b6fadedfc7 WIP of fixing horizontal scrolling 2021-07-15 13:53:53 -05:00
Lucas Scharenbroich 50f5da5608 WIP on BG0X positioning; fix tile horizonal calculation 2021-07-15 11:01:42 -05:00
Lucas Scharenbroich e4d480d2be Fix addressing issue in font routine and data-overwrite bug; Render no longer crashes! 2021-07-10 17:15:35 -05:00
Lucas Scharenbroich 469e8bb74a Add all minimal function in place; not onto debugging 2021-07-09 15:38:32 -05:00
Lucas Scharenbroich 5d713caf5c More parts of the render pipeline in place 2021-07-09 14:18:49 -05:00
Lucas Scharenbroich 7ee1ddb604 Fix cimpilation errors 2021-07-08 08:17:38 -05:00
Lucas Scharenbroich 8ec31631eb Split up source code a bit more; work toward completing render pipeline 2021-07-08 07:46:35 -05:00
Lucas Scharenbroich d1557437c5 Init tile sizes; fix merlin bug and fix bad jump table values 2021-03-24 06:37:48 -05:00
Lucas Scharenbroich 04f202c9f8 Allow dynamic user selection of playfield size 2021-03-21 23:44:33 -05:00
Lucas Scharenbroich 50a3f27a9a Reorg files; focus on S16 artifact 2021-03-21 21:59:54 -05:00