home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / utility / 71 / utl / mono_clk.s < prev    next >
Encoding:
Text File  |  1986-11-21  |  5.4 KB  |  151 lines

  1. *   mono_tlk.s  demonstrate use of genst.prg download ATARI-BBS Nov'86
  2. *               note that genst.prg is very fussy; does not relmod ala lo68.
  3. *   display current time on monochr. monitor *   use vertical blank interrupt
  4. *   as corrected from Chap.2 'Tricks and Tips' ABAQUS 1986  CJPurcell 21AUG'86
  5. *   normally used in monochrome autoboot eSTeClock; can be key-clicked alive.
  6. *
  7. gemdos     equ   1
  8. setexec    equ   5
  9. bios       equ   13
  10. xbios      equ   14
  11. gettime    equ   23
  12. super      equ   38   execute routine in supervisor mode
  13. keep       equ   $31
  14. _v_bas_ad  equ   $44e   screen address
  15. hz_200     equ   $4ba   200hz system timer               
  16. kbmode     equ   $e1a       keyboard shift (mode) indication w.
  17. *
  18. *   system font ATARI ST
  19. *
  20. fontdat   equ   76   ptr to font data
  21. formwd    equ   80   status of next raster line in font
  22. formhg    equ   82   number of raster lines per character
  23. line1   equ     80       bytes per screen line
  24. linea   equ     $a000    linea operator(pseudo instruction)for ATARI
  25. *       .text:
  26.         move.l   4(sp),a0       calculate program size
  27.         move.w   #$100,d6
  28.         add.l    12(a0),d6
  29.         bsr      init           program initialization
  30.         clr      -(sp)
  31.         move.l   d6,-(sp)       number bytes
  32.         move     #keep,-(sp)  
  33.         trap     #gemdos
  34. init:
  35.         dc.w     linea       *get linea pointers for initialization;d0,a0,a1,a2
  36.         moveq    #2*4,d0         *font number ; of the three in array of reg a1
  37.         lea      fontptr(pc),a3   *use smallest font for color; middle for mono
  38.         move.l   $0(a1,d0),(a3)    *mark font pointer
  39.         move     #gettime,-(sp)
  40.         trap     #xbios
  41.         addq.l   #2,sp
  42.         move     d0,d7
  43.         pea      sup_rout(pc)
  44.         move     #super,-(sp)       *execute rest in supervisor mode
  45.         trap     #xbios
  46.         addq.l   #6,sp
  47.         rts
  48. sup_rout:
  49.         move     d7,d0
  50.         and      #%11111,d0
  51.         lsl      #1,d0              *seconds in binary
  52.         move     d0,second
  53.         move     d7,d0
  54.         lsr      #5,d0
  55.         and      #%111111,d0
  56.         move     d0,minute
  57.         move     d7,d0
  58.         moveq    #11,d1
  59.         lsr      d1,d0
  60.         move     d0,hour
  61.         move     #$2700,sr          *interrupts disabled
  62.         move.l   hz_200,time
  63.         add.l    #200,time
  64.         pea      hz_int(pc)
  65.         move     #$45,-(sp)         *timer c interrupt vector
  66.         move     #setexec,-(sp)
  67.         trap     #bios
  68.         addq.l   #8,sp
  69.         move.l   d0,hz_save     200hz vector mark
  70.         rts
  71. hz_int:
  72.         movem.l  d0-d7/a0-a6,-(sp)      save registers
  73.         move.l   time,d0
  74.         cmp.l    hz_200,d0      one second yet?
  75.         bne      no_show        no
  76.         add.l    #200,time      next second 
  77.         addq     #1,second
  78.         cmp      #60,second     check seconds
  79.         bne      show_time
  80.         clr      second
  81.         addq     #1,minute      next minute
  82.         cmp      #60,minute     ckeck minutes
  83.         bne      show_time
  84.         clr      minute
  85.         addq     #1,hour
  86.         cmp      #24,hour       check hours
  87.         bne      show_time
  88.         clr      hour
  89. show_time:
  90.         move     #68,d6        cursor position;(adj. to allow .BAK op.in edit)
  91.         move     hour,d0        get hour
  92.         bsr      wrtdec
  93.         bsr      wrtcol
  94.         move     minute,d0      get minute
  95.         bsr      wrtdec
  96.         bsr      wrtcol
  97.         move     second,d0      get second
  98.         bsr      wrtdec
  99. *                               SHOW condition of CapsLock setting!
  100.         move     #0,a5          this location found by investigation!
  101.         move     kbmode(a5),d0
  102.         and      #%10000,d0
  103.         lsr      #4,d0          set indicator to up arrow, if present
  104.         move     #77,d6         cursor position of CapsLock signal
  105.         bsr      wrtchar        uses magic location for TOS in ROM 1986
  106. no_show:
  107.         movem.l  (sp)+,d0-d7/a0-a6
  108.         move.l   hz_save,-(sp)  address of routine
  109.         rts
  110. wrtdec:
  111.         move     #$2f,d1        number 10
  112. wrtdec1:
  113.         addq     #1,d1
  114.         sub      #10,d0
  115.         bpl      wrtdec1
  116.         add      #$3a,d0        one digit
  117.         move     d0,-(sp)             
  118.         move     d1,d0           
  119.         bsr      wrtchar        output
  120.         move     (sp)+,d0       unit
  121.         bra      wrtchar        output
  122. wrtcol:
  123.         moveq    #$3a,d0         ':'
  124. *                               write characters to graphic ram
  125. *                               where: d0 = character
  126. *                                      d6 = cursor column
  127. wrtchar:
  128.         moveq   #0,d1
  129.         move    d6,d1
  130.         addq    #1,d6           move cursor to next column
  131.         move.l  fontptr(pc),a3  get font pointer
  132.         add.l   _v_bas_ad,d1    plus screen address
  133.         move.l  d1,a4
  134.         move.l  fontdat(a3),a0  font data pointer
  135.         move    formwd(a3),d2   offset of next raster line in font
  136.         move    formhg(a3),d7   form height (number pf scan lines)
  137.         subq    #1,d7
  138. loop:
  139.         move.b  $0(a0,d0),(a4)    onscreen raster line
  140.         add     #line1,a4       pointer to next screen line
  141.         add     d2,a0           pointer to next raster line in font
  142.         dbra    d7,loop
  143.         rts
  144. fontptr ds.l     1
  145. hz_save ds.l     1
  146. second  ds.w     1
  147. minute  ds.w     1
  148. hour    ds.w     1
  149. time    ds.l     1
  150.         .end
  151.