

Code: Alles auswählen
CON
vgrp = 2 ' video pin group
vpin = %%333_0 ' video pin mask
video = (vgrp << 9 | vpin) << 21
...
PUB main : n | x
link{0} := video | @scrn{0}
link[1] := @attr{0}
driver.start(-1, @link{0})
Code: Alles auswählen
movi ctrb, #%0_11111_000 ' LOGIC always (loader support)
movi ctra, #%0_00001_111 ' PLL, VCO/1
movi frqa, #%0001_00000 ' 5MHz * 16/1 = 80MHz
movs frqa, #res_x*3/4 ' |
movs frqa, #0 ' insert res_x*3 into phsa
mov vscl, #1 ' reload as fast as possible
mov zwei, scrn ' vgrp:[!Z]:vpin:[!Z]:scrn = 2:1:8:5:16 (%%)
shr zwei, #5+16 ' |
andn zwei, #%%000_3 ' |
or vcfg_norm, zwei ' | group + %%RGB_0
shr zwei, #9 ' |
movd vcfg_sync, zwei ' | group + %%000_3
mov vcfg, vcfg_sync ' VGA, 2 colour mode
waitcnt temp, #0 ' PLL settled, frame counter flushed
ror vcfg, #1 ' freeze video h/w
mov vscl, phsa ' transfer user value
rol vcfg, #1 ' unfreeze
waitpne $, #0 ' get some distance
waitvid zero, #0 ' latch user value
mov temp, vcfg_norm ' |
or temp, vcfg_sync ' |
and mask, temp ' transfer vpin
mov temp, vcfg ' |
shr temp, #9 ' extract vgrp
shl temp, #3 ' 0..3 >> 0..24
shl mask, temp ' finalise mask
max dira, mask ' drive outputs
mov $000, pal0 ' restore colour entry 0
...
vcfg_norm long %0_01_0_00_000 << 23
vcfg_sync long %0_01_0_00_000 << 23 | %00000011
