home *** CD-ROM | disk | FTP | other *** search
/ Amiga GigaPD 3 / Amiga_GigaPD_v3_3of3.iso / netbsd / docs / mailinglist-archive / 1993-07 / text0008.txt < prev    next >
Encoding:
Text File  |  1993-06-25  |  3.9 KB  |  159 lines

  1.  
  2.  
  3. Begin forwarded message:
  4.  
  5. From: Holger Emden <butabrax@cs.tu-berlin.de>
  6. Subject: NetBSD: Prog for battery clock
  7. To: netbsd-admin@icecube.rain.com
  8. Date: Thu, 1 Jul 1993 06:28:53 +0200 (MET DST)
  9. Cc: butabrax@cs.tu-berlin.de (Holger Emden)
  10. X-Mailer: ELM [version 2.4 PL21]
  11. Mime-Version: 1.0
  12. Content-Type: text/plain; charset=ISO-8859-1
  13. Content-Transfer-Encoding: 8bit
  14. Content-Length: 3540      
  15.  
  16.  
  17. Hello.
  18.  
  19. First a big THANK YOU for NetBSD. It's fantastic.
  20.  
  21. In one of your mails, i read, that you are looking for a program to  
  22. read
  23. the battery clock. The program below works fine on my A3000, but i  
  24. don't
  25. know, if it works on all Amiga, because in several books, they use  
  26. different
  27. addresses and offsets.
  28.  
  29. But before : I would like to get into your mailing list. Thank you.
  30.  
  31. Here it comes:
  32.  
  33. * Read the internal battery clock of the A3000
  34. *
  35. * In a lot of books, the address and offsets in memory are different,
  36. * so lets have a look at battclock.resource :-)
  37. *
  38. * All data is found in the lower 4 bits of a byte. Also, the clock  
  39. uses
  40. * upper and lower digits.
  41.  
  42. start:    lea    $dc0000,a0        ; get base of battery clock
  43.     lea    buffer(pc),a1        ; destination address
  44.     moveq    #$f,d0            ; mask for lower 4 bits
  45.  
  46.     clr.b    $37(a0)            ; hey clock, wanna read you  
  47. ...
  48.  
  49.     move.b    $1b(a0),(a1)        ; weekday ( 0-6 / 1-7 ??? )
  50.     and.b    d0,(a1)+
  51.     move.b    $23(a0),(a1)        ; upper digit of day
  52.     and.b    d0,(a1)+
  53.     move.b    $1f(a0),(a1)        ; lower digit of day
  54.     and.b    d0,(a1)+
  55.     move.b    $2b(a0),(a1)        ; upper digit of month
  56.     and.b    d0,(a1)+
  57.     move.b    $27(a0),(a1)        ; lower digit of month
  58.     and.b    d0,(a1)+
  59.     move.b    $33(a0),(a1)        ; upper digit of jear
  60.     and.b    d0,(a1)+
  61.     move.b    $2f(a0),(a1)        ; lower digit of jear
  62.     and.b    d0,(a1)+
  63.     move.b    $17(a0),(a1)        ; upper digit of hour
  64.     and.b    d0,(a1)+
  65.     move.b    $13(a0),(a1)        ; lower digit of hour
  66.     and.b    d0,(a1)+
  67.     move.b    $0f(a0),(a1)        ; upper digit of minute
  68.     and.b    d0,(a1)+
  69.     move.b    $0b(a0),(a1)        ; lower digit of minute
  70.     and.b    d0,(a1)+
  71.     move.b    $07(a0),(a1)        ; upper digit of second
  72.     and.b    d0,(a1)+
  73.     move.b    $03(a0),(a1)        ; lower digit of second
  74.     and.b    d0,(a1)+
  75.     move.b    $37(a0),(a1)        ; control-byte 1
  76.     and.b    d0,(a1)+
  77.     move.b    $3b(a0),(a1)        ; control-byte 2
  78.     and.b    d0,(a1)+
  79.     move.b    $3f(a0),(a1)        ; control-byte 3
  80.     and.b    d0,(a1)
  81.  
  82.     move.b    #9,$37(a0)        ; ok clock, go on ...
  83.  
  84.     lea    buffer(pc),a0        ; convert from buffer to
  85.     lea    result(pc),a1        ; result
  86.  
  87.     move.b    (a0)+,(a1)+        ; weekday
  88.  
  89.     moveq    #0,d0
  90.     move.b    (a0)+,d0        ; upper digit of day
  91.     muls    #10,d0
  92.     add.b    (a0)+,d0        ; lower digit of day
  93.     move.b    d0,(a1)+        ; save it
  94.  
  95.     moveq    #0,d0
  96.     move.b    (a0)+,d0        ; upper digit of month
  97.     muls    #10,d0
  98.     add.b    (a0)+,d0        ; lower digit of month
  99.     move.b    d0,(a1)+        ; save it
  100.  
  101.     moveq    #0,d0
  102.     move.b    (a0)+,d0        ; upper digit of jear
  103.     muls    #10,d0
  104.     add.b    (a0)+,d0        ; lower digit of jear
  105.     move.b    d0,(a1)+        ; save it
  106.  
  107.     moveq    #0,d0
  108.     move.b    (a0)+,d0        ; upper digit of hour
  109.     muls    #10,d0
  110.     add.b    (a0)+,d0        ; lower digit of hour
  111.     move.b    d0,(a1)+        ; save it
  112.  
  113.     moveq    #0,d0
  114.     move.b    (a0)+,d0        ; upper digit of minute
  115.     muls    #10,d0
  116.     add.b    (a0)+,d0        ; lower digit of minute
  117.     move.b    d0,(a1)+        ; save it
  118.  
  119.     moveq    #0,d0
  120.     move.b    (a0)+,d0        ; upper digit of second
  121.     muls    #10,d0
  122.     add.b    (a0)+,d0        ; lower digit of second
  123.     move.b    d0,(a1)+        ; save it
  124.  
  125. * ok, ok, next time i'll use a macro :-)
  126.  
  127.     move.b    (a0)+,(a1)+        ; control-byte 1
  128.     move.b    (a0)+,(a1)+        ; control-byte 2
  129.     move.b    (a0)+,(a1)        ; control-byte 3
  130.  
  131.     rts                ; we did it :-)
  132.  
  133. buffer:    dc.l    0,0,0,0            ; only a buffer
  134.  
  135. result:    dc.b    0            ; weekday
  136.     dc.b    0            ; day
  137.     dc.b    0            ; month
  138.     dc.b    0            ; jear
  139.     dc.b    0            ; hour
  140.     dc.b    0            ; minute
  141.     dc.b    0            ; second
  142.     dc.b    0            ; control-byte 1
  143.     dc.b    0            ; control-byte 2
  144.     dc.b    0            ; control-byte 3
  145.  
  146.  
  147.                                   Thank you very much and i wish you  
  148. a lot of
  149.                                           fun for your work on  
  150. NetBSD.
  151.  
  152.                                             Holger Emden (butabrax)
  153. -- 
  154.  
  155. Holger Emden, Technical University of Berlin (Germany),
  156. Area : Computer-Engineering, EMail : butabrax@cs.tu-berlin.de
  157.  
  158.  
  159.