TweetFollow Us on Twitter

Volume Number:1
Issue Number:7
Column Tag:Assembly required

Using the Common Resources

By Frank Alviani

Resources are the most mystifying of all the Mac technology, mainly because they are undocumented, and not usually found on other computers. The purpose of resources are to seperate text, icons, fonts, menu items and dialogs from the executable source code of a program where they can be easily changed without re-compilation. With the resource editor and other tools, this opens up a world of “user customized” programs. The user literally changes the program resources to his own tastes. This makes for an exciting possibility in software adaptation that has yet to be fully explored. In the meantime, programmers still must struggle to make use of resources effectively.

A big problem is not having adequate documentation of the format of each resource in terms of a binary file specification; exactly how many bytes and in what format each resource item is specified. While the RMaker provides an easy way to assembly resources, it does little to explain their internal format. The Apple Assembler has the ability to compile resources directly, offering an alternative to the RMaker utility. All that is lacking is the correct assembler source code format of each resource. Now Frank Alviani has filled this omission gap by providing us with the assembler format of all the major resources. This information should go a long way toward improving the resource void. We encourage others to help in this area by sending in articles or information on resources to help improve our understanding of this vital Mac concept. [David E. Smith, Editor]

Linker or RMaker

The big advantage to using the linker rather than the RMaker is flexability. You can control every detail - type style, etc. To balance this, linking is significantly longer and certain RMaker capabilities simply don’t exist - “linking” in picture resources, for example. With RMover, those disadvantages are pretty small, however.

Only the reasonably common resources are documented here (mostly those in volume 1 of IM). I didn’t include the Font resource defs, since nobody in their right minds would do a font in assembler (I had to do 2 in assembler for a DEC Pro system when I wrote a custom screen manager and I KNOW how bad that is!!). While there are probably others that aren’t included, I’ve had no use for them.

The few notes regard (1) The correction to the “control type” field in the Control resource, and (2) an explanation of the enabling mask field in the Menu resource. These are naturally confusing since IM is wrong or silent on the matters.

I decided to take this approach to building a “prototypes” file, rather than use macros, because (a) A typical macro call would be too big to fit on a line, and I am somewhat fussy about the appearance of my code (I have enough trouble without messy code confusing me further...) (b) I include explanatory comments on each line, so I don’t have to keep referring to reference material for each field. Disk space is virtually free, so why not?

;Resource Prototypes for Assembler usage
;Frank Alviani
;More verbose than macros, but easier to copy & fill in...
;ALL resources using local labels (labels starting with @) must
;be bracketed by regular labels; local labels can be re-used only
;if the duplicates are separated by regular labels. This applies
;even if no warning appears in the resource prototype!
;These are arranged roughly alphabetically, altho the DLOG/ALRT/DITL
;are grouped together at the end.
;In general # represents a numeric field normally filled in.
;The name and attribute fields on the RESOURCE line are optional.
;The idea is to have this in one editor window, and to copy to the
;resource file being built as needed. This will hopefully speed the
;process, and give flexability the RMaker doesn’t.
;There are some additional explanatory comments with various resources.
;Some of this is copied from MacTutor 1/4.






DOCBOX  EQU 0    ;standard document window
ALERT   EQU 1    ;alert
PLAIN   EQU 2    ;plain
PLAINSHDEQU 3    ;plain with shadow
NOGROWDOC EQU    4 ;document window w/o grow box
ROUNDBOXEQU 16   ;rounded-corner window (see IM for setting corner radius..)

CBUTTON EQU 0    ;simple button
CCHKBOX EQU 1    ;check box
CRADIO  EQU 2    ;radio button
USEWFNT EQU 8    ;add to above to use window’s fonts
CSCROLL EQU 16   ;scroll bar

; IDENTIFICATION resource - needed for Finder to locate Icon
 DC.B   AA1-@1
@1:DC.B ‘Ver. 0.1 3/31/85’

;BUNDLE resource
 RESOURCE ‘BNDL’ ### ‘name’ [(attr)]
 DC.L   ‘WCA1’   ;signature
 DC.W   0,1 ;data (doesn’t change)
 DC.L   ‘ICN#’   ;icon mappings
 DC.W   0 ;number of mappings - 1
 DC.W   0,128    ;map 0 to icon 128
 DC.L   ‘FREF’   ;FREF mappings
 DC.W   0 ;number of mappings - 1
 DC.W   0,128    ;map 0 to fref 128

