TweetFollow Us on Twitter

Video
Volume Number:3
Issue Number:5
Column Tag:Assembly Language Lab

Video Independence

By Dan Weston, Macintosh Author

Working With Big Screens

The big screens are here. You've seen them at MacExpo in Boston and elsewhere. Micrographix, E-machine, Radius; the names will soon be more familiar. And now the Macintosh II and custom third party video boards and monitors will soon dominate the Macintosh world. Will your applications run on the big screens?

If you've already been testing your programs on the Lisa/XL, then you probably already know how to work with other screen sizes. But most of us are poking along with a single Mac and we don't get a chance to play with the other members of the Macintosh family.

It's really easy to make sure that your programs will take advantage of the big screens. This short article shows how find out how big the current screen is and how to grow and move your windows so that they can use the whole screen.

How Big is the Screen?

The first thing to do is check the Quickdraw globals for the screenbits.bounds rectangle which gives the bounding rectangle for the whole screen. Quickdraw and the window manager use this rectangle, so you might as well do it too.

GetScreenSize is a short assembly language subroutine that takes a pointer to a rectangle variable and fills it in with the coordinates of screenbits.bounds.

; GetScreenSize.ASM
; This module finds out the size of the screen
; currently installed on your Mac
; It fills in a VAR rectangle with the coordinates 
; of screenbits.bounds

INCLUDE QuickEqu.D

XDEF    GetScreenSize

; Procedure GetScreenSize(VAR r:rect)
GetScreenSize:

r  SET  8 ;offset to rectangle parameter
parambytesSET  4 ; bytes for parameter 
 
LINK    A6,#0    ; no locals 
MOVE.L  r(A6),A1 ; get dest rect
MOVE.L  GrafGlobals(A5),A0; get QD globals
LEAscreenBits+bounds(A0),A0 
 
MOVE.L  (A0)+,(A1)+; move the first part
MOVE.L  (A0)+,(A1)+; move the rest
 
UNLK    A6; get rid of stack frame
MOVE.L  (SP)+,A0 ; return address
ADDA.W  #parambytes,SP    ; strip parameter
JMP(A0) ; return

GetScreenSize uses register A5 to get the pointer to the Quickdraw globals and then offsets into the globals to get at screenbits.bounds. Then it copies the coordinates into the VAR rectangle. If you are using a high level language, then you can probably use an expression like

tempRect := screenbits.bounds;

Dragging a Window all Over Town

Once you have the screen dimensions (top and left of screenbits.bounds are always 0,0) you can use them to guide window dragging and growing. For instance, DragWindow takes a rectangle parameter that delimits the boundaries in which the window may be dragged. A good strategy is to inset our copy of screenbits.bounds by about 20 pixels so that at least part of the window will remain on the screen at all times. Figure 1 shows just how far we can drag a window within the inset screen rectangle. The code for doing this is shown below.

figure 1: DragWindow limits

;-------- DoDrag -------------
DoDrag
; The click was in the drag bar of the window.  Drag it.

; xProcedureGetScreenSize(VAR r:Rect)
PEAtRect(A5); global scratch rect
JSRGetScreenSize
 
;Procedure  InsetRect(VAR r:Rect;dh,dv:INTEGER)
PEAtRect(A5); the rect
MOVE.W  #20,-(SP); dh
MOVE.W  #20,-(SP); dv
_InsetRect

; DragWindow (theWindow:WindowPtr; startPt: Point;             
 boundsRect: Rect);
MOVE.L  WWindow(A5),-(SP) ; Pass window 
MOVE.L  Point(A5),-(SP) ; mouse coordinates
PEAtRect(A5); and boundaries
_DragWindow ; Drag Window 
BRA     NextEvent; Go get next event

Growing As Big as You Can

Another use for the screen boundaries is to govern GrowWindow so that your windows can get as big as the biggest screen. GrowWindow takes a rectangle parameter; the top and left coordinates specify the smallest vertical and horizontal measurements the window can have. I choose 70 for each of these so that even the smallest window will have complete scoll bars, including a thumb, as shown in figure 2.

Figure 2: GrowWindow limits

