home *** CD-ROM | disk | FTP | other *** search
- * Program Generated 1 August 1982
- * Author Michael W. Foley
- * With assist from Jim Moore using a program originaly written for the
- * Promethious multifunction card, for the Apple ][.
- *
- *
- * This program will allow you to use a Thunderclock from Apple CP/M.
- * The only equate that needs to be changed for your Apple is the location
- * of the Slot of the Thunderclock.
- * This is set into two of the equates both A$CKW for a write to the clock
- * and A$CKR for a read from the clock, as CNxx, where N is your slot #.
- *
- * The program at the bottom of the assembler routines is an example of a
- * clock data read program to use if you are going to use a MBASIC program
- * to obtain the clock data from the GETLN Buffer area of the Apple. It
- * can be implimented as a subroutine in your program.
- *
- ;**** Equates ****
- ;
- FALSE EQU 00H ; define true and false for conditional assembly
- TRUE EQU NOT FALSE ; true = FFFFH
- BASIC EQU FALSE ; set to true if using this as a asm subroutine
- ; called from a Mbasic program.
- ;
- BDOS EQU 05H ; CP/M Bdos call address
- Z$CPU EQU 0F3DEH ; Address of Softcard found here
- A$VEC EQU 0F3D0H ; 6502 subroutine address goes here
- A$ACC EQU 0F045H ; 6502 accumulator pass area for data
- ;
- ;
- A$CKW EQU 0C50BH ; Clock dependent call address for write
- ;
- ;
- A$CKR EQU 0C508H ; Clock dependent call address for read
- ;
- Z$TMB EQU 0F201H ; start of the GETLN BUFFER
- ;
- ; Character string length from Thunderclock
- Z$FML EQU 019H ; 25 characters total length
- ;
- ; Format character to write to the clock
- Z$FMT EQU '>' ; AP/PM format.
- ;
- ;
- ORG 0100H ; Put this where you want it, here for TPA
- MVI A,Z$FMT ; get the format character in accumulator
- STA A$ACC ; pass it to the 6502 Accumulator at $45
- LXI H,A$CKW ; Set up for clock write to set format
- SHLD A$VEC ; Tell the 6502 where the subroutine is
- LHLD Z$CPU ; get the Softcard address
- MOV M,A ; call the 6502 subroutine
- ; 6502 returns here after setting the proper format
- ; on the clock
- LXI H,A$CKR ; Set up for clock read
- SHLD A$VEC ; Tell the 6502 where the subroutine is
- LHLD Z$CPU ; get the Softcard return address
- MOV M,A ; call the 6502 subroutine for clock read
- ; conditional assembly depending on if you want to
- ; allow the asm subroutine
- ; to print the time string to the console or use a
- ; Mbasic routine to strip
- ; the characters out of memory via peeks and string
- ; concat routines.
- IF BASIC ; if you are going to use a Mbasic routine set
- ; the BASIC equate to TRUE.
- RET ; Return to basic caller
- ENDIF ; Basic is being used to obtain characters
- ;
- IF NOT BASIC ; don't assemble if not needed
- MVI A,'$' ; prepare to concat this onto the end of the string
- ; due to Bdos expecting it as an end of string marker.
- STA Z$TMB+Z$FML+1 ; concat to the end of the string
- MVI C,09H ; Set up to call Bdos string printing routine
- LXI D,Z$TMB ; point to the beginning of the GETLN buffer
- ; begin the read at this point.
- CALL BDOS ; write the GETLN buffer to the console device for
- ; the length of characters output by the clock.
- RET ; back to the caller
- ENDIF ; not basic caller
- END ; of this program for the Thunderclock + for the
- *
- * MBASIC ROUTINES TO READ THE THUNDERCLOCK DATE TIME STRING FROM MEMORY
- *
- * 10 FML = &H19 'Length of clock character string
- * 20 DG$ = " " 'Character to clear the time
- * 30 FOR X = &H201 th &H201+FML 'Loop to get characters
- * 40 DG$ = DG$ + CHR$(PEEK(X)) 'One charater at a time
- * 50 NEXT I
- * 60 ' Now DG$ holds the time form the Thunderclock
- *
- * Now you can use the MBASIC MID$ function to get the data you
- * want from the Thunderclocks time string.