;CONTROL resource
;NOTE - although the assembler definition of this claims that the
;“control type” field is a long word, IT LIES. Control type is a 16-bit

 RESOURCE ‘CNTL’ ### ‘name’ [(attr)]
 DC.W   # ;top
 DC.W   # ;left
 DC.W   # ;bottom
 DC.W   # ;right
 DC.W   # ;initial value
 DC.W   0 ;visible (T/F)
 DC.W   # ;max value
 DC.W   # ;min value
 DC.W   # ;control type
 DC.L   0 ;refCon
 DC.B   @2-@1    ;title length (at least 1)
@1:DC.B ‘xxx’    ;title

;CURSOR resource
 RESOURCE ‘CURS’ ### ‘name’ [(attr)]
 DC.L   #,# ;1st 8 bytes of cursor
 DC.L   #,# ;2nd 8 bytes
 DC.L   #,# ;3rd 8 bytes
 DC.L   #,# ;4th 8 bytes
 DC.L   #,# ;1st 8 bytes of mask
 DC.L   #,# ;2nd 8 bytes
 DC.L   #,# ;3rd 8 bytes
 DC.L   #,# ;4th 8 bytes  
 DC.W   #,# ;h,v of hot spot
;FREF resource
 RESOURCE ‘FREF’ ### ‘name’ [(attr)]
 DC.B   ‘APPL’,0,0,0
;ICN# resource
 RESOURCE ‘ICN#’ ### ‘name’ [(attr)]
;there’d usually be an ‘include’ here...

;MENU resource
;NOTE - the “enable field”: bits are number right to left 0-15. Bit
;1 is the first menu item. A “0” bit in the mask disables that item.
;I haven’t tried it, but I think turning off bit 0 of the mask
;disables the entire menu..

 RESOURCE ‘MENU’ ### ‘name’ [(attr)]
lbl:  DC.W1 ;MENU ID
 DC.W   0 ;width holder
 DC.W   0 ;height holder
 DC.L   0 ;std menu pro holder
 DC.L   $1FF;enable all items
 DC.B   @2-@1    ;title length (in bytes)
@1:DC.B 20;title (this is the apple)

;MENU ITEM resource
 DC.B   # ;item length
 DC.B   ‘xxx’    ;menu item
 DC.B   0 ;no icon
 DC.B   0 ;keyboard equivalent
 DC.B   0 ;marking character
 DC.B   0 ;style of item’s text
;PATTERN stuff
 RESOURCE ‘PAT ‘ ### ‘name’ [(attr)]
 DC.L   #,# ;1st, 2nd 4 bytes of pattern
 RESOURCE ‘PAT#’ ### ‘name’ [(attr)]
 DC.W   # ;# of patterns
 DC.L   #,# ;1st, 2nd 4 bytes of pattern #1

;STRING resource
 RESOURCE ‘STR ‘ ### ‘name’ [(attr)]
 DC.B   @2-@1    ;text length
@1:DC.B ‘xxx’    ;text

;STRING LIST resource
 RESOURCE ‘STR#’ ### ‘name’ [(attr)]
 DC.W   # ;count of strings
 DC.B   @2-@1    ;text length - string #1
@1:DC.B ‘xxx’    ;text

;WINDOW resource
 RESOURCE ‘WIND’ ### ‘name’ [(attr)]
 DC.W   # ;top
 DC.W   # ;left
 DC.W   # ;bottom
 DC.W   # ;right
 DC.W   # ;window type
 DC.W   # ;visible (T/F)
 DC.W   # ;draw goAway (T/F)
 DC.L   0 ;refCon (available)
 DC.B   @2-@1    ;title length
@1:DC.B ‘xxx’    ;title

; -- Dialog / Alert / DITL are grouped together --

;DIALOG resource
 RESOURCE ‘DLOG’ ### ‘name’ [(attr)]
 DC.W   # ;top
 DC.W   # ;left
 DC.W   # ;bottom
 DC.W   # ;right
 DC.W   # ;window type
 DC.B   # ;visible (T/F)
 DC.B   # ;goAway flag (T=has close box)
 DC.L   0 ;refCon
 DC.W   # ;ID of DITL list
 DC.B   @2-@1    ;text length
@1:DC.B ‘xxx’    ;text

;ALERT resource
 RESOURCE ‘ALRT’ ### ‘name’ [(attr)]
 DC.W   # ;top
 DC.W   # ;left
 DC.W   # ;bottom
 DC.W   # ;right
 DC.W   # ;resource ID of DITL list
 DC.W   # ;stages (see IM for details..)

