home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
enterprs
/
c128
/
text
/
examples.arc
/
TIME.A
< prev
next >
Wrap
Text File
|
1989-12-01
|
6KB
|
154 lines
; time.asm
;================================================================
; Display/Set time for CS-DOS 12feb88 - CS
;================================================================
; Uses time of day clock at $DC08
hours = $dc0b ; latch
mins = $dc0a
secs = $dc09
tenths = $dc08 ; start
int04 = $1704
int05 = $1705
int0e = $170e
primm = $ff7d
chrout = $ffd2
star = $0b00
.wor star
* = star
jmp start
dw Date
start lda #0
sta $ff00
time ldx #1 ; check for %1
jsr int04
bcc stime ; its there. Set time
pt jsr ptime ; Else display time
lda #13
jsr chrout
exit0 lda #0
jmp int0e
ptime lda hours ; Display hh:mm:ss.t
lda hours
sta h
and #$7f
jsr p0
lda mins
jsr p0
lda secs
jsr p1
lda #"."
jsr chrout
lda tenths
jsr p2
bit h
bmi pm
lda #"a"
.byt $2c
pm lda #"p"
jsr chrout
lda #"m"
jmp chrout
p1 pha
and #$f0
lsr a
lsr a
lsr a
lsr a
ora #$30
jsr chrout
pla
p2 and #$0f
ora #$30
jmp chrout
p0 jsr p1
lda #":"
jmp chrout
jpt jmp pt
;----------------------------
; Set time from command line
;----------------------------
; time hh:mm:ss
; time hhmmss
; time hh-mm-ss
stime pha ; save 1st char
lda #0 ; Reset time
sta h
sta m
sta s
sta t
pla
ldx #3 ; assume hours
ldy #1 ; two digits max
sd cmp #"." ; Tenths?
beq st
cmp #":"
beq skip
cmp #"-"
beq skip
mp cmp #"p"
beq spm
cmp #"0" ; Error, ignore
bcc jpt
cmp #"9"+1
bcs jpt
and #$0f
asl a
asl a
asl a
asl a
asl a
rol t,x
asl a
rol t,x
asl a
rol t,x
asl a
rol t,x
.byt $2c
st ldx #0
dey
bmi skip
more jsr int05
bcc sd
stt ldy #3
sl lda t,y
sta tenths,y
dey
bpl sl
jmp pt
skip ldy #1
dex
bmi stt
jsr int05
bcs stt
cmp #"0"
bcs mp
cmp #"."
beq st
bne more
t .byt 0
s .byt 0
m .byt 0
h .byt 0
spm lda h
ora #$80
sta h
jmp stt
.end