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