The bottom and right coordinates of the growrect parameter to GrowWindow specify the maximum vertical and horizontal dimensions the window can have. The bottom coordinate of screenbits.bounds, minus about 15 pixels, is good for the maximum height. The maximum width should be wider than the screen, however, to allow for stretching windows partially off the sides of the screen, as many people learned to do with MacWrite. I chose the largest positive integer, $7FFF, for my maximum width. Beware of using negative numbers for this parameter.

Interestingly enough, even though MacWrite will let you make a window much wider than the screen, it seems to have the original Mac screen height hard-coded into its grow routine. E-Machines includes a nice ROM patch with its big screen that lets you hold down the option key while growing a window to override the limits that the underlying program may be trying to impose on window size. The code fragment to grow a window on an arbitrary screen is shown below.

;-----------------  DoGrow  ------------------------
DoGrow:

; first include scroll bar and grow region in update region
BSRInvalidScroll
 
; here is where we actually grow the window
; xProcedureGetScreenSize(VAR r:Rect)
PEAtRect(A5); global scratch rect
JSRGetScreenSize
 
ADD.W #70,tRect+top(A5)   ; 70 pixels high
ADD.W #70,tRect+left(A5)  ; 70 pixels wide
SUB.W #15,tRect+bottom(A5); not too tall
MOVE.W  #$7FFF,tRect+right(A5);extra-wide OK
 
;FUNCTION GrowWindow(theWindow:WindowPtr;startPt:Point;
;   sizeRect:Rect):LONGINT
CLR.L -(SP) ; space for result
MOVE.L  WWindow(A5),-(SP) ; theWindow
MOVE.L  Point(A5),-(SP) ; startPt
PEAtRect(A5); sizeRect
_GrowWindow
MOVE.W  (SP)+,D1 ; new vertical dimension
MOVE.W  (SP)+,D0 ; new horizontal dimension
 
; now draw it to the new size

True Confessions

