Tic-80: Extract 16KB VRAM from 80KB RAM

Created on 1 Dec 2018  路  7Comments  路  Source: nesbox/TIC-80

We could get additional 16KB of RAM to implement Sprite Flags, complete music commands, use Persistent memory with peek/poke and etc. without breaking compatibility.

enhancement

Most helpful comment

added sprite flags section here 528bb40
looks like this
flags

All 7 comments

New separated memory layout (by the vram/ram commands)

|           16K VRAM LAYOUT         |
+-------+-------------------+-------+
| ADDR  | INFO              | SIZE  |
+-------+-------------------+-------+
| 00000 | SCREEN            | 16320 |
| 03FC0 | PALETTE           | 48    |
| 03FF0 | PALETTE MAP       | 8     |
| 03FF8 | BORDER            | 1     |
| 03FF9 | SCREEN OFFSET     | 2     |
| 03FFB | MOUSE CURSOR      | 1     |
| 03FFC | ...               | 4     |
+-------+-------------------+-------+

+-----------------------------------+
|           80K RAM LAYOUT          |
+-------+-------------------+-------+
| ADDR  | INFO              | SIZE  |
+-------+-------------------+-------+
| 04000 | TILES             | 8192  |
| 06000 | SPRITES           | 8192  |
| 08000 | MAP               | 32640 |
| 0FF80 | GAMEPADS          | 4     |
| 0FF84 | MOUSE             | 4     |
| 0FF88 | KEYBOARD          | 4     |
| 0FF8C | ...               | 16    |
| 0FF9C | SOUND REGISTERS   | 72    |
| 0FFE4 | WAVEFORMS         | 256   |
| 100E4 | SFX               | 4224  |
| 11164 | MUSIC PATTERNS    | 11520 |
| 13E64 | MUSIC TRACKS      | 408   |
| 13FFC | SOUND STATE       | 4     |
| 14000 | ...               | 16384 |
+-------+-------------------+-------+

added sprite flags section here 528bb40
looks like this
flags

So, if you extracted the VRAM and made it have its own memory, do you have a possible memory layout for the main RAM's 0x0000~0x3FFF range?

@StinkerB06 VRAM will be mapped to 0x0000~0x3FFF range

   TIC80 memory schematic
   ======================

   ---------- 16K VRAM -----------

    .............  
   .-------------. 
   |     16K     | 
   '-------------' 
    '''''''''''''  

   ----------- 80K RAM -----------

    .............   .............  
   .-------------. .-------------. 
   |     16K     | |     16K     | 
   '-------------' '-------------' 
    '''''''''''''   '''''''''''''  
    .............   .............  
   .-------------. .-------------. 
   |     16K     | |     16K     | 
   '-------------' '-------------' 
    '''''''''''''   '''''''''''''  
    .............  
   .-------------. 
   |     16K     | 
   '-------------' 
    '''''''''''''  

Added fget(index,flag) fset(index,flag,bool) api here a08fd71

font data moved to the RAM layout, you can update it in runtime, also we can add font editor in the future
so, the latest view of the memory in .80 is

|           16K VRAM LAYOUT         |
+-------+-------------------+-------+
| ADDR  | INFO              | SIZE  |
+-------+-------------------+-------+
| 00000 | SCREEN            | 16320 |
| 03FC0 | PALETTE           | 48    |
| 03FF0 | PALETTE MAP       | 8     |
| 03FF8 | BORDER            | 1     |
| 03FF9 | SCREEN OFFSET     | 2     |
| 03FFB | MOUSE CURSOR      | 1     |
| 03FFC | ...               | 4     |
+-------+-------------------+-------+
|           80K RAM LAYOUT          |
+-------+-------------------+-------+
| ADDR  | INFO              | SIZE  |
+-------+-------------------+-------+
| 04000 | TILES             | 8192  |
| 06000 | SPRITES           | 8192  |
| 08000 | MAP               | 32640 |
| 0FF80 | GAMEPADS          | 4     |
| 0FF84 | MOUSE             | 4     |
| 0FF88 | KEYBOARD          | 4     |
| 0FF8C | SFX STATE         | 16    |
| 0FF9C | SOUND REGISTERS   | 72    |
| 0FFE4 | WAVEFORMS         | 256   |
| 100E4 | SFX               | 4224  |
| 11164 | MUSIC PATTERNS    | 11520 |
| 13E64 | MUSIC TRACKS      | 408   |
| 13FFC | SOUND STATE       | 4     |
| 14000 | STEREO VOLUME     | 4     |
| 14004 | PERSISTENT MEMORY | 1024  |
| 14404 | SPRITE FLAGS      | 512   |
| 14604 | FONT              | 2048  |
| 14E04 | ...               | 12796 |
+-------+-------------------+-------+
Was this page helpful?
0 / 5 - 0 ratings

Related issues

nesbox picture nesbox  路  5Comments

darkhog picture darkhog  路  4Comments

fangzhangmnm picture fangzhangmnm  路  3Comments

BuoYancYdabl picture BuoYancYdabl  路  5Comments

msx80 picture msx80  路  5Comments