CON 'Simple thing to test spin2cpp with Catalina with CON 'VGA driver settings intensity = 80 '0..128 fpix2 = 25_175_000 'var ' long cog ' long PixelBufferAddress, ColorTableAddress 'these must be together in this order PUB Start()|cog,p1,p2,p'Start up assembly 'Start off using pixels and palette from embedded bitmap 'PixelBufferAddress:=@BMP1 +$436 'Point to start of pixels 'ColorTableAddress:=@BMP1 +$36 'Point to start of color table 'p:=@PixelBufferAddress p1:=@BMP1 +$436 'Point to start of pixels p2:=@BMP1 +$36 'Point to start of color table p:=@p1 cog:=coginit(16,@VideoOrg,p)-1 'waitms(100) DAT orgh org 0 VideoOrg ' drvl #59 waitx ##10000000 drvh #59 waitx ##10000000 'jmp #VideoOrg ' Setup 'Read in parameters rdlong PB,ptra++ 'PB is now PixelBufferAddress rdlong ptrb,ptra++ 'ptrb is now ColorTableAddress 'loc ptra,#@BMP1 +$436 'Point to start of pixels 'mov pB, ptra'## @BMP1 +$436 'Point to start of pixels 'loc ptra, #@BMP1 +$36 'Point to start of color table 'mov ptrb, ptra'##@BMP1 +$36 'Point to start of color table rdlong pa,#@clkfreq 'calculate streamer frequency qfrac ##fpix2,pa getqx pa shr pa,#1 setxfrq pa '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 'Need to add cog# into dacmodes cogid x shl x, #8 or dacmode_s, x or dacmode_c, x 'Setup the RGB and HSync smartpins and turn them on 'enable dac modes in pins 0..3 wrpin dacmode_s,smart1 drvl smart1 'Loop for RGB pins rep @.end,#3 add smart1,#1 wrpin dacmode_c,smart1 drvl smart1 .end ' ' Field loop ' field 'RJA adding rdfast here rdfast ##640*480,PB' 'set rdfast to wrap on bitmap callpa #10,#blank 'top blanks mov x,##480 'set visible lines line call #hsync 'do horizontal sync xcont m_rf,#0 'do visible line djnz x,#line 'another line? callpa #33,#blank 'bottom blanks drvnot vsync 'vsync on callpa #2,#blank 'vertical sync blanks drvnot vsync 'vsync off 'Load LUT every frame (so can be changed) mov x,#0 rdfast #0,ptrb 'load .bmp palette into lut rep @.end,#$100 rflong y shl y,#8 wrlut y,x add x,#1 .end jmp #field 'loop ' ' ' Subroutines ' blank call #hsync 'blank lines xcont m_vi,#0 _ret_ djnz pa,#blank hsync xcont m_bs,#0 'horizontal sync xzero m_sn,#1 _ret_ xcont m_bv,#0 ' ' ' Initialized data ' 'RJA: dacmodes for P2 VGA 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 'Note: These 6 values now set in Spin before launching the driver m_bs long $7F010000 + 32<<17 + 16 'before sync m_sn long $7F010000 + 32<<17 + 96 'sync m_bv long $7F010000 + 32<<17 + 48 'before visible m_vi long $7F010000 + 32<<17 + 640 'visible m_rf long $7F080000 + 32<<17 + 640 'visible rfbyte 8bpp LUT->DAC smart1 long 32 vsync long 32+4 ' ' x long 0 y long 0 ' ' ' Bitmap ' fit $1f8 DAT orgh BMP1 'Embedded VGA bitmap image file "bitmap2.bmp"