Re: [Oberon] FPGA - Display.Mod 4-bit colour
Tomas Some history: In Native Oberon the "several video drivers" topic was solved somewhat similar. There were nine different implementations of Display. The files were called - Displays.Display.Mod - Empty.Display.Mod - GD54xx.Display.Mod - S3C805.Display.Mod - S3C924.Display.Mod - S3Trio.Display.Mod - SVGA.Display.Mod - VGA.Display.Mod - W32.Display.Mod All had the same interface (CONST, TYPE, VAR, PROCEDURE) but different implementations corresponding to the chip of the graphics card. In Native Oberon, Kernel.Mod offered routines to read configuration strings provided by the boot loader. (see also Oberon.Text) You configured a prefix (eg "S3Trio." ) to match your HW, Modules.Mod got that video driver prefix from Kernel and took care to load the correct file by adding this prefix to the filename. But this approach is not implemented in the inner core of ProjectOberon. br Jörg Am 02.10.18, 07:54 schrieb "Jörg" <joerg.straube@iaeth.ch>: Tomas No. The current Display subsystem in ProjectOberon is not prepared for different "video drivers". You would have to re-write the Display subsystem to be object oriented. With such an approach, all Display procedures Dot, CopyPattern... are procedure variables to be initialized with the correct procedures of the chosen "video driver". Basically, Display can then be seen as kind of dispatcher module for the underlying video driver. But most probably the easiest is to keep the interface of your two Display modules identical. If so, compile DisplayBW.Mod (implementing MODULE Display;) and rename Display.rsc to DisplayBW.rsc Then compile DisplayColor.Mod (also implementing MODULE Display;) and rename Display.rsc to DisplayColor.rsc Now, the two files DisplayBW.rsc and DisplayColor.rsc are different implementations of Display having identical keys. Before booting, you have to copy the correct DisplayXY.rsc to Display.rsc br Jörg Am 01.10.18, 21:41 schrieb "Oberon im Auftrag von Tomas Kral" <oberon-bounces@lists.inf.ethz.ch im Auftrag von thomas.kral@email.cz>: > I believe the white now truly is {0,1,2,3} = 15, rather than {0} = 1. > But changing it, would invalidate clients, making a different import > KEY. Hi, Now I have two display modules, `Display.Mod' and `Display2.Mod' handling 1-bit and 4-bit colour respectively. While there could be a single driver `vid.v' selecting the mode by a switch e.g. swi[6], adjusting video base accordingly. Can the system somehow boot with either `Display' or `Display2' based on the swi[6]? `Display' is imported by other modules `Oberon',`Viewers',.. -- Tomas Kral <thomas.kral@email.cz> -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Hi Joerg, Thank you. PO2013 is also about new tricks. How about running `Display.Mod' in support for both modes. MODULE Display; ... BEGIN IF SW[6] THEN dpt := 4 (*4 bit*) ELSE dpt := 1 (*1 bit*) END ; ppw := 32 DIV dpt; (*pixels per word*) bpl := dpt * 128 (*bytes per line*) END Display. -- Tomas Kral <thomas.kral@email.cz>
On Tue, 2 Oct 2018 11:40:22 +0200 Tomas Kral <thomas.kral@email.cz> wrote:
IF SW[6] THEN dpt := 4 (*4 bit*) ELSE dpt := 1 (*1 bit*) END
Hi, I am experimenting with 1-bit/4-bit colour map switch. It does things, display is alright. But colours are mapped as thus, the names are not exact but they appear to me like that. map entry colour 00000000 black 00000080 red 00008000 green 00008080 yellow 00800000 cyan 00800080 violet 00808000 light cyan 00808080 light violet 00C0C0C0 light light violet 000000FF light red 0000FF00 light yellow 0000FFFF orange 00FF0000 dark red 00FF00FF yet another shade of violet 00FFFF00 turquoise 00FFFFFF white The good point is, I can now set mono display with two colours other than black/white, e.g. green/black or yellow/black, etc. While I would expect the colours be more or similar like this. map entry colour 00000000 black 00000080 blue 00008000 green 00008080 cyan 00800000 red 00800080 violet 00808000 yellow 00808080 grey 00C0C0C0 light grey 000000FF light blue 0000FF00 light green 0000FFFF light cyan 00FF0000 light red 00FF00FF light violet 00FFFF00 light yellow 00FFFFFF white The colours are added by these lines in verilog for both 1-bit/4-bit. assign vidm = (pixbuf[0] ^ inv); // mono assign vidc = pixbuf[3:0] ^ {inv, inv, inv, inv}; // 4-bit ... // RGB[7:0] = RRR GGG BB assign RGB = {color[23:21], color[15:13], color[7:6]}; ... if (cmode) vid <= vidc else vid <= {3'b000, vidm}; ... and looked up in the map ... if (~hblank & ~vblank) case (vid) 4'h0: color <= col0; ... 4'hf: color <= col15; endcase else color <= 24'h000000; ... Noticeably, Display does not seem to have the same intensity down across, at the the 1/3 upper top appears slightly darker. I am becoming quite confused, I would be grateful for any hints. Many thanks in advance. -- Tomas Kral <thomas.kral@email.cz>
On Tue, 16 Oct 2018 01:26:45 +0200 Tomas Kral <thomas.kral@email.cz> wrote:
Noticeably, Display does not seem to have the same intensity down across, at the the 1/3 upper top appears slightly darker.
Hi, This seems a matter of vision angle, I have tried to leave out hsync/vsync signals just for the thrill of it, than indeed picture is dark at the top of the screen. So is probably right what is does, except I cannot decide on the palette map. In RGB triplet, leftmost byte influences RED most, middle green, and last blue. But looking at the map entries, it appears as if the other way round. $000080H displays as deep red, while I would expect blue. Another thought, in `Display.Mod' I can see, CONST black* = 0; white* = 1(*5*); (*black = background*) Now white may become 15, $FF or -1 in other terms. But changing it would require rebuilding other system modules. I have added in the Top module, a simple `IF' instantiating second map index based on the mode. Not sure if brightest idea. I wish to add two procedures to manipulate the map SetMap(), GetMap(), but where? `Display3.Mod' might be the option or non-existent Display2. I thought Display3 not only provides simple graphics primitives polygons, rectangles, etc but also acts as underlying functionality for Gadgets, correct? What other functionality of Display3 makes sense porting to RISC? Thank you for reading this. -- Tomas Kral <thomas.kral@email.cz>
Tomas Graphics needs memory: firstly the colored framebuffer and offline bitmaps take a lot of memory, secondly the whole Gadgets system needs a lot of code. So, with only 1MB of RAM it’s questionable to port all graphics modules over to ProjectOberon. You can do it, you then have a colored OS but there is almost no space left for a reasonable application. This was the reason why I restricted myself to 800x600 @ 16 colors, and I reduced the stack size a little to have a little more space for the apps. Hint: stackSize is declared in Kernel.Mod, but Modules.Mod still uses an own hard coded constant (iso of importing Kernel.stackSize!) I put the map manipulation in Display.Mod and recompiled the system. Be sure you recompile ALL modules and they compile correctly. If not, booting the new system will provide some headache😊 Fonts are stored B/W. So, you have to „colorize“ them. In the first version of Display, you probably stetch the pattern each time you draw a letter, obviously slowing down the whole text system. In a second step, you might modify Fonts.Mod (and Display) to colorize/stretch the whole font once, and Display can use the pre-stretched font patterns right away... br Jörg
Am 16.10.2018 um 21:57 schrieb Tomas Kral <thomas.kral@email.cz>:
On Tue, 16 Oct 2018 01:26:45 +0200 Tomas Kral <thomas.kral@email.cz> wrote:
Noticeably, Display does not seem to have the same intensity down across, at the the 1/3 upper top appears slightly darker.
Hi,
This seems a matter of vision angle, I have tried to leave out hsync/vsync signals just for the thrill of it, than indeed picture is dark at the top of the screen.
So is probably right what is does, except I cannot decide on the palette map. In RGB triplet, leftmost byte influences RED most, middle green, and last blue. But looking at the map entries, it appears as if the other way round.
$000080H displays as deep red, while I would expect blue.
Another thought, in `Display.Mod' I can see, CONST black* = 0; white* = 1(*5*); (*black = background*)
Now white may become 15, $FF or -1 in other terms. But changing it would require rebuilding other system modules.
I have added in the Top module, a simple `IF' instantiating second map index based on the mode. Not sure if brightest idea.
I wish to add two procedures to manipulate the map SetMap(), GetMap(), but where?
`Display3.Mod' might be the option or non-existent Display2.
I thought Display3 not only provides simple graphics primitives polygons, rectangles, etc but also acts as underlying functionality for Gadgets, correct?
What other functionality of Display3 makes sense porting to RISC?
Thank you for reading this.
-- Tomas Kral <thomas.kral@email.cz> -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
The whole Gadgets system needs a lot of code. So, with only 1MB of RAM it’s questionable to port all graphics modules over to ProjectOberon.
I see. I wish to do some trending, graphing only. I saw some photos of Ceres with dual screens mono/colour, that I plan to mimic with SW[6]. While SW[7] remains for invert. Instead of Gadgets, we can support simple pop-up menus, like I saw with Lilith, Mensa. That may still comfortably fit within 1MB. Just ideas.
Display can use the pre-stretched font patterns right away...
Yes, faster, I see. I stretch with parameter 1-bit (no stretch) 4-bit stretch), that took me some time to understand. I got some speed back with optimised scroll, though I loose some with font render, agree. I do not need to rebuild system so far (which may be of little or no benefit), may require a change in time to get on compatible Display interface with Ceres and yours, too. -- Tomas Kral <thomas.kral@email.cz>
Tomas Kral [thomas.kral@email.cz] wrote:
Instead of Gadgets, we can support simple pop-up menus, like I saw with Lilith, Mensa. That may still comfortably fit within 1MB. Just ideas.
Simple popups are described in the book by Reiser on the original Oberon System. They seem low level and fairly limited. A more thorough package would be Dialogs by Markus Knasmuller. They require Oberon-2, if I am not mistaken. If so then Dialogs would need to be somewhat reworked for Oberon-07. Wojtek
On Wed, 17 Oct 2018 14:09:05 +0000 "Skulski, Wojciech" <skulski@pas.rochester.edu> wrote:
A more thorough package would be Dialogs by Markus Knasmuller. They require Oberon-2, if I am not mistaken. If so then Dialogs would need to be somewhat reworked for Oberon-07.
Hi, Looking for pointer as where to get dialog sources. Many thanks -- Tomas Kral <thomas.kral@email.cz>
Tomas Oberon's strength is that everything is Text. So, you can edit a text and can activate that text as command to modify or enhance the OS. This a totally different paradigm than "normal" OSes (like Windows or Linux) use, where you have the control interface (text-based terminal or visuals-based GUI) and a text editor, that has nothing to do with controlling the OS. The weakness of this approach is, when you want to introduce a GUI to Oberon, the GUI has to fit somehow into this paradigm; the GUI should not be something separate from the text like in Windows or Linux, but it has to be part of the (text) system. To do that you have to modify the whole system. There are two different approaches used in different Oberon systems: 1) Introducing Objects.Mod, the base module everything else is based on. So, Texts are Objects, Files are Objects, Gadgets are Objects etc. Basically everything is inherited from Objects. This is the approach Oberon System 3 aka ETH Oberon took. 2) Introduce non-ASCII objects in Texts/TextFrames. So, basically all GUI elements are coded as special characters in the text you can copy, delete and activate and so on. This is the approach Oberon V4 aka Linz Oberon took. Porting modules from one Oberon GUI approach to the other Oberon GUI approach needs A LOT OF work. - The Gadget system is part of ETH Oberon. - Dialogs is part of Linz Oberon. FPGA ProjectOberon is closer to Linz Oberon (V4) than to ETH Oberon (S3). So, looking into Dialogs makes more sense than looking into Gadgets. Here the zipped source of Dialogs: http://aminet.net/package/dev/obero/Dialogs But to use Dialogs you need to rework Texts/TextFrames first... This is something for advanced programmers. br Jörg -----Original Message----- From: Oberon <oberon-bounces@lists.inf.ethz.ch> On Behalf Of Tomas Kral Sent: Monday, October 29, 2018 5:03 PM To: oberon@lists.inf.ethz.ch Subject: Re: [Oberon] FPGA - Display.Mod 4-bit colour On Wed, 17 Oct 2018 14:09:05 +0000 "Skulski, Wojciech" <skulski@pas.rochester.edu> wrote:
A more thorough package would be Dialogs by Markus Knasmuller. They require Oberon-2, if I am not mistaken. If so then Dialogs would need to be somewhat reworked for Oberon-07.
Hi, Looking for pointer as where to get dialog sources. Many thanks -- Tomas Kral <thomas.kral@email.cz> -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Joerg:
So, looking into Dialogs makes more sense than looking into Gadgets. Here the zipped source of Dialogs: http://aminet.net/package/dev/obero/Dialogs
Probably a better source is the original Linz repository. There is lots of stuff there besides Dialogs. http://www.ssw.uni-linz.ac.at/Research/Projects/OberonDownloads.html
But to use Dialogs you need to rework Texts/TextFrames first... This is something for advanced programmers.
Dialogs need an Oberon-2 compiler for RISC5, which is probably even more advanced than reworking Texts. On the other hand, if Oberon-2 for RISC5 existed, then the most straightforward way of enhancing the FPGA Oberon System would be a recompilation of Linz Oberon V4 on top of the current video subsystem. Looking at the Linz Oberon V4, which I just launched under Windows 7, I can see a lot of highly useful software. It could all be reused if the Oberon-2 compiler for RISC5 was available. Thank you, Wojtek
Looking at the Linz Oberon V4, which I just launched under Windows 7, I can see a lot of highly useful software. It could all be reused if the Oberon-2 compiler for RISC5 was available.
I do not run Windows, but saw some screenshots, it seems the dialogs ties menus to standard Oberon texts commands at the viewer's menu bar. The menu bar consists buttons, with bevels. So instead executing simple command `System.Close System.Copy .. Edit.Store', a selection menu with more options pops up? Also the whole system takes look of Windows 3.xx I did not see all screenshots, but is there more to it? -- Tomas Kral <thomas.kral@email.cz>
Tomas:
I did not see all screenshots, but is there more to it?
There is definitely more. If you look at the Linz webserver then there are lots of very useful packages which turn Oberon System V4 into a very productive software environment. All of these could be available at the expense of developing an Oberon-2 compiler. This development is supposedly not very hard, because RISC5 was intentionally designed to make the compiler development easy. It is was one of the goals of the NW/PR project. Likewise, the Component Pascal software could be used if Component Pascal compiler was available. We stumble upon this topic about once a year. http://www.ssw.uni-linz.ac.at/Research/Projects/OberonDownloads.html The memory on the original FPGA board used by the NW/PR project was a bit too small to consider running Linz V4. There is now a more capable board almost available with 4 megs of fast RAM, which may be sufficient for Linz V4, though probably not sufficient for System 3. I say "almost available" because students are currently testing the hardware. We will see if it all works as planned. In a more distant future I may design a similar board with more RAM, but here we have to tackle the cache if we use SDRAM. Another route would be an Oberon-2 compiler for either Microblaze or Nios II, which would open the door to many commercial boards with SDRAM. These could probably run both V4 and System 3. W.
On Tue, 16 Oct 2018 14:57:11 +0200 Tomas Kral <thomas.kral@email.cz> wrote:
I cannot decide on the palette map. In RGB triplet, leftmost byte influences RED most, middle green, and last blue.
Quite the opposite. Best results obtained so far, by reordering bits in RGB register. // RGB[7:0] = BB GGG RRR assign RGB = {color[23:22], color[15:13], color[7:5]}; Which I believe is matching resolution of Pepino LX9 board. Colour map now appears like this. 00000000 black 00000080 dark red | 00FFFFFF white - based on SW[6] 00008000 green 00008080 yellow 00800000 deep blue 00800080 magenta 00808000 cyan 00808080 grey 00C0C0C0 light grey 000000FF red 0000FF00 light green 0000FFFF light yellow 00FF0000 blue 00FF00FF light violet 00FFFF00 light cyan 00FFFFFF white In invert mode SW[7], the colours do not swap as opposite, which makes me wonder of bit reversal. // RGB[7:0] = RRR GGG BB assign RGB = {<<{color[7:5]}, <<{color[15:13]}, <<{color[23:22]}}; I googled that `<<' stands in Verilog for stream operator doing bit reversing, if I am not mistaken and the above stands to be corrected. It could also be little endianness that I often confuse. I really need to read some book on Verilog and FPGA, I have PDF by Pong, if that is good one. -- Tomas Kral <thomas.kral@email.cz>
Tomas If you want to know how to program your video correctly you have to study your HW. As I have another board (Pipistrello) as you have (Pepino) I can not send you my Verilog code as your HW is different. If you look at your „RISC5_pepino.ucf" you will find: NET "RGB[0]" LOC = "B10"; # RED 0 NET "RGB[1]" LOC = "A10"; # RED 1 NET "RGB[2]" LOC = "C11"; # RED 2 NET "RGB[3]" LOC = "A11"; # GREEN 0 NET "RGB[4]" LOC = "B12"; # GREEN 1 NET "RGB[5]" LOC = "A12"; # GREEN 2 NET "RGB[6]" LOC = "C13"; # BLUE 0 NET "RGB[7]" LOC = "A13"; # BLUE 1 So, the lowest three bits (0..2) are red, bits 3..5 are green and the most significant two (6..7) are blue. These FPGA lines are digital 0 and 1s; but the VGA monitor wants analog RGB values, so you need a DAC (digital analog converter). The following video shows you how this can be done: https://www.youtube.com/watch?v=wzhDRIX2Ors <https://www.youtube.com/watch?v=wzhDRIX2Ors> (3:22 - 7:00) and luckily on page 1 of the Pepino schematic http://www.saanlima.com/download/pepino-v1.1/pepino4-schematic.pdf <http://www.saanlima.com/download/pepino-v1.1/pepino4-schematic.pdf> you see that Magnus foresaw three somewhat similar resistors for RED (RED0=2000 Ohm, RED1=1000 Ohm and RED2=560 Ohm). Now to „invert“ colors, it somewhat depends on what you expect. The easy one first: inverting white should result in black, shouldn’t it? But what do you expect as inverted color of „orange“? The easiest way to define „inverting colors" is to invert all bits and accept the outcome. Hence inverting 0FF8000H (orange) results in 0007FFFH (="pure blue") br Jörg
Am 18.10.2018 um 11:29 schrieb Tomas Kral <thomas.kral@email.cz>:
On Tue, 16 Oct 2018 14:57:11 +0200 Tomas Kral <thomas.kral@email.cz> wrote:
I cannot decide on the palette map. In RGB triplet, leftmost byte influences RED most, middle green, and last blue.
Quite the opposite.
Best results obtained so far, by reordering bits in RGB register. // RGB[7:0] = BB GGG RRR assign RGB = {color[23:22], color[15:13], color[7:5]};
Which I believe is matching resolution of Pepino LX9 board.
Colour map now appears like this.
00000000 black 00000080 dark red | 00FFFFFF white - based on SW[6] 00008000 green 00008080 yellow 00800000 deep blue 00800080 magenta 00808000 cyan 00808080 grey 00C0C0C0 light grey 000000FF red 0000FF00 light green 0000FFFF light yellow 00FF0000 blue 00FF00FF light violet 00FFFF00 light cyan 00FFFFFF white
In invert mode SW[7], the colours do not swap as opposite, which makes me wonder of bit reversal.
// RGB[7:0] = RRR GGG BB assign RGB = {<<{color[7:5]}, <<{color[15:13]}, <<{color[23:22]}};
I googled that `<<' stands in Verilog for stream operator doing bit reversing, if I am not mistaken and the above stands to be corrected. It could also be little endianness that I often confuse.
I really need to read some book on Verilog and FPGA, I have PDF by Pong, if that is good one.
-- Tomas Kral <thomas.kral@email.cz> -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
On Thu, 18 Oct 2018 13:58:22 +0200 Jörg <joerg.straube@iaeth.ch> wrote:
If you look at your „RISC5_pepino.ucf" you will find:
NET "RGB[0]" LOC = "B10"; # RED 0 NET "RGB[1]" LOC = "A10"; # RED 1 NET "RGB[2]" LOC = "C11"; # RED 2 NET "RGB[3]" LOC = "A11"; # GREEN 0 NET "RGB[4]" LOC = "B12"; # GREEN 1 NET "RGB[5]" LOC = "A12"; # GREEN 2 NET "RGB[6]" LOC = "C13"; # BLUE 0 NET "RGB[7]" LOC = "A13"; # BLUE 1
Ah, this piece I was missing all the way, and cost me quite a few trials. Reading through and seeing wiring diagram at last, for the first time speaks to me. Thank you. -- Tomas Kral <thomas.kral@email.cz>
participants (4)
-
Jörg -
Jörg Straube -
Skulski, Wojciech -
Tomas Kral