TweetFollow Us on Twitter

Icon Converter
Volume Number:2
Issue Number:1
Column Tag:Assembly Lab

Icon Converter Shows Disk I/O

By Chris Yerga, School of Engineering, UC California at Berkely, MacTutor Contributing Editor

Chris Yerga wins $50 for the outstanding program of the month with this feature article. Congratulations!

In the second issue of MacTutor, David Smith presented a program that I valued as one of my most useful utilities -- the Icon Converter. This program would take an icon generated by Apple's Icon Editor and convert it to an MDS compatable text file, making it far easier to create icon resources for assembly programs. However, the Icon Converter didn't give a catalog of files , didn't display the icons on the screen, and worse of all, was written in MS Basic. This most likely presented little trouble to the majority of users, but due to the chaotic organization of my disks, I found it frustrating.

This month's column covers the design of an assembly language Icon Converter application that includes these features. As well as developing a valuable utility, the column will explain some of the programming techniques involved in disk I/O using SFGetFile in such an application. The reader is invited to review my "Micro-Finder" utility in MacTutor, Vol. 1 No. 7 which covered an introduction to the standard file package from assembly. Remember, programs which follow the strict Apple guidelines will work with the new standard file package under Finder 5.0. So as not to be redundant, I will assume that the reader understands the basic concepts of assembly language programming covered in previous issues.

Nature of Bit Maps

First, we must recognize that an icon fits into the general category of BitMap. A BitMap is a QuickDraw data structure that represents a rectangular arrangement of bits. The bits themselves define an image simply by representing whether the corresponding pixel is on or off. The structure of a BitMap is that of a record with three fields. The PASCAL TYPE definition is as follows:

 baseAddr : QDPtr;
 rowBytes : INTEGER;
 bounds : Rect

The first field is baseAddr, a pointer to the actual bit image in memory. The next field is rowBytes, an integer that tells how wide (in bytes) each row of the image is. The last field is bounds; it is a rectangle describing the usable area of the bit image. This allows the programmer to define BitMaps which have widths that do not lie on byte boundaries. A sample BitMap is shown in Figure #1; however, realize that this is not an Icon BitMap. Whereas an Icon BitMap is 32 by 32 pixels, the sample BitMap is only 8 by 8 pixels.

Now, given the information that an icon is always 32 by 32 bits in size, we can see that the rowBytes and bounds fields of all icon BitMaps are the same. To calculate rowBytes, we take the number of bits, or pixels, horizontally and divide by 8 to determine how many bytes are needed to hold them. 8 divides evenly into 32 to give us a rowBytes value of 4. The bounds rectangle needed to enclose the 32 by 32 bits of the icon is simply 0,0,32,32. So the only data in an icon's BitMap that changes is the actual bit image of the icon.

It follows that in order to store an icon on a disk, the bit image is the only data that needs to be written. Examining files produced by Apple's old icon editor clearly shows that this is the scheme they used. The net result is that it is extremely easy to make use of files saved in this format.

File Manager Reviewed

In order for a program to access data stored in a file on disk, it must use the File Manager. The File Manager employs a register based calling scheme to pass parameters between itself and the calling program. As has been mentioned in previous installments, address register A0 points to a data structure in memory upon entry to a register based routine - IOParamBlock is used in this case. The proper fields of the IOParamBlock are filled with data, A0 is loaded, and then the desired trap is called. A digram showing which IOParamBlock fields are appropriate for the various File Manager calls is included in figure #2.

Before any data can be read from or written to a file, the file must be opened. This allows the File Manager to locate the file and create an access path to the file. In order for the file to be opened, the program must allocate 522 bytes of memory for the access path buffer and pass it to the _Open routine. After the file is opened, a path reference number, not to be confused with a volume reference number, is returned. This reference number is then used to refer to the file in following File Manager calls.

