Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.02 KB | None | 0 0
  1.  
  2.  
  3. CON
  4. _CLKMODE = RCSlow ' Start prop in RCSlow mode internal crystal
  5.  
  6. PUB main
  7.  
  8. clkset(%01101000, 12_000_000) ' Set internal oscillator to RCFast and set PLL to start
  9. waitcnt(cnt + 120_000) ' wait approx 10ms at 12mhz for PLL to 'warm up'
  10.  
  11. clkset(%01101111, 80_000_000) ' 80MHz (5MHz PLLx16)
  12. coginit(COGID, @cogstart, @cogstart)
  13.  
  14. ' dira[0]~~
  15.  
  16. DAT
  17. org 0
  18. cogstart
  19. mov vcfg, ivcfg ' Sets up the parameters for video generation
  20. mov ctra, ictra ' internal PLL mode, PLLA = 16 * colorburst frequency
  21. mov frqa, ifrqa ' 2 * colorburst frequency
  22. mov dira, idira ' Sets pin directions
  23.  
  24. '-----------------------------------------------------------------------------------------------
  25. ' MAIN LOOP
  26. '-----------------------------------------------------------------------------------------------
  27. mainloop
  28. mov numline, #9 ' 9 lines of vsync
  29. vsync0
  30. cmp numline, #6 wz ' lines 4,5,6 serration pulses
  31. if_nz cmp numline, #5 wz ' lines 1,2,3 / 7,8,9 equalizing pulses
  32. if_nz cmp numline, #4 wz '
  33.  
  34. mov count, #2 ' 2 pulses per line
  35. :half
  36. if_nz mov VSCL, vscleqal ' equalizing pulse (short)
  37. if_z mov VSCL, vsclselo ' serration pulse (long)
  38. waitvid sync, #0 ' -40 IRE
  39. if_nz mov VSCL, vscleqhi ' equalizing pulse (long)
  40. if_z mov VSCL, vsclsync ' serration pulse (short)
  41. waitvid sync, blank ' 0 IRE
  42.  
  43. djnz count, #:half
  44. djnz numline, #vsync0
  45.  
  46. mov numline, #12 ' 12 blank lines
  47. blank0
  48. mov VSCL, vsclsync
  49. waitvid sync, #0 ' -40 IRE
  50. mov VSCL, vsclblnk
  51. waitvid sync, blank ' 0 IRE
  52. djnz numline, #blank0
  53.  
  54. '-----------------------------------------------------------------------------------------------
  55. ' ACTIVE VIDEO
  56. '-----------------------------------------------------------------------------------------------
  57. mov numline, #241 ' 241 lines of active video
  58. active
  59. mov VSCL, vsclsync ' horizontal sync (0H) 4.7us
  60. waitvid sync, #0 ' -40 IRE
  61.  
  62. mov VSCL, vscls2cb ' 5.3us 0H to burst
  63. waitvid sync, blank
  64.  
  65. mov VSCL, vsclbrst ' 9 cycles of colorburst
  66. waitvid sync, burst
  67.  
  68. mov VSCL, vsclbp ' backporch 9.2us OH to active video
  69. waitvid sync, blank
  70.  
  71. '-----------------------------------------------------------------------------------------------
  72. ' VISIBLE SCAN LINE START
  73. '-----------------------------------------------------------------------------------------------
  74. mov VSCL, vsclactv ' PLLA per pixel, pixels per frame
  75.  
  76. waitvid color, pixels
  77. waitvid color, pixels
  78. waitvid color, pixels
  79. waitvid color, pixels
  80. waitvid color, pixels
  81. waitvid color, pixels
  82. waitvid color, pixels
  83. waitvid color, pixels
  84.  
  85. '-----------------------------------------------------------------------------------------------
  86. ' VISIBLE SCAN LINE END
  87. '-----------------------------------------------------------------------------------------------
  88. mov VSCL, vsclfp ' front porch 1.5us
  89. waitvid sync, blank
  90.  
  91. djnz numline, #active
  92. jmp #mainloop
  93. '-----------------------------------------------------------------------------------------------
  94. ' END
  95. '-----------------------------------------------------------------------------------------------
  96.  
  97. '-----------------------------------------------------------------------------------------------
  98. ' CONFIG DATA
  99. '-----------------------------------------------------------------------------------------------
  100. ivcfg long %0_11_0_0_1_000_00000000000_001_0_01110000 '
  101. ictra long %0_00001_110_00000000_000000_000_000000 ' NTSC (PLLDIV = VCO/2, PLL internal (video mode)
  102. ifrqa long $16E8_BA2F ' (7,159,090.9Hz/80MHz)<<32 NTSC demoboard & Hydra
  103. idira long $0000_7000 ' demoboard
  104.  
  105. sync long $8A0200 ' %%0 = -40 IRE, %%1 = 0 IRE, %%2 = burst
  106. ' 0000 0000 1000 1010 0000 0010 0000 0000
  107. blank long %%1111_1111_1111_1111 ' 16 pixels color 1
  108. burst long %%2222_2222_2222_2222 ' 16 pixels color 1
  109.  
  110. vscleqal long 1<<12+135 ' NTSC sync/2
  111. vsclsync long 1<<12+269 ' NTSC sync = 4.7us
  112. vsclblnk long 1<<12+3369 ' NTSC H-sync
  113. vsclselo long 1<<12+1551 ' NTSC H/2-sync
  114. vscleqhi long 1<<12+1685 ' NTSC H/2-sync/2
  115. vscls2cb long 1<<12+304-269 ' NTSC sync to colorburst
  116. vsclbrst long 16<<12+16*9 ' NTSC 16 PLLA per cycle, 9 cycles of colorburst
  117. vsclbp long 1<<12+(527-304-16*9)+213' NTSC back porch + overscan (213)
  118. vsclactv long 10<<12+10*32 ' NTSC 10 PLLA per pixel, 32 pixels per frame
  119. vsclfp long 1<<12+214+86 ' NTSC overscan (214) + front porch
  120.  
  121. numline long $0
  122. count long $0
  123.  
  124.  
  125. color long %%1111_0000_1111_0000
  126. pixels long %10101010_10101010_10101010_10101010
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement