// P R I N T D E B U G
// Print page to the display -- for debugging.
get "PressInternals.df"
get "PressParams.df"
//outgoing procedures
external PDisplay
//incoming procedures
external
[
//WINDOW
WindowInit
WindowClose
WindowReadBlock
WindowGetPosition
WindowSetPosition
FileVDA
//PRESSML
DoubleAdd
Ugt
BitBLT
//OS
Zero
MoveBlock
Timer
//PRESS
PressError
DblShift
FSGet
FSGetX
FSPut
MulDiv
//CURSOR
CursorChar
CursorDigit
CursorToggle
//PRINT
PrintError
]
// incoming statics
external
[
BitsFile
]
manifest DISWID=36
let PDisplay(pg) be
[
let nbands=pg>>PageG.LastBand-pg>>PageG.FirstBand+1
let gbands=nbands//Number of bands we have dis for
if gbands gr 800/BANDWidth then gbands=800/BANDWidth
let dsiz=nil//Size of dis buffer
let dcore=nil//Dis buffer
while gbands ge 1 do
[
dsiz=gbands*BANDWidth*DISWID//Size
dcore=FSGet(dsiz+1)//Try for it
if dcore then break//OK
gbands=gbands-1
]
if dcore eq 0 then [ PressError(1701); return ]
let dataVec=FSGetX(4096)
let dptr=(dcore+1)&(-2)//Even address
Zero(dptr,dsiz)//Zero it.
let display=vec 10
display=(display+1)&(-2)//Even address
display!0=@#420
display!1=DISWID
display!2=dptr
display!3=gbands*BANDWidth/2
let BitWc=pg>>PageG.BitWc
let pages=((BitWc*BANDWidth+1023)/1024)//1024 word hunks
let del=vec 1; del!0=0; del!1=BitWc
let rwin=WindowInit(BitsFile)//Get a window.
let band=0//Number of bands displayed.
while band ls nbands do//Loop through all bands.
[
let b=nbands-band
if b gr gbands then b=gbands// b= number of bands to show this time
let wid=0//Number of words displayed
while wid ls BitWc do
[
let w=BitWc-wid
if w gr DISWID then w=DISWID// w= number of words to display
//When we get here, we are to display "b" bands starting at "band".
//In each band, we are to show "w" words starting at "wid"
Zero(dptr,dsiz)
let pos=vec 1
pos!0=0; pos!1=(band)*pages+pg>>PageG.BitPage
DblShift(pos,-10)//1024 hunks to Words
let dw=vec 1
dw!0=0; dw!1=wid//Amount to pass up
DoubleAdd(dw,pos)//Where to start
WindowSetPosition(rwin,dw)
let nWordsRead=0
for db=0 to b-1 do
[
let dbase=dptr+DISWID*db*BANDWidth
WindowReadBlock(rwin,dataVec,2)
nWordsRead=(nWordsRead+2)ṡ//avoid wrap around
let nWords=-(dataVec!0)
if nWords eq 0 then break//all done
if nWords ls 0 then//jump to next <4096> page start
[
WindowReadBlock(rwin,dataVec,4096-nWordsRead)
WindowReadBlock(rwin,dataVec,2)
nWords=-(dataVec!0)
nWordsRead=2
]
//BITBLT!!!!
WindowReadBlock(rwin,dataVec+2,nWords)
nWordsRead=nWordsRead+nWords
let BLTv=vec 11
BLTv!0=0
BLTv!2=dbase
BLTv!3=DISWID//Dest scan line length
BLTv!4=0//Dest x offset
BLTv!6=nWords//Dest width (and so, source width)
BLTv!7=1//Dest height
BLTv!9=4096//consider it just one scan line
BLTv!11=0//Source y offset
for s=0 to BANDWidth-1 do
[ BLTv!5=s//Dest y offset
BLTv!8=dataVec+2+(nWords/16)*s//Source CBA
BLTv!10=(nWords&15)*s//Source x offset
BitBLT(BLTv)
]
] //end of "for db=0 to b-1"
@#420=display//Now displaying!
CursorToggle(2); CursorToggle(3)//Let him know!
PrintError()//Wait for response
@#420=0
wid=wid+w
]
band=band+b
]
WindowClose(rwin)
@#420=display!0
FSPut(dcore)
FSPut(dataVec)
]