forked from hperaza/RSX280
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdate.mac
137 lines (116 loc) · 2.59 KB
/
date.mac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
;***********************************************************************
;
; This file is part of RMD, a Resource Monitoring Display utility
; for the RSX280 OS. Copyright (C) 1985-2022, Hector Peraza.
;
; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License as
; published by the Free Software Foundation; either version 2 of
; the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;
;***********************************************************************
; Time of Day display routine
.Z280
include RMD.INC
include SYSFN.INC
public SYSTIM
extrn BCD2BIN,VXY,VAHEX,VPUTC
cseg
;-----------------------------------------------------------------------
SYSTIM: ld hl,dtbuf
SC .GDAT
ret c
;; call valdt ; validate date and time
;; ret c ; return if error
VGTOXY 51,0
call PRDAT
ld c,' '
call VPUTC
call PRTIM
ret
PRDAT: ld a,(dtbuf+7)
dec a ; 1..7 -> 0..6
and 7 ; blank will be displayed if value invalid
ld hl,dow
call PR3
ld c,' '
call VPUTC
ld hl,dtbuf+3
ld a,(hl) ; day
call VAHEX
ld c,'-'
call VPUTC
dec hl
ld a,(hl) ; month
call BCD2BIN
dec a
cp 12
jr c,pr1
xor a
pr1: push hl
ld hl,month
call PR3
pop hl
ld c,'-'
call VPUTC
dec hl
dec hl
ld a,(hl) ; year
call VAHEX
inc hl
ld a,(hl)
call VAHEX
ret
PR3: ld c,a
add a,a ; *2
add a,c ; *3
add hl,a ; A is still positive (no sign extension)
ld b,3
pm: ld c,(hl)
call VPUTC
inc hl
djnz pm
ret
PRTIM: ld hl,dtbuf+4
ld a,(hl) ; hour
call VAHEX
ld c,':'
call VPUTC
inc hl
ld a,(hl) ; min
call VAHEX
ld c,':'
call VPUTC
inc hl
ld a,(hl) ; sec
call VAHEX
ret
month: db 'JanFebMarAprMayJunJulAugSepOctNovDec'
; Validate date (only day and month)
valdt: ld hl,dtbuf+2
ld c,12h+1 ; month
call vldt1 ; check if in range
ret c
ld c,31h+1 ; day
vldt1: ld a,(hl)
inc hl
or a
scf
ret z
cp c
ccf
ret
dow: db 'SunMonTueWedThuFriSat '
;-----------------------------------------------------------------------
dseg
dtbuf: ds 8
end