home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
PROGRAMS
/
CLOCKK
/
NO-SLOT.LBR
/
DTS.Z80
< prev
Wrap
Text File
|
2000-06-30
|
3KB
|
150 lines
;
; This simplistic program sets the No-Slot Clock. It must be edited
; with the time to set in the buffer at the end, assembled, linked,
; and then run at the correct time. Dumb but fast way of getting
; the clock working. (v1.0)
; 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
jp start
org highram
start:
ld (stack),sp ; save ccp stack
ld sp,stack ; set up local stack
call eprint
db cr,lf,'DTS v1.0 AMS 5/22/87',cr,lf
db 'Date and time are now set to:'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 doclk ; set 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
doclk:
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 writing 8 bytes in comp reg
ld a,(4) ; reset clock comparator
ld hl,compreg ; point to bit stream
call wrtclk ; send stream to clock
; This section will write out all 8 bytes of the clock
ld hl,buf ; point to bit stream
call wrtclk ; send stream to clock
; We are all done writing, 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
; This routine should be called with HL->buffer of data to
; write out to the clock.
wrtclk ld d,8 ; do 8 bytes
nxtbyt ld a,(hl) ; get first byte
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
dec d ; done with 8 bytes?
jr nz,nxtbyt ; go do next byte
ret ; all done
; data storage and values
compreg db 0c5h,3ah,0a3h,5ch ; comparison reg
db 0c5h,3ah,0a3h,5ch,0 ; definition
buf db 0h,0h,25h,1h ; set HMS
db 11h,25h,5h,87h ; set DMY
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