-
Notifications
You must be signed in to change notification settings - Fork 1
/
vgatest.spin2
43 lines (34 loc) · 1.18 KB
/
vgatest.spin2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "config.spin2"
_CLKFREQ = video.VIDEO_CLKFREQ
DEBUG_TIMESTAMP = True
VAR
long scanbuffer[(320+16)*2]
long vdpmode
long linect,framect
long lestack[128]
OBJ
video: "NeoVGA"
PUB main()
' Create test card
longfill(@scanbuffer[ 0],$FFFFFF00,40)
longfill(@scanbuffer[ 40],$FFFF0000,40)
longfill(@scanbuffer[ 80],$00FFFF00,40)
longfill(@scanbuffer[120],$00FF0000,40)
longfill(@scanbuffer[160],$FF00FF00,40)
longfill(@scanbuffer[200],$FF000000,40)
longfill(@scanbuffer[240],$0000FF00,40)
longfill(@scanbuffer[280],$00000000,40)
longmove(@scanbuffer[320+16],@scanbuffer,320)
' alternating pattern on right edge
scanbuffer[319] := $FF000000
scanbuffer[319+320+16] := $0000FF00
video.start(ANALOG_BASEPIN&63 + (DIGITAL_BASEPIN&63)<<8 + (DIGITAL_REVERSED?64<<8:0),VSYNC_PIN,VIDEO_MODE,VIDEO_SUBMODE,@scanbuffer,16*4,2,@linect,@vdpmode,video.CLK_MULTIPLIER*3*4*6*6)
cogspin(COGEXEC_NEW,soundgen(DIGITAL_BASEPIN,video.CLK_MULTIPLIER*3*4*6*6),@lestack)
PUB soundgen(mbpin,period) | time,phase,sample,freq
time := getct()
freq := 1<<26
repeat
sample,_ := polxy($7FFF,phase+=freq)
sample.word[1] := sample.word[0]
waitct(time+=period)
wxpin(mbpin,sample)