The program will go about reading an icon file in the following manner. First, the SFGetFile package will be called to get the filename of the file to be loaded. Ironically, Apple's Icon Editor breaks with their own standards in that it doesn't assign a filetype or creator to the files it creates. It leaves these fields cleared! Our program tells the SFGetFile package to list all files with NIL values for filetype and creator. As it turns out, Icon Editor files are usually the only ones that fit this criterion, but occasionally some strange file will find its way into the SFGetFile list. (Anyone unfamiliar with the workings of the SFGetFile package should read MacTutor Vol 1 #7, where I covered the Standard FIle package in more detail than is appropriate here.)

Once the desired file is known, it must be opened. Figure 2 shows us which parameters must be passed. IOCompletion will be NIL, because we don't want the File Manager to call a routine after it is done; rather, we want it to return control to us. The filename, refnum, and version number are given to us by the SFGetFile call, and are passed unchanged. The value 1 is stored in the IOPermission field to specify read-only access to the file. Finally, a pointer to the access path buffer is passed. The _Open trap is called and assuming no errors were flagged, the file is now ready to be read.

Reading Disk Files

Once the file is opened, the program is free to read the data from it. The File Manager stores the data it reads in the memory block pointed to by the ioBuffer field of the ioParamBlock. Since the BasAddr field of an icon's BitMap points to its bit image, which is what we want to load, we set ioBuffer equal to BasAddr. ReqCount tells the File Manager how many bytes to read from the file. Multiplying the BitMap's rowBytes value (4) by its number of rows vertically (32) gives the value 128 for this field. The ioPosMode and ioPosOffset fields are both cleared, because the special positioning features of the File Manager are not needed in this case. The _Read trap is then invoked. The input operation is now finished, and the _Close trap is called.

Icon Displayed via CopyBits

It is helpful to see the icons on the screen after they have been loaded. This is achieved through the CopyBits procedure, which can be used to transfer a BitMap to the screen. Its PASCAL interface follows:

 (srcBits,dstBis: BitMap; srcRect,
 dstRect: Rect;  mode: INTEGER;
  maskRgn: RgnHandle);

The first parameter passed to CopyBits is a pointer to the source BitMap, which is our icon BitMap. This is followed by a pointer to the destination BitMap. The destination BitMap will be that of the current GrafPort, which is stored beginning at 2 bytes past the beginning of the GrafPort data. After this is pushed, we push srcRect, which describes the rectangular region of the source BitMap to be copied. The entire BitMap is to be copied, of course, so 0,0,32,32 is sent. dstRect is next, and for it we pass a 32 by 32 rectangle describing where on the screen we want the icon displayed. The next word of data determines which transfer mode is used. Zero is used to set the standard copy mode. The last parameter is a handle to a region to which the BitMap should be masked, and is useless in this instance. NIL is passed. _CopyBits is then called and the icon is displayed inside DestRect.

Now that the icon is loaded and displayed, it's binary bit image must be converted to ASCII data for the MDS file. The program allocates 2K of memory to house the ASCII data before it is written to the destination file. The conversion process is a simple loop that stores "DC.B" at the beginning of each line, converts 8 bytes of hex data to ASCII, stores this ASCII data, stores a carriage return for the end of the line, and loops. The main part of the this loop is the hex to decimal conversion routine, HexToAscii, which takes a hex byte in D0 and converts it to an ASCII word which is returned in D1. It's code is straightforward and commented, and I recommend examining it, as the functional value of the program is based on it.

The final step of the conversion process is writing the MDS file out to disk. First, we must call the SFPutFile trap to get the desired filename from the user. Next, the file must be created on the volume, a task handled by the File Manager's _Create trap (appropriately enough...). As usual, ioCompletion is NIL. The file name and volume reference number, which specifies the volume that will contain the new file, are given to us by the SFPutFile. Finally, we must specify a 1 byte version number for the file. As we are unconcerned with version numbers, this field will contain NIL. After this is done, we call the _Create trap and continue with the next step.

As in reading, we must first open the destination file before we can perform any I/O. Since we have just set the ioCompletion, ioNamePtr, ioVRefNum, and ioVersNum fields, we do not need to do so again. The value 1 is stored in the IOPermission field to specify read-only access to the file. A pointer to the 522 byte access path buffer is passed, and the file is _Opened.

Writing to Disk Files

Now we are ready to do the actual writing. The first step is to calculate the length of the ASCII data in our 2K buffer. This is necessary because the actual data will not fill the entire buffer. After this value has been found, it is stored in the ioReqCount field, informing the File Manager of how much data needs to be written. Next, the base address of the buffer is stored in ioBuffer. Finally, ioPosMode and ioPosOffset are cleared to disable these features of the File Manager, and the _Write trap is called.

Setting Type and Creator Bytes

We now have an file of ASCII data on the disk, but we need to give it filetype and creator tags in order for MDS to recognize it. The filetype will be TEXT, and the creator will be EDIT. The trap that allows us to set these stamps is _SetFileInfo. Unfortunately, however, _SetFileInfo also sets about a dozen other pieces of file information, and requires that they be specified as well. The solution is to first call _GetFileInfo, which reads the current information fields from the file and stores them in the ioParamBlock. In essence, we are letting _GetFileInfo do the tedious business of passing the other parameters to _SetFileInfo. So we call _GetFileInfo, set the filetype and creator, and then call _SetFileInfo.

We are now finished writing the file, so we _Close it. The final step is to call _FlushVol to insure that everything gets updated on the volume.

It is quite possible that an I/O error will occur during one of the above operations. In such an event, the File Manager returns an error code in ioResult. A copy of this error code is also placed in D0. After every I/O operation, the program invokes a macro which checks D0 for an error code. If one is found, it displays a dialog box alerting the user of an error and aborts to the main menu.

Dialog Box Makes it User Friendly

The above steps are the heart of the conversion section of the program. The external features, such as the appearance of the program and so on are fairly simple, involving a single dialog box to support the features described above. Menus have been omitted not to save us from writing extra code, but rather to create a more efficient interface. It is my belief that menus are useful only in applications involving several possible categories of actions that the user may take (ie: Filing commands, Editing commands, Font commands, etc). In such an application, menus serve to organize the possible choices and thus make them more manageable to the user. Whereas in our case, the application serves but one purpose, and consequently, all the possible actions the user may take fall under one category.

I hope that this article and the source code will help explain the basic workings of the File Manager. If not, perhaps the program itself will be useful. If even that is of no use to you, then perhaps you shouldn't have read this far. [But if you did, you've learned a lot! Thanks Chris for a great column. -Ed.]

