home *** CD-ROM | disk | FTP | other *** search
-
-
- Begin forwarded message:
-
- From: Holger Emden <butabrax@cs.tu-berlin.de>
- Subject: NetBSD: Prog for battery clock
- To: netbsd-admin@icecube.rain.com
- Date: Thu, 1 Jul 1993 06:28:53 +0200 (MET DST)
- Cc: butabrax@cs.tu-berlin.de (Holger Emden)
- X-Mailer: ELM [version 2.4 PL21]
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- Content-Length: 3540
-
-
- Hello.
-
- First a big THANK YOU for NetBSD. It's fantastic.
-
- In one of your mails, i read, that you are looking for a program to
- read
- the battery clock. The program below works fine on my A3000, but i
- don't
- know, if it works on all Amiga, because in several books, they use
- different
- addresses and offsets.
-
- But before : I would like to get into your mailing list. Thank you.
-
- Here it comes:
-
- * Read the internal battery clock of the A3000
- *
- * In a lot of books, the address and offsets in memory are different,
- * so lets have a look at battclock.resource :-)
- *
- * All data is found in the lower 4 bits of a byte. Also, the clock
- uses
- * upper and lower digits.
-
- start: lea $dc0000,a0 ; get base of battery clock
- lea buffer(pc),a1 ; destination address
- moveq #$f,d0 ; mask for lower 4 bits
-
- clr.b $37(a0) ; hey clock, wanna read you
- ...
-
- move.b $1b(a0),(a1) ; weekday ( 0-6 / 1-7 ??? )
- and.b d0,(a1)+
- move.b $23(a0),(a1) ; upper digit of day
- and.b d0,(a1)+
- move.b $1f(a0),(a1) ; lower digit of day
- and.b d0,(a1)+
- move.b $2b(a0),(a1) ; upper digit of month
- and.b d0,(a1)+
- move.b $27(a0),(a1) ; lower digit of month
- and.b d0,(a1)+
- move.b $33(a0),(a1) ; upper digit of jear
- and.b d0,(a1)+
- move.b $2f(a0),(a1) ; lower digit of jear
- and.b d0,(a1)+
- move.b $17(a0),(a1) ; upper digit of hour
- and.b d0,(a1)+
- move.b $13(a0),(a1) ; lower digit of hour
- and.b d0,(a1)+
- move.b $0f(a0),(a1) ; upper digit of minute
- and.b d0,(a1)+
- move.b $0b(a0),(a1) ; lower digit of minute
- and.b d0,(a1)+
- move.b $07(a0),(a1) ; upper digit of second
- and.b d0,(a1)+
- move.b $03(a0),(a1) ; lower digit of second
- and.b d0,(a1)+
- move.b $37(a0),(a1) ; control-byte 1
- and.b d0,(a1)+
- move.b $3b(a0),(a1) ; control-byte 2
- and.b d0,(a1)+
- move.b $3f(a0),(a1) ; control-byte 3
- and.b d0,(a1)
-
- move.b #9,$37(a0) ; ok clock, go on ...
-
- lea buffer(pc),a0 ; convert from buffer to
- lea result(pc),a1 ; result
-
- move.b (a0)+,(a1)+ ; weekday
-
- moveq #0,d0
- move.b (a0)+,d0 ; upper digit of day
- muls #10,d0
- add.b (a0)+,d0 ; lower digit of day
- move.b d0,(a1)+ ; save it
-
- moveq #0,d0
- move.b (a0)+,d0 ; upper digit of month
- muls #10,d0
- add.b (a0)+,d0 ; lower digit of month
- move.b d0,(a1)+ ; save it
-
- moveq #0,d0
- move.b (a0)+,d0 ; upper digit of jear
- muls #10,d0
- add.b (a0)+,d0 ; lower digit of jear
- move.b d0,(a1)+ ; save it
-
- moveq #0,d0
- move.b (a0)+,d0 ; upper digit of hour
- muls #10,d0
- add.b (a0)+,d0 ; lower digit of hour
- move.b d0,(a1)+ ; save it
-
- moveq #0,d0
- move.b (a0)+,d0 ; upper digit of minute
- muls #10,d0
- add.b (a0)+,d0 ; lower digit of minute
- move.b d0,(a1)+ ; save it
-
- moveq #0,d0
- move.b (a0)+,d0 ; upper digit of second
- muls #10,d0
- add.b (a0)+,d0 ; lower digit of second
- move.b d0,(a1)+ ; save it
-
- * ok, ok, next time i'll use a macro :-)
-
- move.b (a0)+,(a1)+ ; control-byte 1
- move.b (a0)+,(a1)+ ; control-byte 2
- move.b (a0)+,(a1) ; control-byte 3
-
- rts ; we did it :-)
-
- buffer: dc.l 0,0,0,0 ; only a buffer
-
- result: dc.b 0 ; weekday
- dc.b 0 ; day
- dc.b 0 ; month
- dc.b 0 ; jear
- dc.b 0 ; hour
- dc.b 0 ; minute
- dc.b 0 ; second
- dc.b 0 ; control-byte 1
- dc.b 0 ; control-byte 2
- dc.b 0 ; control-byte 3
-
-
- Thank you very much and i wish you
- a lot of
- fun for your work on
- NetBSD.
-
- Holger Emden (butabrax)
- --
-
- Holger Emden, Technical University of Berlin (Germany),
- Area : Computer-Engineering, EMail : butabrax@cs.tu-berlin.de
-
-
-