Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
668 | lvd | 1 | |
2 | I/O ports |
||
3 | |||
4 | ULAplus is controlled by two ports. |
||
5 | |||
6 | 0xBF3B is the register port (write only) |
||
7 | |||
8 | The byte output will be interpreted as follows: |
||
9 | |||
10 | Bits 0-5: Select the register sub-group |
||
11 | Bits 6-7: Select the register group. Two groups are currently available: |
||
12 | |||
13 | 00 - palette group |
||
14 | |||
15 | When this group is selected, the sub-group determines the |
||
16 | entry in the palette table (0-63). |
||
17 | |||
18 | 01 - mode group |
||
19 | |||
20 | The sub-group must be zero (colour) or one (greyscale). Sub-group entries 2-63 are reserved. |
||
21 | |||
22 | 0xFF3B is the data port (read/write) |
||
23 | |||
24 | When the palette group is selected, the byte written will describe the color. |
||
25 | |||
26 | When the mode group is selected, the byte output will be interpreted as follows: |
||
27 | |||
28 | Bit 0: Palette mode select; on when set. |
||
29 | |||
30 | Implementations that support the Timex video modes use the #FF register to set the video mode, as per the Timex machines. |
||
31 | It is left to the individual implementations to determine if reading the port returns the previous write or the floating bus. |
||
32 | |||
33 | |||
34 | RGB palette entries |
||
35 | G3R3B2 encoding |
||
36 | |||
37 | For a device using the RGB colour space the palette entry is interpreted as follows |
||
38 | |||
39 | Bits 0-1: Blue intensity. |
||
40 | Bits 2-4: Red intensity. |
||
41 | Bits 5-7: Green intensity. |
||
42 | |||
43 | This colour space uses a sub-set of 9-bit RGB. The missing lowest blue bit is set to OR of the other two blue bits |
||
44 | (Bb becomes 000 for 00, and Bb1 for anything else). This gives access to a fixed half the potential 512 colour palette. |
||
45 | The reduces the jump in intensity in the lower range in the earlier version of the specification. |
||
46 | It also means the standard palette can now be represented by the ULAplus palette. |
||
47 | |||
48 | |||
49 | Greyscale palette entries |
||
50 | |||
51 | In greyscale mode, each palette entry describes an intensity from zero to 255. This can be achieved by simply removing the colour from the output signal. |
||
52 | Software |
||
53 | |||
54 | A rapidly growing collection of software is available including a palette editor, palette files to re-colour existing games, |
||
55 | a 6-bit RGB colour extension to CP/M plus, a slideshow of converted Commodore 64 hi-res pictures, |
||
56 | and brand new games, all of which can be found at [http://sites.google.com/site/ulaplus/home]. |
||
57 | |||
58 | The palette editor enables you to create a palette for use with existing software without needing to rewrite the software. |
||
59 | You can save the palette and load it before loading the original software as normal. |
||
60 | In this way all existing software can be re-coloured without any programming knowledge required. |
||
61 | |||
62 | An introduction to using the ULAplus palette from BASIC is also available [1] |
||
63 | Limitations |
||
64 | |||
65 | Although in theory 64 colours can be displayed at once, in practice this is usually not possible except when displaying colour bars, |
||
66 | because the four CLUTs are mutually exclusive; it is not possible to mix colours from two CLUTs in the same cell. |
||
67 | Emulation |
||
68 | |||
69 | The 64 colour mode lookup table is organized as 4 palettes of 16 colours. |
||
70 | |||
71 | Bits 7 and 6 of each Spectrum attribute byte (normally used for FLASH and BRIGHT) will be used as an index value (0-3) |
||
72 | to select one of the four colour palettes. |
||
73 | |||
74 | Each colour palette has 16 entries (8 for INK, 8 for PAPER). Bits 0 to 2 (INK) and 3 to 5 (PAPER) of the attribute byte |
||
75 | will be used as indexes to retrieve colour data from the selected palette. |
||
76 | |||
77 | With the standard Spectrum display, the BORDER colour is the same as the PAPER colour in the first CLUT. |
||
78 | For example BORDER 0 would set the border to the same colour as PAPER 0 (with the BRIGHT and FLASH bits not set). |
||
79 | |||
80 | The complete index can be calculated as |
||
81 | |||
82 | ink_colour = (FLASH * 2 + BRIGHT) * 16 + INK |
||
83 | paper_colour = (FLASH * 2 + BRIGHT) * 16 + PAPER + 8 |
||
84 | |||
85 | When scaling 3-bits of colour data to more bits for emulators that operate in high colour mode, |
||
86 | simply concatenate the bits repeatedly and then truncate to as many bits as needed. For example, for 8-bits the following conversion should be used: |
||
87 | |||
88 | 76543210 |
||
89 | hmlhmlhm |
||
90 | |||
91 | where h is the high bit, m is the middle bit, and l is the low bit of the original 3-bit value. |
||
92 |