'' ************************************* '' * LA_VGA 1920x1080-1bpp - Cluso99 * '' ************************************* '' * modified/rewritten from... * '' * Propeller 2 VGA Driver 4bpp lut * '' * + graphics & text support * '' * Ozpropdev 18th October 2016 * '' ************************************* '' Modified for silicon - 15th November 2018 by ozpropdev '' RR20181115 1920x1080 @ 180MHz '' Notes: setxfrq instruction hardcoded!!!! '' mov temp3,#h/2 --> ##h/2 '' mov y1,#h/2 --> ##h/2 '' to make it fit hub, reduce h & v visible pixels/lines, increase bank pixels/lines '' mov x,#bottom_blanks --> ##bottom_blanks '' VGS_gfx11_FHDb.spin2 1440x540 working but gets hot and starts to fail '' c 1680x540 cannot update fast enough so scrolls left (pix=clock=180MHz) '' d add xtal setup code '' RR20181117 VGA_base_1920x1080_001a.spin '' 001b scrolls left (pix=clock=180MHz) '' c adj: no scrolling, stable, warm '' f try to get full width 1920x480 180MHz!!! try 150MHz (not on Acer) '' Acer X233H: 165MHz= doesnt work '' 168MHz=excellent, no shiver '' 180MHz=single pixel shiver '' Acer G246HL: similar results to above, but slightly off-screen to left '' Acer X233H#2: doesnt work (menu not wkg, VGA to laptop OK) '' g 148.5MHz works '' h 148.5MHz hsync works nicely '' 002a saved '' b adj field (screen display code) '' RR20181118 d divide screen into sections '' e tweek code, fix loc ptra, --> #@palette, fix cls with ret, graphics ret wcz '' e3 loc ptrx,#@xxxx --> loc ptrx,#\xxxx '' but this needs to be loc pa,#@gfx !!! '' f1 text display still wrong (remove) '' f2 remove text & font '' 003a use 512KB HUB for video buffer (1920x1080/2 @ 4bpp = 506.25KB) '' b m_rf 2bpp '' RR20181119 c use loc x,#\@xxx for hub addresses '' d try to fix jitter on cls '' e 4bpp (stuffed up somewhere!) '' RR20181122 f use 12MHz/4*99/2=148.5MHz (tested in 003a1 as suggested by Chip) '' 004a remove gfx cog '' d all dots are visible in 4bpp '' e concentric rectangles '' 005a renamed VGA_1920x1080x4bpp_005a.spin & VGA_1920x1080x2bpp_005a.spin '' e try to fix set_pixel - still wrong '' 006a draw clock lines '' h nice clocks '' k display clock digits '' RR20181124 007a "LA_VGA_007a.spin" add LA streamer '' RR20181125 bcd add LA streamer from PIN_test_006a '' RR20181201 008a add "Pin_test_008" & "VGA_1920x1080x1bpp_008b" '' b convert the data stream into visible clocking '' j converting to display 2pps (2 pixels/sample) wkg '' RR20181206 k displays 960 x 8 samples but first sample is being corrupted??? glitch b4 at end of incrementing outputs??? '' lm do_vga is not displaying the timing grid (off-screen monitor adj) '' RR20181208 n reverse hdg & adj for 960 clocks per line (was 480) '' q timing marks wkg '' RR20181208 009a wkg (sample00 corrupt) '' c add 8x8x96char font & text '' 010ab try sync w vga streamer to change colors on the fly - wkg '' f '' RR20181224 011 publish code (note bug in converting 1st logged samples) tweek Vporch '' RR20190128 012a try fix 1st logged samples '' RR20190130 00a LA_VGA_012_00a (different display method for samples), tweek reformat (from LA_012a), sample P56-63 '' pps=1 '' de-j change mark_hdr, 64K samples, 11 lines, 20,000+ samples '' RR20190130 01 wkg CON { 'P2-EVAL _XTALFREQ = 20_000_000 ' crystal frequency _XDIV = 4 '\ '\ crystal divider to give 5.0MHz _XMUL = 10 '| 25 MHz '| crystal / div * mul to give 50 MHz _XDIVP = 2 '/ '/ crystal / div * mul /divp to give 25 MHz _XOSC = %10 '15pF ' %00=OFF, %01=OSC, %10=15pF, %11=30pF } 'P2D2 _XTALFREQ = 12_000_000 ' crystal frequency ''_XDIV = 12 * 2 '\ ' crystal divider to give 0.5MHz ''_XMUL = 297 '| 148.5MHz ' crystal / div * mul ''_XDIVP = 1 '/ ' crystal / div * mul /divp to give _CLKFREQ (1,2,4..30) _XDIV = 4 '\ '\ crystal divider to give 3.0MHz _XMUL = 99 '| 148.5MHz '| crystal / div * mul to give 297MHz _XDIVP = 2 '/ '/ crystal / div * mul /divp to give 148.5MHz _XOSC = %01 'OSC ' %00=OFF, %01=OSC, %10=15pF, %11=30pF _XSEL = %11 'XI+PLL ' %00=rcfast(20+MHz), %01=rcslow(~20KHz), %10=XI(5ms), %11=XI+PLL(10ms) _XPPPP = ((_XDIVP>>1) + 15) & $F ' 1->15, 2->0, 4->1, 6->2...30->14 _CLOCKFREQ = _XTALFREQ / _XDIV * _XMUL / _XDIVP ' internal clock frequency _SETFREQ = 1<<24 + (_XDIV-1)<<18 + (_XMUL-1)<<8 + _XPPPP<<4 + _XOSC<<2 ' %0000_000e_dddddd_mmmmmmmmmm_pppp_cc_00 ' setup oscillator _ENAFREQ = _SETFREQ + _XSEL ' %0000_000e_dddddd_mmmmmmmmmm_pppp_cc_ss ' enable oscillator '' 1920x1080 60Hz mode @ 148.5MHz from https://timetoexplore.net/blog/video-timings-vga-720p-1080p '' ---------------------------------------------------------------------------------- PIXEL_CLK = _CLOCKFREQ ' H_DISP = 1920 H_FPORCH = 88 H_SYNC = 44 H_BPORCH = 148 V_DISP = 1080 V_FPORCH = 4 +32 'tweek V_SYNC = 5 V_BPORCH = 36 -32 'tweek '' ---------------------------------------------------------------------------------- {{ '' 1920x1080 60Hz mode @ 180MHz from http://www.epanorama.net/faq/vga2rgb/calc.html '' ---------------------------------------------------------------------------------- PIXEL_CLK = _CLOCKFREQ ' H_DISP = 1920 '-480 '- 240 '480 '960 H_FPORCH = 32 '+120 ' H_SYNC = 696 ' H_BPORCH = 32 '+360 '+ 240 '480 '960 V_DISP = 1080 -600 '- 540 V_FPORCH = 22 +300 ' V_SYNC = 11 ' V_BPORCH = 22 +300 '+ 540 '' ---------------------------------------------------------------------------------- }} ' P0=HS ' P1=B ' P2=G ' P3=R ' P4=VS vsync = 4 ' vsync pin intensity = 80 '0..128 w = H_DISP h = V_DISP ' 1920x1080 1bpp = 259.2KB bpp = 1 ' 1 bit per pixel pps = 1 ' 1 pixel(s) per sample ' ppb = 8/bpp ' pixels per byte ' shrppb = 0 ' 0=1bpp, 1=2bpp, 2=4bpp fpix = float(PIXEL_CLK) top_blanks = V_FPORCH sync_blanks = V_SYNC bottom_blanks = V_BPORCH before_sync = H_FPORCH sync = H_SYNC before_visible = H_BPORCH '' ---------------------------------------------------------------------------------- ' fset = ((fpix / float(_CLOCKFREQ) * 2.0) * float($4000_0000)) fset = $8000_0000 'set to full clock freq <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< lut_start = 0 ' samples uses video_buffer +offset '' video_length = w*h*bpp/32 (in longs) '' sample_length = 30*32 '= 960 samples of 8 channels = 1 line (use multiples of 32) '' sample_length = 60*32 '=1920 samples of 8 channels = 1 line (use multiples of 32) sample_length = 1920*32 '=1920 samples * 32 lines (of 8 channels) CON '------------------------------------------------------------------------------------------------ _baud = 115_200 _bitper = (_clockfreq / _baud) << 16 + 7 ' 115200 baud, 8 bits _txmode = %0000_0000_000_0000000000000_01_11110_0 'async tx mode, output enabled for smart output _rxmode = %0000_0000_000_0000000000000_00_11111_0 'async rx mode, input enabled for smart input '------------------------------------------------------------------------------------------------ rx_pin = 63 ' pin serial receiver tx_pin = 62 ' pin serial transmitter spi_cs = 61 ' pin SPI memory select (also sd_ck) spi_ck = 60 ' pin SPI memory clock (also sd_cs) spi_di = 59 ' pin SPI memory data in (also sd_di) spi_do = 58 ' pin SPI memory data out (also sd_do) '------------------------------------------------------------------------------------------------ '' +--------------------------------------------------------------------------+ '' | Cluso's LMM_SerialDebugger for P2 (c)2013-2018 "Cluso99" (Ray Rodrick)| '' +--------------------------------------------------------------------------+ '' xxxxxx : xx xx xx xx ... DOWNLOAD: to cog/lut/hub {addr1} following {byte(s)} '' xxxxxx - [xxxxxx] [L] LIST: from cog/lut/hub {addr1} to < {addr2} L=longs '' xxxxxx G GOTO: to cog/lut/hub {addr1} '' Q QUIT: Quit Rom Monitor and return to the User Program '' Lffffffff[.]xxx LOAD: Load file from SD '' Rffffffff[.]xxx RUN: Load & Run file from SD '' TAQOZ: goto TAQOZ '' +--------------------------------------------------------------------------+ '' LMM DEBUGGER - CALL Modes...(not all modes supported) '' +--------------------------------------------------------------------------+ _MODE = $F << 5 ' mode bits defining the call b8..b5 (b4..b0 are modifier options) _SHIFT = 5 ' shr # to extract mode bits _HEX_ = 2 << 5 ' hex... _REV_ = 1 << 4 ' - reverse byte order _SP = 1 << 3 ' - space between hex output pairs '_DIGITS = 7..0 where 8->0 ' - no. of digits to display _LIST = 3 << 5 ' LIST memory line (1/4 longs) from cog/hub _ADDR2 = 1 << 4 ' 1= use lmm_p2 as to-address _LONG_ = 1 << 1 ' 1=display longs xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx _TXSTRING = 4 << 5 ' tx string (nul terminated) from hub _RXSTRING = 5 << 5 ' rx string _ECHO_ = 1 << 4 ' - echo char _PROMPT = 1 << 3 ' - prompt (lmm_x) _ADDR = 1 << 2 ' - addr of string buffer supplied _NOLF = 1 << 1 ' - strip _MONITOR = 7 << 5 ' goto rom monitor '' +--------------------------------------------------------------------------+ '' P2 ROM SERIAL ROUTINES (HUBEXEC) '' +--------------------------------------------------------------------------+ _SerialInit = $fcab8 ' Serial Initialise (lmm_x & lmm_bufad must be set first) _HubTxCR = $fcae4 ' Sends (overwrites lmm_x) _HubTxRev = $fcaec ' Sends lmm_x with bytes reversed _HubTx = $fcaf0 ' Sends lmm_x (can be up to 4 bytes) _HubHexRev = $fcb24 ' Sends lmm_x with bytes reversed as Hex char(s) as defined in lmm_f _HubHex8 = $fcb28 ' Sends lmm_x as Hex char(s) after setting lmm_f as 8 hex chars _HubHex = $fcb2c ' Sends lmm_x as Hex char(s) as defined in lmm_f _HubTxStrVer = $fcb9c ' Sends $0 terminated string at lmm_p address after setting lmm_p=##_str_vers _HubTxString = $fcba4 ' Sends $0 terminated string at lmm_p address _HubListA2H = $fcbc4 ' List/Dump line(s) from lmm_p address to lmm_p2 address after setting lmm_f=#_LIST+_ADDR2 _HubList = $fcbc8 ' List/Dump line(s) from lmm_p address to lmm_p2 address according to lmm_f _HubRx = $fcb10 ' Recv char into lmm_x _HubRxStrMon = $fccc4 ' Recv string into lmm_bufad address after setting prompt=lmm_x=#"*" & params=lmm_f=#_RXSTRING+_ECHO_+_PROMPT _HubRxString = $fcccc ' Recv string into lmm_p/lmm_bufad address according to params in lmm_f _HubMonitor = $fcd78 ' Calls the Monitor; uses lmm_bufad as the input buffer address _RdLongCogHub = $fcf34 ' read cog/lut/hub long from lmm_p address into lmm_x, then lmm_p++ _str_vers = $fd014 ' locn of hub string, $0 terminated '' +--------------------------------------------------------------------------+ '' HUB ADDRESSES '' +--------------------------------------------------------------------------+ _HUBROM = $FC000 ' ROM $FC000 _HUBBUF = $FC000 ' overwrite Booter _HUBBUFSIZE = 80 ' RxString default size for _HUBBUF '' +--------------------------------------------------------------------------+ ''============[ COG VARIABLES $1E0-$1EF - MONITOR]============================= ''-------[ LMM parameters, etc ]----------------------------------------------- lmm_x = $1e0 ' parameter passed to/from LMM routine (typically a value) lmm_f = $1e1 ' parameter passed to LMM routine (function options; returns unchanged) lmm_p = $1e2 ' parameter passed to/from LMM routine (typically a hub/cog ptr/addr) lmm_p2 = $1e3 ' parameter passed to/from LMM routine (typically a 2nd hub/cog address) lmm_c = $1e4 ' parameter passed to/from LMM routine (typically a count) ''-------[ LMM additional workareas ]------------------------------------------ lmm_w = $1e5 ' workarea (never saved - short term use between calls, except _HubTx) lmm_tx = $1e6 ' _HubTx lmm_hx = $1e7 ' _HubHex/_HubString lmm_hx2 = $1e8 ' _HubHex lmm_hc = $1e9 ' " lmm_lx = $1ea ' _HubList lmm_lf = $1eb ' " lmm_lp = $1ec ' " lmm_lp2 = $1ed ' " lmm_lc = $1ee ' " lmm_bufad = $1ef ' _HubRxString '' +--------------------------------------------------------------------------+ '' ASCII equates '' +--------------------------------------------------------------------------+ _CLS_ = $0C _BS_ = $08 _LF_ = $0A _CR_ = $0D _TAQOZ_ = $1B ' goto TAQOZ '' +--------------------------------------------------------------------------+ DAT org 0 '+-------[ Set Xtal ]----------------------------------------------------------+ entry hubset #0 ' set 20MHz+ mode hubset ##_SETFREQ ' setup oscillator waitx ##20_000_000/100 ' ~10ms hubset ##_ENAFREQ ' enable oscillator '+-----------------------------------------------------------------------------+ 'Clear screen... mov mxx,#0 ' 1bpp (red) loc ptra,#\@video_buffer rep @.cls,##w*h*bpp/32 ' = 259.2KB wrlong mxx,ptra++ .cls '+-----------------------------------------------------------------------------+ ' clear capture buffer mov pa,#0 loc ptra,#\@samples rep @.clc,##sample_length/4 ' samples in longs wrlong pa,ptra++ .clc '+-----------------------------------------------------------------------------+ ' preset output pins ' mov outa,#0 ' P0-7=0 ' mov dira,#$FF ' P0-8=outputs mov outb,#0 ' P56-63=0 mov dirb,##$3F00_0000 ' P56-61=outputs <<<<<<< '+-----------------------------------------------------------------------------+ '' Sample xxxx using streamer to hub on every clock cycle... '' setxfrq ##$8000_0000 'sysclk sample rate '' wrfast #0,##@samples ' %1111_xxxx_xppp_xxxx << 16 ' 000 P31-0 ' 001 P39-8 ' 010 P47-16 ' 011 P55-24 ' 100 P63-32 ' 101 P7-0+P63-40 ' 110 P15-0+P63-48 ' 111 P23-0+P63-56 ' xinit ##%1111_0000_0000_0000 << 16 | sample_length,#0 'P00-31 (32 bits) ' xinit ##%1111_0000_0100_0000 << 16 | sample_length,#0 'P32-63 (32 bits) ' xinit ##%1110_0000_0pp0_0000 << 16 | sample_length,#0 'P00-15 (16 bits) ' xinit ##%1101_0000_0ppp_0000 << 16 | sample_length,#%00011 'P00-07 (8 bits) ' xinit ##%1101_0000_0ppp_p000 << 16 | sample_length,#%00r10 'P00-03 (4 bits) ' xinit ##%1101_0000_0ppp_pp00 << 16 | sample_length,#%00r01 'P00-01 (2 bits) ' xinit ##%1101_0000_0ppp_ppp0 << 16 | sample_length,#%00r00 'P00 (1 bit) '' xinit ##%1101_0000_0000_0000 << 16 | sample_length,#%00011 'P00-07 (8 bits) '+-----------------------------------------------------------------------------+ '' Sample P0-P07 using streamer to hub on every clock cycle... setxfrq ##$8000_0000 'sysclk sample rate wrfast #0,##@samples '' xinit ##%1101_0000_0000_0000 << 16 | sample_length,#%00011 'P00-07 (8 bits) xinit ##%1101_0000_0111_0000 << 16 | sample_length,#%00011 'P56-63 (8 bits) ' now do a little pin pulsing test '' waitx #(32-2-7) ' align to start from 2nd 32bits waitx ##(20-15)'+6*1920 ' align to start from 20 bits (P56 goes high) ' rep @.rep,#sample_length/2 ' because an instruction takes 2 clocks '' rep @.rep,#sample_length/2/2 ' because an instruction takes 2 clocks & half fill '' rep @.rep,#8*32/2 ' count for 8* 32bit samples (loop takes 2 clocks) '' rep @.rep,##sample_length/2-960 ' count for 'n' samples (loop takes 2 clocks) rep @.rep,##20000/2 ' count for 'n' samples (loop takes 2 clocks) add outb,add1 .rep mov outb,#0 waitxfi ' pause til samples done ' stop streamer ????? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< '+-----------------------------------------------------------------------------+ ' reformat samples... call #reformat ' reformat the samples '+-----------------------------------------------------------------------------+ ' Convert samples to display lines (lsb first) call #convert '+-----------------------------------------------------------------------------+ jmp #do_vga '+-----------------------------------------------------------------------------+ '+=============================================================================+ '+ Reformat byte samples into bit samples per channel (lsb first) + '+=============================================================================+ reformat loc ptra,#\@samples ' start of sample stream loc ptrb,#\@chan_00 ' start of channel 00 conversion mov ctr,len ' no. of 32bit samples ' reformat a block of 32samples of 8channels... .next32 mov ctr2,#32 ' loop for 32 samples of 8 channels .loop32 rdbyte i0,ptra++ ' get 32 samples of 8 channels rcr i0,#1 wc ' get sample-0 ch-0 rcr o0,#1 ' save sample-0 ch-0 rcr i0,#1 wc ' get sample-0 ch-1 rcr o1,#1 ' save sample-0 ch-1 rcr i0,#1 wc ' get sample-0 ch-2 rcr o2,#1 ' save sample-0 ch-2 rcr i0,#1 wc ' get sample-0 ch-3 rcr o3,#1 ' save sample-0 ch-3 rcr i0,#1 wc ' get sample-0 ch-4 rcr o4,#1 ' save sample-0 ch-4 rcr i0,#1 wc ' get sample-0 ch-5 rcr o5,#1 ' save sample-0 ch-5 rcr i0,#1 wc ' get sample-0 ch-6 rcr o6,#1 ' save sample-0 ch-6 rcr i0,#1 wc ' get sample-0 ch-7 rcr o7,#1 ' save sample-0 ch-7 djnz ctr2,#.loop32 ' write out the 8 channels of 32-bits push ptrb ' save channel 00 pointer wrlong o0,ptrb ' save to chan 00 add ptrb,len4 ' set channel 01 pointer wrlong o1,ptrb ' save to chan 01 add ptrb,len4 ' set channel 02 pointer wrlong o2,ptrb ' save to chan 02 add ptrb,len4 ' wrlong o3,ptrb ' add ptrb,len4 ' wrlong o4,ptrb ' add ptrb,len4 ' wrlong o5,ptrb ' add ptrb,len4 ' wrlong o6,ptrb ' add ptrb,len4 ' wrlong o7,ptrb ' pop ptrb ' reload channel 00 pointer add ptrb,#4 ' pointer++ djnz ctr,#.next32 ' again for next 32 samples ret wcz '+=============================================================================+ '+=============================================================================+ '+ Convert samples to display lines (lsb first) + '+=============================================================================+ convert '+-----------------------------------------------------------------------------+ ' do the heading time markers... loc ptrb,#\@video_buffer+000*w*bpp/8 ' line # of video stream mov ctr_1,#11 ' 11 display lines per channel .nexthdr call #mark_hdr ' display heading time markers djnz ctr_1,#.nexthdr '+-----------------------------------------------------------------------------+ ' do the channels... loc ptra,#\@chan_00 ' start of channel conversion loc ptrb,#\@video_buffer+012*w*bpp/8 ' line # of video stream mov ctr_1,#11 ' 10 display lines per channel .next00 call #convert_line ' display one channel line djnz ctr_1,#.next00 loc ptra,#\@chan_01 ' start of channel conversion loc ptrb,#\@video_buffer+022*w*bpp/8 ' line # of video stream mov ctr_1,#11 ' 10 display lines per channel .next01 call #convert_line ' display one channel line djnz ctr_1,#.next01 loc ptra,#\@chan_02 ' start of channel conversion loc ptrb,#\@video_buffer+032*w*bpp/8 ' line # of video stream mov ctr_1,#11 ' 10 display lines per channel .next02 call #convert_line ' display one channel line djnz ctr_1,#.next02 loc ptra,#\@chan_03 ' start of channel conversion loc ptrb,#\@video_buffer+042*w*bpp/8 ' line # of video stream mov ctr_1,#11 ' 10 display lines per channel .next03 call #convert_line ' display one channel line djnz ctr_1,#.next03 loc ptra,#\@chan_04 ' start of channel conversion loc ptrb,#\@video_buffer+052*w*bpp/8 ' line # of video stream mov ctr_1,#11 ' 10 display lines per channel .next04 call #convert_line ' display one channel line djnz ctr_1,#.next04 loc ptra,#\@chan_05 ' start of channel conversion loc ptrb,#\@video_buffer+062*w*bpp/8 ' line # of video stream mov ctr_1,#11 ' 10 display lines per channel .next05 call #convert_line ' display one channel line djnz ctr_1,#.next05 loc ptra,#\@chan_06 ' start of channel conversion loc ptrb,#\@video_buffer+072*w*bpp/8 ' line # of video stream mov ctr_1,#11 ' 10 display lines per channel .next06 call #convert_line ' display one channel line djnz ctr_1,#.next06 loc ptra,#\@chan_07 ' start of channel conversion loc ptrb,#\@video_buffer+082*w*bpp/8 ' line # of video stream mov ctr_1,#11 ' 10 display lines per channel .next07 call #convert_line ' display one channel line djnz ctr_1,#.next07 ret wcz ctr_1 long 0 '+=============================================================================+ '+=============================================================================+ '+ Convert a line of samples for display (lsb first) + '+=============================================================================+ convert_line mov ctr1,#w/32/pps ' do 1 line of samples pps=1 mov saveptrb,ptrb ' save ptrb on entry ' copy channel data/pixels to line(s) ' b0=1st bit to display, 1=white .next rdlong i0,ptra++ ' get 32 bit samples push ptrb wrlong i0,ptrb add ptrb,#w*bpp/8 ' next pixel line wrlong i0,ptrb add ptrb,#w*bpp/8 ' next pixel line wrlong i0,ptrb add ptrb,#w*bpp/8 ' next pixel line wrlong i0,ptrb add ptrb,#w*bpp/8 ' next pixel line wrlong i0,ptrb add ptrb,#w*bpp/8 ' next pixel line wrlong f8,ptrb ' all 1's pop ptrb ' reload top pixel line pointer add ptrb,#4 ' pointer++ djnz ctr1,#.next mov ptrb,saveptrb ' restore ptrb from entry add ptrb,##96*w*bpp/8 ' next line # for this channel ret wcz saveptrb long 0 '+=============================================================================+ '+=============================================================================+ '+ mark every 10 clocks (1 clock/nibble) with timing header + '+=============================================================================+ mark_hdr mov saveptrb,ptrb ' save ptrb on entry loc ptra,#\@font_nn ' point to hub font (row 0) mov ctr2,#8 ' font lines for timing .nextrow push ptra ' save font row posn mov ctr,#48 ' 480*2 clocks (48*2 marks) mov ctr1,#1 ' preset to add digit 1st time .loop10 mov mxx,m10a ' preset to marker only djnz ctr1,#.skip mov ctr1,#5 rdbyte mxx,ptra ' read font row add ptra,#8 ' font-digit++ shl mxx,#1 ' shift to allow for timing mark or mxx,m10a ' add timing mark .skip wrbyte mxx,ptrb++ ' write marker (+ digit) wrbyte m00,ptrb++ cmp ctr1,#3 wz ' mark50 ? if_z testb ctr2,#2 wz ' rows 6-3 only (z=1) if_nz wrbyte m10b,ptrb++ if_z wrbyte m50,ptrb++ wrbyte m00,ptrb++ wrbyte m00,ptrb++ djnz ctr,#.loop10 pop ptra ' restore font row posn add ptra,#1 ' fontrow++ djnz ctr2,#.nextrow ' call #mark_line ' call #mark_line mov ptrb,saveptrb ' restore ptrb from entry add ptrb,##96*w*bpp/8 ' next line # for this channel ret wcz '+-----------------------------------------------------------------------------+ {{ '+-----------------------------------------------------------------------------+ 'mark every 10 clocks (1 clock/nibble) mark_line rep @.rep,#49-1 ' 480*2 clocks (48*2 marks) wrbyte m10a,ptrb++ wrbyte m00,ptrb++ wrbyte m10b,ptrb++ wrbyte m00,ptrb++ wrbyte m00,ptrb++ .rep ret wcz '+-----------------------------------------------------------------------------+ }} '+-----------------------------------------------------------------------------+ len long sample_length/32 ' no. of samples(32bits) per channel len4 long sample_length/8 ' no. of samples(bytes) per channel add1 long 1<<24 f8 long $FFFF_FFFF ' all F's i0 long 0 ' input bits sample o0 long 0 ' output bits sample ch 00 o1 long 0 o2 long 0 o3 long 0 o4 long 0 o5 long 0 o6 long 0 o7 long 0 top long 0 mid long 0 bot long 0 tmp long 0 tmp2 long 0 ctr long 0 ctr1 long 0 ctr2 long 0 ctr3 long 0 mxx long 0 temp long 0 m00 long %0000_0000 ' 0 marker m10a long %0000_0001 ' 10 marker (at nibble 0) m10b long %0001_0000 ' 10 marker (at nibble 5) m50 long %0011_1000 ' 50 marker '+=============================================================================+ '+=============================================================================+ '+ Setup VGA display (lsb first) + '+=============================================================================+ ''+============================================================================+ ''+ DAC Streamer: VGA out with streamer (from hub on every clock cycle...) + ''+============================================================================+ do_vga '' setxfrq ##$8000_0000 ' sysclk sample rate '' rdfast ##long_length/16,##@buffer ' rdfast to wrap on xxKB bitmap (longs/16) '+-------[ Setup Streamer ]----------------------------------------------------+ vid loc ptra,#\@palette_pairs ' set 1st color palette setq2 #2-1 ' (only need 2) rdlong lut_start,ptra ' set next palette color mov ctr1,#135 ' & set row ctr setxfrq ##fset 'set transfer frequency to xxxMHz dirh #vsync 'make vsync pin output 'the next 4 lines may be commented out to bypass level scaling setcy ##intensity << 24 '\ r set colorspace for rgb setci ##intensity << 16 '| g setcq ##intensity << 08 '| b setcmod #%01_0_000_0 '/ enable colorspace conversion wrpin dacmode_s,#0 '\ enable dac modes in pins 0..3 wrpin dacmode_c,#1 '| wrpin dacmode_c,#2 '| wrpin dacmode_c,#3 '| setnib dira,#$f,#0 '/ & enable output rdfast ##w*h*bpp/32/16,##@video_buffer ' wraps ~253KB bitmap (longs/16) '+-------[ Display Screen ]----------------------------------------------------+ ' Field loop field outnot #vsync '\ vsync on mov x,#sync_blanks '| call #blank '| outnot #vsync '/ vsync off '----------------------------------------------- mov x,#top_blanks call #blank '----------------------------------------------- ' display visible screen 1bpp mov x,##h 'set visible lines loc ptra,#\@palette_pairs ' set 1st color palette mov ctr1,#1 ' & force new load below .visible xcont m_bs,#0 'horizontal sync (before sync) xcont m_sn,#1 'horizontal sync (sync) djnz ctr1,#.skip ' set new palette? setq2 #2-1 ' (only need 2) rdlong lut_start,ptra ' set next palette color add ptra,#2*4 ' next color pair '' mov ctr1,#135 ' & set row ctr mov ctr1,#96 ' & set row ctr .skip xcont m_bv,#0 'horizontal sync (before visible) xcont m_rf,#0 'visible line djnz x,#.visible 'another line? '----------------------------------------------- mov x,##bottom_blanks call #blank '----------------------------------------------- jmp #field 'loop '----------------------------------------------- ' display blank lines blank xcont m_bs,#0 'horizontal sync (before sync) xcont m_sn,#1 'horizontal sync (sync) xcont m_bv,#0 'horizontal sync (before visible) xcont m_vi,#0 'blank visible _RET_ djnz x,#blank '+-----------------------------------------------------------------------------+ ' Initialized data dacmode_s long %0000_0000_000_1011000000000_01_00000_0 'hsync is 123-ohm, 3.3V dacmode_c long %0000_0000_000_1011100000000_01_00000_0 'R/G/B are 75-ohm, 2.0V m_bs long $CF000000+before_sync m_sn long $CF000000+sync m_bv long $CF000000+before_visible m_vi long $CF000000+w 'visible 'm_rf long $6F000000+w '4bit RFLONG LUT 'm_rf long $5F000000+w '2bit RFLONG LUT m_rf long $4F000000+w '1bit RFLONG LUT ' xinit ##%0100_dddd_eppp_bbbb << 16 | sample_length,#%rxx '1-bit RFLONG LUT, r=reorder $xxxxxxxx ' xinit ##%0101_dddd_eppp_bbbb << 16 | sample_length,#%rxx '2-bit RFLONG LUT, r=reorder $xxxxxxxx ' xinit ##%0110_dddd_eppp_bbbb << 16 | sample_length,#%rxx '4-bit RFLONG LUT, r=reorder $xxxxxxxx x long 1 y long 1 fit $1E0 ' check fits in cog with lmm_x fit $1F0 ' check fits in cog '+-----------------------------------------------------------------------------+ DAT orgh $600 '$400 '+=============================================================================+ '+ mini font 8x8 reversed + '+=============================================================================+ '' Derived from: AiChip_SmallFont_Atari_lsb_001.spin '' RR20100214 modified for 1-pinTV '' RR20181208 modified for P2 - chars for timing header '+=============================================================================+ font_nn byte %00000000 ' ........ $30 0 byte %00111100 ' ..####.. byte %01100110 ' .##..##. byte %01110110 ' .##.###. byte %01101110 ' .###.##. $30 0 byte %01100110 ' .##..##. byte %00111100 ' ..####.. byte %00000000 ' ........ byte %00000000 ' ........ $32 2 byte %00111100 ' ..####.. byte %01100110 ' .##..##. byte %00110000 ' ....##.. byte %00011000 ' ...##... $32 2 byte %00001100 ' ..##.... byte %01111110 ' .######. byte %00000000 ' ........ byte %00000000 ' ........ $34 4 byte %00110000 ' ....##.. byte %00111000 ' ...###.. byte %00111100 ' ..####.. byte %00110110 ' .##.##.. $34 4 byte %01111110 ' .######. byte %00110000 ' ....##.. byte %00000000 ' ........ byte %00000000 ' ........ $36 6 byte %00111100 ' ..####.. byte %00000110 ' .##..... byte %00111110 ' .#####.. byte %01100110 ' .##..##. $36 6 byte %01100110 ' .##..##. byte %00111100 ' ..####.. byte %00000000 ' ........ byte %00000000 ' ........ $38 8 byte %00111100 ' ..####.. byte %01100110 ' .##..##. byte %00111100 ' ..####.. byte %01100110 ' .##..##. $38 8 byte %01100110 ' .##..##. byte %00111100 ' ..####.. byte %00000000 ' ........ byte %00000000 ' ........ $30 0 byte %00111100 ' ..####.. byte %01100110 ' .##..##. byte %01110110 ' .##.###. byte %01101110 ' .###.##. $30 0 byte %01100110 ' .##..##. byte %00111100 ' ..####.. byte %00000000 ' ........ byte %00000000 ' ........ $32 2 byte %00111100 ' ..####.. byte %01100110 ' .##..##. byte %00110000 ' ....##.. byte %00011000 ' ...##... $32 2 byte %00001100 ' ..##.... byte %01111110 ' .######. byte %00000000 ' ........ byte %00000000 ' ........ $34 4 byte %00110000 ' ....##.. byte %00111000 ' ...###.. byte %00111100 ' ..####.. byte %00110110 ' .##.##.. $34 4 byte %01111110 ' .######. byte %00110000 ' ....##.. byte %00000000 ' ........ byte %00000000 ' ........ $36 6 byte %00111100 ' ..####.. byte %00000110 ' .##..... byte %00111110 ' .#####.. byte %01100110 ' .##..##. $36 6 byte %01100110 ' .##..##. byte %00111100 ' ..####.. byte %00000000 ' ........ byte %00000000 ' ........ $38 8 byte %00111100 ' ..####.. byte %01100110 ' .##..##. byte %00111100 ' ..####.. byte %01100110 ' .##..##. $38 8 byte %01100110 ' .##..##. byte %00111100 ' ..####.. byte %00000000 ' ........ alignl '+=============================================================================+ '+ 24 bit color format = rr_gg_bb_00 + '+=============================================================================+ palette_pairs long $ffffff00 'white long $0000aa00 'blue long $00000000 'black \ bg long $ffffff00 'white / fg long $00aa0000 'green long $aa000000 'red long $0000aa00 'blue long $aa00aa00 'magenta long $aa550000 'brown long $00aaaa00 'cyan long $aaaaaa00 'gray long $55ff5500 'bright green long $ff555500 'bright red long $ffff5500 'yellow long $55ffff00 'bright cyan long $ff55ff00 'bright magenta long $00aa0000 'green long $00000000 'black long $aa000000 'red long $ffff5500 'yellow long $55555500 'dark gray long $5555ff00 'bright blue '+=============================================================================+ '+ samples / video_buffer + '+=============================================================================+ ' currently separate but can be shared, and palette can be overwritten samples byte 0[sample_length] ' capture buffer chan_00 long 0[sample_length/32] ' converted channel bitstreams... chan_01 long 0[sample_length/32] ' chan_02 long 0[sample_length/32] ' chan_03 long 0[sample_length/32] ' chan_04 long 0[sample_length/32] ' chan_05 long 0[sample_length/32] ' chan_06 long 0[sample_length/32] ' chan_07 long 0[sample_length/32] ' video_buffer long 0[1920*1080*1/32] ' 1920x1080 1bpp = 259.2KB '+=============================================================================+ '