;    Icon Converter 3.0
; © Copyright 1985 by Chris Yerga
;for MacTutor

;  Declare external labels


.TRAP _MakeFile  $A008  ;The _Create trap
     ;which is not in
     ;the MDS trap file

;   Define Macros  

MACRO IsError  =
 CMP.W  #0,D0    ;Check for nonzero D0
 BEQ    @2
 BRA    ioErr    ;pop up the error dialog

MACRO   Center String,MidPT,Y  =

 CLR.W  -(SP)    ;Save room for INTEGER                        
 ;width of string
 PEA  '{String}'
 CLR.L  D3;Clear the high word of D3 ;so the DIVU works
 MOVE.W (SP)+,D3 ;Get the width (in pixels)                    
 ;in D3
 DIVU #2,D3 ;Divide by 2
 MOVE.L #{MidPT},D4
 SUB.W  D3,D4  ;Subtract (Width/2) from                        
 ;103 to center text
 MOVE.W D4,-(SP) ;Push the X coordinate
 MOVE.W #{Y},-(SP) ;Push the Y coordinate
 _MoveTo;Position the pen
 PEA  '{String}'
 | ;End of Macro
;  Local Constants  

AllEvents EQU  $0000FFFF ; Mask for FlushEvents
MaxEvents EQU  12
DWindLenEQU $AA  ; The size of a Dialog                        

;  Start of Main Program  

_Debugger ;Should never get here.  Is called
 ;when there is a problem with the
 ;memory manager.
CLR.L -(SP)     ;Save room for DIalogPtr
MOVE.W  #150,-(SP) ;The ResID of the error dialog
PEAErrDialog(A5) ;Where to put the DialogRec
MOVE.L  #-1,-(SP);Put it in front, please...
LEAErrDHandle,A2 ;Save handle, but keep it
MOVE.L  (SP),(A2);on the stack
_DrawDialog ;Draw the dialog..
MOVE.L  (A2),-(SP) ;Set the Dialog to the current _SetPort     
Center  Sorry!  That operation was interrupted,150,20
Center  by an I/O error. Check the disk            and,150,32
Center  try again.,150,44
MOVE.L  ErrDHandle,-(SP)  ;Get rid of the dialog
MOVE.L  MainPort,-(SP)  ;restore the main port
_SetPort;as the active port
BRAMain ;abort to the main menu

MOVEM.L D0-D7/A0-A6,-(SP)
 ;The standard-issue routine
LEASAVEREGS,A0   ;which saves the registers
MOVE.L  A6,(A0)  
MOVE.L  A7,4(A0)
;  Initialize the ROM routines  

PEA-4(A5) ;QD Global ptr
_InitGraf ;Init QD global
_InitFonts;Init font manager
_InitWindows;Init Window Manager
_InitMenus;Guess got it!
CLR.L -(SP) ;Standard SysErr/DS dialog
_InitDialogs;Init Dialog Manger
_TEInit ;Init ROM Text edit
MOVE.L  #AllEvents,D0;And flush ALL previous
_InitCursor ;Get the standard arrow
PEAScreen ;Clear the screen
;  Allocate some Memory  

MOVE.L  #80,D0 ;Get 80 Bytes for IOParamBlock
IsError ;Handle any error
LEAIOParamBlock,A1 ;Save the Ptr
MOVE.L  A0,(A1)
MOVE.L  #522,D0  ;Get 522 Bytes for access _NewPtr             
 ;path buffer
IsError ;Handle any error
LEAAPBuffer,A1   ;Save the Ptr
MOVE.L  A0,(A1)
MOVE.L  #128,D0  ;Get 128 Bytes for Icon Data
IsError ;Do the error thing...
LEAIconBitMap,A1 ;Save the Ptr
MOVE.L  A0,(A1)
MOVE.L  #128,D0  ;Get 128 Bytes for Mask Data
IsError ;Do the error thing...
LEAMaskBitMap,A1 ;Save the Ptr
MOVE.L  A0,(A1)
MOVE.L  #2048,D0 ;Get 2K bytes for Target _NewPtr              
 ;file buffer
LEAConvertBuf,A1 ;save the ptr
MOVE.L  A0,(A1)
;  Set up the Dialog Box  

