'800x480 HDMI example that shows bird photo in WVGA resolution 'RJA figured out that HDMI pulls from LUT starting at index #32 (instead of #0 like VGA). 'Rev.2b: Draws a rectangle on top '******************************************** '* WVGA 800 x 480 x 8bpp LUT - HDMI * '******************************************** CON hdmi_base = 32'48'16 'must be a multiple of 8 _clkfreq=250_000_000 'needs a faster clock to avoid flicker on Parallax LCD CON width=800 height=480 var long PixelBufferAddress PUB Main()|p p:=@BMP1 p+=$436 'Point to start of pixels PixelBufferAddress:=p 'save this for later coginit(16,@VideoOrg,p) 'ptra will become value of p in assembly DrawRectangle(100,100,200,150,0) repeat PUB DrawRectangle(px,py,w,h,c)|i,j 'draw rectangle at point (px,py) with width w and height h in color index #c repeat i from px to px+w-1 repeat j from py to py+h-1 SetPixel(i,j,c) PUB SetPixel(px,py,c) 'set pixel at (px,py) to color index, c byte[PixelBufferAddress][py*width+px]:=c DAT orgh org VideoOrg ' ' Setup 'Load LUT mov ptrb,ptra sub ptrb,##$400 'point to start of palette instead of start of pixels mov x,#32'0 Note: HDMI starts at index #32 instead of #0 !!!!!!!!!!!!!!!!!!!!!!!! rdfast #0,ptrb 'load .bmp palette into lut rep @.end,#$100 rflong y shl y,#8 wrlut y,x add x,#1 .end setxfrq ##$0CCCCCCC+1 'set streamer freq to 1/10th clk setcmod #$100 'enable HDMI mode drvl #7<<6 + hdmi_base 'enable HDMI pins wrpin ##%100100_00_00000_0,#7<<6 + hdmi_base 'set 1mA drive on HDMI pins ' ' Field loop ' field 'RJA adding rdfast here rdfast ##800*480,ptra' 'set rdfast to wrap on bitmap mov hsync0,sync_000 'vsync off mov hsync1,sync_001 callpa #33,#blank 'top blanks mov x,##480 'set visible lines line call #hsync 'do horizontal sync xcont m_rf,#1 'do visible line djnz x,#line 'another line? callpa #10,#blank 'bottom blanks mov hsync0,sync_222 'vsync on mov hsync1,sync_223 callpa #2,#blank 'vertical sync blanks jmp #field 'loop ' ' ' Subroutines ' blank call #hsync 'blank lines xcont m_vi,hsync0 _ret_ djnz pa,#blank hsync xcont m_bs,hsync0 'horizontal sync xzero m_sn,hsync1 _ret_ xcont m_bv,hsync0 ' ' ' Initialized data ' sync_000 long %1101010100_1101010100_1101010100_10 ' sync_001 long %1101010100_1101010100_0010101011_10 ' hsync sync_222 long %0101010100_0101010100_0101010100_10 'vsync sync_223 long %0101010100_0101010100_1010101011_10 'vsync + hsync m_bs long $70810000 + hdmi_base<<17 + 16 'before sync m_sn long $70810000 + hdmi_base<<17 + 96 'sync m_bv long $70810000 + hdmi_base<<17 + 48 'before visible m_vi long $70810000 + hdmi_base<<17 + 800 'visible m_rf long $70880000 + hdmi_base<<17 + 800 'visible rfbyte 8bpp LUT->DAC ' ' x long 0 y long 0 ' Uninitialized data ' hsync0 res 1 hsync1 res 1 ' ' ' Bitmap ' fit $1f8 DAT orgh BMP1 'Embeddeg WVGA bitmap image file "bitmapW.bmp"