home *** CD-ROM | disk | FTP | other *** search
/ Old Hackers Atari User Group Newsletter / Old_Hackers_Atari_User_Group_Newsletter_OHJF96A.atr / hmagnify.txt < prev    next >
Text File  |  2023-02-26  |  7KB  |  1 lines

  1.                 ()()()()¢¢                MAGNIFY¢    Brought to you by OL' HACKERS.  The¢ program "MAGNIFY.COM" will be found on¢ OHAUG  Jan/Feb 1996  newsletter  disk.¢ The programmer is unkown.¢¢ WHAT DOES IT DO?¢¢     MAGNIFY  is a program which allows¢ you to take any graphics 8 or graphics¢ 7  1/2 (Micro-Painter format) file and¢ dump it to your Epson (or  compatible)¢ printer.   There  are  several   extra¢ features in this program which make it¢ different from the many public  domain¢ screen dump utilities around.¢¢ BACKGROUND!¢¢     I  had  started  out  with  such a¢ program (KWIKDUMP), and started adding¢ extra  features.   In  the end, it was¢ becoming   too   slow,  since  it  was¢ written in  Atari  Basic,  and  I  was¢ unable  to  add  the  last few special¢ features, so I decided  to  write  the¢ whole thing in machine language.¢¢ PROBLEMS FACED.¢¢     One  problem  I  had with KWIKDUMP¢ was that it simply dumped  the  screen¢ to  the  printer   with   no   editing¢ capabilities.   Any  1-bits   in   the¢ picture  printed  as  black and 0-bits¢ printed as white.   Depending  on  the¢ choice  of  colour  registers  in  the¢ picture,  the  printed image could end¢ up   looking  like  a   negative.   To¢ resolve this in my modified version of¢ KWIKDUMP,  I created a routine to flip¢ all the bits in the picture.¢     Another problem  was  the  printed¢ pictures  were  too  small,  taking up¢ less than 1/4 of the page.   I  wanted¢ them  to  be  closer to a full page in¢ size.  My first cut at magnifying  the¢ picture was to take each bit and print¢ it as a 2x2 square of  bits  with  the¢ same value.  Each 1-bit would become 2¢ 1-bits side by side which were printed¢ twice.   This  worked fine, but led to¢ rather blocky pictures.  It  also  did¢ not allow for the fact that graphics 7¢ 1/2 pictures have four colours, and it¢ would  be nice to try to differentiate¢ between them.¢¢ WHAT I DID!¢¢     I decided to try to  magnify  each¢ pair  of  bits together, calling it 2-¢ bit  horizontal  magnification.   Each¢ pair   of   bits   beside  each  other¢ horizontally on the screen (1 pixel in¢ graphics  7  1/2)  are  treated as one¢ entity to be magnified.  A bit pattern¢ consisting  of  a  1  followed  by a 0¢ (i.e.  10)  becomes  1010.   This  bit¢ pattern would be  printed  two  times,¢ thus    supplying     the     vertical¢ magnification.     This    helped   to¢ distinguish between the 4  colours  of¢ the original picture, since a 10 or 01¢ pattern would  look  gray  instead  of¢ black.¢     However,  this  method  still  had¢ some    problems   in   the   vertical¢ direction.  I therefore decided to add¢ another routine which would treat each¢ pair of bits in the vertical direction¢ as  one  entity   for   magnification,¢ calling      it     2-bit     vertical¢ magnification.  Instead of taking a  1¢ and 0 vertically and making them 1100,¢ I made  them  1010  vertically.   This¢ helped  to  alleviate  some   of   the¢ problems.¢¢ COMBINING TWO METHODS.¢¢     Finally, I created a routine which¢ implemented both 2-bit magnifications,¢ calling  it   2-bit   horizontal   and¢ vertical magnification.¢     I  was  now able to print pictures¢ the  way  I  wanted,  using  the  much¢ modified KWIKDUMP, with  a  number  of¢ machine language subroutines stored as¢ strings   doing   the  magnifying  and¢ flipping.  However, I could  not  tell¢ what  the  picture  was  going to look¢ like until I printed it in all of  the¢ different  modes.   Why not magnify it¢ on the screen, and scroll  around  the¢ picture,    thus    deciding     which¢ magnification technique was best!¢¢ BRINGING IN ASSEMBLY!¢¢     Goodbye  basic  and hello assembly¢ language!  MAGNIFY was born.   Writing¢ it was a great learning experience.  I¢ had  to  be  able  to  read  the  disk¢ directory and  display  it,  read  the¢ picture  file itself, implement smooth¢ scrolling, and dump the picture to the¢ printer,  and  all  in  one  program! ¢ Great stuff.¢¢ COMPROMISES MADE!¢¢     In  writing this program, I had to¢ make several compromises due to memory¢ restrictions.   It  will   only   read¢ Micro-Painter  format  picture   files¢ (i.e. uncompressed), and does no error¢ trapping when reading the file.  I can¢ only  magnify  the  middle 32 bytes of¢ the 40 bytes per line of picture.  The¢ ANTIC  chip  does  not allow a display¢ line to cross  a  4K  boundary.   When¢ implementing     smooth     horizontal¢ scrolling, you create a  display  line¢ which  is  wider  than the screen, and¢ you only show part of it.  To make the¢ magnification  and  scrolling routines¢ as  simple  as  possible,  I  chose  a¢ display   line   width  which  divided¢ evenly   into  4096  (4K).   The  best¢ choice   was   64,   which  is  2x32. ¢ Besides, I didn't have  enough  memory¢ to  magnify  the whole 7680 bytes of a¢ graphics 7 1/2 picture.¢¢ USING MAGNIFY¢¢     The MAGNIFY program should be  put¢ on a DOS disk as an autorun file (i.e.¢ name it  AUTORUN.SYS  for  DOS  2.0). ¢ Boot   your   computer   without   any¢ cartridges   (hold   down   OPTION  on¢ XL/XE's).¢     Once MAGNIFY has loaded and  gives¢ you  the  startup  screen,  remove the¢ program disk and put in  your  picture¢ disk  and  press  START.  You will now¢ see a list of all  the  files  on  the¢ disk  which  have  an extender of .?IC¢ where the ? is any legal character for¢ a  filename.  This allows for .MIC and¢ .PIC.  Each file has a  letter  beside¢ it.   Press the appropriate letter for¢ the picture you want and  it  will  be¢ loaded.¢¢ GRAPHICS 8 PICTURE.¢¢     The  picture  will  initially   be¢ displayed  in  graphics 8.  If you are¢ using a  television  as  your  display¢ device,  artifacting  could  make your¢ picture look  rather  interesting.   I¢ use  a  monitor, and in hi-res mode it¢ displays the pictures properly without¢ any artifacting.¢¢ DIFFERENT CONTROL COMMANDS:¢¢     To  invert  all  bits  (exchanging¢ black and white), press OPTION.¢¢     To  switch  back and forth between¢ graphics 8 and 7 1/2, press SELECT.¢¢     Now plug a joystick  into  port  1¢ and  let's  start  magnifying.  If you¢ press the  joystick  button  you  will¢ cycle  through  the  5   magnification¢ modes, which are:¢¢  (1) none¢  (2) 1-bit horizontal and vertical¢  (3)  2-bit   horizontal   and   1-bit¢ vertical¢  (4)  1-bit   horizontal   and   2-bit¢ vertical¢  (5) 2-bit horizontal and vertical.¢¢     In any of the four magnified modes¢ you can  scroll  around  the  picture,¢ checking out how different areas look. ¢ Once   you    have    decided    which¢ magnification  technique  should  work¢ best  on  your  printer, press START. ¢ The full picture will  be  printed  in¢ the  same  magnification  mode  as  is¢ currently on the display.¢¢ TO GO TO DIRECTORY MENU:¢¢     To  return  to the directory menu,¢ press the ESC key.   If  you  want  to¢ change picture disks, simply press ESC¢ again, change disks and press START.¢¢ ENJOY!¢¢     I hope you find MAGNIFY  a  useful¢ program.   I  certainly do, and I also¢ learned  a  lot  about  the  fantastic¢ graphics   capabilities    of    Atari¢ computers  while  writing  it.    Have¢ fun!¢                *****¢