mirror of
https://github.com/irmen/prog8.git
synced 2024-11-25 19:31:36 +00:00
improved docs on how to run the compiler
This commit is contained in:
parent
6e3820c6b8
commit
163c6bc628
@ -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>
|
BIN
docs/source/_static/hello_screen.png
Normal file
BIN
docs/source/_static/hello_screen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
@ -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.
@ -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
|
||||
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
|
||||
ubyte minutes = clock_seconds / 60 as ubyte
|
||||
clock_seconds -= minutes * 60
|
||||
ubyte seconds = 0; clock_seconds as ubyte ; @todo fix crash
|
||||
|
||||
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')
|
||||
}
|
||||
|
||||
|
@ -7,10 +7,7 @@
|
||||
|
||||
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
|
||||
float minutes = floor(clock_seconds / 60)
|
||||
@ -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')
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user