home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 18
/
CD_ASCQ_18_111294_W.iso
/
dos
/
prg
/
pas
/
pscrn55
/
basic.exe
/
DISP_IMG.BAS
< prev
next >
Wrap
BASIC Source File
|
1994-10-09
|
6KB
|
173 lines
'=========================================================== Disp_IMG.Bas
'
' PowerBASIC users: UN-REM "PUBLIC" for each procedure.
' UN-REM "PUBLIC" for each procedure.
' UN-REM "PUBLIC" for each procedure.
'
' ALSO: compile this to a .PBU file,
' then add $LINK "Disp_IMG.PBU" to any
' file where you want to use psDisplayData.
'
' Finally: speed this up -- a lot -- by
' going to SUB psDisplayData and UN-REMming
' the PokeI ... line (follow other notes too).
'
'******************************************************************
' This is a P-Screen module containing:
'
' psDisplayDATA -- to display P-Screen's IMAGE data screens.
'
' psPAINT -- called by psDisplayData to (optionally) display
' "drop shadows" beneath screens you display.
'
' YOU can also call psPAINT anytime you want to "paint" areas
' of the screen -- as you might to highlight menu options.
'
' Color = 0 - 255. Colors > 127 will blink -or- will appear
' as bright backgrounds if you've turned bright BGs ON.
'
'
' BOTH routines are much f-a-s-t-e-r when compiled!
'
'=========================================================== Disp_IMG.Bas
DEFINT A-Z
'...NOTE: Since these are BASIC routines, we do NOT pass
' parameters BYVAL. Pass them by REFERENCE instead.
DECLARE SUB psDisplayData (TopRow%, LeftCol%, BottomRow%, RightCol%, ScrnArray%(), ShadowColr%)
DECLARE SUB psPaint (TopRow%, LeftCol%, BottomRow%, RightCol%, Attribute%)
'
SUB psDisplayData (TRow%, LCol%, BRow%, RCol%, ScrArray%(), ShadowColr%) ''Public
IF TRow < 1 THEN EXIT SUB '...NEVER go backwards!
'*********************************************************
' Purpose: Display P-Screen's IMAGE data screens by
' POKE-ing data directly to video memory.
' This is much f-a-s-t-e-r when compiled!
'
' Input: Pass screen coordinates (TRow, LCol, etc.).
' Also pass an INTEGER array with screen data.
'
' Finally, pass ShadowColr (1 - 255) IF you want
' a drop shadow drawn beneath your screen.
' ShadowColr = 0 means "no drop shadow."
'
' Colors > 127 will blink -or- will appear as bright
' backgrounds if you've turned bright BGs ON.
'
' Returns: Nothing
'*********************************************************
'*********************************************************
'
' POKE screen data directly to video memory.
'
' NOTE: Since Microsoft BASIC has NO option to poke
' words/integers (just bytes), we must POKE the character
' and attribute separately -- a relatively slow process.
'
' If you own PowerBASIC or Crescent's Quik Pak, you
' may be able to SPEED this up by replacing the 2 POKE
' statements below with 1 call to a poke-WORD routine.
' See the "PokeI..." and "CALL Poke2 ..." lines below.
'
'*********************************************************
'...if ShadowColr <> 0, paint a drop shadow. NOTE: you can
' CHANGE where the shadow appears by changing "+ 1" and "+ 2"
' below. But NEVER send TopRow < 0!
IF ShadowColr <> 0 THEN
CALL psPaint(TRow + 1, LCol + 2, BRow + 1, RCol + 2, ShadowColr)
END IF
'***********************************************************
'...Determine what type of monitor is being used, and, most
' importantly, where to begin POKE-ing around in memory.
'***********************************************************
DEF SEG = 0
IF (PEEK(&H410) AND 48) <> 48 THEN VidSeg = &HB800 ELSE VidSeg = &HB000
'...color monitor '...monochrome
DEF SEG = VidSeg
Element = 1: LastEl = UBOUND(ScrArray)
FOR Row = TRow TO BRow
FOR Col = LCol TO RCol
IF Element > LastEl THEN EXIT FOR '... stay in bounds
Offset = ((Row - 1) * 160) + ((Col - 1) * 2)
'... see notes below about REPLACING these 2 POKEs
POKE Offset, (ScrArray(Element) AND &HFF)
'...this correctly handles bright background colors!
POKE Offset + 1, CLNG((ScrArray(Element)) AND 65535) \ 256
' &HFFFF&) &H100
'...PowerBASIC users: REM-out the last 2 lines, and
' use the next one instead. It's m-u-c-h faster!
'''PokeI Offset, ScrArray(Element)
'...Try the NEXT line if you have Crescent's Quik Pak.
' When compiled it's a little (but not much) faster.
''''CALL Poke2(VidSeg, Offset, ScrArray(Element))
Element = Element + 1
NEXT
NEXT
DEF SEG
END SUB
SUB psPaint (TopRow, LeftCol, BottomRow, RightCol, Attribute) ''Public
IF TopRow < 1 THEN EXIT SUB '...NEVER go backwards!
'************************************************************
' Purpose: "paint" a drop shadow beneath screens you display.
' This POKEs colors directly to video memory --
' ignoring character and changing just the attribute.
'
' Input: Pass screen coordinates (TRow, LCol, etc.).
'
' Also pass a color attribute (0 - 255).
' Colors > 127 will blink -or- will appear as bright
' backgrounds if you've turned bright BGs ON.
'
' Returns: Nothing
'************************************************************
'...Determine what type of monitor is being used, and, most
' importantly, where to begin POKE-ing around in memory.
'************************************************************
DEF SEG = 0
IF (PEEK(&H410) AND 48) <> 48 THEN VidSeg = &HB800 ELSE VidSeg = &HB000
'...color monitor '...monochrome
DEF SEG = VidSeg
'*********************************************************
'
' POKE colors directly to video memory.
'
'*********************************************************
FOR Row = TopRow TO BottomRow
FOR Col = LeftCol TO RightCol
Offset = 1 + ((Row - 1) * 160) + ((Col - 1) * 2)
POKE Offset, Attribute
NEXT
NEXT
DEF SEG
END SUB