; ; This program is meant to display the no-slot clock time ; information in a simple but understandable format. (v1.1) ; Andrew Sopchak 5/22/87 ; .hd64 ; .xlist maclib ports.lib .list ; cr equ 13 lf equ 10 highram equ 02000h ; RAM address for execution of access segment ext eprint,cout ; link with SYSLIB 3.x jp start org highram ; put rest of code in safe RAM area start: ld (stack),sp ; save ccp stack ld sp,stack ; set up local stack call eprint db cr,lf,'DT v1.1 AMS 5/22/87',cr,lf,0 ld hl,(1) ; get base bios address ld bc,60 ; offset to setlatch routine add hl,bc ; address now in hl ld (setlatch+1),hl ; store address for readclk call readclk ; get clock info call dumpclk ; print out clock data ld sp,(stack) ; restore ccp stack ret dumpclk: ld a,(buf+6) ; month ld c,'/' call dobyte ld a,(buf+5) ; date call dobyte ld a,(buf+7) ; year ld c,' ' call dobyte ld a,(buf+3) ; hours (24 hour format) ld c,':' call dobyte ld a,(buf+2) ; minutes call dobyte ld a,(buf+1) ; seconds ld c,'.' call dobyte ld a,(buf) ; fractional seconds (just for fun) ld c,'|' call dobyte ld a,(buf+4) ; day of week (also for fun) ld c,' ' call dobyte ret ; and we're done dobyte: ld b,a and 11110000b srl a ; move to lower nibble srl a srl a srl a add a,'0' ; convert to ascii call cout ld a,b and 00001111b add a,'0' call cout ld a,c ; get separator character call cout ret readclk: di ; don't bother me in0 a,(cbar) ; save old value ld (oldcbar),a ld a,0 call setlatch ld (oldlatch),bc ; save old value ld a,b ; load latch1 to a res 3,a ; point to ROM ld b,a ld a,0ffh ; set values for latch call setlatch ; now we are pointing to ROM ld a,081h ; set MMU for 4k common area 0 out0 (cbar),a ; This section turns on the clock by writing the 8 bytes ; in the comparison register of the clock ld a,(4) ; reset clock comparator ld hl,compreg ; point to bit stream ld a,(hl) ; get first byte nxtbyt ld b,a ; b contains byte ld c,8 ; do this for 8 bits nxtbit srl b ; 0->b7...b0->cy jr c,wr1bit wr0bit ld a,(0) ; write a 0 bit jr skip wr1bit ld a,(1) ; write a 1 bit skip dec c jr nz,nxtbit ; do all 8 bits inc hl ; point to next byte ld a,(hl) ; get next byte or a ; set zero flag jr nz,nxtbyt ; go do next byte ; This section will read in all 8 bytes of the clock ld hl,buf ; set up buffer ld e,8 ; do 8 bytes rdbyt ld d,8 ; do 8 bits rdbit ld a,(4) ; get bit in b0 srl a ; shift bit into cy rr (hl) ; shift bit into (hl) dec d ; dec bit counter jr nz,rdbit ; read next bit inc hl ; point to next buf location dec e ; dec byte counter jr nz,rdbyt ; read next byte ; We are all done reading, so restore values and return ld bc,(oldlatch) ; restore old latch values ld a,0ffh call setlatch ld a,(oldcbar) ; restore old CBAR values out0 (cbar),a ei ; I can be bothered now ret ; data storage and values compreg db 0c5h,3ah,0a3h,5ch ; comparison reg db 0c5h,3ah,0a3h,5ch,0 ; definition buf ds 8 ; place to store data oldcbar ds 1 ; old CBAR oldlatch ds 2 ; temp save of current latch settings setlatch jp 0000h ; address of BIOS setlatch routine ds 64 ; local stack stack ds 2 end