2018-11-25 00:17:39 +00:00
|
|
|
%import c64lib
|
|
|
|
%import c64utils
|
2019-01-24 20:45:50 +00:00
|
|
|
%import c64flt
|
2019-02-02 23:14:56 +00:00
|
|
|
%zeropage basicsafe
|
2019-01-24 20:45:50 +00:00
|
|
|
|
2018-11-25 00:17:39 +00:00
|
|
|
|
2019-07-29 21:11:13 +00:00
|
|
|
main {
|
2018-11-25 00:17:39 +00:00
|
|
|
|
2018-12-18 14:12:56 +00:00
|
|
|
sub start() {
|
2018-11-25 00:17:39 +00:00
|
|
|
|
2019-01-24 20:45:50 +00:00
|
|
|
; set text color and activate lowercase charset
|
|
|
|
c64.COLOR = 13
|
2018-12-18 14:12:56 +00:00
|
|
|
c64.VMCSB |= 2
|
2018-11-25 00:17:39 +00:00
|
|
|
|
2019-01-15 20:35:15 +00:00
|
|
|
; use optimized routine to write text
|
|
|
|
c64scr.print("Hello!\n")
|
2018-12-18 14:12:56 +00:00
|
|
|
|
|
|
|
; use iteration to write text
|
2019-01-15 20:35:15 +00:00
|
|
|
str question = "How are you?\n"
|
2019-08-18 01:16:23 +00:00
|
|
|
ubyte char
|
|
|
|
for char in question
|
2018-12-18 14:12:56 +00:00
|
|
|
c64.CHROUT(char)
|
|
|
|
|
2019-01-15 20:35:15 +00:00
|
|
|
; use indexed loop to write characters
|
2018-12-18 14:12:56 +00:00
|
|
|
str bye = "Goodbye!\n"
|
2020-02-07 00:22:07 +00:00
|
|
|
for char in 0 to len(bye)-1
|
2019-08-18 01:16:23 +00:00
|
|
|
c64.CHROUT(bye[char])
|
2018-11-25 00:17:39 +00:00
|
|
|
|
2019-01-24 20:45:50 +00:00
|
|
|
|
2019-01-24 22:31:16 +00:00
|
|
|
float clock_seconds = ((mkword(c64.TIME_LO, c64.TIME_MID) as float) + (c64.TIME_HI as float)*65536.0) / 60
|
|
|
|
float hours = floor(clock_seconds / 3600)
|
|
|
|
clock_seconds -= hours*3600
|
|
|
|
float minutes = floor(clock_seconds / 60)
|
|
|
|
clock_seconds = floor(clock_seconds - minutes * 60.0)
|
2019-01-24 20:45:50 +00:00
|
|
|
|
2019-01-24 22:31:16 +00:00
|
|
|
c64scr.print("system time in ti$ is ")
|
|
|
|
c64flt.print_f(hours)
|
2019-01-24 20:45:50 +00:00
|
|
|
c64.CHROUT(':')
|
2019-01-24 22:31:16 +00:00
|
|
|
c64flt.print_f(minutes)
|
2019-01-24 20:45:50 +00:00
|
|
|
c64.CHROUT(':')
|
2019-01-24 22:31:16 +00:00
|
|
|
c64flt.print_f(clock_seconds)
|
2019-01-24 20:45:50 +00:00
|
|
|
c64.CHROUT('\n')
|
2020-02-07 00:22:07 +00:00
|
|
|
|
|
|
|
c64scr.print("bye!\n")
|
2020-03-12 23:27:33 +00:00
|
|
|
}
|
2018-11-25 00:17:39 +00:00
|
|
|
}
|