fix example

This commit is contained in:
Irmen de Jong 2020-08-27 18:21:12 +02:00
parent 4ffb194847
commit c2205e473a

View File

@ -1,6 +1,7 @@
; CommanderX16 text clock example! ; CommanderX16 text clock example!
; make sure to compile with the cx16 compiler target. ; make sure to compile with the cx16 compiler target.
%import cx16textio
%zeropage basicsafe %zeropage basicsafe
main { main {
@ -9,7 +10,7 @@ main {
cx16.r0L = 2020 - 1900 cx16.r0L = 2020 - 1900
cx16.r0H = 8 cx16.r0H = 8
cx16.r1L = 26 cx16.r1L = 27
cx16.r1H = 19 cx16.r1H = 19
cx16.r2L = 16 cx16.r2L = 16
cx16.r2H = 0 cx16.r2H = 0
@ -22,7 +23,7 @@ main {
repeat { repeat {
c64.CHROUT(19) ; HOME c64.CHROUT(19) ; HOME
screen.print(" yyyy-mm-dd HH:MM:SS.jj\n\n") txt.print("\n yyyy-mm-dd HH:MM:SS.jj\n\n")
cx16.clock_get_date_time() cx16.clock_get_date_time()
c64.CHROUT(' ') c64.CHROUT(' ')
print_date() print_date()
@ -32,33 +33,33 @@ main {
} }
sub print_date() { sub print_date() {
screen.print_uw(1900 + cx16.r0L) txt.print_uw(1900 + cx16.r0L)
c64.CHROUT('-') c64.CHROUT('-')
if cx16.r0H < 10 if cx16.r0H < 10
c64.CHROUT('0') c64.CHROUT('0')
screen.print_ub(cx16.r0H) txt.print_ub(cx16.r0H)
c64.CHROUT('-') c64.CHROUT('-')
if cx16.r1L < 10 if cx16.r1L < 10
c64.CHROUT('0') c64.CHROUT('0')
screen.print_ub(cx16.r1L) txt.print_ub(cx16.r1L)
} }
sub print_time() { sub print_time() {
if cx16.r1H < 10 if cx16.r1H < 10
c64.CHROUT('0') c64.CHROUT('0')
screen.print_ub(cx16.r1H) txt.print_ub(cx16.r1H)
c64.CHROUT(':') c64.CHROUT(':')
if cx16.r2L < 10 if cx16.r2L < 10
c64.CHROUT('0') c64.CHROUT('0')
screen.print_ub(cx16.r2L) txt.print_ub(cx16.r2L)
c64.CHROUT(':') c64.CHROUT(':')
if cx16.r2H < 10 if cx16.r2H < 10
c64.CHROUT('0') c64.CHROUT('0')
screen.print_ub(cx16.r2H) txt.print_ub(cx16.r2H)
c64.CHROUT('.') c64.CHROUT('.')
if cx16.r3L < 10 if cx16.r3L < 10
c64.CHROUT('0') c64.CHROUT('0')
screen.print_ub(cx16.r3L) txt.print_ub(cx16.r3L)
} }
} }