Shop OBEX P1 Docs P2 Docs Learn Events
Understanding TV.SPIN Initialization — Parallax Forums

Understanding TV.SPIN Initialization

Mark SwannMark Swann Posts: 124
edited 2007-11-03 20:08 in Propeller 1
I have only just started examining Graphics.Spin and how it initializes the TV.Spin object.

For the question, the following is excerpted from Graphics.Spin.

  long  tv_status     '0/1/2 = off/visible/invisible           read-only
  long  tv_enable     '0/? = off/on                            write-only
  long  tv_pins       '%ppmmm = pins                           write-only

 
...
 
PUB start | i, j, k, kk, dx, dy, pp, pq, rr, numx, numchr
  'start tv
  longmove(@tv_status, @tvparams, paramcount)
  tv_screen := @screen
  tv_colors := @colors
  tv.start(@tv_status)

 
...
 
DAT
tvparams                long    0               'status
                        long    1               'enable
                        long    %001_0101       'pins
                        long    %0000           'mode
 

Why is the longmove necessary?

Shouldn't you be able to pass the address of tvparms in the DAT section, as in "tv.start(@tvparms)" ?

Lucidman
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-03 00:34
    The "tv_status" block is not read-only. The TV driver is changing the value in the first long ("status") all the time and the other values are allowed to change and will be copied to the cog during the vertical retrace. If you wanted to have more than one TV attached to a Propeller, that would work with the existing code because the VAR area is duplicated for each instance of the TV driver. If you just passed "tvparms", it would work if there was always only one copy of the TV driver, but would not work properly if there were more than one copy (because all the cogs running it would try to change the same block of memory).
  • Mark SwannMark Swann Posts: 124
    edited 2007-11-03 00:56
    Mike Green said...
    The "tv_status" block is not read-only. The TV driver is changing the value in the first long ("status") all the time and the other values are allowed to change and will be copied to the cog during the vertical retrace. If you wanted to have more than one TV attached to a Propeller, that would work with the existing code because the VAR area is duplicated for each instance of the TV driver. If you just passed "tvparms", it would work if there was always only one copy of the TV driver, but would not work properly if there were more than one copy (because all the cogs running it would try to change the same block of memory).
    So, let me say back to you what I think you are saying.

    Graphics.Spin could have two tv objects like the following...

    OBJ
      tv1   : "tv"
    
      tv2   : "tv"
    
    

    ·...right?

    But each would need separate control blocks ... right?

    What is keeping you from setting up two control blocks in the DAT section and not use up space in the VAR section?

    Lucidman
    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-03 01:54
    You could have two control blocks in the DAT section, but then you'd need two start routines (the way things are written), one for each. If you're tight on space and you never want to change the status information once the TV driver is launched, you could change how the TV driver is started, only have the first long word in the VAR area and use defaults for the rest of the information so that it's assembled in with the TV assembly driver rather than copied in with each vertical refresh interval.
  • Mark SwannMark Swann Posts: 124
    edited 2007-11-03 02:01
    Mike,

    Thanks for your patient answers.

    Lucidman
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-03 09:54
    This is so true smile.gif
    I really do not know what I should admire more: Mike's patience, or his knowledge and experience....
  • Paul Sr.Paul Sr. Posts: 435
    edited 2007-11-03 20:08
    deSilva said...
    This is so true smile.gif
    I really do not know what I should admire more: Mike's patience, or his knowledge and experience....

    Admire them equally as he is a true Gem.
Sign In or Register to comment.