improved docs on how to run the compiler

This commit is contained in:
Irmen de Jong 2019-01-24 23:31:16 +01:00
parent 6e3820c6b8
commit 163c6bc628
7 changed files with 43 additions and 29 deletions

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.7" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -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

Binary file not shown.

Binary file not shown.

View File

@ -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')
}

View File

@ -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')
}
}