CLR.L -(SP) ;Save room for DIalogPtr
MOVE.W  #128,-(SP) ;The ResID of the dialog
PEAMainDialog(A5);Where to put the DialogRec
MOVE.L  #-1,-(SP);Put it in front, please...
LEAMainDHandle,A2;Save handle, but keep it
MOVE.L  (SP),(A2);on the stack
_DrawDialog ;Draw the dialog..
MOVE.L  (A2),-(SP) ;Set the Dialog to the _SetPort             
 ;current GrafPort
PEAIconFrame;Outline the ICON box
PEAMaskFrame;Ditto for the MASK
MOVE.W  #7,-(SP) ;Athens
MOVE.W  #18,-(SP);18 Pt
Center  Icon Converter 3.0,200,30
MOVE.W  #2,-(SP) ;Geneva
MOVE.W  #12,-(SP);12 Pt
Center  ©1985 by Chris Yerga for   MacTutor,200,45
CLR.W -(SP) ;Chicago
PEAMainPort ;Save the GrafPtr for the Main port
;  Main Event Loop  

CLR.L -(SP) ;NIL for FilterProc
PEAItemHit;VAR ItemHit
MOVE  ItemHit,D0 ;Get the Item #
CMP.B #1,D0 ;Open an Icon?
CMP.B #2,D0 ;Open a Mask?
CMP.B #3,D0 ;Standard Mask?
CMP.B #4,D0 ;Do the conversion?
CMP.B #5,D0 ;Help?
CMP.B #6,D0 ;Quit?
BRAMain ;loop til we get a good event
MOVE.L  (A0),A6
MOVE.L  4(A0),A7
MOVEM.L (SP)+,D0-D7/A0-A6

BSRGetFile;Get filename
BEQMain ;user hit <Cancel>
LEAIconBitMap,A3 ;set up params for read
BSRReadIcon ;read the file
BSRPlotIcon ;draw the icon
BSRGetFile;Get filename
BEQMain ;user hit cancel
LEAMaskBitMap,A3 ;set up for read...
BSRReadIcon ;read the file
BSRPlotMask ;display the mask

MOVE.L  MaskBitMap,A0;Get Ptr to Bitmap data
MOVE.L  #31,D0   ;loop 32 times
MOVE.L  #$FFFFFFFF,(A0)+       ;fill the mask with black
DBRA    D0,FillMask;loop until we're done
MOVE.L  ConvertBuf,A2;Fill the file buffer with
MOVE.L  IconBitMap,A3;the icon definition
MOVE.W  #$0D0D,(A2)+ ;stick in a few cr's for                  
MOVE.L  MaskBitMap,A3; & the mask definition
BSRPutFile;Get the filename for save
BEQMain ;user cancelled out
MOVE.L  A2,D2    ;Save the buffer Ptr
MOVE.L  IOParamBlock,A2     ;Get Ptr in A2
CLR.L 12(A2);No completion routine
LEAGFileName,A0  ;ioNamePtr
MOVE.L  A0,18(A2);save it in IOPB
MOVE.W  GetVRef,22(A2)  ;volume ref #
CLR.B 26(A2);version # = 0 
_MakeFile ;generate the file
MOVE.B  #2,27(A2);write-only permission
MOVE.L  APBuffer,28(A2) ;pointer to our access MOVE.L    A2,A0 
 ;path buffer
_Open   ;open the data fork of the file
MOVE.L  ConvertBuf,D1;Get the Base address of                  
 ;the buffer
SUB.L D1,D2 ;use it to calculate the ;length of buffer
MOVE.L  ConvertBuf,32(A2);Buffer ptr
MOVE.L  D2,36(A2);write the whole buffer
CLR.W 44(A2);standard positioning
CLR.L 46(A2);with no offset
_Write  ;write the buffer
CLR.W 28(A2);no directory index
MOVE.L  A2,A0    ;Get the current file info
_GetFileInfo;so we don't have to set ;everything
MOVE.L  #'TEXT',32(A2)  ;file type = TEXT
MOVE.L  #'EDIT',36(A2)  ;creator   = EDIT
MOVE.L  A2,A0    ;write the info
MOVE.L  A2,A0    ;Close out the file
MOVE.L  A2,A0    ;& flush the volume

MOVE.L  #15,D2   ;loop 16 times (16 lines of code)
MOVE.L  #7,D3    ;put 8 bytes of data in each line
MOVE.L  LineStart,(A2)+ ;Put the 'DC.B  ' at the 
MOVE.B  LineStart+4,(A2)+ ;beginning of each line
MOVE.B  (A3)+,D0 ;Get next byte of data
BSRHexToAscii    ;get ascii word in D1
MOVE.B  #'$',(A2)+ ;precede digit with $ for hex
MOVE.W  D1,(A2)+ ;store ascii equivalent of byte
MOVE.B  #',',(A2)+ ;store comma separator
DBRA  D3,@3 ;loop till we've done 8 bytes
SUBA  #1,A2 ;replace the last comma w/ cr
MOVE.W  #$200D,(A2)+
DBRA  D2,NextRow  ;loop till we've done 16 lines RTS           
      ;of code
