blog:x68_devcode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
blog:x68_devcode [2020/07/12 14:09] – [GVRAM Operations] johnblog:x68_devcode [2020/08/07 21:22] (current) – [X68000 C Code Examples] john
Line 1: Line 1:
-====== X68000 C Code Examples ======+====== Sharp X68000 C Code Examples ======
  
 Here are some example code listings to compile and run on the Sharp X68000. They demonstrate how to use some of the built-in system calls. Here are some example code listings to compile and run on the Sharp X68000. They demonstrate how to use some of the built-in system calls.
Line 1504: Line 1504:
  
 ===== TVRAM Operations ===== ===== TVRAM Operations =====
 +
 +TVRAM (or Text-RAM) is another area of video RAM on the X68000, distinctly seperate from the previous GVRAM we looked at above.
 +
 +Text RAM is again accessed via a memory mapped address range in the X68000 address space.
 +
 +1 Row 128 bytes(64 words)
 +
 +^ Page ^ Address Range       ^
 +| 0    | 0xE00000 - 0xE1FFFF |
 +| 1    | 0xE20000 - 0xE3FFFF |
 +| 2    | 0xE40000 - 0xE5FFFF |
 +| 3    | 0xE60000 - 0xE7FFFF |
 +
 +Unlike GVRAM where one pixel was directly mapped to a single memory location (writing a 16bit value to //0xC00000// would set the colour of a single pixel at screen position 0,0), [[https://en.wikipedia.org/wiki/Planar_(computer_graphics)|Text RAM is planar]]. 
 +
 +Writing a 16bit value to //0xE00000// will actually turn on and off the first 16 bits of row 0 of the screen.
 +
 +For example; suppose you write the 16bit value 0xFFFF (bits: 1111111111111111), to 0xE00000. You'll get a line of 16 pixels turned on:
 +
 +{{:blog:x68000_text_ffff.png?200|}}
 +
 +If you write the value 0xAAAA (a pattern of: 1010101010101010) to 0xE00000 you instead get an alternating pattern of pixels on and off:
 +
 +{{:blog:x68000_text_aaaa.png?200|}}
 +
 +Writing another 16bit value to 0xE20000, 0xE40000 and 0xE60000 will result in the bit patterns being overlaid and generating a different colour for those first 16 pixels.
 +
 +Using this planar arrangement means you only need to write 64 x 16bit words to set every pixel in a row to be on or off... of course if you want them to be different colours you then need to write other patterns to the other text planes. It's swings and roundabouts to trade off.
 +
 +TO-DO - further explanation of how the colour of the pixels is determined (palette lookup).
  
 ---- ----
  
 ===== Sprite Operations ===== ===== Sprite Operations =====
  • blog/x68_devcode.1594559372.txt.gz
  • Last modified: 2020/07/12 14:09
  • by john