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

Dropbox 22.4.24 - Cloud backup and synch...
Dropbox is an application that creates a special Finder folder that automatically syncs online and between your computers. It allows you to both backup files and keep them up-to-date between systems... Read more
Posterino 3.3.5 - Create posters, collag...
Posterino offers enhanced customization and flexibility including a variety of new, stylish templates featuring grids of identical or odd-sized image boxes. You can customize the size and shape of... Read more
Kodi 17.1. - Powerful media center tool...
Kodi (was XBMC) is an award-winning free and open-source (GPL) software media player and entertainment hub that can be installed on Linux, OS X, Windows, iOS, and Android, featuring a 10-foot user... Read more
Kodi 17.1. - Powerful media center tool...
Kodi (was XBMC) is an award-winning free and open-source (GPL) software media player and entertainment hub that can be installed on Linux, OS X, Windows, iOS, and Android, featuring a 10-foot user... Read more
Bookends 12.8 - Reference management and...
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
Apple iTunes 12.6 - Play Apple Music and...
Apple iTunes lets you organize and stream Apple Music, download and watch video and listen to Podcasts. It can automatically download new music, app, and book purchases across all your devices and... Read more
Default Folder X 5.1.4 - Enhances Open a...
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
Amazon Chime 4.1.5587 - 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
CrossOver 16.2 - Run Windows apps on you...
CrossOver can get your Windows productivity applications and PC games up and running on your Mac quickly and easily. CrossOver runs the Windows software that you need on Mac at home, in the office,... Read more
Adobe Creative Cloud - Access...
Adobe Creative Cloud costs $19.99/month for a single app, or $49.99/month for the entire suite. Introducing Adobe Creative Cloud desktop applications, including Adobe Photoshop CC and Illustrator CC... Read more

The best deals on the App Store this wee...
Deals, deals, deals. We're all about a good bargain here on 148Apps, and luckily this was another fine week in App Store discounts. There's a big board game sale happening right now, and a few fine indies are still discounted through the weekend.... | Read more »
The best new games we played this week
It's been quite the week, but now that all of that business is out of the way, it's time to hunker down with some of the excellent games that were released over the past few days. There's a fair few to help you relax in your down time or if you're... | Read more »
Orphan Black: The Game (Games)
Orphan Black: The Game 1.0 Device: iOS Universal Category: Games Price: $4.99, Version: 1.0 (iTunes) Description: Dive into a dark and twisted puzzle-adventure that retells the pivotal events of Orphan Black. | Read more »
The Elder Scrolls: Legends is now availa...
| Read more »
Ticket to Earth beginner's guide: H...
Robot Circus launched Ticket to Earth as part of the App Store's indie games event last week. If you're not quite digging the space operatics Mass Effect: Andromeda is serving up, you'll be pleased to know that there's a surprising alternative on... | Read more »
Leap to victory in Nexx Studios new plat...
You’re always a hop, skip, and a jump away from a fiery death in Temple Jump, a new platformer-cum-endless runner from Nexx Studio. It’s out now on both iOS and Android if you’re an adventurer seeking treasure in a crumbling, pixel-laden temple. | Read more »
Failbetter Games details changes coming...
Sunless Sea, Failbetter Games' dark and gloomy sea explorer, sets sail for the iPad tomorrow. Ahead of the game's launch, Failbetter took to Twitter to discuss what will be different in the mobile version of the game. Many of the changes make... | Read more »
Splish, splash! The Pokémon GO Water Fes...
Niantic is back with a new festival for dedicated Pokémon GO collectors. The Water Festival officially kicks off today at 1 P.M. PDT and runs through March 29. Magikarp, Squirtle, Totodile, and their assorted evolved forms will be appearing at... | Read more »
Death Road to Canada (Games)
Death Road to Canada 1.0 Device: iOS Universal Category: Games Price: $7.99, Version: 1.0 (iTunes) Description: Get it now at the low launch price! Price will go up a dollar every major update. Update news at the bottom of this... | Read more »
Bean's Quest Beginner's Guide:...
Bean's Quest is a new take on both the classic platformer and the endless runner, and it's free on the App Store for the time being. Instead of running constantly, you can't stop jumping. That adds a surprising new level of challenge to the game... | Read more »

Price Scanner via

Apple Chip Foundry TSMC To Begin A11 System-o...
Digitimes’ Steve Shen is reporting today that according to the Chinese-language Economic Daily News (EDN), chipmaker and major Apple supplier foundery Taiwan Semiconductor Manufacturing Company (TSMC... Read more
MacX MediaTrans 3.5 iOS Data Transfer Spring...
MacXDVD Software has announced general availability of the latest MacX MedTrans 3.5, featuring a new user interface (UI). MacX MediaTrans is ann iPhone manager that enables free data transfer between... Read more
Regular Price $19.95 DupeZap 4 Finder For OS...
Hyperbolic Software has announced the release of DupeZap 4.0.2, their modern duplicate finder developed exclusively for macOS. DupeZap 4 is an utility for Mac owners seeking to reclaim disk space... Read more
B-Eng Releases SSD Health Check for MVNe for...
Fehraltorf, Switzerland based B-Eng has announced the release and immediate availability of SSD Health Check for MVNe for MacBook Pro, their app that delivers important data and insights for MVNe... Read more
Apple iMacs on sale for up to $200 off MSRP,...
B&H Photo has 21″ and 27″ Apple iMacs on sale for up to $200 off MSRP, each including free shipping plus NY sales tax only: - 27″ 3.3GHz iMac 5K: $2099 $200 off MSRP - 27″ 3.2GHz/1TB Fusion iMac... Read more
Apple Certified Refurbished iMacs available f...
Apple has Certified Refurbished 2015 21″ & 27″ iMacs available for up to $350 off MSRP. Apple’s one-year warranty is standard, and shipping is free. The following models are available: - 21″ 3.... Read more
1.4GHz Mac mini on sale for $419, $80 off MSR...
B&H Photo has the 1.4GHz Mac mini on sale for $80 off MSRP including free shipping plus NY sales tax only: - 1.4GHz Mac mini: $419.88 $80 off MSRP Read more
Apple refurbished Mac minis available for up...
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
Updated iPad Price Trackers
Scan our Apple iPad (and iPod touch) Price Trackers for the latest information on sales, bundles, and availability on systems from Apple’s authorized internet/catalog resellers. We update the... Read more
12-inch 32GB Space Gray iPad Pro on sale for...
B&H Photo has 12″ Space Gray 32GB WiFi Apple iPad Pros on sale for $50 off MSRP including free shipping. B&H charges sales tax in NY only: - 12″ Space Gray 32GB WiFi iPad Pro: $749 $50 off... Read more

Jobs Board

Fulltime aan de slag als shopmanager in een h...
Ben jij helemaal gek van Apple -producten en vind je het helemaal super om fulltime shopmanager te zijn in een jonge en hippe elektronicazaak? Wil jij werken in Read more
*Apple* Mobile Master - Best Buy (United Sta...
**492889BR** **Job Title:** Apple Mobile Master **Location Number:** 000886-Norwalk-Store **Job Description:** **What does a Best Buy Apple Mobile Master do?** Read more
*Apple* Mobile Master - Best Buy (United Sta...
**492472BR** **Job Title:** Apple Mobile Master **Location Number:** 000470-Seattle-Store **Job Description:** **What does a Best Buy Apple Mobile Master do?** Read more
*Apple* Mobile Master - Best Buy (United Sta...
**492562BR** **Job Title:** Apple Mobile Master **Location Number:** 000853-Jackson-Store **Job Description:** **What does a Best Buy Apple Mobile Master do?** 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
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.