2020-09-04 22:17:58 +00:00
|
|
|
; CommanderX16 text datetime example!
|
2020-08-26 18:52:38 +00:00
|
|
|
|
2020-09-09 20:49:32 +00:00
|
|
|
%target cx16
|
2020-09-20 21:49:36 +00:00
|
|
|
%import textio
|
2020-08-24 22:18:33 +00:00
|
|
|
%zeropage basicsafe
|
2020-03-24 18:37:54 +00:00
|
|
|
|
2020-07-26 22:32:59 +00:00
|
|
|
main {
|
2020-07-26 16:56:51 +00:00
|
|
|
|
2020-07-26 21:32:20 +00:00
|
|
|
sub start() {
|
2020-08-25 14:36:31 +00:00
|
|
|
|
2020-12-21 19:38:00 +00:00
|
|
|
cx16.clock_set_date_time(mkword(8, 2020 - 1900), mkword(19, 27), mkword(0, 16), 0)
|
2020-09-19 20:37:24 +00:00
|
|
|
txt.lowercase()
|
2020-08-25 14:36:31 +00:00
|
|
|
|
2020-08-26 17:34:12 +00:00
|
|
|
repeat {
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout(19) ; HOME
|
2020-08-27 16:21:12 +00:00
|
|
|
txt.print("\n yyyy-mm-dd HH:MM:SS.jj\n\n")
|
2020-12-31 00:02:36 +00:00
|
|
|
void cx16.clock_get_date_time()
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout(' ')
|
2020-08-26 17:34:12 +00:00
|
|
|
print_date()
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout(' ')
|
2020-08-26 17:34:12 +00:00
|
|
|
print_time()
|
2021-01-23 22:31:50 +00:00
|
|
|
|
|
|
|
txt.chrout('\n')
|
|
|
|
txt.chrout('\n')
|
|
|
|
uword jiffies = c64.RDTIM16()
|
|
|
|
txt.print_uw(jiffies)
|
|
|
|
}
|
2020-08-26 17:34:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub print_date() {
|
2020-08-28 19:42:53 +00:00
|
|
|
txt.print_uw(1900 + lsb(cx16.r0))
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout('-')
|
2020-08-28 19:42:53 +00:00
|
|
|
if msb(cx16.r0) < 10
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout('0')
|
2020-08-28 19:42:53 +00:00
|
|
|
txt.print_ub(msb(cx16.r0))
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout('-')
|
2020-08-28 19:42:53 +00:00
|
|
|
if lsb(cx16.r1) < 10
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout('0')
|
2020-08-28 19:42:53 +00:00
|
|
|
txt.print_ub(lsb(cx16.r1))
|
2020-08-26 17:34:12 +00:00
|
|
|
}
|
2020-08-25 20:26:05 +00:00
|
|
|
|
2020-08-26 17:34:12 +00:00
|
|
|
sub print_time() {
|
2020-08-28 19:42:53 +00:00
|
|
|
if msb(cx16.r1) < 10
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout('0')
|
2020-08-28 19:42:53 +00:00
|
|
|
txt.print_ub(msb(cx16.r1))
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout(':')
|
2020-08-28 19:42:53 +00:00
|
|
|
if lsb(cx16.r2) < 10
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout('0')
|
2020-08-28 19:42:53 +00:00
|
|
|
txt.print_ub(lsb(cx16.r2))
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout(':')
|
2020-08-28 19:42:53 +00:00
|
|
|
if msb(cx16.r2) < 10
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout('0')
|
2020-08-28 19:42:53 +00:00
|
|
|
txt.print_ub(msb(cx16.r2))
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout('.')
|
2020-08-28 19:42:53 +00:00
|
|
|
if lsb(cx16.r3) < 10
|
2021-01-23 22:31:50 +00:00
|
|
|
txt.chrout('0')
|
2020-08-28 19:42:53 +00:00
|
|
|
txt.print_ub(lsb(cx16.r3))
|
2020-08-23 22:26:26 +00:00
|
|
|
}
|
2020-07-03 23:02:36 +00:00
|
|
|
}
|
2020-08-24 21:18:46 +00:00
|
|
|
|