TweetFollow Us on Twitter

Res Formats
Volume Number:2
Issue Number:6
Column Tag:Resource Roundup

Resource Formats for Asm, RMaker and Lisa

By David Wilson, Personal Concepts

Creating Resources

When I first began to program the Mac, the accepted way to create resources was to define them in a text file (named something like ExampleR.text) using the Lisa Workshop. You then ran the text file through the Lisa's RMaker to compile this high-level "resource language" into the correct format for each resource on disk.

In the Fall of 1984, I began to present Apple's three-day Macintosh Technical Training seminars, designed to teach the basics of Mac programming, and we used this approach to do our in-class programming with the Lisa Pascal Workshop.

Things have gotten more complicated during the last year, with the development of various utility programs to help you create and modify resources, and even decompile them into text files. Furthermore, as the readers of MacTutor long ago recognized, programming directly on the Mac has grown tremendously in popularity. Many programmers still use the text file approach, but use the RMaker that runs on the Mac - one with a slightly different format from that used on the Lisa.

I had to deal with these format differences when we developed Apple's new four-day Macintosh Programing Seminars , using TML Pascal on the Mac for in-class programming. I had to convert my sample programs' source code from the Lisa Workshop to TML Pascal, and finally created the table that follows to help in the process. It is presented here in the hope that you will also find it useful.

"But wait", you cry! "I never use a Lisa - why should I care about it's obscure RMaker format?" Good question. Here are some answers:

1. There are still many Lisa source code samples, from Apple and other sources, that you may want to use. This table will help you painlessly convert them to your Mac development system.

2. There are useful utility programs, such as DialogCreator and REdit that produce text files only in the Lisa format. Again, you must do the conversion.

3. Other utility programs, such as ScrnEdit, will produce text files in either format, but the text files often become a bit garbled in the process - you will need some reference to put things in order, and the table may also be helpful in that case.

Of course, you may have decided not to use text files at all, since resources can be created directly with ResEdit, and "included" with the RMaker or Linker step. The disadvantage to this approach is that you lose the documentation provided by the text files, and you sometimes will have more difficulty in exactly aligning the rectangles for scroll bars, dialog items. etc.

In any case, good luck in your Macintosh programming, and remember Scott Knaster's motto for all Mac programmers: "Everything you know is wrong."

