diff --git a/docs/docs.iml b/docs/docs.iml index 78aaf41eb..88ad54124 100644 --- a/docs/docs.iml +++ b/docs/docs.iml @@ -1,10 +1,9 @@ - + - - - + + \ No newline at end of file diff --git a/docs/source/_static/hello_screen.png b/docs/source/_static/hello_screen.png new file mode 100644 index 000000000..6e195427e Binary files /dev/null and b/docs/source/_static/hello_screen.png differ diff --git a/docs/source/index.rst b/docs/source/index.rst index 4a24f3272..48a13ad80 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -31,15 +31,12 @@ When this code is compiled:: %import c64lib %import c64utils + %import c64flt ~ main { - sub start() { - - ; set screen colors and activate lowercase charset - c64.EXTCOL = 5 - c64.BGCOL0 = 0 - c64.COLOR = 1 + ; set text color and activate lowercase charset + c64.COLOR = 13 c64.VMCSB |= 2 ; use optimized routine to write text @@ -55,14 +52,29 @@ When this code is compiled:: for ubyte c in 0 to len(bye) c64.CHROUT(bye[c]) - } + 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) + + c64scr.print("system time in ti$ is ") + c64flt.print_f(hours) + c64.CHROUT(':') + c64flt.print_f(minutes) + c64.CHROUT(':') + c64flt.print_f(clock_seconds) + c64.CHROUT('\n') + } } + you get a program that outputs this when loaded on a C-64: -@todo screenshot - +.. image:: _static/hello_screen.png + :align: center + :alt: result when run on C-64 Design principles and features diff --git a/examples/compiled/examples.d64 b/examples/compiled/examples.d64 index 0c691f8d1..884c393b4 100644 Binary files a/examples/compiled/examples.d64 and b/examples/compiled/examples.d64 differ diff --git a/examples/compiled/hello.prg b/examples/compiled/hello.prg index 243ac94f1..e84eea9af 100644 Binary files a/examples/compiled/hello.prg and b/examples/compiled/hello.prg differ diff --git a/examples/hello.p8 b/examples/hello.p8 index 8bee5ea46..40a8b56db 100644 --- a/examples/hello.p8 +++ b/examples/hello.p8 @@ -25,21 +25,19 @@ c64.CHROUT(bye[c]) - float clock_seconds = ((c64.TIME_LO as float) + 256.0*(c64.TIME_MID as float) + 65536.0*(c64.TIME_HI as float)) / 60 - ubyte hours = clock_seconds / 3600 as ubyte - clock_seconds -= hours * 3600 - ubyte minutes = clock_seconds / 60 as ubyte - clock_seconds -= minutes * 60 - ubyte seconds = 0; clock_seconds as ubyte ; @todo fix crash - + 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) ; @todo implement strcpy/strcat/strlen? - c64scr.print("system time is ") - c64scr.print_ub(hours) + c64scr.print("system time in ti$ is ") + c64flt.print_f(hours) c64.CHROUT(':') - c64scr.print_ub(minutes) + c64flt.print_f(minutes) c64.CHROUT(':') - c64scr.print_ub(seconds) + c64flt.print_f(clock_seconds) c64.CHROUT('\n') } diff --git a/examples/test.p8 b/examples/test.p8 index 0aca44f97..5c011806d 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -7,12 +7,9 @@ sub start() { - ubyte ub1 - uword uw1 - - float clock_seconds = ((c64.TIME_LO as float) + 256.0*(c64.TIME_MID as float) + 65536.0*(c64.TIME_HI as float)) / 60 + 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 + clock_seconds -= hours*3600 float minutes = floor(clock_seconds / 60) clock_seconds -= minutes * 60.0 @@ -20,6 +17,14 @@ ubyte minutes_b = minutes as ubyte ubyte seconds_b = clock_seconds as ubyte + c64scr.print_ub(hours_b) + c64.CHROUT(':') + c64scr.print_ub(minutes_b) + c64.CHROUT(':') + c64scr.print_ub(seconds_b) + c64.CHROUT('\n') + + } }