Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
95 lines (75 sloc) 1.82 KB
'******************************
'* VGA 640 x 480 x 8bpp-lut *
'******************************
CON
intensity = 80 '0..128
fclk = 80_000_000.0
fpix = 25_000_000.0
fset = (fpix / fclk * 2.0) * float($4000_0000)
vsync = 0 'vsync pin (all FPGA boards now)
DAT org
'
'
' Setup
'
hubset #$FF 'set clock to 80MHz
rdfast #0,##$1000-$400 'load .bmp palette into lut
rep @.end,#$100
rflong y
shl y,#8
wrlut y,x
add x,#1
.end
rdfast ##640*480/64,##$1000 'set rdfast to wrap on bitmap
setxfrq ##round(fset) 'set transfer frequency to 25MHz
'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,#3<<6 + 0 'enable dac modes in pins 0..3
'
'
' Field loop
'
field mov x,#33 'top blanks
call #blank
mov x,#480 'set visible lines
line call #hsync 'do horizontal sync
xcont m_rf,#0 'visible line
djnz x,#line 'another line?
mov x,#10 'bottom blanks
call #blank
drvnot #vsync 'sync on
mov x,#2 'sync blanks
call #blank
drvnot #vsync 'sync off
jmp #field 'loop
'
'
' Subroutines
'
blank call #hsync 'blank lines
xcont m_vi,#0
_ret_ djnz x,#blank
hsync xcont m_bs,#0 'horizontal sync
xcont m_sn,#1
_ret_ xcont m_bv,#0
'
'
' Initialized data
'
dacmode long %0000_0000_000_1010000000000_01_00000_0
m_bs long $7F010000+16 'before sync
m_sn long $7F010000+96 'sync
m_bv long $7F010000+48 'before visible
m_vi long $7F010000+640 'visible
m_rf long $7F080000+640 'visible rlong 8bpp lut
x res 1
y res 1
'
'
' Bitmap
'
orgh $1000 - $436 'justify pixels at $1000, pallete at $1000-$400
file "bitmap2.bmp" '640 x 480, 8pbb-lut
You can’t perform that action at this time.