;DITL resource
 RESOURCE ‘DITL’ ### ‘name’ [(attr)]
 DC.W   # ;# of items - 1

lbl:  DC.L0 ;handle holder
 DC.W   # ;top
 DC.W   # ;left
 DC.W   # ;bottom
 DC.W   # ;right
 DC.B   type;item-type
 DC.B   @2-@1    ;item length (MUST BE EVEN)
@1:DC.B ‘xxx’    ;item

; items must be even length
; item types are as follows
;  control item - control-item + 4
;     button0
;check box1
;radio button  2
;resource 3
;static text8
;edit text16
;icon item32
;quickdraw pict  64
;user item0
; disable item - item + 128
; system icons
;stop   0
;note   1
;alert  2


Community Search:
MacTech Search:

Software Updates via MacUpdate

Google Earth - View and contr...
Google Earth gives you a wealth of imagery and geographic information. Explore destinations like Maui and Paris, or browse content from Wikipedia, National Geographic, and more. Google Earth combines... Read more
QuickBooks R12 - Financial...
QuickBooks helps you manage your business easily and efficiently. Organize your finances all in one place, track money going in and out of your business, and spot areas where you can save. Built for... Read more
Google Earth - View and contr...
Google Earth gives you a wealth of imagery and geographic information. Explore destinations like Maui and Paris, or browse content from Wikipedia, National Geographic, and more. Google Earth combines... Read more
QuickBooks R12 - Financial...
QuickBooks helps you manage your business easily and efficiently. Organize your finances all in one place, track money going in and out of your business, and spot areas where you can save. Built for... Read more
FileZilla 3.24.0 - Fast and reliable FTP...
FileZilla (ported from Windows) is a fast and reliable FTP client and server with lots of useful features and an intuitive interface. Version 3.24.0: New The context menu for remote file search... Read more
Bookends 12.7.8 - Reference management a...
Bookends is a full-featured bibliography/reference and information-management system for students and professionals. Bookends uses the cloud to sync reference libraries on all the Macs you use.... Read more
Duplicate Annihilator 5.8.3 - Find and d...
Duplicate Annihilator takes on the time-consuming task of comparing the images in your iPhoto library using effective algorithms to make sure that no duplicate escapes. Duplicate Annihilator detects... Read more
BusyContacts 1.1.6 - Fast, efficient con...
BusyContacts is a contact manager for OS X that makes creating, finding, and managing contacts faster and more efficient. It brings to contact management the same power, flexibility, and sharing... Read more
MarsEdit 3.7.10 - Quick and convenient b...
MarsEdit is a blog editor for OS X that makes editing your blog like writing email, with spell-checking, drafts, multiple windows, and even AppleScript support. It works with with most blog services... Read more
BusyCal 3.1.4 - Powerful calendar app wi...
BusyCal is an award-winning desktop calendar that combines personal productivity features for individuals with powerful calendar sharing capabilities for families and workgroups. Its unique features... Read more

Super Mario Run dashes onto Android in M...
Super Mario Run was one of the biggest mobile launches in 2016 before it was met with a lukewarm response by many. While the game itself plays a treat, it's pretty hard to swallow the steep price for the full game. With that said, Android users... | Read more »
WarFriends Beginner's Guide: How to...
Chillingo's new game, WarFriends, is finally available world wide, and so far it's a refreshing change from common mobile game trends. The game's a mix of tower defense, third person shooter, and collectible card game. There's a lot to unpack here... | Read more »
Super Gridland (Entertainment)
Super Gridland 1.0 Device: iOS Universal Category: Entertainment Price: $1.99, Version: 1.0 (iTunes) Description: Match. Build. Survive. "exquisitely tuned" - Rock Paper Shotgun No in-app purches, and no ads! | Read more »
Red's Kingdom (Games)
Red's Kingdom 1.0 Device: iOS Universal Category: Games Price: $4.99, Version: 1.0 (iTunes) Description: Mad King Mac has kidnapped your father and stolen your golden nut! Solve puzzles and battle goons as you explore and battle your... | Read more »
Turbo League Guide: How to tame the cont...
| Read more »
Fire Emblem: Heroes coming to Google Pla...
Nintendo gave us our first look at Fire Emblem: Heroes, the upcoming mobile Fire Emblem game the company hinted at last year. Revealed at the Fire Emblem Direct event held today, the game will condense the series' tactical RPG combat into bite-... | Read more »
ReSlice (Music)
ReSlice 1.0 Device: iOS Universal Category: Music Price: $9.99, Version: 1.0 (iTunes) Description: Audio Slice Machine Slice your audio samples with ReSlice and create flexible musical atoms which can be triggered by MIDI notes or... | Read more »
Stickman Surfer rides in with the tide t...
Stickson is back and this time he's taken up yet another extreme sport - surfing. Stickman Surfer is out this Thursday on both iOS and Android, so if you've been following the other Stickman adventures, you might be interested in picking this one... | Read more »
Z-Exemplar (Games)
Z-Exemplar 1.4 Device: iOS Universal Category: Games Price: $3.99, Version: 1.4 (iTunes) Description: | Read more »
5 dastardly difficult roguelikes like th...
Edmund McMillen's popular roguelike creation The Binding of Isaac: Rebirth has finally crawled onto mobile devices. It's a grotesque dual-stick shooter that tosses you into an endless, procedurally generated basement as you, the pitiable Isaac,... | Read more »

