The goal of this project was to create a graphics adapter with multiple modes. Instead of of rewriting vga-text-mode to allow multiple modes, I created a new project called FPGA Graphics Adapter which was made with these different modes in mind.

The way it works right now is that there are 4 different modes which are all trying to run at the same time, but only one of them is allowed to work. This is done by using long assign statements that switch between each mode depending on the value of the first register, called the mode register. Here is an example of that:

assign screen_r_address = (int_reg[0] == 0) ? mtxt_scr_addr : ((int_reg[0] == 1) ? ctxt_scr_addr : ((int_reg[0] == 2) ? lbmp_scr_addr : hbmp_scr_addr));

wire [15:0] mtxt_scr_addr;
wire [15:0] ctxt_scr_addr;
wire [15:0] lbmp_scr_addr;
wire [15:0] hbmp_scr_addr;

screen_r_address is the address of the data to be read from the main screen RAM. Each mode has its own screen address that it wants to read from, but the actual screen address is set based on int_reg[0], the mode register. It works the same way for the sub-character address and the display output.

As of now there is only monochrome and color text modes. Mono text works the same way that it did in vga-text-mode. Color text works a bit differently though. Part of having multiple modes means that there is only one large memory instead of a separate memory for characters and color. In color mode, a color code is written followed by the character code. When it is being drawn on the screen, the module calculates the address the same way that mono does except shifted left one. The first bit is now selects color or character. The module gets the color and then the address using the fast clock, then proceeds just like it did in vga-text-mode.

This video shows a program which writes a test string in color mode then switches to mono mode. In mono mode there is an extra space between each character which is where the color code is. With the new extended ascii characterset, the colors show up as these unusual characters between the regular letters.

And here’s some messed up pictures from when I was making it: colorcodeprinted.jpeg glitchedout.jpeg