C3+MikronautsVGA80+keyboard test program
I am probably being a little optimistic by calling this PropOS_C3, but what the heck. Below is the program that is basically testing out the C3, MikronautsVGA80, and the keyboard program.
Some observations:
C3: I started out using a USB keyboard with a USB to PS/2 converter, for whatever reason the C3 does not recognize it. As soon as I plugged in a PS/2 plug keyboard, it started to work. I still wish the new boards would use the available 2011 technology.
I plugged in 6.250 MHz crystal, and I tried the program below. I am getting a hit and miss situation when I try to start the program up. Sometimes program starts up, and sometimes it does not start, so I am not sure what the problem is. I did notice that there is a greater chance for the program to start when the power plug is in.
MikronautsVGA80: This program gets me the 80 char screen that I wanted to play around with, I guess I can live with the 30 rows, I was looking for 24. I would like to see a flashing underline cursor, but I do not have any idea as to how to do that. Is that something in the program itself that I am missing?
keyboard: Where do I program the keyboard control, meaning it should do the function, and not just display the key press to the screen. A good example is the backspace key, when I press that, all I get is a character on the screen, and not the actual backspace.
The program below is a very simple test to see how the keyboard, and the VGA screen interact. I am looking for a command line type of scenario, not sure if the VGA program is capable of doing graphics, and if it is, not sure how you could use a mouse and a keyboard at the same time. So, I guess I need some guidance on the problems mentioned above. As I improve this program I will post it; I will try to do this in stages so the beginners will have a chance to see how everything evolves, instead of trying to decipher 20 objects with 50 pages of code. That its for now.
Thanks
Ray
Some observations:
C3: I started out using a USB keyboard with a USB to PS/2 converter, for whatever reason the C3 does not recognize it. As soon as I plugged in a PS/2 plug keyboard, it started to work. I still wish the new boards would use the available 2011 technology.
I plugged in 6.250 MHz crystal, and I tried the program below. I am getting a hit and miss situation when I try to start the program up. Sometimes program starts up, and sometimes it does not start, so I am not sure what the problem is. I did notice that there is a greater chance for the program to start when the power plug is in.
MikronautsVGA80: This program gets me the 80 char screen that I wanted to play around with, I guess I can live with the 30 rows, I was looking for 24. I would like to see a flashing underline cursor, but I do not have any idea as to how to do that. Is that something in the program itself that I am missing?
keyboard: Where do I program the keyboard control, meaning it should do the function, and not just display the key press to the screen. A good example is the backspace key, when I press that, all I get is a character on the screen, and not the actual backspace.
The program below is a very simple test to see how the keyboard, and the VGA screen interact. I am looking for a command line type of scenario, not sure if the VGA program is capable of doing graphics, and if it is, not sure how you could use a mouse and a keyboard at the same time. So, I guess I need some guidance on the problems mentioned above. As I improve this program I will post it; I will try to do this in stages so the beginners will have a chance to see how everything evolves, instead of trying to decipher 20 objects with 50 pages of code. That its for now.
Thanks
Ray
'' PropOS_C3.spin CON _clkmode = xtal1 + pll16x _xinfreq = 6_250_000 CLOCKS_PER_MICROSECOND = 5*16 CLOCKS_PER_MILLISECOND = 5000*16 STATUS_LED_BUS_MUX = 15 PS2_DATA = 26 PS2_CLK = 27 VAR long x, y, k OBJ vga : "MikronautsVGA80.spin" '' Program by Wlliam Henning kbd : "keyboard_010.spin" PUB Main '' This is needed for the C3 init ''''' vga.start(%10110) '' 16 ' ' Delay_US(1*1_000_000) ' ' DIRA[STATUS_LED_BUS_MUX] := 1 ' OUTA[STATUS_LED_BUS_MUX] := 0 ' ''''''''''''''''''''''''''''''''''''''' vga.cls '' Clear the screen vga.str(string("Hello World")) kbd.start(PS2_DATA, PS2_CLK) kbd.clearkeys vga.out($0D) '' Newline vga.out(">") '' Special char repeat if (kbd.gotkey == TRUE) '' Checks to see if there is a keypress k:= kbd.key '' If there is, grab it vga.out(k) if (k == $0D) '' If enter key vga.out(">") '' goto newline PUB Delay_MS(time) waitcnt (cnt + time*CLOCKS_PER_MILLISECOND) PUB Delay_US(time) waitcnt (cnt + time*CLOCKS_PER_MICROSECOND)
Comments
The reason the C3 does not recognize your keyboard is that the converters are passive; the keyboard must support the PS2 protocol.
I am glad you like the driver. The "hit-and-miss" sync you notice is a known problem, that Kuroneko's patch has already fixed with the 64 and 50 column drivers (that use 80Mhz), and I have incorporated the fix into the 80 column version I have here - but I am having some issues. I should be able to work on it next week, right now I am working on getting a few more of my PCB's into production in time for UPEW :-)
To get 24 rows, select the 8x10 font by uncommenting the correct object line, and set scalex=2 in its CON section.
I will attach the lates, hacked to pieces, untested, with incorrect comments on top, not cleaned up, version of the driver. It might blow up your LCD and fry your Prop or it just might work
The driver only provides basic tvtext style output, it does not implement cursors or line/screen editing.
It is relatively easy to keep track of the cursor and provide such capabilities; and it should be easy to modify existing text editors written in Spin to use my driver to provide 80x24 output.
You can make a blinking underline cursor by getting the character at the cursor position, and alternating the character at that location with the original character and the underscore character.
Here are a few helper functions, including a new version of CLS, that I will later add to the next version of the drivers that will make writing editors and blinking cursors easier:
Ray
I will certainly due so after my current time crunch is over - I am afraid getting ready for UPEW product launches is higher priority
I only posted the above to point you in the approximately correct direction.
FYI, the sync issue is due to lack fo synchronization between hub access cycles and WAITVID behaviour; kuroneko figured out how to force synchronization, but I could not get it running in the 80 column driver quickly. Fixing this driver is on my "TODO" list, and I will try - but cannot promise - to have it running before UPEW.
The new methods I added above were untested, and have to be placed into the driver source, not the application source.
For now, I suggest you go back to 80MHz, and use the 64 column driver. Using the 8x10 font with scalex=2 it will give you a nice steady 64x24 screen, which will let you work on getting line/screen editing going until such time as the 80 column driver is fully qualified.
Thanks
Ray
Ray
Ray
Did you go back to 80Mhz for the 64 column driver?
I've never had it not sync with kuroneko's patch applied.
For inexpensive embedded x86, I've had great success using Intel Atom 330 mini-ITX boards - inexpensive, and small.
The get method does work. You have to assign its result to something or print it directly e.g. vga.out(vga.get(xx, yy)). Calling vga.out(xx) is equivalent to CLS (xx is a global and therefore initially 0). As for the blink() implementation, try this instead:
the 64 and 50 column drivers work perfectly for me, every time, with your fix!
The Intel mini-itx boards are a little under powered for my purposes, although the D510 is 1.8GHz, which is still not good enough. But, when you compare it to 100MHz, then the mini-itx stuff is a speed demon.
Ray
Now, does this mean that the 80 x 24 driver will work?
Thanks
Ray
As for the 80 column driver, don't use the one posted in this thread and AFAIK the one from its introductory thread is not fixed yet. Just wait for Bill.
I'm curious, when it goes wrong, does the LED stay on (it seems it's hard-wired to the buffer enable line)?
I tried out the 'blink' PUB, it works as expected, but I did notice the program is starting to show some lag time between the keypress, and the char showing up on the screen. I guess maybe I need to step up to a 100MHz crystal?
The other problem now seems to be the control of the keyboard, I am still getting garbage characters on the screen after a keypress like 'backspace'. I guess I have to change something in the VGA driver object, but it seems like $08 is addressed in the out(c) PUB. Every time that I try to use it from an out() perspective, it still throws up some garbage to the screen, and does not do the actual backspace. I guess all this should keep me busy.
Thanks
Ray
The zip file with the changes to VGA64 driver file is attached below. I guess i need some feedback as to what could be done better.
Thanks
Ray
Thanks
Ray
Bkeystring[0]:= "X"
vga.out(Bkeystring[1])
and all I get is a garbage character on the screen. So, I am not sure if this is a problem with the VGA64 driver, or my "ultra sensitive" C3 board. The worst part is I do not know how to get around this problem. It is probably some simple explanation that I am not seeing at the moment. Any help would be appreciated.
Thanks
Ray
The problem appears to be that you are not initializing Bkeystring anywhere in the code above, so it has random garbage in it.
It has nothing to do with your C3, or the driver, it is simply a programming error.
Bill
You are puttin "X" into array element Bkeystring[0], but trying to print array element Bkeystring [1] - whose value was never initialized (set), and as such will have garbage in it
Hmm...
If the stack frame is:
agument
return address
local valriables
then Bkeystring[1] would not clobber anything if it was the last local declared... i think.
Ray should declare a global line buffer, and implement a line editor based on that.
Thanks
Ray
Ray