Shop OBEX P1 Docs P2 Docs Learn Events
A nostalgic HDMI display driver [0.90 beta in post #34 - beta stage reached] - Page 2 — Parallax Forums

A nostalgic HDMI display driver [0.90 beta in post #34 - beta stage reached]

2»

Comments

  • pik33pik33 Posts: 2,350
    edited 2021-03-03 11:39

    0.07

    Now 6 modes available, 0,1,2 - PAL based, 624 lines, 256,257,258 - NTSC based, 524 lines

    Modes 0 and 256 signal 1140 pixels per line and works @ ~360 MHz
    Modes 1 and 257 signal 1026 pixels per line and works @ ~320 MHz
    Modes 2 and 258 signal 912 pixels per line and works @ ~280 MHz

    The driver sets the cpu clock itself while starts at the selected mode, so the main program may start at any PLL based frequency, it will be changed after calling a start(mode) method

    Mode #2 can be problematic, the 24" Philips monitor either didn't want to display this or displayed it with adding unwanted black borders at the top and bottom of the screen I had no problems to display #258.

    1 and 257 can be good modes, 320 MHz seems to be fully safe for a P2 (although I didn't get any unwanted side effects at 357 MHz)

    I also moved the palette to the lower half of the LUT, saving 4 clocks in the main loop. Still about 38 clocks left, which may be useful for adding more functions, eg 2 or 4x horizontal zoomed test or making the driver universal text/graphics.

  • pik33pik33 Posts: 2,350

    The driver reached version #0.10 and became a big mess. If someone wants to play with it, there is a github repository: https://github.com/pik33/ultibo-propeller. I have to clean the mess until go further, publish the code here and start to add sprites and graphics modes to it.

    I added this screen to the demo. A big nostalgia. I added a huge delay and watch this (not working, version 0,00) blue beauty. Some day this will be a working program...

  • pik33pik33 Posts: 2,350
    edited 2021-03-26 13:19

    Beta reached. The driver seems to be usable now. I will fork the project, as this driver is now usable and only debugging is needed, but I want to add more functions like graphics modes, double wide text etc. This will be started as another project.

    The driver uses 8x16 fonts which are selectable and definable. Simply add a font file to .dat section and use setfontnum to set offset to the font definitions in HUB. This will change as I have one free byte in every character in the buffer so it can be used to the font selection. Fonts are defined char by char, 16 bytes for char, starting from the top line/byte

    The driver has 8 modes, 4 PAL based and 4 NTSC based. They use ~360, ~320 and ~280 MHz clock, which is set by the driver after selecting the mode, which can be changed on the fly via setmode()

    The safest modes are 320 MHz based. 360 MHz based modes may set the clock too high (although I didn't notice any problems with these clocks). 280 Mhz based modes have very tight timings. I don't notice any problems with these modes, but the hsync is short there.

    Modes are numbered as tn_bb_cc_vv_hh where:

    t - text (0), graphics (1) (for future versions of the driver
    n - PAL based (0), NTSC based (1)
    bb - borders/clock frequency. 00-wide border(if available, PAL only), 360 MHz, 01: medium border PAL only), 320 MHz, 10 narrow border, 280 MHz, 11 no border, 360 MHz for PAL (which enables 1024x576 full resolution, 128x36 chars), 320 MHz for NTSC with 880x496 resolution, 110x31 chars
    cc,vv,hh: reserved

    This means available modes are 0, 64, 128, 192, (PAL based 624 lines 50 Hz) and 256, 320, 384, 448 (NTSC based 524 lines 60 Hz)

    The modes are redefinable, simply change values in timings[]

    All NTSC based modes have narrow (or no) border as there are no lines left for wider upper and lower border and I didn't want to make a mode with narrow up/down and wide left/right although this is of course possible via modifying mode lines.

    The demo was separated from the driver and placed in its own file.

    The driver compiles on both Propeller Tool and Flexprop. I noticed the Propeller Tool is much more restricted than Flexspin, which allows local variables and access the object variables by object.variable - the Propeller Tool didn't accept this and I had to add a metod to retrieve a variable value from the demo program

    Driver file attached.

    Available driver functions:

    • font functions

    pub setfontnum(afontnum) - set a font offset. To be removed in the next version
    pub defchar(fn,ch,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) - redefine a character

    • cursor functions

    pub cursoron() - switch the cursor on
    pub cursoroff() - switch the cursor off
    pub setcursorpos(x,y) - set the (x,y) position of cursor
    pub setcursorshape(shape) - define a cursor shape (0-full..15-line)

    • vblank functions

    pub waitvbl(amount) - wait for start of vblank. Amount=delay in framesi
    pub waitvblend(amount) - wait for end of vblank. Amount=delay in frames

    • color functions

    pub getvgacolor(color) - get a palette color number of VGA DOS color
    pub setscreencolors(ff,bb) - set font and back colors for all screen - from 256 color palett
    pub setbordercolors(r,g,b) - set border color for all screen - rgb
    pub setcharcolor(x,y,c) - set the color for the character at line y and position x
    pub setbackcolor(x,y,c) - set the background color at line y and position x
    pub setbordercolor(line,r,g,b) - set the border color, o is upper border, lines+1 is lower border
    pub setwritecolors(ff,bb) - set colors for putchar, write and writeln
    pub setcolor(c,r,g,b) -set color #c in palette to r,g,b

    • text functions

    pub cls(fc,bc) - clear the screen, set its foreground/background color
    pub putcharxy(x,y,achar) - cutput a char at x,y, don't change colors and cursor position
    pub putcharxyc(x,y,achar,f,b) - output a char at x,y and colors f,b, don't change a cursor position
    pub outtextxy(x,y,text) - output a string at position x,y without changing colors and cursor position
    pub outtextxyc(x,y,text,f,b) - output a string at position x,y and colors b,f without changing a cursor position
    pub putchar(achar) - output a char at the cursor position, move the cursor
    pub write(text) - output a string at the cursor position, move the cursor
    pub writeln(text) - output a string at the cursor position x,y, move the cursor to the next line
    pub scrollup() - scroll the screen one line up
    pub scrolldown() - scroll the screen one line down
    pub crlf() - set cursor at the first character in a new line, scroll if needed
    pub bksp() - backspace. Move the cursor back, clear a character

    • converting

    pub inttostr(i) - convert a integer to dec string, return a pointer
    pub inttohex(i,d) - convert unsigned integer to hex string with d digits, return a pointer

    • Starting and mode setting

    pub setmode(mode) - set the graphics mode
    pub start(mode,base) - start the driver with graphics mode 'mode' at pins 'base'

Sign In or Register to comment.