Displaying a Neochrome Picture

From Atari Wiki
Jump to navigation Jump to search

                     Assembly Language, in Devpac, Tutorial

                                       by

                      John Cove of Prophecy Public Domain

                                      for

                                     ICTARI

                Series 1, Part 3, Displaying a Neochrome Picture
     ______________________________________________
     Section 1.01 - Displaying a Neochrome picture.
     ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
     Here is a  complete,  and  working,  routine  to  display  a Neochrome
     picture.

                        clr.l   -(sp)                   ... line  1
                        move    #$20,-(sp)              ... line  2
                        trap    #1                      ... line  3
                        addq.l  #6,sp                   ... line  4

                        jsr     v_sync                  ... line  5
                        move.b  #0,$ff8260              ... line  6

                        lea     pic+128,a0              ... line  7
                        move.l  $44e,a1                 ... line  8
                        move    #(32000/4)-1,d0         ... line  9
        copypic         move.l  (a0)+,(a1)+             ... line 10
                        dbra    d0,copypic              ... line 11

                        movem.l pic+4,d0-d7             ... line 12
                        movem.l d0-7,$ff8240            ... line 13

                        move    #7,-(sp)                ... line 14
                        trap    #1                      ... line 15
                        addq.l  #2,sp                   ... line 16

                        jsr     v_sync                  ... line 17
                        move.b  #1,$ff8260              ... line 18

                        clr.w   -(sp)                   ... line 19
                        trap    #1                      ... line 20


         pic            incbin  test.neo                ... line 21

     ____________________________
     The rather LARGE explanation
     ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
     Lines 1 to 4 - This opens the supervisor mode.

     Line 5 - This waits until a vbl cycle is complete.

     Line 6 - This alters  the  screen  mode  to  low resolution, as a .NEO
     picture file will only display  correctly in low resolution.

     Line 7 - This points to the  picture  data in the picture file & moves
     the contents into the data  register,  a0.  The  processor  knows when
     it has reached the end of  the  picture   data  because after the file
     is  loaded,  a  pointer  is   placed,  in  memory,  at  the end of the
     picture data and the data will   stop  being loaded into the  register
     a0.  The  actual  picture data  starts  at   the   offset +128, or the
     seventeenth byte in the file.

     Line 8 -  The  logic  screen  address  is  $44e.    So   all  that  is
     happening is that the screen address,  the  final  destination of  the
     picture data, is being put into the register a1.

     Line 9 - The actual number  of  bytes  that  the  picture  data  takes
     up is 32000, which is  also  the  same  as  the standard sized  ST Low
     resolution  screen. So, you are  loading  that amount of bytes, 32000,
     into the register d0.

     Line 10 - This serves   a   few   functions. First  a  label,  because
     you  will be performing a conditional  loop  on  Line 11, and  this is
     where  you  will jump to. The   second   is  the moving of the data in
     a0  and  literally  moving  it  onto  the  screen.   The plus   symbol
     after the (a0) register,  and   (a1),  is  simply telling the computer
     to take the next part of picture data, so on and so on!!

     Line 11 - This is  a  condition,  and  when  all  the picture has been
     displayed, this is when the condition is met, and basically, when  you
     jump  back  to the  loop,  the  pointer  to  the  picture data will be
     implemented by one and in EFFECT will  jump  to the  next byte of  the
     picture  data, to be displayed.  God that was DIFFICULT to explain...

     Line 12 - This  is   implementing   the   palette,  from  the  picture
     data, on  the screen. The palette is also contained within the picture
     file, at the offset of +4 so the data starts at the second byte in the
     file. The palette data uses 16 words and is picked up in the registers
     d0-d7.

     Line 13 - This  puts   the  palette  values, from  the  picture  file,
     in d0-d7 and implements it onto the screen.

     Line 14 to 16 - This waits for the user to  press  any  key, before it
     continues.

     Line 17 - This waits until a vbl cycle is complete.

     Line 18 - This sets  the  screen  mode to  medium  resolution,  really
     used  for the returning to GENst.

     Line 19 to 20 - This is  the  standard exit routine, out of supervisor
     mode.

     Line 21 - This is  the  incLUDE  binARY  command,  that loads  a  file
     from the disk and is then present in that label.


     As you can see,  it  is  VERY  similar  to  the Degas Elite displaying
     routines!!!!!!!!

     I am very sorry, but  I  really  must  leave  it  there,  as I have to
     finish  off  the intro for  ST  WORLD  Issue  3,  and  sent it to Sion
     before  the  Christmas  deadline which is tomorrow!!

     Hopefully, the HOT NEWS article will make up for my  missing  article.
     Sorry  to the regular followers of this article, being,  that I  know,
     Simon  Osbourne  and the main man, Sion Dovey.
     ----------------------------------------------------------------------
     Tronic of Effect, aka John  Cove,  [C]opyright 1995 .. Started: 19-12-
     1995
     Finished: 19-12-1995


            "I reserve the right to publish these tutorial series
             wherever  I  choose...   Only,  with express written
             confirmation,  is  this  to  be  published by anyone
             other than myself.   These  series  were written for
             ST World, but if I feel that the series is not being
             taken advantage of in the way that most ST users are
             able  to read  the  series, then  I will publish the
             series in my own, and other  peoples, disk magazines
             and products."

Back to ASM_Tutorial