It is really so easy to check the screen size that there is no excuse for not doing it. I am sorry to say that I make the mistake of using hard-coded screen sizes in some of my example programs in The Complete Book of Macintosh Assembly Langauge Programming, Vol I. We all live and learn, I guess. I am preparing a list of other things that could have been better in the book. Some suggestions have already come from readers. I encourage you to send me your comments so that I can keep the material up-to-date through articles like this or maybe with mailings to readers. [Dan Weston's two book series, The Complete Book of Macintosh Assembly Language Programming, Vol. 1 & 2, is a classic and one of the best of all Mac programming books. We recommend it highly. Write to Dan care of MacTutor and we will forward any comments to him. His books are published by Scott Foresman & Co. and available at B. Dalton bookstores. -Ed]

Big Screens Have Big Prices

Anthony J. Oresteen

Batavia, IL

In recent months there have been numerous large screen monitors introduced for the Macintosh. These include the Radius, Big Picture, MegaScreen II, ect. One thing in common with these products is the big price. They all cost about $2000! Similar screens are available for the IBM PC world at half the price, around $999 for screen, PC card and support software. The Wyse WY-700 at 1200 x 800 is one that comes to mind. Somehow I smell a snake here. What are Macintosh buyers getting for the extra $1000? Perhaps we can learn a lesson from "hard disk" history. I'm waiting for the price drop!

[The impact of the Mac II will make alternate screen technologies more acceptable, driving up demand and competition, which will drive down the price. -Ed]

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Fresh From the Land Down Under – The Tou...
After a two week hiatus, we are back with another episode of The TouchArcade Show. Eli is fresh off his trip to Australia, which according to him is very similar to America but more upside down. Also kangaroos all over. Other topics this week... | Read more »
TouchArcade Game of the Week: ‘Dungeon T...
I’m a little conflicted on this week’s pick. Pretty much everyone knows the legend of Dungeon Raid, the match-3 RPG hybrid that took the world by storm way back in 2011. Everyone at the time was obsessed with it, but for whatever reason the... | Read more »
SwitchArcade Round-Up: Reviews Featuring...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for July 19th, 2024. In today’s article, we finish up the week with the unusual appearance of a review. I’ve spent my time with Hot Lap Racing, and I’m ready to give my verdict. After... | Read more »
Draknek Interview: Alan Hazelden on Thin...
Ever since I played my first release from Draknek & Friends years ago, I knew I wanted to sit down with Alan Hazelden and chat about the team, puzzle games, and much more. | Read more »
The Latest ‘Marvel Snap’ OTA Update Buff...
I don’t know about all of you, my fellow Marvel Snap (Free) players, but these days when I see a balance update I find myself clenching my… teeth and bracing for the impact to my decks. They’ve been pretty spicy of late, after all. How will the... | Read more »
‘Honkai Star Rail’ Version 2.4 “Finest D...
HoYoverse just announced the Honkai Star Rail (Free) version 2.4 “Finest Duel Under the Pristine Blue" update alongside a surprising collaboration. Honkai Star Rail 2.4 follows the 2.3 “Farewell, Penacony" update. Read about that here. | Read more »
‘Vampire Survivors+’ on Apple Arcade Wil...
Earlier this month, Apple revealed that poncle’s excellent Vampire Survivors+ () would be heading to Apple Arcade as a new App Store Great. I reached out to poncle to check in on the DLC for Vampire Survivors+ because only the first two DLCs were... | Read more »
Homerun Clash 2: Legends Derby opens for...
Since launching in 2018, Homerun Clash has performed admirably for HAEGIN, racking up 12 million players all eager to prove they could be the next baseball champions. Well, the title will soon be up for grabs again, as Homerun Clash 2: Legends... | Read more »
‘Neverness to Everness’ Is a Free To Pla...
Perfect World Games and Hotta Studio (Tower of Fantasy) announced a new free to play open world RPG in the form of Neverness to Everness a few days ago (via Gematsu). Neverness to Everness has an urban setting, and the two reveal trailers for it... | Read more »
Meditative Puzzler ‘Ouros’ Coming to iOS...
Ouros is a mediative puzzle game from developer Michael Kamm that launched on PC just a couple of months back, and today it has been revealed that the title is now heading to iOS and Android devices next month. Which is good news I say because this... | Read more »

Price Scanner via MacPrices.net

Amazon is still selling 16-inch MacBook Pros...
Prime Day in July is over, but Amazon is still selling 16-inch Apple MacBook Pros for $500-$600 off MSRP. Shipping is free. These are the lowest prices available this weekend for new 16″ Apple... Read more
Walmart continues to sell clearance 13-inch M...
Walmart continues to offer clearance, but new, Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBooks... Read more
Apple is offering steep discounts, up to $600...
Apple has standard-configuration 16″ M3 Max MacBook Pros available, Certified Refurbished, starting at $2969 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free,... Read more
Save up to $480 with these 14-inch M3 Pro/M3...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
Amazon has clearance 9th-generation WiFi iPad...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Apple is offering a $50 discount on 2nd-gener...
Apple has Certified Refurbished White and Midnight HomePods available for $249, Certified Refurbished. That’s $50 off MSRP and the lowest price currently available for a full-size Apple HomePod today... Read more
The latest MacBook Pro sale at Amazon: 16-inc...
Amazon is offering instant discounts on 16″ M3 Pro and 16″ M3 Max MacBook Pros ranging up to $400 off MSRP as part of their early July 4th sale. Shipping is free. These are the lowest prices... Read more
14-inch M3 Pro MacBook Pros with 36GB of RAM...
B&H Photo has 14″ M3 Pro MacBook Pros with 36GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 Pro MacBook Pro (... Read more
14-inch M3 MacBook Pros with 16GB of RAM on s...
B&H Photo has 14″ M3 MacBook Pros with 16GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $150-$200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 MacBook Pro (... Read more
Amazon is offering $170-$200 discounts on new...
Amazon is offering a $170-$200 discount on every configuration and color of Apple’s M3-powered 15″ MacBook Airs. Prices start at $1129 for models with 8GB of RAM and 256GB of storage: – 15″ M3... Read more

Jobs Board

*Apple* Systems Engineer - Chenega Corporati...
…LLC,** a **Chenega Professional Services** ' company, is looking for a ** Apple Systems Engineer** to support the Information Technology Operations and Maintenance Read more
Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and Read more
*Apple* / Mac Administrator - JAMF Pro - Ame...
Amentum is seeking an ** Apple / Mac Administrator - JAMF Pro** to provide support with the Apple Ecosystem to include hardware and software to join our team and Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.