Oct 89 Letters
Volume Number: 5
Issue Number: 10
Column Tag: Letters
By David E. Smith, Editor & Publisher, MacTutor
Any sympathetic souls
John Love, III
Springfield, VA
I’m having absolutely NO luck with MACDTS, or anyone else for that matter,
trying to solve my following 2 separate & distinct problems. I KNOW this is an AWFUL
lot, but I’m going crazy ?!*!?
; 1) Using _CopyBits to create a color PICT2 file:
entireScreen pointer ; My globals
screenMap pointer ; ...
pictBounds rect ; ...
picHdl handle ; ...
clr.w -(sp)
bsr TestForColor
pop.w d0
beq.s .bitMap
; ----------
.pixMap GetCWMgrPort !entireScreen
move.l entireScreen,a0
lea portPixMap(a0),a1
move.l a1,screenMap
move.l portPixMap(a0),a1
move.l (a1),a1 ; Handle -- Pointer.
bra.s .setBounds
;
.bitMap GetWMgrPort !entireScreen
move.l entireScreen,a0
lea portBits(a0),a1
move.l a1,.screenMap
; ~~~~~~~~~~
.setBounds move.l bounds+topLeft(a1),pictBounds+topLeft
move.l bounds+botRight(a1),pictBounds+botRight
; ----------
.setPort SetPort entireScreen
ClipRect !pictBounds
; etc
.macDraw2 OpenPicture !pictBounds,=picHdl
CopyBits screenMap,screenMap,!pictBounds,!pictBounds,#srcCopy,#0
; etc
; above code works in black-and-white mode, but NOT in color.
;
; I’ve tried : move.l entireScreen,a0
; move.l portPixMap(a0),screenMap
; Also : move.l entireScreen,a0
; move.l portPixMap(a0),a1
; move.l (a1),screenMap
;
; ... but neither permutation works --> an empty picHdl (10 bytes,
obviously
; ... corresponding to just the picSize & picFrame fields).
; ... it doesn’t bomb, but the file comes up blank, that is, just
; ... the 512-byte header + those 10 bytes and nothing else.
; ... I think it’s kinda interesting that ONLY upon
;
; move.l portPixMap(a0),screenMap
;
; ... do I get a PICT2 file, albeit an empty one.
; ... In the other two cases, I get just a PICT file.
;
; SIGH !!
; ------------------------------
; 2) Switching color on & off on the fly, that is, changing the MODE:
; following was deduced from the “Cards and Drivers ...” book.
; This book is supposed to be official stuff from Apple, yet
; MacDTS fails to respond in other than purely qualitative prose.
;
; All my code does is turn video to a constant gray all over
; as if I had turned the video OFF. All further execution ceases !!
; No bomb, but I must re-boot.
; My calling stuff:
origMode integer ; My globals
paramBlkRec byte ioFQElSize ; ...
VDPgInfo byte VDPageInfo ; ...
clr.w -(sp)
bsr TestForColor
pop.w d0
beq.s .notColor
; ----------
; Save the current mode for reseting when done
; and then set to black-and-white:
.itsColor clr.w -(sp) ; result = Error code.
push.l MainDevice
pea paramBlkRec ; VARed ...
pea VDPgInfo
bsr GetMode
lea VDPgInfo,a1
move.w csMode(a1),origMode ; ... for reseting later.
pop.w d0
bsr testError ; Returns if d0 <> 0.
; ----------
clr.w -(sp)
push.l MainDevice
push.w #oneBitMode ; ... for black-and-white.
bsr SetDeviceMode
pop.w d0
bsr testError
.notColor
; etc
.onExiting clr.w -(sp)
bsr TestForColor
pop.w d0
beq.s .byeBye
; ----------
; Reset the mode to its original value:
.resetColor clr.w -(sp)
push.l MainDevice
push.w .origMode
bsr SetDeviceMode
pop.w d0
bsr .testError
.byeBye
; etc
; All my subroutine children:
; ======================================