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"?> <?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"> <component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$" />
<excludeFolder url="file://$MODULE_DIR$/build" /> <orderEntry type="jdk" jdkName="Python 3.7" jdkType="Python SDK" />
</content>
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </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 c64lib
%import c64utils %import c64utils
%import c64flt
~ main { ~ main {
sub start() { sub start() {
; set text color and activate lowercase charset
; set screen colors and activate lowercase charset c64.COLOR = 13
c64.EXTCOL = 5
c64.BGCOL0 = 0
c64.COLOR = 1
c64.VMCSB |= 2 c64.VMCSB |= 2
; use optimized routine to write text ; use optimized routine to write text
@ -55,14 +52,29 @@ When this code is compiled::
for ubyte c in 0 to len(bye) for ubyte c in 0 to len(bye)
c64.CHROUT(bye[c]) 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: 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 Design principles and features

Binary file not shown.

Binary file not shown.

View File

@ -25,21 +25,19 @@
c64.CHROUT(bye[c]) 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 float clock_seconds = ((mkword(c64.TIME_LO, c64.TIME_MID) as float) + (c64.TIME_HI as float)*65536.0) / 60
ubyte hours = clock_seconds / 3600 as ubyte float hours = floor(clock_seconds / 3600)
clock_seconds -= hours * 3600 clock_seconds -= hours*3600
ubyte minutes = clock_seconds / 60 as ubyte float minutes = floor(clock_seconds / 60)
clock_seconds -= minutes * 60 clock_seconds = floor(clock_seconds - minutes * 60.0)
ubyte seconds = 0; clock_seconds as ubyte ; @todo fix crash
; @todo implement strcpy/strcat/strlen? ; @todo implement strcpy/strcat/strlen?
c64scr.print("system time is ") c64scr.print("system time in ti$ is ")
c64scr.print_ub(hours) c64flt.print_f(hours)
c64.CHROUT(':') c64.CHROUT(':')
c64scr.print_ub(minutes) c64flt.print_f(minutes)
c64.CHROUT(':') c64.CHROUT(':')
c64scr.print_ub(seconds) c64flt.print_f(clock_seconds)
c64.CHROUT('\n') c64.CHROUT('\n')
} }

View File

@ -7,12 +7,9 @@
sub start() { sub start() {
ubyte ub1 float clock_seconds = ((mkword(c64.TIME_LO, c64.TIME_MID) as float) + (c64.TIME_HI as float)*65536.0) / 60
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 hours = floor(clock_seconds / 3600) float hours = floor(clock_seconds / 3600)
clock_seconds -= hours * 3600 clock_seconds -= hours*3600
float minutes = floor(clock_seconds / 60) float minutes = floor(clock_seconds / 60)
clock_seconds -= minutes * 60.0 clock_seconds -= minutes * 60.0
@ -20,6 +17,14 @@
ubyte minutes_b = minutes as ubyte ubyte minutes_b = minutes as ubyte
ubyte seconds_b = clock_seconds 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')
} }
} }