Years ago, right after PB 3.0 came out, I wrote these
two screen portion Subs to replace TextGet and TextPut
which was written in Microsoft C by John Clark Craig.
I used them in QuickBasic 4.0, In QuickBasic, you had
use Subs like these to copy a portion of the screen and
paste it back. When I bought PB 3.0 I saw that Peek$
and POKE$ could do the same thing with the same amount
of code. TextGetz and TextPutz came out of that effort.
Anyway, I bought PBCC 2.0 and found that Poke$ and Peek$
got their tailfeathers plucked, they don't fly right.
I rewrote TextGetz and TextPutz and used Console Tool's
POKE and PEEK. I would like to know if this new version
would work before I try to change the code from a large
program to PBCC. I think it will work, but I'm not all
that great of a programmer, if you experts think it will
work, I'll do the conversion.
SUB TextGetz (Row1%, Column1%, Row2%, Column2%, _
Portion$())
MouseHideCursor
DEF SEG = &HB800'.............. for color monitor
ERASE Portions$'............... Clear out last run
DECR Row1%
AreaWidth% = (Column2% - Column1%) * 2
StartPosition% = (Column1% * 2) + (Row1% * 160) - 2
AreaDepth% = Row2% - Row1%
FOR x = 1 TO AreaDepth%
Portion$(x) = PEEK$(StartPosition%, AreaWidth%)
INCR StartPosition%, 160
NEXT x
MouseShowCursor
END SUB
Sub TextPutz (Row1%, Column1%, Row2%, Portion$())
MouseHideCursor
DEF SEG = &HB800
DECR Row1% : DECR Column1%
StartPosition% = (Column1% * 2) + (Row1% * 160)
AreaDepth% = Row2% - Row1%
FOR x = 1 to AreaDepth%
POKE$ StartPosition%, Portion$(x)
INCR StartPosition%, 160
NEXT X
MouseShowCursor
END SUB
The top two Subs are my originals and works great.
The bottom two are the ones I'm wondering about.
SUB TextGetz (Row1&,Column1&,Row2&,Column2&,Portion$(),Colors$())
MOUSE OFF
RESET Portion$() : DIM Portion$()
DECR Row1%
AreaWidth& = (Column2& - Column1&)
AreaDepth& = Row2& - Row1&
FOR x& = 1 to AreaDepth&
Portion$(x&)= ConsolePeek(0, Row&1, Column&1,AreaWidth&)
Colors$(x&)= ConsolePeek(%colors, Row&1, Column&1, _
AreaWidth&)
INCR Row&
NEXT x&
MOUSE ON
END SUB
SUB TextPutz (Row1&,Column&,Row2&,Column2&,Portion$,Colors$)
MOUSE OFF
DECR Row& : DECR Column1&
AreaDepth& = Row2& - Row1& - 1
For x& = 1 to AreaDepth&
ConsolePoke 0, Portion$, Row1&, Column1&
ConsolePoke %colors, Colors$, Row1&, Column1&
INCR Row1&
Next x&
MOUSE ON
END SUB
Did I have to DIM after that RESET
Thanks, Jerry Fielden
[This message has been edited by Jerry Fielden (edited March 04, 2000).]
two screen portion Subs to replace TextGet and TextPut
which was written in Microsoft C by John Clark Craig.
I used them in QuickBasic 4.0, In QuickBasic, you had
use Subs like these to copy a portion of the screen and
paste it back. When I bought PB 3.0 I saw that Peek$
and POKE$ could do the same thing with the same amount
of code. TextGetz and TextPutz came out of that effort.
Anyway, I bought PBCC 2.0 and found that Poke$ and Peek$
got their tailfeathers plucked, they don't fly right.
I rewrote TextGetz and TextPutz and used Console Tool's
POKE and PEEK. I would like to know if this new version
would work before I try to change the code from a large
program to PBCC. I think it will work, but I'm not all
that great of a programmer, if you experts think it will
work, I'll do the conversion.
SUB TextGetz (Row1%, Column1%, Row2%, Column2%, _
Portion$())
MouseHideCursor
DEF SEG = &HB800'.............. for color monitor
ERASE Portions$'............... Clear out last run
DECR Row1%
AreaWidth% = (Column2% - Column1%) * 2
StartPosition% = (Column1% * 2) + (Row1% * 160) - 2
AreaDepth% = Row2% - Row1%
FOR x = 1 TO AreaDepth%
Portion$(x) = PEEK$(StartPosition%, AreaWidth%)
INCR StartPosition%, 160
NEXT x
MouseShowCursor
END SUB
Sub TextPutz (Row1%, Column1%, Row2%, Portion$())
MouseHideCursor
DEF SEG = &HB800
DECR Row1% : DECR Column1%
StartPosition% = (Column1% * 2) + (Row1% * 160)
AreaDepth% = Row2% - Row1%
FOR x = 1 to AreaDepth%
POKE$ StartPosition%, Portion$(x)
INCR StartPosition%, 160
NEXT X
MouseShowCursor
END SUB
The top two Subs are my originals and works great.
The bottom two are the ones I'm wondering about.
SUB TextGetz (Row1&,Column1&,Row2&,Column2&,Portion$(),Colors$())
MOUSE OFF
RESET Portion$() : DIM Portion$()
DECR Row1%
AreaWidth& = (Column2& - Column1&)
AreaDepth& = Row2& - Row1&
FOR x& = 1 to AreaDepth&
Portion$(x&)= ConsolePeek(0, Row&1, Column&1,AreaWidth&)
Colors$(x&)= ConsolePeek(%colors, Row&1, Column&1, _
AreaWidth&)
INCR Row&
NEXT x&
MOUSE ON
END SUB
SUB TextPutz (Row1&,Column&,Row2&,Column2&,Portion$,Colors$)
MOUSE OFF
DECR Row& : DECR Column1&
AreaDepth& = Row2& - Row1& - 1
For x& = 1 to AreaDepth&
ConsolePoke 0, Portion$, Row1&, Column1&
ConsolePoke %colors, Colors$, Row1&, Column1&
INCR Row1&
Next x&
MOUSE ON
END SUB
Did I have to DIM after that RESET
Thanks, Jerry Fielden
[This message has been edited by Jerry Fielden (edited March 04, 2000).]
Comment