[For those of us fanatics that insist on doing our resources in assembly language, we've also included the assembly formats from an earlier issue of MacTutor, listed below. Following the assembler formats are the RMaker resource formats for both the Macintosh and the Lisa. -Ed.]

Assembly  Resource Formats
;Resource Prototypes for Assembler usage
;Frank Alviani
;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 
;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 Vol. 1 No. 4.






DOCBOX  EQU 0  ;standard doc window
ALERT   EQU 1  ;alert
PLAIN   EQU 2  ;plain
PLAINSHDEQU 3  ;plain with shadow
NOGROWDOC EQU    4 ;doc 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 field!!

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 = 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

RMaker Formats

The chart on the next four pages summarizes the Resource text file formats by the RMaker used by most Macintosh programming systems, including TML Pascal, Consulair C, Megamax C, and the MDS Assembler. The formats are shown in the left-hand column, with comments in the far right-hand column.

The center column shows the differences to be aware of when using the Lisa Pascal Workshop RMaker. In may cases there are no differences, but when there are, they are often subtle and easily missed, so check carefully.

The most subtle difference involves defining scroll bars, with the Macintosh RMaker needing the minimum, then maximum, then initial setting of the thumb. The Lisa RMaker wants miminum, initial, and then maximum. Your scroll bars will not work if you get these confused.

Other problems include the Macintosh RMaker's requirement that you separate items with a truly blank line (containing only a carriage return), and define a string resource with "STR(space)". The Lisa RMaker is more tolerant in these areas.

The format for dialog items (DITL) is that for Macintosh RMaker 2.0D2, shipped with the December 1985 Software Supplement (Volume I, Issue II). The ealier version is similar, but not quite as powerful.

                                 Macintosh            Lisa                          Comments

------------------------------ Bundles of Finder Information -------------------------------------------
JEN4 0                      Creator, Signature, Owner
ICN#                         Finder Icon and Mask
0  129  1  130                                       applic. is 129; document is 130
FREF                                                      File type
0  131  1  132                                       APPL is 131;  SCRN is 132

                                                             Type BNDL
                                                             JEN4 0                       Local ID 0
                                                             2                               2 types follow
                                                             ICN# 2                       2 Iicon lists
                                                             0  129                       local ID 0 goes with ICN# ID 129
                                                             1  130
                                                             FREF 2                       2 file references
                                                             0  131                       local ID 0 goes with FREF ID 131
                                                             1  132

Type JEN4 = STR                                   Creator name
                                 ,0                         Local ID of 0 for ICN# and FREF
This is for your own use                                                                      Any text that you want

Type FREF                 File reference (file type)
                                 ,130                     Resource ID = 130
APPL 0                                                  Application; local ID = 0.

                                 ,131                     Resource ID = 131
SCRN 1                                                  Document file type; local ID = 1.

Type ICN# = GNRL     Icon and Mask for Finder
                                 ,129                     Use IDs from 128 to 255
.H                                                          Hexadecimal data will follow
0001 8000 0002 4000                          16 lines of 16 hex digits for icon
.                                                            .
.                                                            .
000F F000 000F F000                                                                         16  lines of 16 hex digits 
for mask

                                                             Type ICN#
                                                             2                               icon and mask follow
                                                             00018000                 32 lines of 8 hex digits for icon
                                                             ...                              32 lines of 8 hex digits for mask

------------------------ Using CODE resources  from Linker output ------------------------------
Include TML1:T13      Type CODE            From Linker
                                                             Demo9L,0                  Use Demo9L.obj; start with CODE 
---------------------- Controls, such as scroll bars, push buttons, etc. ---------------------------
Type CNTL                                             Control
                                 ,401                     Resource ID
Vertical bar                                           Title; doesn't show on scroll bars
-1 416 273 432        top left bottom right (local coord)
Visible                                                   Can see it right away
16                                                         Scroll bar
0                                                           32-bit reference constant  = 0
0  70  35                                               minimum  maximum  current
                                                             0  35  70                   minimum  current      maximum
----------------------------------- Cursor definition -------------------------------------------------------
Type CURS = GNRL                                 Cursor
.H                                                          Hexadecimal data will follow
2000 ... 0000                                        64 hex digits for cursor data
FFFF ... FFFF              64 hex digits for mask data
0003 0003                                            top left (y x)

                                                             Type CURS
                                                             0003 0003
-------------------------------- Dialog and Alert boxes --------------------------------------------------
Type ALRT                Same                     Alert box
                                 ,503                     Resource ID
70 131 190 381                                    top left bottom right (global)
603                                                       Use DITL number 603
F432                         Stages list  (stages 4321)

Type DLOG                                             Dialog window
                                 ,401                     ID
About T13               Dialog window title
30 12 326 500                                      top left bottom right (global)
Visible  NoGoAway                                 or Invisible, or GoAway
1                                                           Dialog window type
0                                                           Dialog window reference constant
501                                                       Use DITL 501

                                                             Type DLOG
                                                             30 12 326 500
                                                             Visible 1 NoGoAway 01 = window type; 0 = ref constant
                                                             501                           Use DITL 501
                                                             About Demo9            Title

Type DITL                  Same                    Dialog Item List
                                 ,501                     (Optional) name, ID
9                                                           Number of items in list

BtnItem                     BtnItem Enabled     Push button, enabled
85 382 155 465                                    top left bottom right (local)
Put Away                  words to go in button

ChkItem Disabled       ChkItem Disabled    Check box, disabled
185 260 205 420                                  Includes check box and words
Some words              Put to right of check box

EditText Disabled       EditText Disabled  Editable text, with frame
185 10 205 245
Modify these words   Up to 240 characters

IconItem                    IconItem Enabled    Icon, but no mask
12 14 76 78                                          Icon scaled to fit this rectangle
257                                                       Use ICON   ID = 257

PicItem                     PicItem Enabled      QuickDraw Picture (PICT)
35 25 90 110                                        Picture scaled to fit this rectangle
128                                                       Use PICT ID = 128

RadioItem                  RadioItem Enabled  Radio button
245 260 265 420                                  Button and words inside rectangle
1200 Baud                                             Words to right of radio button

ResCItem                   ResCItem Enabled  Scroll bar
0 400 260 415                                      Fit in this rectangle
512                                                       Use CNTL ID = 512

StatText                   StatText Enabled    Static text
210 10 230 245                                    Word-wrapped inside rectangle
Cannot fix this                                       Up to 240 characters

UserItem                   UserItem Enabled   User-defined
------------------------ Icons for menu, dialog box, or in your program ------------------------
Type ICON = GNRL                                  Icon, with no mask
                                 ,257                     Use IDs from 256 to 511
.H                                                          --------                    No .H for Lisa
00FFAA11                                             32 lines of 8 hex digits
----------------------------- Menu titles and items -----------------------------------------------------
Type MENU                Same                     Menu
                                 ,401                     (Optional) name, ID
\14                                                       Hex 14 = ACSII 20 =  
                                 About T13 ^1                                                    Use ICON (256 + 1) = 257 
on the left
                                 (-                         Disabled dotted line
--------------------------- Procedures as resources ----------------------------------------------------
Type PROC                --------------------                             Procedure, such as CDEF, MDEF
                                 ,128                     Resource ID
MyProcedure                                         filename for procedure (from Linker)
-------------------------- A single string (use GetString ROM call) ----------------------------------
Type STR_                Type STR               Use blank after STR for Mac version
This is a message      Up to 255 characters
----------------------------- A list of strings (use GetIndString) ----------------------------------------
Type STR#                List of strings
2                                                           Number so strings in the list
This is the first string                                                                         Item 1
Here is another string                            Item 2
                                                             Type STR#
                                                             This is the first string
                                                             Here is another string
------------------------------------- Window template ----------------------------------------------------
Type WIND                 Same                    Window template
                                 ,401                     Resource ID 
Untitled                     Title
40 64 327 495                                      top left bottom right (global)
Visible  GoAway        or Invisible, or NoGoAway
4                                                           Window type
0                    Reference constant

Community Search:
MacTech Search:

Software Updates via MacUpdate

VOX 2.8.30 - Music player that supports...
VOX just sounds better! The beauty is in its simplicity, yet behind the minimal exterior lies a powerful music player with a ton of features and support for all audio formats you should ever need.... Read more
Default Folder X 5.1.6b3 - Enhances Open...
Default Folder X attaches a toolbar to the right side of the Open and Save dialogs in any OS X-native application. The toolbar gives you fast access to various folders and commands. You just click on... Read more
CleanMyMac 3.8.6 - $39.95
CleanMyMac makes space for the things you love. Sporting a range of ingenious new features, CleanMyMac lets you safely and intelligently scan and clean your entire system, delete large, unused files... Read more
Postbox 5.0.17 - Powerful and flexible e...
Postbox is a new email application that helps you organize your work life and get stuff done. It has all the elegance and simplicity of Apple Mail, but with more power and flexibility to manage even... Read more
Amazon Chime 4.6.5852 - Amazon-based com...
Amazon Chime is a communications service that transforms online meetings with a secure, easy-to-use application that you can trust. Amazon Chime works seamlessly across your devices so that you can... Read more
coconutBattery 3.6.3 - Displays info abo...
With coconutBattery you're always aware of your current battery health. It shows you live information about your battery such as how often it was charged and how is the current maximum capacity in... Read more
VueScan 9.5.82 - Scanner software with a...
VueScan is a scanning program that works with most high-quality flatbed and film scanners to produce scans that have excellent color fidelity and color balance. VueScan is easy to use, and has... Read more
Thunderbird 52.3.0 - Email client from M...
As of July 2012, Thunderbird has transitioned to a new governance model, with new features being developed by the broader free software and open source community, and security fixes and improvements... Read more
Little Snitch 4.0.2 - Alerts you about o...
Little Snitch gives you control over your private outgoing data. Track background activity As soon as your computer connects to the Internet, applications often have permission to send any... Read more
Thunderbird 52.3.0 - Email client from M...
As of July 2012, Thunderbird has transitioned to a new governance model, with new features being developed by the broader free software and open source community, and security fixes and improvements... Read more

The best games we played this week - Aug...
Another busy week has come to a close. We played a lot of excellent games this week and now it's time to look back and reflect on some our favorites. Here are our picks for the week of August 18. [Read more] | Read more »
War Wings beginner's guide - how to...
War Wings is the newest project from well-established game maker Miniclip. It's a World War II aerial dogfighting game with loads of different airplane models to unlock and battle. The game offers plenty of single player and multiplayer action. We... | Read more »
How to win every 2v2 battle in Clash Roy...
2v2 is coming back to Clash Royale in a big way. Although it's only been available for temporary periods of time, 2v2 has seen a hugely positive fan response, with players clamoring for more team-based gameplay. Soon we'll get yet another taste of... | Read more »
Roll to Win with Game of Dice’s new upda...
Joycity’s hit Game of Dice gets a big new update this week, introducing new maps, mechanics, and even costumes. The update sets players loose on an exciting new map, The Cursed Tower, that allows folks to use special Runes mid-match. If you feel... | Read more »
Bottom of the 9th (Games)
Bottom of the 9th 1.0.1 Device: iOS iPhone Category: Games Price: $4.99, Version: 1.0.1 (iTunes) Description: Play the most exciting moment of baseball in this fast-paced dice and card game! | Read more »
The best apps for viewing the solar ecli...
If you somehow missed the news, many parts of the United States will be witness to a total solar eclipse on August 21 for the first time in over 90 years. It'll be possible to see the eclipse in at least some capacity throughout the continental U... | Read more »
The 5 best mobile survival games
Games like ARK: Survival Evolved and Conan Exiles have taken the world of gaming by storm. The market is now flooded with hardcore survival games that send players off into the game's world with nothing but maybe the clothes on their back. Never... | Read more »
Portal Walk (Games)
Portal Walk 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Portal Walk is adventure and relaxing platform game about Eugene. Eugene stuck between worlds and trying to find way back home.... | Read more »
Technobabylon (Games)
Technobabylon 1.0 Device: iOS Universal Category: Games Price: $4.99, Version: 1.0 (iTunes) Description: City of Newton, 2087. Genetic engineering is the norm, the addictive Trance has replaced almost any need for human interaction,... | Read more »
5 reasons why 2v2 is the best mode in Cl...
Supercell has been teasing fans with 2v2 windows that allow players to team up for limited periods of time. The Summer of 2v2 was just this past July, but players are already clamoring for more of that sweet, sweet team-based action. The fans have... | Read more »

Price Scanner via

Back To School With The Edge Desk All-in-one...
Back to school is just around the corner, and the ergonomically correct Edge Desk all-in-one portable kneeling desk is ideal for students living in dorms and small apartments, Edge Desk features:... Read more
Norton Core Secure Wi-Fi Router Now Available...
First introduced at the 2017 Consumer Electronics Show (CES), Norton Core, a secure, high-performance Wi-Fi router, fundamentally changed the concept of Wi-Fi routers by making security the primary... Read more
ViewSonic Adds New 27-inch 4K UHD Monitor to...
ViewSonic Corp. has introduced the VP2785-4K, a 27-inch 4K UHD (3840×2160) monitor that delivers precise and consistent color representation and performance to ensure incredible image quality. Built... Read more
Apple now offering Certified Refurbished 2017...
Apple is now offering Certified Refurbished 2017 27″ iMacs for up to $350 off original MSRP. Apple’s one-year warranty is standard, and shipping is free. The following models are available: – 27″ 3.... Read more
13-inch 2.3GHz MacBook Pros on sale for $100...
Amazon has the new 2017 13″ 2.3GHz MacBook Pros on sale today for $100 off MSRP, each including free shipping: – 13″ 2.3GHz/128GB Space Gray MacBook Pro (MPXQ2LL/A): $1199.99 $100 off MSRP – 13″ 2.... Read more
Clearance 2016 13-inch MacBook Airs available...
B&H Photo has clearance 2016 13″ MacBook Airs available for up to $200 off original MSRP. Shipping is free, and B&H charges NY & NJ sales tax only: – 13″ 1.6GHz/128GB MacBook Air (MMGF2LL... Read more
Clearance 21-inch and 27-inch iMacs available...
B&H Photo has clearance 21″ and 27″ Apple iMacs available for up to $500 off original MSRP, each including free shipping plus NY & NJ sales tax only: – 27″ 3.3GHz iMac 5K: $1799 $500 off... Read more
New iOS 11 Productivity Features Welcome But...
The iOS community is in late summer holding mode awaiting the September arrival of the iPhone 8 and iOS 11. iOS 11 public betas have been available for months — number six was released this week —... Read more
Samsung Electronics Launches New Portable SSD...
Samsung Electronics America, Inc. has announced the launch of Samsung Portable SSD T5 – its newest portable solid state drive (PSSD) that raises the bar for the performance of external memory... Read more
TrendForce Reports YoY Gain of 3.6% for 2Q17...
Market research firm TrendForce reports that the global notebook shipments for this second quarter registered a sequential quarterly increase of 5.7% and a year-on-year increase of 3.6%, totaling 39.... Read more

Jobs Board

Development Operations and Site Reliability E...
Development Operations and Site Reliability Engineer, Apple Payment Gateway Job Number: 57572631 Santa Clara Valley, California, United States Posted: Jul. 27, 2017 Read more
Frameworks Engineering Manager, *Apple* Wat...
Frameworks Engineering Manager, Apple Watch Job Number: 41632321 Santa Clara Valley, California, United States Posted: Jun. 15, 2017 Weekly Hours: 40.00 Job Summary Read more
Development Operations and Site Reliability E...
Development Operations and Site Reliability Engineer, Apple Payment Gateway Job Number: 57572631 Santa Clara Valley, California, United States Posted: Jul. 27, 2017 Read more
Frameworks Engineering Manager, *Apple* Wat...
Frameworks Engineering Manager, Apple Watch Job Number: 41632321 Santa Clara Valley, California, United States Posted: Jun. 15, 2017 Weekly Hours: 40.00 Job Summary Read more
Business Development Manager - *Apple* Medi...
Job Summary Apple Music is a single, intuitive app that...- all in one place. You can stream any Apple Music song, playlist or album, and download it Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.