home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / ST_NEWS / STN_02_4.MSA / DATA_DOC32 < prev    next >
Text File  |  1987-06-11  |  5KB  |  141 lines

  1. üCHANGING YOUR ICONS Çby Richard Karsmakers and "Strike-a-Light"
  2.  
  3. People  who use MacIntosh or Amiga computers are  probably  quite 
  4. familiar  with the fact that each program can be specified by  an 
  5. icon  of its own.  A game program can actually be signified by  a 
  6. joystick  or  even  a  small 'high-res'  screen  taken  from  the 
  7. program.  The only limitation, most of the time, is that the icon 
  8. can only use one color and the background color.
  9.  
  10. The ST's possibilities with regard to this changing of the  icons 
  11. are  far  more  limited:  There are  only  five  possible  icons, 
  12. excluding  the Atari sign in the "About" option of  the  desktop. 
  13. These can, however, be changed.
  14.  
  15. The principle is extremely simple.  You simply make a bit pattern 
  16. of  an  icon  and calculate that into  numbers.  You  then  start 
  17. hunting for those numbers and that's all.  A new icon can  simply 
  18. be loaded onto that space, somewhere in RAM. A program to achieve 
  19. this,  written  for Data Becker's "Profimat",  is  the  following 
  20. (written by Robert Heessels):
  21.  
  22.  
  23.  TEXT
  24.  
  25.  clr.l -(sp)                       ; supervisor mode
  26.  move #$20,-(sp)
  27.  trap #1
  28.  addq.l #6,sp
  29.  move.l d0,d7
  30.  move.l #0,$4d2                    ; disable "STARTGEM" interrupt
  31.  move.l #$d000,a6                  ; hunt for Icon start address
  32.  move.l #$20000,a1                 ; and the ending address
  33. zoek:
  34.  cmp.l #$80000263,(a6)             ; this is a bit pattern in the
  35.                                    ; disk drive Icon
  36.  beq zoek_einde                    ; found? Then stop search!
  37.  add.l #2,a6
  38.  cmp.l a1,a6                       ; end address reached?
  39.  bne zoek                          ; no - continue
  40.  bra einde                         ; jump to end
  41. zoek_einde:
  42.  sub.l #180,a6                     ; start of all icons
  43.  
  44.  
  45.  move #0,-(sp)                     ; Open file for new icon data
  46.  move.l #naam,-(sp)
  47.  move #$3d,-(sp)                   ; Open file
  48.  trap #1
  49.  addq.l #8,sp
  50.  tst d0                            ; Error?
  51.  bmi einde
  52.  move d0,d6
  53.  
  54.  move.l a6,-(sp)                   ; load file at icon data
  55.  move.l #1280,-(sp)                ; file length (5*256)
  56.  move d6,-(sp)
  57.  move #$3f,-(sp)                   ; Read
  58.  trap #1
  59.  add.l #12,sp
  60.  
  61. einde:                             ; user mode
  62.  move.l d7,-(sp)
  63.  move #$20,-(sp)
  64.  trap #1
  65.  addq.l #6,sp
  66.  
  67.  clr.l -(sp)                       ; terminate
  68.  trap #1
  69.  
  70.  DATA
  71.  
  72. naam: dc.b 'a:\new_icon.icn',0
  73.  
  74.  END
  75.  
  76.  
  77. On the disk,  you'll find a sample Icon file as well as a program 
  78. called GEMSTART that is needed in the AUTO folder if you want  to 
  79. start it from on system bootup.  Simply copy the GEMSTART program 
  80. in  the  auto folder and make sure the actual program is  in  the 
  81. root directory.  If the program would be NEW_ICON.PRG, you'd have 
  82. to create a file called GEMSTART.INF on the disk,  containing the 
  83. following line:
  84.  
  85. A:NEW_ICON.PRG
  86.  
  87.  
  88.  
  89. Of course,  you can also use folders, etc., or other disk drives. 
  90. Any other program using GEM can also be started up  automatically 
  91. using this program.
  92.  
  93. But  now more about the icon format.  Each icon is made up  of  a 
  94. mask and a 'sprite'.  Each one of these is represented 128 bytes: 
  95. 4 bytes wide and 32 bytes high.  Horizontally,  the bits are used 
  96. to specify if bits are on or off.  You'll just have to look at it 
  97. binary.  A  bit pattern like this would create a 'sprite' like  a 
  98. chessboard:
  99.  
  100.  %11111111000000001111111100000000
  101.  %11111111000000001111111100000000
  102.  %11111111000000001111111100000000
  103.  %11111111000000001111111100000000
  104.  %11111111000000001111111100000000
  105.  %11111111000000001111111100000000
  106.  %11111111000000001111111100000000
  107.  %11111111000000001111111100000000
  108.  %00000000111111110000000011111111
  109.  %00000000111111110000000011111111
  110.  %00000000111111110000000011111111
  111.  %00000000111111110000000011111111
  112.  %00000000111111110000000011111111
  113.  %00000000111111110000000011111111
  114.  %00000000111111110000000011111111
  115.  %00000000111111110000000011111111
  116.  %11111111000000001111111100000000
  117.  %11111111000000001111111100000000
  118.  %11111111000000001111111100000000
  119.  %11111111000000001111111100000000
  120.  %11111111000000001111111100000000
  121.  %11111111000000001111111100000000
  122.  %11111111000000001111111100000000
  123.  %11111111000000001111111100000000
  124.  %00000000111111110000000011111111
  125.  %00000000111111110000000011111111
  126.  %00000000111111110000000011111111
  127.  %00000000111111110000000011111111
  128.  %00000000111111110000000011111111
  129.  %00000000111111110000000011111111
  130.  %00000000111111110000000011111111
  131.  %00000000111111110000000011111111
  132.  
  133. Get it?  It's that easy!  The only problem is that the icons  are 
  134. always located on a different location in memory (this changes if 
  135. you use an AUTO folder or not).  That's why a search routine  has 
  136. been included in the source file from a few pages back.
  137.  
  138. By  the  way,  if the program need not be started  from  an  AUTO 
  139. folder, the GEMSTART program can be omitted.
  140.  
  141.