`DT COMDyDT Z80E'DTS Z80`e!sJ"1J"L" DT v1.1 AMS 5/22/87 *< ""͑!7!{J":"/t!:"t!:" t!:!:t!:!t!:!.t!:!|t!:" t!G????0ͪ"x0ͪ"yͪ"8:2">"C"x˟G>">9::!!~G88:: #~ !!:? # K">":"9::\:\R"~#ʦ" ʐ" ͪ" }" ʂ"ʂ"ʆ"W"W" W"yW" W"yG>GO> ͪ"œ"W"O*. ":ļ2>/768887*9~ ʋ7:~ (#,( <( '( "9; ; 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 ; ; 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