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

Microsoft Office 2016 16.11 - Popular pr...
Microsoft Office 2016 - Unmistakably Office, designed for Mac. The new versions of Word, Excel, PowerPoint, Outlook, and OneNote provide the best of both worlds for Mac users - the familiar Office... Read more
Adobe Photoshop CC 2018 19.1.2 - Profess...
Photoshop CC 2018 is available as part of Adobe Creative Cloud for as little as $19.99/month (or $9.99/month if you're a previous Photoshop customer). Adobe Photoshop CC 2018, the industry standard... Read more
Adobe Dreamweaver CC 2018 -...
Dreamweaver CC 2018 is available as part of Adobe Creative Cloud for as little as $19.99/month (or $9.99/month if you're a previous Dreamweaver customer). Adobe Dreamweaver CC 2018 allows you to... Read more
Adobe Flash Player - Plug-in...
Adobe Flash Player is a cross-platform, browser-based application runtime that provides uncompromised viewing of expressive applications, content, and videos across browsers and operating systems.... Read more
Drive Genius 5.2.0 - $79.00
Drive Genius features a comprehensive Malware Scan. Automate your malware protection. Protect your investment from any threat. The Malware Scan is part of the automated DrivePulse utility. DrivePulse... Read more
MegaSeg 6.0.6 - Professional DJ and radi...
MegaSeg is a complete solution for pro audio/video DJ mixing, radio automation, and music scheduling with rock-solid performance and an easy-to-use design. Mix with visual waveforms and Magic... Read more
ffWorks 1.0.7 - Convert multimedia files...
ffWorks (was iFFmpeg), focused on simplicity, brings a fresh approach to the use of FFmpeg, allowing you to create ultra-high-quality movies without the need to write a single line of code on the... Read more
Dash 4.1.5 - Instant search and offline...
Dash is an API documentation browser and code snippet manager. Dash helps you store snippets of code, as well as instantly search and browse documentation for almost any API you might use (for a full... Read more
Evernote 7.0.3 - Create searchable notes...
Evernote allows you to easily capture information in any environment using whatever device or platform you find most convenient, and makes this information accessible and searchable at anytime, from... Read more
jAlbum Pro 15.3 - Organize your digital...
jAlbum Pro has all the features you love in jAlbum, but comes with a commercial license. You can create gorgeous custom photo galleries for the Web without writing a line of code! Beginner-friendly... Read more

Latest Forum Discussions

See All

Around the Empire: What have you missed...
Oh hi nice reader, and thanks for popping in to check out our weekly round-up of all the stuff that you might have missed across the Steel Media network. Yeah, that's right, it's a big ol' network. Obviously 148Apps is the best, but there are some... | Read more »
All the best games on sale for iPhone an...
It might not have been the greatest week for new releases on the App Store, but don't let that get you down, because there are some truly incredible games on sale for iPhone and iPad right now. Seriously, you could buy anything on this list and I... | Read more »
Everything You Need to Know About The Fo...
In just over a week, Epic Games has made a flurry of announcements. First, they revealed that Fortnite—their ultra-popular PUBG competitor—is coming to mobile. This was followed by brief sign-up period for interested beta testers before sending out... | Read more »
The best games that came out for iPhone...
It's not been the best week for games on the App Store. There are a few decent ones here and there, but nothing that's really going to make you throw down what you're doing and run to the nearest WiFi hotspot in order to download it. That's not to... | Read more »
Death Coming (Games)
Death Coming Device: iOS Universal Category: Games Price: $1.99, Version: (iTunes) Description: --- Background Story ---You Died. Pure and simple, but death was not the end. You have become an agent of Death: a... | Read more »
Hints, tips, and tricks for Empires and...
Empires and Puzzles is a slick match-stuff RPG that mixes in a bunch of city-building aspects to keep things fresh. And it's currently the Game of the Day over on the App Store. So, if you're picking it up for the first time today, we thought it'd... | Read more »
What You Need to Know About Sam Barlow’s...
Sam Barlow’s follow up to Her Story is #WarGames, an interactive video series that reimagines the 1983 film WarGames in a more present day context. It’s not exactly a game, but it’s definitely still interesting. Here are the top things you should... | Read more »
Pixel Plex Guide - How to Build Better T...
Pixel Plex is the latest city builder that has come to the App Store, and it takes a pretty different tact than the ones that came before it. Instead of being in charge of your own city by yourself, you have to work together with other players to... | Read more »
Fortnite Will Be Better Than PUBG on Mob...
Before last week, if you asked me which game I prefer between Fortnite Battle Royale and PlayerUnknown’s Battlegrounds (PUBG), I’d choose the latter just about 100% of the time. Now that we know that both games are primed to hit our mobile screens... | Read more »
Siege of Dragonspear (Games)
Siege of Dragonspear 2.5.12 Device: iOS Universal Category: Games Price: $9.99, Version: 2.5.12 (iTunes) Description: Experience the Siege of Dragonspear, an epic Baldur’s Gate tale, filled with with intrigue, magic, and monsters.... | Read more »

Price Scanner via

Sunday Sales: $200 off 13″ Touch Bar MacBook...
Amazon has new 2017 13″ 3.1GHz Touch Bar MacBook Pros on sale this weekend for $200 off MSRP, each including free shipping: – 13″ 3.1GHz/256GB Space Gray MacBook Pro (MPXV2LL/A): $1599.99 $200 off... Read more
B&H drops prices on 15″ MacBook Pros up t...
B&H Photo has dropped prices on new 2017 15″ MacBook Pros, now up to $300 off MSRP and matching Adorama’s price drop yesterday. Shipping is free, and B&H charges sales tax for NY & NJ... Read more
Apple restocks Certified Refurbished 2017 13″...
Apple has restocked Certified Refurbished 2017 13″ 2.3GHz MacBook Pros for $200-$230 off MSRP. A standard Apple one-year warranty is included with each MacBook, models receive new outer cases, and... Read more
13″ Space Gray Touch Bar MacBook Pros on sale...
Adorama has new 2017 13″ Space Gray Touch Bar MacBook Pros on sale for $150 off MSRP. Shipping is free, and Adorama charges sales tax in NY & NJ only: – 13″ 3.1GHz/256GB Space Gray MacBook Pro (... Read more
Best deal of the year on 15″ Apple MacBook Pr...
Adorama has New 2017 15″ MacBook Pros on sale for up to $300 off MSRP. Shipping is free, and Adorama charges sales tax in NJ and NY only: – 15″ 2.8GHz Touch Bar MacBook Pro Space Gray (MPTR2LL/A): $... Read more
Save $100-$150+ on 13″ Touch Bar MacBook Pros...
B&H Photo has 13″ Touch Bar MacBook Pros on sale for $100-$150 off MSRP. Shipping is free, and B&H charges sales tax for NY & NJ residents only: – 13″ 3.1GHz/256GB Space Gray MacBook Pro... Read more
Current deals on 27″ Apple iMacs, models up t...
B&H Photo has 27″ iMacs on sale for up to $150 off MSRP. Shipping is free, and B&H charges sales tax for NY & NJ residents only: – 27″ 3.8GHz iMac (MNED2LL/A): $2149 $150 off MSRP – 27″ 3... Read more
Thursday Deal: 13″ 2.3GHz MacBook Pro for $11...
B&H Photo has the 13″ 2.3GHz/128GB Space Gray MacBook Pro on sale for $100 off MSRP. Shipping is free, and B&H charges sales tax for NY & NJ residents only: – 13-inch 2.3GHz/128GB Space... Read more
How to save $100-$190 on 10″ & 12″ iPad P...
Apple is now offering Certified Refurbished 2017 10″ and 12″ iPad Pros for $100-$190 off MSRP, depending on the model. An Apple one-year warranty is included with each model, and shipping is free: –... Read more
Silver 12″ 1.3GHz MacBook on sale at B&H...
B&H Photo has the 2017 12″ 1.3GHz Silver MacBook on sale for $1399.99 including free shipping plus sales tax for NY & NJ residents only. Their price is $200 off MSRP, and it’s the lowest... Read more

Jobs Board

Art Director, *Apple* Music + Beats1 Market...
# Art Director, Apple Music + Beats1 Marketing Design Job Number: 113258081 Culver City, California, United States Posted: 07-Mar-2018 Weekly Hours: 40.00 **Job Read more
*Apple* Solution Consultant - Apple (United...
# Apple Solution Consultant Job Number: 113569564 Williston, Vermont, United States Posted: 06-Mar-2018 Weekly Hours: 40.00 **Job Summary** Are you passionate about Read more
*Apple* Media Products (AMP) Engineering Man...
# Apple Media Products (AMP) Engineering Manager Job Number: 86497853 Santa Clara Valley, California, United States Posted: 07-Mar-2018 Weekly Hours: 40.00 **Job Read more
QA Automation Engineer, *Apple* Pay - Apple...
# QA Automation Engineer, Apple Pay Job Number: 113202642 Santa Clara Valley, California, United States Posted: 02-Mar-2018 Weekly Hours: 40.00 **Job Summary** At Read more
Lead *Apple* Solution Consultant - Apple (U...
# Lead Apple Solution Consultant Long Island NY Job Number: 113486035 Long Island City, New York, United States Posted: 07-Mar-2018 Weekly Hours: 40.00 **Job Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.