Price Scanner via

Twelve South Releases RelaxedLeather Cases fo...
Inspired by the laid-back luxury of burnished leather boots and crafted in rich tones of taupe, herb and marsala, RelaxedLeather cases deliver smart, easy protection for the iPhone 7. Each genuine... Read more
Week’s Best Deal: New 2016 13-inch 2.0GHz Mac...
Amazon has the new 2016 13″ 2.0GHz non-Touch Bar MacBook Pros on sale for a limited time for $225 off MSRP including free shipping: - 13″ 2.0GHz MacBook Pro, Space Gray (MLL42LL/A): $1274.99 $225 off... Read more
Back in stock: Apple refurbished Mac minis fr...
Apple has Certified Refurbished Mac minis available starting at $419. Apple’s one-year warranty is included with each mini, and shipping is free: - 1.4GHz Mac mini: $419 $80 off MSRP - 2.6GHz Mac... Read more
Apple Ranked ‘Most Intimate Brand’
The top ranked ‘”intimate” brands continued to outperform the S&P and Fortune 500 indices in revenue and profit over the past 10 years, according to MBLM’s Brand Intimacy 2017 Report, the largest... Read more
B-Eng introduces SSD Health Check for Mac OS
Fehraltorf, Switzerland based independant Swiss company- B-Eng has announced the release and immediate availability of SSD Health Check 1.0, the company’s new hard drive utility for Mac OS X. As the... Read more
Apple’s Education discount saves up to $300 o...
Purchase a new Mac or iPad using Apple’s Education Store and take up to $300 off MSRP. All teachers, students, and staff of any educational institution qualify for the discount. Shipping is free: -... Read more
4-core 3.7GHz Mac Pro on sale for $2290, save...
Guitar Center has the 3.7GHz 4-core Mac Pro (MD253LL/A) on sale for $2289.97 including free shipping or free local store pickup (if available). Their price is a $710 savings over standard MSRP for... Read more
128GB Apple iPad Air 2, refurbished, availabl...
Apple has Certified Refurbished 128GB iPad Air 2s WiFis available for $419 including free shipping. That’s an $80 savings over standard MSRP for this model. A standard Apple one-year warranty is... Read more
13-inch 2.7GHz Retina MacBook Pro on sale for...
B&H Photo has the 2015 13″ 2.7GHz/128GB Retina Apple MacBook Pro on sale for $100 off MSRP. Shipping is free, and B&H charges NY tax only: - 13″ 2.7GHz/128GB Retina MacBook Pro (MF839LL/A): $... Read more
Laptop Market – Flight To Quality? – The ‘Boo...
Preliminary quarterly PC shipments data released by Gartner Inc. last week reveal an interesting disparity between sales performance of major name PC vendors as opposed to that of less well-known... Read more

Jobs Board

*Apple* macOS Systems Integration Administra...
…most exceptional support available in the industry. SCI is seeking an Junior Apple macOS systems integration administrator that will be responsible for providing Read more
*Apple* Retail - Multiple Positions- Deer Pa...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
*Apple* Retail - Multiple Positions - Apple,...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
*Apple* Technician - nfrastructure (United S...
Let’s Work Together Apple Technician This position is based in Portland, ME Life at nfrastructure At nfrastructure, we understand that our success results from our Read more
*Apple* Mobile Master - Best Buy (United Sta...
**467692BR** **Job Title:** Apple Mobile Master **Location Number:** 000602-Columbia MO-Store **Job Description:** **What does a Best Buy Apple Mobile Master Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.