Announcement

Collapse
No announcement yet.

Replacement for PCOPY

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

  • Replacement for PCOPY

    I was wondering what replaces PCOPY which is a Quickbasic statement in Powerbasic for DOS? I’ve been learning different things on how to use PSET and animating the object. Thx.

  • #2
    Hi,
    Look in the UNIT directory for the file SCRNUNIT.BAS

    This file contains the PGCOPY routine, which will "Copy data from one text page to another".

    Joe

    Comment


    • #3
      In reference to PCOPY

      I was just wondering if there is a statement replacing the PCOPY statement that quickbasic uses.

      Comment


      • #4
        Qbasic Help (the top of the screen reads QUickBasic, but I got it from QBasic):
        ───────────────────────────────────────────────────────────────────────────
        Copies one video memory page to another.

        PCOPY sourcepage%,destinationpage%

        ■ sourcepage% The number of a video memory page to copy.
        ■ destinationpage% The number of the video memory page to copy to.

        ■ The value that identifies the video page is determined by the size
        of video memory and the current screen mode.

        Here's a little starting point. I doubt it will work "as written" but it may give some of the more skilled MS-DOS programmers a nudge in a good direction.

        I can't tell from the help if the internal var 'pbvScreenBuff' points to the active page, the virtual page or the entire video memory; so I guessed 'virtual.' This also assumes text mode.

        Code:
        FUNCTION  PCOPY (sourcepage as INTEGER, destPage AS INTEGER) AS INTEGER
         ' save current data segment 
             saveDefSeg = pbvDefSeg 
         ' save current screen pages
             saveAPage  = pbvScrnAPage
             saveVPage  = pbvScrnVPage 
        
            ' set the current virtual page to the source page (I "guess" we go to virtual page?) 
              SCREEN  ,,, sourcePage 
            ' acquire address: 
              vSeg         = pScreenBuff MOD &h10000      ' pbvScrnBuff = 32-bit address. 
              vOff         = pbvScreenBuff AND &hFFFF
              DEF SEG      = vSeg 
              VData$       =  PEEK$(voff, 2 * pbvScrnCols * pbvScrnRows)  
              ' set video virtual page to the destination page 
              SCREEN ,,,DestPage 
              ' get that address
              vSeg         = pbvScreenBuff MOD &h10000
              voff         = pbvScreenBUff AND &hFFFF 
             ' poke the data  
              DEF SEG      =  vSeg
              POKE$           vOff, sData$ 
             ' restore the data segment 
              DEF SEG      =  saveDefSeg
             ' restore the vPage and Apage 
              SCREEN ,,saveAPage, sSaveVPage 
        
        END FUNCTION
        Heck, it's a thought.

        MCM
        Last edited by Michael Mattias; 7 Mar 2009, 10:45 AM.
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          > I was just wondering if there is a statement replacing the PCOPY statement that quickbasic uses.
          >> Look in the UNIT directory for the file SCRNUNIT.BAS.. This file contains the PGCOPY routine

          Duh, I just looked at this. It's a 'drop in replacement' if the pages are 'text.'

          Oh, well, the little mental exercise couldn't have hurt me. Not too much, anyway.

          MCM
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Calling the function

            So Michael,

            I can use the CALL statement to call this function below correct?


            FUNCTION PCOPY (sourcepage as INTEGER, destPage AS INTEGER) AS INTEGER
            ' save current data segment
            saveDefSeg = pbvDefSeg
            ' save current screen pages
            saveAPage = pbvScrnAPage
            saveVPage = pbvScrnVPage

            ' set the current virtual page to the source page (I "guess" we go to virtual page?)
            SCREEN ,,, sourcePage
            ' acquire address:
            vSeg = pScreenBuff MOD &h10000 ' pbvScrnBuff = 32-bit address.
            vOff = pbvScreenBuff AND &hFFFF
            DEF SEG = vSeg
            VData$ = PEEK$(voff, 2 * pbvScrnCols * pbvScrnRows)
            ' set video virtual page to the destination page
            SCREEN ,,,DestPage
            ' get that address
            vSeg = pbvScreenBuff MOD &h10000
            voff = pbvScreenBUff AND &hFFFF
            ' poke the data
            DEF SEG = vSeg
            POKE$ vOff, sData$
            ' restore the data segment
            DEF SEG = saveDefSeg
            ' restore the vPage and Apage
            SCREEN ,,saveAPage, sSaveVPage

            END FUNCTION
            Last edited by Russ Meyers; 21 Mar 2009, 11:59 AM. Reason: Added the code.

            Comment


            • #7
              Frankly, I have no idea if it will work.. I never tried it.

              Had it been my challenge, first thing I would have done is try the routine provided in the SCRNUNIT.BAS file.

              I think the key point is here, just as with ALL software... you'll never know until you DO try it.

              But let's play 'head doctor' here.... Whats the worst thing that can happen if you try it and it does not work? Well, you still don't have working code (no gain/no loss) but now you know something which does NOT work (small gain).

              That is, the WORST that can happen by actually trying something is, you come out a little bit ahead of where you were. That sounds like a pretty good deal to me.

              MCM
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment

              Working...
              X