Part SEVEN: Explanations about the video display
An ORIC always use a monochrome display. The fact you can use 8 colors at the same times on the screen doesn't mean that you're not in monochrome.
For the video chip (ULA: Undedicated Logic Array) or the Oric, a pixel is either a foreground pixel, or a background pixel. When you draw a line, a circle, a dot, put a letter on the screen, etc... you never have the opportunity to specify it's color. The only effect is that some pixels of the screen switch between the state OFF (meaning it's a background pixel) and the state ON (it's a foreground pixel).
By default, the colors on the screen are WHITE INK and BLACK PAPER. The Oric is able to display up to 8 colors at the same time, so here is how it works.
But before of that, I've to explain how the video memory works.
In TEXT mode, you can see the screen like a giant (!) array of 40 rows by 28 lines.
In general, the first line is reserved by the system, and is used for displaying infos like the file beeing loaded, the status of the CapsLock trigger, and stuff like that. It is called the status line.
In this array, you can put some values. If these values (bytes) are in the range 32-127, it means this is a character to display. It is standard ASCII codes. I said standard. Values above 127 are not ASCII values.
If the value is above 127, it means that the character is in Video Inverse. In that case, you substract 128, and you have the standard ASCII value, but displayed with different colors. As I'm talking about colors, here is a little table that shows the available colors, and the resulting inverted colors:
As you can see, the video inversion consist in an inversion of each component of the color.
Now, about the colors, you have to understand the principle of line attributes.
When you want to change a color, you have to insert an attribute that will say to the ULA, that now the colors are not WHITE or BLACK, but something else. An attribute is any value find by the ULA in the screen, with a value less than 32. Almost every attribute start it's effect at the position he was read, and this until another attribute changes something, or until we reach the end of the current video line. When a new line starts, the ULA resets all its internal attribute registers, set the background color (the paper) to BLACK and the foreground color (the ink) to WHITE.
This simplicity is cool. But the drawback is that when you put an attribute somewhere, you cannot put something else.
And this something else could have been character or graphics.
Before I continue, I now gives you the list of all available attributes:
Paper (background) attributes
CharSet modifier attributes
Video control attributes
With all these tables, you can now understand why it is impossible to access to the 2 first columns of the screen.
When you type PAPER 4, the first column of the screen is filled with the attribute 20, and when you type INK 6, the second column is filled with the attribute 6. If you try to poke something in these adresses, the text at the right is altered (meaning that the text become WHITE, or the background become BLACK).
For aesthetical reasons, I give you an advice: If you want to display text with colors, better try to put the INK attribute first, and then the PAPER attribute. The result is the same, except that the first column is black. So it look like if only ONE column where unusable. It's the same thing in HIRES, it reduces the shocking effect of graphics starting very far from the left of the screen.
It's possible to enable special effects for the display of text (and for graphics too with the blinking).
Attributes 8 to 15 changes the way the text is displayed at screen. You can select the alternate charset, display the text in double height mode, and at last, made the text blinking.
All theses specials functions can be used with only ONE attribute, so it don't take to much space on screen.
The Oric is able to use 2 different character-set for displaying text. The normal charset is copied from the ROM at the startup, while the second one is generated by a ROM routine. The second charset looks like a 2x3 blocs matrix. Each of these pixels is about 3x3 pixels, except the middle line that is only 3x2 pixels (because 3 blocs of 3 pixels makes 9 pixels ---> more than the 6x8 character size).
Note: most computers uses an 8x8 font size, but in the Oric, it is only 6x8. This explains the strange HIRES resolution. 240 pixels wide looks like 40x6 pixels. And as the video chip process HIRES a bit like TEXT, it's normal that the constraints looks the same. For the ULA a byte can contain only 6 displayable bits, because the 8th bit represents video inversions, and the 7th bit is used as an "attribute active" flag.
This charset can be useful for displaying pseudo-graphics since it's easy to compute the appearance of a block. The following table gives the values to use for activate one of the blocks: (Always add 32 to this value)
Perhaps you were thinking that alternate charset was a bit tricky ? Hum, just read now about the Double Height feature !
Double height allows the video controler to display only one of the halves of a character with a vertical stretching effect. Since the attributes never specify if you want to display the top or bottom part of the character, the ULA most decides itself. The choices is based on the number of the text line beeing displayed. If the number is EVEN it will display the upper part, if it's ODD it will be the lower part. So, you have to be carefull when you use this feature. If you want to scroll the screen, you will see all your letters displayed uncorectly every two frames...
Anyway, it's possible to create mixed video modes.
When you are in Hires mode, you have 200 Hires video lines, and 3 Text lines. This is an example of mixed mode.
After you start your Oric, just type on the following keys:
you will see something like the screen at right. Strange no ?
Perhaps you need an explanation ?
In fact, when you type ESC+], you just put a 50 Hertz graphics attribute at the position under the cursor. When the ULA reads this character, it switches to the HIRES drawing mode. If you don't believe me, just type HIRES:DRAW 239,199,1:TEXT
Now, if you type again ESC+], you will see a part of a line instead of the initial scrambling. It proves you that the video chipset starts to draw what is present in the HIRES memory when it encounters this special character.
Using this method it is possible to program various screen mode with mix between HIRES and LORES. But there is a major drawback ! When you're in TEXT mode, the ULA decodes memory bytes as ASCII codes. These ascii codes are used for accessing the CharSet table that contains the patterns to display for drawing characters. The adress of theses CharSet tables are $B400 for the standard charset, and $B800 for the alternate charset. The trouble is that the adresses from $B400 to $BB80 are in the memory used by HIRES display (from $A000 to $BFE0) !!!
The screen shot at right shows you an example of text mode using HIRES mode for displaying rasters.
The picture at the left, is another example of how to insert a HIRES window in a standard TEXT mode.
Such a method can be usefull for plenty of applications ! Imagine you want to program a great Role Playing Game ? If you need to show inventory, or display the current equipment of your hero, it can be valuable !
You want to do a HTML viewer ? Perhaps it is possible to combine the speed of the TEXT display, with the graphix capabilities of HIRES mode (Ok, viewing HTML on an Oric can be pretty useless. But I suppose that my page is dedicated to useless applications of programming 8 bit machines !).