Shop OBEX P1 Docs P2 Docs Learn Events
Why does the graphics driver take so much stack? — Parallax Forums

Why does the graphics driver take so much stack?

boeboyboeboy Posts: 301
edited 2007-07-02 15:03 in Propeller 1
Why do i need so much stack space when i am useing the graphics driver?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lets see what this does... KA BOOM (note to self do not cross red and black)

Comments

  • Jasper_MJasper_M Posts: 222
    edited 2007-03-23 18:20
    Graphics driver doesn't really use stack, it's the TV driver that uses it. Never mind that. Bitmap&Display buffers are in stack afaik. From GFX demo:

    _stack = ($3000 + $3000 + 100) >> 2 'accomodate display memory and stack
    ...
    bitmap_base = $2000
    display_base = $5000

    Somebody correct me if I'm wrong, but:
    It uses stack in a weird way - it allocates stack, uses only a tiny fraction it as a normal stack and uses the rest just like a buffer defined VAR area, reading/writing to it directly.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-23 18:34
    The space between the end of the program proper (and its variables) and the end of memory is used for the Spin stack, but there's no reason why it can't be shared. Many programming systems do this sort of thing, allocating buffers or control blocks from one end of memory and a stack from the other end. The graphics demo programs allocate their display memory this way. Neither the graphics driver (graphics.spin) nor the TV/VGA drivers themselves actually allocate this memory. They're merely passed the address of the bitmap and display buffers. You could, if you wanted, define them as variables in your program just as well.
  • Jasper_MJasper_M Posts: 222
    edited 2007-03-23 18:51
    Yes. I'm gonna quote you from the other thread, because I kind of misunderstood and you explained it there (accidentally?, it wasn't completely off-topic):
    Mike Green said...
    Strictly speaking, the display memory is not allocated in the stack. The _stack statement just tests for that amount of space between the start of the stack and the end of memory. The large blocks for the bitmap and display buffer are allocated at fixed locations at the end of memory and the _stack statement just takes that into account.
  • boeboyboeboy Posts: 301
    edited 2007-04-05 17:21
    thank you all

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lets see what this does... KA BOOM (note to self do not cross red and black)
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-02 04:28
    If you can live with some flicker, you can actually cut that in half by defining both at the same address and removing the line to copy the base to the display. This will directly update the image memory instead of buffering first.

    _stack = ($3000 + 100) >> 2 'accomodate display memory and stack
    ...
    bitmap_base = $5000
    display_base = $5000

    -Martin




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • RinksCustomsRinksCustoms Posts: 531
    edited 2007-07-02 15:03
    After hours of roll.gif· my own head,·searching through electronic mud, trying to understand·just· how to get the driver to output on the resistor DAC starting on pin 4,··i found this link:hop.gifhttp://www.parallax.com/dl/docs/prod/prop/Hydra-Ch16Sample-v1.0.pdf· It goes into detail on exactly how the tv driver works and it's settings, memory allocation, and a bit more. I'm ordering a copy of the HYDRA manual in hopes that there is more information on the VGA and GRAPHICS drivers. As the s-video setting within the driver looks interesting.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Definetly a E3 (Electronics Engineer Extrodinare!)
    "I laugh in the face of imposible,... not because i know it all, ... but because I don't know well enough!"
Sign In or Register to comment.