home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / amiga-flight / programs / lights2.asm < prev    next >
Assembly Source File  |  1977-12-31  |  4KB  |  76 lines

  1. *****************************************************************************
  2. ***                             LIGHTS1.ASM                               ***
  3. ***                                                                       ***
  4. ***    Author : Pete Cheetham, Andrew Duffy                               ***
  5. ***    Date   : November 1992, June 1994                                  ***
  6. ***    Desc.  : This program was written to demonstrate driving the 68000 ***
  7. ***             applications board.                                       ***
  8. ***             It counts repeatedly from 0 to 255, outputting the value  ***
  9. ***             each time to the LEDs and then delaying for 0.2 seconds   ***
  10. ***             before moving onto the next number.                       ***
  11. ***                                                                       ***
  12. ***                          ©XCNT, 1992-1994.                            ***
  13. *****************************************************************************
  14.  
  15.  
  16. *****************************************************************************
  17. ***                              Includes                                 ***
  18. *****************************************************************************
  19.  
  20.         include    "subrts.h"    Included by default anyway
  21.  
  22. *****************************************************************************
  23. ***                              Constants                                ***
  24. *****************************************************************************
  25.  
  26. FIFTHSEC    EQU    50000        Number of clock ticks in 0.2 seconds
  27.  
  28. *****************************************************************************
  29. ***                          Initialisation routine                       ***
  30. *****************************************************************************
  31.  
  32.         move.b    #APPS_ALL_IN,d0    Initialise the applications board
  33.         jsr    APPS_INIT    (port A all input)
  34.  
  35.         movea.l    #Instructs,a6    Print instructions
  36.         jsr    OUTSTR
  37.  
  38. *****************************************************************************
  39. ***                              Main routine                             ***
  40. *****************************************************************************
  41.  
  42.         move.l    #FIFTHSEC,d0    Initialise delay value
  43.         move.b    #0,d1        Initialise LED value
  44.  
  45. Loop        move.b    d1,APPS_PORTB    Output it to the LEDs
  46.         bsr    Delay        Wait a while
  47.         add.b    #1,d1        Increment LED value.
  48.         bra    Loop        Repeat forever
  49.  
  50.         rts            Exit (never gets here)
  51.  
  52. *****************************************************************************
  53. ***                             Delay routine                             ***
  54. *** Waits for the value in bits 23-0 of d0 clock ticks to elapse before   ***
  55. *** returning.                                                            ***
  56. *****************************************************************************
  57.  
  58. Delay        jsr    START_TIMER    Initialise clock and start it going
  59. Delay1        jsr    CHECK_TIMER    Has countdown timer reached zero ?
  60.         beq    Delay1        No, go back and wait some more
  61.         rts            Return from subroutine
  62.  
  63. *****************************************************************************
  64. ***                               Strings                                 ***
  65. *****************************************************************************
  66.  
  67. Instructs    dc.b    "Lights2.asm",13,10,"===========",13,10,13,10
  68.         dc.b    "Ensure that the LEDs are switched on.",13,10
  69.         dc.b    "This program counts repeatedly from 0 to 255, outputting the value each time",13,10
  70.         dc.b    "to the LEDs and then displaying for 0.2 seconds before moving onto the next",13,10
  71.         dc.b    "number."13,10,0
  72.  
  73. *****************************************************************************
  74. ***                       End of file LIGHTS2.ASM.                        ***
  75. *****************************************************************************
  76.