;  HexToAscii routine -> converts a hex byte to an  
;ASCII word
;on entry:
;D0 = Hex byte to be converted
;on return:
;D1 = ASCII word result
;uses D0,D1,D4,A0

MOVE.B  D0,D4  ;save copy of byte
LSR#4,D0;Get the high nibble
ANDI  #$0F,D0    ;mask out all extraneous bits
LEAByteTable,A0  ;Get base address of table
MOVE.B  (A0,D0),D1 ;Move 1st ascii byte into D1
ASL#8,D1;move the byte to the proper position
ANDI  #$0F,D4    ;get the low nibble
MOVE.B  (A0,D4),D0 ;Get 2nd ascii byte
OR.W  D0,D1 ;store 2nd byte in word

DC.B    '0123456789ABCDEF'
CLR.L -(SP)      ;Save room for DIalogPtr
MOVE.W  #129,-(SP) ;The ResID of the help dialog
PEAHelpDialog(A5)  ;Where to put the DialogRec
MOVE.L  #-1,-(SP)  ;Put it in front, please...
LEAHelpDHandle,A2  ;Save handle, but keep it
MOVE.L  (SP),(A2)    ;on the stack
_DrawDialog    ;Draw the dialog..
MOVE.L  (A2),-(SP) ;Set the Dialog to the current _SetPort     
Center  The Icon Converter is based on an          MS-Basic Program,224,20
Center  written by David Smith and presented in          MacTutor Vol. 
1 #2,224,32
Center  that takes a file generated by the Apple         Icon Editor 
Center  converts it to an MDS format TEXT type           file to save 
Center  programmer from the tedious task of        typing in the HEX 
Center  by hand.,224,80
Center  This program is an adaptation of the             original,224,97
Center  Icon Converter in assembly language.,224,109
BSRAwaitOK;wait for the user to click OK
PEAScreen ;clear the dialog box
MOVE.L  HelpDHandle,-(SP)           ;Redraw the dialog
Center  Clicking in either of the Open buttons           allows the user 
Center  open a file generated by the old icon editor           for either,224,32
Center  the icon or mask respectively.,224,44
Center  Clicking in the None button tells the Icon             Editor/Converter,224,61
Center  to generate a standard mask for the icon         (all black).,224,73
Center  Clicking in the Convert button converts the            displayed 
Center  and mask to an MDS compatable  file.,224,102
BSRAwaitOK;wait for the user to click OK
PEAScreen ;clear the dialog box
MOVE.L  HelpDHandle,-(SP)  ;Redraw the dialog
Center  Subscribe to MacTutor - the no fluff             Macintosh programming,224,20
Center  journal - to learn how to write programs         like this in,224,32
Center  Assembly Language on the Mac.,224,44
Center  $24 per year will keep you on top of             Macintosh programming,224,61
Center  in Assembly  Language/Basic/C/Forth/Pascal and         many,224,73
Center  other languages!,224,85
Center  MacTutor  P.O. Box 846  Placentia Ca             92670,224,102
Center  or call (714) 993-9939,224,119
MOVE.L  HelpDHandle,-(SP) ;Get rid of the dialog
MOVE.L  MainPort,-(SP)   ;restore the main port
_SetPort;as the active port

CLR.L -(SP) ;NIL for FilterProc
PEAItemHit;VAR ItemHit
MOVE  ItemHit,D0 ;Get the Item #
CMP.B #1,D0 ;was it OK?
; ReadIcon routine:
;on entry A3 contains a ptr to the bitmap which
;will receive the data.

MOVE.L  IOParamBlock,A2 ;Get Ptr in A2
CLR.L 12(A2);No completion routine
LEAGFileName,A0  ;ioNamePtr
MOVE.L  A0,18(A2);save it in IOPB
MOVE  GetVRef,22(A2) ;the volume refNum
MOVE.B  GetVers,26(A2)  ;the file version #
MOVE.B  #1,27(A2);read-only permission
MOVE.L  APBuffer,28(A2)   ;the access path buffer
MOVE.L  A2,A0    ;Ptr to IOPB
_Open   ;Open the file
IsError ;handle any error
MOVE.L  (A3),32(A2);data buffer
MOVE.L  #128,36(A2);# of bytes to read
CLR.W 44(A2);standard positioning
CLR.L 46(A2);no offset
_Read   ;read the data
IsError ;hope for no errors
MOVE.L  A2,A0    ;close the file
MOVE.W  #82,-(SP);x Coordinate
MOVE.W  #187,-(SP) ;y Coordinate
PEA'PROMPT' ;Prompt (Unused)
MOVE.L  #0,-(SP) ;NIL for ProcPtr
MOVE.W  #1,-(SP)  ;We only want 1 file type listed
PEATypeList ;The TypeList
MOVE.L  #0,-(SP) ;NIL for dlgHook
PEASFReply;The Reply Record
MOVE.W  #2,-(SP) ;Routine Selector for _Pack3                  
LEASFReply,A0    ;check for successful call
CMP.B #0,(A0)
MOVE.W  #104,-(SP) ;x coordinate
MOVE.W  #190,-(SP) ;y coordinate
PEA'Save MDS file as:'  ;Prompt
PEA'Untitled.ICON' ;Default name
CLR.L -(SP) ;standard dialog box
PEASFReply;the reply record
MOVE.W  #1,-(SP) ;Routine selector for SFPutFile
LEASFReply,A0    ;check for successful call
CMP.B #0,(A0)
PEACurPort;get the GrafPtr in CurPort
MOVE.L  CurPort,A0 ;put it in A0
PEAIconBitMap    ;source
PEASourceRect    ;source rect
PEAIconRect ;dest rect
CLR.W -(SP) ;SrcCopy mode
CLR.L -(SP) ;no mask region
PEACurPort;get the GrafPtr in CurPort
 MOVE.L CurPort,A0 ;put it in A0
