CHANGING YOUR ICONS by Richard Karsmakers and "Strike-a-Light" People who use MacIntosh or Amiga computers are probably quite familiar with the fact that each program can be specified by an icon of its own. A game program can actually be signified by a joystick or even a small 'high-res' screen taken from the program. The only limitation, most of the time, is that the icon can only use one color and the background color. The ST's possibilities with regard to this changing of the icons are far more limited: There are only five possible icons, excluding the Atari sign in the "About" option of the desktop. These can, however, be changed. The principle is extremely simple. You simply make a bit pattern of an icon and calculate that into numbers. You then start hunting for those numbers and that's all. A new icon can simply be loaded onto that space, somewhere in RAM. A program to achieve this, written for Data Becker's "Profimat", is the following (written by Robert Heessels): TEXT clr.l -(sp) ; supervisor mode move #$20,-(sp) trap #1 addq.l #6,sp move.l d0,d7 move.l #0,$4d2 ; disable "STARTGEM" interrupt move.l #$d000,a6 ; hunt for Icon start address move.l #$20000,a1 ; and the ending address zoek: cmp.l #$80000263,(a6) ; this is a bit pattern in the ; disk drive Icon beq zoek_einde ; found? Then stop search! add.l #2,a6 cmp.l a1,a6 ; end address reached? bne zoek ; no - continue bra einde ; jump to end zoek_einde: sub.l #180,a6 ; start of all icons move #0,-(sp) ; Open file for new icon data move.l #naam,-(sp) move #$3d,-(sp) ; Open file trap #1 addq.l #8,sp tst d0 ; Error? bmi einde move d0,d6 move.l a6,-(sp) ; load file at icon data move.l #1280,-(sp) ; file length (5*256) move d6,-(sp) move #$3f,-(sp) ; Read trap #1 add.l #12,sp einde: ; user mode move.l d7,-(sp) move #$20,-(sp) trap #1 addq.l #6,sp clr.l -(sp) ; terminate trap #1 DATA naam: dc.b 'a:\new_icon.icn',0 END On the disk, you'll find a sample Icon file as well as a program called GEMSTART that is needed in the AUTO folder if you want to start it from on system bootup. Simply copy the GEMSTART program in the auto folder and make sure the actual program is in the root directory. If the program would be NEW_ICON.PRG, you'd have to create a file called GEMSTART.INF on the disk, containing the following line: A:NEW_ICON.PRG Of course, you can also use folders, etc., or other disk drives. Any other program using GEM can also be started up automatically using this program. But now more about the icon format. Each icon is made up of a mask and a 'sprite'. Each one of these is represented 128 bytes: 4 bytes wide and 32 bytes high. Horizontally, the bits are used to specify if bits are on or off. You'll just have to look at it binary. A bit pattern like this would create a 'sprite' like a chessboard: %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %11111111000000001111111100000000 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 %00000000111111110000000011111111 Get it? It's that easy! The only problem is that the icons are always located on a different location in memory (this changes if you use an AUTO folder or not). That's why a search routine has been included in the source file from a few pages back. By the way, if the program need not be started from an AUTO folder, the GEMSTART program can be omitted. Originally published in ST NEWS Volume 2 Issue 4.