Announcement

Collapse
No announcement yet.

Shared Virtual Array

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Shared Virtual Array

    How do I share a virtual array with a SUB ?

    Dim Virtual SCRN(1) AS String * 8000

    SUB SCRNSAVE

    IF BIT(pbvScrnCard,0) THEN Addr& = &hB000 ELSE Addr& = &hB800
    DEF SEG = Addr&
    SaveBytes% = pbvScrnRows * pbvScrnCols * 2
    SCRN(1)=PEEK$(0,SAVEBYTES%)
    DEF SEG

    END SUB

    I have tried the SHARE command as

    SHARE SCRN()

    What am I doing wrong ?

  • #2
    You are sharing the array correctly; however, you cannot access PB VIRTUAL arrays using pointers, PEEK or POKE. The only way to access elements of a virtual array is to use the array name and a subscript.

    But since your array is only 16000 bytes, there's no reason it can't be a regular array; although for your code example, there's no reason to use an array rather than a fixed or dynamic string.

    MCM


    ------------------
    Michael Mattias
    Racine WI USA
    [email protected]
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      I have tried the SHARE command as

      SHARE SCRN()

      What am I doing wrong ?
      Change SHARE to SHARED


      ------------------

      Comment

      Working...
      X