PEAMaskBitMap    ;source
PEASourceRect    ;source rect
PEAMaskRect ;dest rect
CLR.W -(SP) ;SrcCopy mode
CLR.L -(SP) ;no mask region
;  Program Variables  

SaveRegs: DCB.L 2,0;For saving the SP etc..
MainDHandle:DC.L 0 ;For the main dialog                        
HelpDHandle:DC.L 0 ;For the Help dialog Handle
ErrDHandle: DC.L 0 ;For the ioErr dialog                       
ItemHit:DC.W0  ;For _ModalDialog
IOParamBlock:  DC.L0
APBuffer: DC.L 0

;   That's all....Enjoy!  


/Output IconVert





;  IconVert 3.0  
;  by Chris Yerga for MacTutor
;          RESOURCES


DC.B  'IconVert 3.0 - Chris Yerga 8/4/85'

DC.L  'BDOG';Name of Signature
DC.W  0,1
DC.L  'FREF';FREF mappings
DC.W  0 ;1 mapping (1-1 = 0)
DC.W  0,128
DC.L  'ICN#';ICN# mappings
DC.W  0 ;1 mapping (1-1 = 0)
DC.W  0,128

DC.B  'APPL',0,0,0

RESOURCE 'ICN#' 128'Application Icon'
INCLUDE Martini.ICON ;put your icon here

RESOURCE 'DLOG' 128  'Appl Dialog'
DC.W  29,56,170,456;BoundsRect
DC.W  1 ;Dialog Box w/ Outline
DC.B  1,1 ;Visible
DC.B  0,0 ;NoGoAway
DC.L  0 ;Refcon...
DC.W  128 ;DITL ResID
DC.B  'BOX' ;Title (Unused)
RESOURCE 'DLOG' 129 'Help Dialog'
DC.W  175,32,330,480 ;BoundsRect
DC.W  1 ;Dialog box w/ outline
DC.B  1,1 ;Visible
DC.B  0,0 ;NoGoAway
DC.L  0 ;Refcon...
DC.W  129 ;DITL ResID
DC.B  'HELP';Title (not used)
RESOURCE 'DLOG' 150 'ioErr Dialog'
DC.W  135,106,205,406;BoundsRect
DC.W  1 ;Dialog box w/ outline
DC.B  1,1 ;Visible
DC.B  0,0 ;NoGoAway
DC.L  0 ;RefCon
DC.W  150 ;DITL ResID
DC.B  'ERR' ;Title
DC.W  7 ;8 Items (8-1=7)

* Item #1 *
DC.L  0 ;Handle Holder
DC.W  60,94,77,144 ;Bounds
DC.B  4 ;Button
DC.B  'Open';Text w/ length byte

* Item #2 *
DC.L  0 ;Handle Holder
DC.W  60,256,77,306;Bounds
DC.B  4 ;Button
DC.B  'Open';Text w/ length byte

* Item #3 *
DC.L  0 ;Handle Holder
DC.W  79,256,96,306;Bounds
DC.B  4 ;Button
DC.B  'None';Text w/ length byte

* Item #4 *
DC.L  0 ;Handle Holder
DC.W  118,40,137,140 ;Bounds
DC.B  4 ;Button
DC.B  'Convert ' ;Text w/ length byte

* Item #5 *
DC.L  0 ;Handle Holder
DC.W  118,150,137,250;Bounds
DC.B  4 ;Button
DC.B  'Help';Text w/ length byte

* Item #6 *
DC.L  0 ;Handle Holder
DC.W  118,260,137,360;Bounds
DC.B  4 ;Button
DC.B  'Quit';Text w/ length byte

* Item #7 *
DC.L  0 ;Handle Holder
DC.W  98,154,113,190 ;Bounds
DC.B  136 ;Button
DC.B  'Icon';Text w/ length byte

