On Layer 1,1 enhanced ULA mode [til/spectrum]

If you want control of the PAPER colour, you’ll need to use PALETTE FORMAT and LAYER PALETTE – read on:
With LAYER 1,1:

To make use of the fuller colour set, you need to enable “Enhanced ULA functionality” which is achieved using the PALETTE FORMAT n routine.
The PALETTE FORMAT n value is allowed 255, 127, 63, 31, 15, 7, 3, 1 and 0. The pattern here is 255 shifted right.
To then select a colour for the layer, the LAYER PALETTE 0, i, v routine is used (or a palette can be loaded with LAYER PALETTE 0 BANK n, i).
The maximum number of INK is dictated by the PALETTE FORMAT 255, and in this case calling INK 255 is legal. If the palette were formatted to 127, calling INK 255 would result in a K Invalid Colour exception.
PAPER is limited. Essentially it supports 256 / (palette format+1) colours. So if you call PALETTE FORMAT 255, you get one paper colour (and 255 inks). If you PALETTE FORMAT 63, you get four paper colours. This is because paper is using the MSB, and with 64 inks available (colour is zero indexed), the top 2 bits of the byte are available so 0b00 (0), 0b01 (1), 0b10 (2) and 0b11 (3).
The paper value from 0 onwards is taken from palette index 128. So you can change the paper colour by doing LAYER PALETTE 0, 128, 0 to set PAPER 0 to black, or with PALETTE FORMAT 63 : LAYER PALETTE 0, 129, 292 : PAPER 1 sets the paper to grey.

So if you want 64 paper colours, you can use PALETTE FORMAT 1
PALETTE FORMAT 1 gets you 1 paper – so only PAPER 0 is legal, and all else fails. 127 gets you 2 paper. 63, 4 papers, and so on. Paper is using the MSB and the ink is using the LSBs.
(MSB = most significant bits (LSB = least), i.e. when you have PALETTE FORMAT 127 then that’s 1 bit that’s unused (the MSB – as the far left bit is the 128 value bit), so that MSB is used for two states: on and off, so you get 2 PAPER colours with PALETTE FORMAT 127)


This content originally appeared on remy sharp's b:log and was authored by remy sharp's b:log

If you want control of the PAPER colour, you'll need to use PALETTE FORMAT and LAYER PALETTE - read on:

With LAYER 1,1:

  • To make use of the fuller colour set, you need to enable "Enhanced ULA functionality" which is achieved using the PALETTE FORMAT n routine.
  • The PALETTE FORMAT n value is allowed 255, 127, 63, 31, 15, 7, 3, 1 and 0. The pattern here is 255 shifted right.
  • To then select a colour for the layer, the LAYER PALETTE 0, i, v routine is used (or a palette can be loaded with LAYER PALETTE 0 BANK n, i).
  • The maximum number of INK is dictated by the PALETTE FORMAT 255, and in this case calling INK 255 is legal. If the palette were formatted to 127, calling INK 255 would result in a K Invalid Colour exception.
  • PAPER is limited. Essentially it supports 256 / (palette format+1) colours. So if you call PALETTE FORMAT 255, you get one paper colour (and 255 inks). If you PALETTE FORMAT 63, you get four paper colours. This is because paper is using the MSB, and with 64 inks available (colour is zero indexed), the top 2 bits of the byte are available so 0b00 (0), 0b01 (1), 0b10 (2) and 0b11 (3).
  • The paper value from 0 onwards is taken from palette index 128. So you can change the paper colour by doing LAYER PALETTE 0, 128, 0 to set PAPER 0 to black, or with PALETTE FORMAT 63 : LAYER PALETTE 0, 129, 292 : PAPER 1 sets the paper to grey.

So if you want 64 paper colours, you can use PALETTE FORMAT 1

PALETTE FORMAT 1 gets you 1 paper - so only PAPER 0 is legal, and all else fails. 127 gets you 2 paper. 63, 4 papers, and so on. Paper is using the MSB and the ink is using the LSBs.

(MSB = most significant bits (LSB = least), i.e. when you have PALETTE FORMAT 127 then that's 1 bit that's unused (the MSB - as the far left bit is the 128 value bit), so that MSB is used for two states: on and off, so you get 2 PAPER colours with PALETTE FORMAT 127)

Originally published on Remy Sharp's b:log


This content originally appeared on remy sharp's b:log and was authored by remy sharp's b:log


Print Share Comment Cite Upload Translate Updates
APA

remy sharp's b:log | Sciencx (2021-03-21T21:22:43+00:00) On Layer 1,1 enhanced ULA mode [til/spectrum]. Retrieved from https://www.scien.cx/2021/03/21/on-layer-11-enhanced-ula-mode-til-spectrum/

MLA
" » On Layer 1,1 enhanced ULA mode [til/spectrum]." remy sharp's b:log | Sciencx - Sunday March 21, 2021, https://www.scien.cx/2021/03/21/on-layer-11-enhanced-ula-mode-til-spectrum/
HARVARD
remy sharp's b:log | Sciencx Sunday March 21, 2021 » On Layer 1,1 enhanced ULA mode [til/spectrum]., viewed ,<https://www.scien.cx/2021/03/21/on-layer-11-enhanced-ula-mode-til-spectrum/>
VANCOUVER
remy sharp's b:log | Sciencx - » On Layer 1,1 enhanced ULA mode [til/spectrum]. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/03/21/on-layer-11-enhanced-ula-mode-til-spectrum/
CHICAGO
" » On Layer 1,1 enhanced ULA mode [til/spectrum]." remy sharp's b:log | Sciencx - Accessed . https://www.scien.cx/2021/03/21/on-layer-11-enhanced-ula-mode-til-spectrum/
IEEE
" » On Layer 1,1 enhanced ULA mode [til/spectrum]." remy sharp's b:log | Sciencx [Online]. Available: https://www.scien.cx/2021/03/21/on-layer-11-enhanced-ula-mode-til-spectrum/. [Accessed: ]
rf:citation
» On Layer 1,1 enhanced ULA mode [til/spectrum] | remy sharp's b:log | Sciencx | https://www.scien.cx/2021/03/21/on-layer-11-enhanced-ula-mode-til-spectrum/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.