* Item #8 *
DC.L  0 ;Handle Holder
DC.W  98,210,113,246 ;Bounds
DC.B  136 ;static text
DC.B  'Mask';Text w/ length byte
RESOURCE 'DITL' 129 'Help Items'
DC.W  0 ;1 Item (1-1=0)
* Item #1 *
DC.L  0 ;handle holder
DC.W  135,199,152,249;BoundsRect
DC.B  4 ;Button
DC.B  'OK';title
RESOURCE 'DITL' 150 'Err Items'
DC.W  0 ;1 Item (1-1=0)
* Item #1 *
DC.L  0 ;handle holder
DC.W  51,120,68,180;BoundsRect
DC.B  4 ;Button
DC.B  'Oh no!'   ;title
STRING_FORMAT 0  ;set things back to normal

Community Search:
MacTech Search:

Software Updates via MacUpdate

Sound Studio 4.10.0 - Robust audio recor...
Sound Studio lets you easily record and professionally edit audio on your Mac. Easily rip vinyls and digitize cassette tapes, or record lectures and voice memos. Prepare for live shows with live... Read more
Sparkle Pro 4.0 - Visual website creator...
Sparkle Pro will change your mind if you thought building websites wasn't for you. Sparkle is the intuitive site builder that lets you create sites for your online portfolio, team or band pages, or... Read more
Dropbox 140.4.1951 - Cloud backup and sy...
Dropbox for Mac is a file hosting service that provides cloud storage, file synchronization, personal cloud, and client software. It is a modern workspace that allows you to get to all of your files... Read more
FotoMagico 6.0.5 - Powerful slideshow cr...
FotoMagico lets you create professional slideshows from your photos and music with just a few, simple mouse clicks. It sports a very clean and intuitive yet powerful user interface. High image... Read more
Remotix 6.4.2 - Access all your computer...
Remotix is a fast and powerful application to easily access multiple Macs (and PCs) from your own Mac. Features: Complete Apple Screen Sharing support - including Mac OS X login, clipboard... Read more
Microsoft Office 365, 2019 16.57 - Popul...
Microsoft Office 365. The essentials to get it all done. Unmistakably Office, designed for Mac Get started quickly with new, modern versions of Word, Excel, PowerPoint, Outlook and OneNote-... Read more
War Thunder - Multiplayer war...
In War Thunder, aircraft, attack helicopters, ground forces and naval ships collaborate in realistic competitive battles. You can choose from over 1,500 vehicles and an extensive variety of combat... Read more
RoboForm 9.2.8 - Password manager; syncs...
RoboForm is a password manager that offers one-click login, mobile syncing, easy form filling, and reliable security. Password Manager. RoboForm remembers your passwords so you don't have to! Just... Read more
Adobe Photoshop 23.1.1 - Professional im...
You can download Photoshop for Mac as a part of Creative Cloud for only $20.99/month (or $9.99/month if you have purchased an earlier software version). Adobe Photoshop is a recognized classic of... Read more
VirtualBox 6.1.32 - x86 virtualization s...
VirtualBox is a family of powerful x86 virtualization products for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers... Read more

Latest Forum Discussions

See All

‘Ark Legends’ Gives Players a Chance to...
It’s Airpods and Amazon gift cards galore as Melting Games opens pre-registration for Ark Legends. The upcoming mobile RPG is giving away tons of in-game goodies such as gold, energy, iron core, hero summon chest and rare iron core to players who... | Read more »
‘Nickelodeon Extreme Tennis’ Out Now on...
Nickelodeon Extreme Tennis () from Old Skull Games and Nickelodeon is this week’s new Apple Arcade release. Nickelodeon Extreme Tennis features characters from old and new Nickelodeon shows including SpongeBob, TMNT, and many more. The tennis game... | Read more »
SwitchArcade Round-Up: ‘RPGolf Legends’,...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for January 20th, 2022. In today’s article, we’ve got a massive amount of new releases to check out. We’ve got summaries of all of them, from heaven to hell. We also have the lists of... | Read more »
‘Zed Blade ACA NEOGEO’ Review – Well, It...
SNK’s NEOGEO platform played host to a great many classics, both famous and under-the-radar. The Metal Slug games. The King of Fighters series. Magician Lord. Shock Troopers. Sengoku 3. NEO Turf Masters. Fatal Fury. Samurai Shodown. Twinkle Star... | Read more »
‘Inua – A Story in Ice and Time’ is a Un...
One thing I know about ARTE from their output on mobile over the years is that they love collaborating with really interesting and unique studios to put out really interesting and unique gaming experiences. This is true yet again with the latest... | Read more »
Out Now: ‘Angry Birds Journey’, ‘RPG Dic...
Each and every day new mobile games are hitting the App Store, and so each week we put together a big old list of all the best new releases of the past seven days. Back in the day the App Store would showcase the same games for a week, and then... | Read more »
SwitchArcade Round-Up: ‘Banjo-Kazooie’ C...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for January 19th, 2022. After a couple of big-pants articles in recent days, today is somewhat of a lighter one. We’ve got a little news to go over, a small handful of new releases to... | Read more »
‘Yu-Gi-Oh! Master Duel’ Is Out Now on PC...
Yu-Gi-Oh! Master Duel was confirmed for all consoles including Switch, PS5, and more in addition to PC and mobile platforms last year. Since then, Yu-Gi-Oh! | Read more »
SwitchArcade Round-Up: Reviews Featuring...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for January 18th, 2022. We’ve got another batch of reviews today, with our pal Mikhail covering the lamentable Grand Theft Auto: The Trilogy Definitive Edition. Has it been whipped into... | Read more »
‘Total War: Medieval II’ Coming to iOS a...
After a bit of teasing, Feral Interactive just announced that it is bringing Total War: Medieval II to iOS and Android. This will be the developer’s first release since the brilliant Alien Isolation. Check out my review of the iOS version here. | Read more »

Price Scanner via

In stock and on sale! 16″ 10-Core M1 Pro MacB...
Amazon has new 16″ 10-Core/512GB M1 Pro MacBook Pros in stock today and on sale for $50 off MSRP including free shipping. Their prices are the lowest available for new M1 Pro 16″ MacBook Pro from any... Read more
Deal Alert!: 14″ M1 Pro with 10-Core CPU in s...
Amazon has the new 14″ M1 Pro MacBook Pro with a 10-Core CPU and 16-Core GPU in stock today and on sale for $2299.99 including free shipping. Their price is $200 off Apple’s standard MSRP, and it’s... Read more
Apple has 24-inch M1 iMacs (8-Core CPU/8-Core...
Apple has restocked a wide array of 24-inch M1 iMacs with 8-Core CPUs and 8-Core GPUs in their Certified Refurbished store. Models are available starting at only $1269 and range up to $260 off... Read more
Select 24″ M1 iMacs are on sale for $100 off...
Sales of Apple’s new 24″ M1 iMacs have been rare since its introduction, perhaps due to global supply issues. However, B&H is offering a $100 discount on select 24″ iMacs, and they’re in stock... Read more
M1 Mac minis are back in stock today at Apple...
Apple has M1-powered Mac minis available in their Certified Refurbished section starting at only $589 and up to $140 off MSRP. Each mini comes with Apple’s one-year warranty, and shipping is free: –... Read more
B&H has M1-powered Mac minis on sale for...
B&H Photo has Apple’s Mac minis with M1 Apple Silicon CPUs in stock today and on sale for $50-$100 off MSRP, starting at $649. Free 1-2 shipping is free to many US addresses. Their prices are... Read more
New Amazon sale: Apple’s 13″ M1 MacBook Airs...
Amazon has Apple 13″ M1 MacBook Airs on sale for $100 off MSRP, starting at only $899. Their prices are the lowest available for new MacBook Airs today. Stock may come and go, so check their site... Read more
Get an Apple Watch Series 7 for $50 off MSRP,...
Amazon has Apple Watch Series 7 models on sale for $50 off MSRP including free shipping. Their prices are the lowest available for Apple Watch Series 7 models today: – 41mm Apple Watch Series 7 GPS... Read more
Here are the details of Apple’s 2022 Educatio...
Need a new Apple Mac or iPad for school? Whether you’re a student, teacher, or staff member, you can use your .edu email address when ordering at Apple Education to take up to $400 off the price of a... Read more
Amazon is blowing out 2020 21″ iMacs for only...
Amazon has clearance 2020 21″ iMacs (2.3GHz Dual-Core i5, 8GB RAM, 256GB SSD) on sale right now for $599.99 including free shipping. Original MSRP for this model was $1099. Amazon expects delivery in... Read more

Jobs Board

Registered Nurse (RN) Employee Health PSJH -...
…is calling for a Registered Nurse (RN) Employee Health PSJH to our location in Apple Valley, CA.** We are seeking a Registered Nurse (RN) Employee Health PSJH to be Read more
Systems Administrator - Pearson (United State...
…and troubleshoot Windows operating systems (workstation and server), laptop computers, Apple iPads, Chromebooks and printers** + **Administer and troubleshoot all Read more
IT Assistant Level 1- IT Desktop Support Anal...
…providing tier-1 or better IT help desk support in a large Windows and Apple environment * Experience using IT Service Desk Management Software * Knowledge of IT Read more
Human Resources Business Partner PSJH - Provi...
…**is calling a** **Human Resources Business Partner, PSJH** **to our location in Apple Valley, CA.** **Applicants that meet qualifications will receive a text with Read more
Manager Community Health Investment Programs...
…is calling a Manager Community Health Investment Programs PSJH to our location in Apple Valley, CA.** **Qualified candidates will be invited to do a self-paced video Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.