diff --git a/compiler/res/prog8lib/cx16/cx16diskio.p8 b/compiler/res/prog8lib/cx16/cx16diskio.p8 index 28161641c..edf2ad805 100644 --- a/compiler/res/prog8lib/cx16/cx16diskio.p8 +++ b/compiler/res/prog8lib/cx16/cx16diskio.p8 @@ -7,7 +7,7 @@ cx16diskio { ; Use kernal LOAD routine to load the given program file in memory. - ; This mimimics Basic's LOAD "filename",drive / LOAD "filename",drive,1 + ; This is similar to Basic's LOAD "filename",drive / LOAD "filename",drive,1 ; If you don't give an address_override, the location in memory is taken from the 2-byte file header. ; If you specify a custom address_override, the first 2 bytes in the file are ignored ; and the rest is loaded at the given location in memory. diff --git a/compiler/res/prog8lib/cx16logo.p8 b/compiler/res/prog8lib/cx16logo.p8 index 7c5afff35..229319d60 100644 --- a/compiler/res/prog8lib/cx16logo.p8 +++ b/compiler/res/prog8lib/cx16logo.p8 @@ -20,12 +20,12 @@ cx16logo { } str[] logo_lines = [ - "\uf10d\uf11a\uf139\uf11b \uf11a\uf13a\uf11b\n", - "\uf10b\uf11a▎\uf139\uf11b \uf11a\uf13a\uf130\uf11b\n", - "\uf10f\uf11a▌ \uf139\uf11b \uf11a\uf13a \uf11b▌\n", - "\uf102 \uf132\uf11a▖\uf11b \uf11a▗\uf11b\uf132\n", - "\uf10e ▂\uf11a▘\uf11b \uf11a▝\uf11b▂\n", - "\uf104 \uf11a \uf11b\uf13a\uf11b \uf139\uf11a \uf11b\n", + "\uf10d\uf11a\uf139\uf11b \uf11a\uf13a\uf11b", + "\uf10b\uf11a▎\uf139\uf11b \uf11a\uf13a\uf130\uf11b", + "\uf10f\uf11a▌ \uf139\uf11b \uf11a\uf13a \uf11b▌", + "\uf102 \uf132\uf11a▖\uf11b \uf11a▗\uf11b\uf132", + "\uf10e ▂\uf11a▘\uf11b \uf11a▝\uf11b▂", + "\uf104 \uf11a \uf11b\uf13a\uf11b \uf139\uf11a \uf11b", "\uf101\uf130\uf13a \uf139▎\uf100" ] } diff --git a/compiler/res/prog8lib/diskio.p8 b/compiler/res/prog8lib/diskio.p8 index 281b05159..ece443fdd 100644 --- a/compiler/res/prog8lib/diskio.p8 +++ b/compiler/res/prog8lib/diskio.p8 @@ -434,7 +434,7 @@ io_error: } ; Use kernal LOAD routine to load the given program file in memory. - ; This mimimics Basic's LOAD "filename",drive / LOAD "filename",drive,1 + ; This is similar to Basic's LOAD "filename",drive / LOAD "filename",drive,1 ; If you don't give an address_override, the location in memory is taken from the 2-byte file header. ; If you specify a custom address_override, the first 2 bytes in the file are ignored ; and the rest is loaded at the given location in memory. diff --git a/compiler/test/arithmetic/testrepeat.p8 b/compiler/test/arithmetic/testrepeat.p8 new file mode 100644 index 000000000..d1442648a --- /dev/null +++ b/compiler/test/arithmetic/testrepeat.p8 @@ -0,0 +1,75 @@ +%import textio +%zeropage basicsafe +%option no_sysinit + +main { + sub start() { + uword amount + uword zero = 0 + uword one = 1 + uword hundred = 100 + uword two55 = 255 + uword two56 = 256 + uword two57 = 257 + uword thousand = 1000 + uword maximum = 65535 + + txt.print("expected:\n 0, 1, 100, 255, 256, 257, 1000, 65535\n\n") + + repeat zero { + amount++ + } + txt.print_uw(amount) + txt.nl() + + amount=0 + repeat one { + amount++ + } + txt.print_uw(amount) + txt.nl() + + amount=0 + repeat hundred { + amount++ + } + txt.print_uw(amount) + txt.nl() + + amount=0 + repeat two55 { + amount++ + } + txt.print_uw(amount) + txt.nl() + + amount=0 + repeat two56 { + amount++ + } + txt.print_uw(amount) + txt.nl() + + amount=0 + repeat two57 { + amount++ + } + txt.print_uw(amount) + txt.nl() + + amount=0 + repeat thousand { + amount++ + } + txt.print_uw(amount) + txt.nl() + + amount=0 + repeat maximum { + amount++ + } + txt.print_uw(amount) + txt.nl() + + } +} diff --git a/docs/source/libraries.rst b/docs/source/libraries.rst index 2f02e26f0..826885168 100644 --- a/docs/source/libraries.rst +++ b/docs/source/libraries.rst @@ -136,6 +136,15 @@ Provides several routines that deal with disk drive I/O, such as: - load and save data from and to the disk - delete and rename files on the disk +.. attention:: + **CX16 specific note** + The cx16 emulators provide a convenience feature called 'host filesystem passthrough' where basically + the directory on your host system is treated as the "disk drive" in the emulator. + In this mode, most of the I/O routines in the machine's kernal, and by extension the ones in this + module, *don't work*. You have to use a sd-card mounted disk image to be able to use all routines. + Regular ``load()`` (but not ``load_raw()``) works just fine even with the host filesystem. + Another thing to pay attention to is the capitalization of filenames due to the petscii translation involved. + string ------ @@ -206,6 +215,24 @@ That also means though that it is constrained to 320*200 resolution on the Cx16 Use the ``gfx2`` library if you want full-screen graphics or non-monochrome drawing. +math +---- +Low level math routines. You should not normally have to bother with this directly. +The compiler needs it to implement most of the math operations in your programs. + + +cx16logo +-------- +A 'fun' module that contains the Commander X16 logo and that allows you +to print it anywhere on the screen. + + +prog8_lib +--------- +Low level language support. You should not normally have to bother with this directly. +The compiler needs it for verious built-in system routines. + + gfx2 (cx16 only) ----------------- Full-screen multicolor bitmap graphics routines, available on the Cx16 machine only. @@ -226,19 +253,11 @@ because the Commander X16's default colors for this (the first 16 colors) are to and are quite different than how they looked on a VIC-II chip in a C-64. -math ----- -Low level math routines. You should not normally have to bother with this directly. -The compiler needs it to implement most of the math operations in your programs. +cx16diskio (cx16 only) +----------------------- +Available for the Cx16 target. Contains extensions to the load and load_raw routines from the regular +diskio module, to deal with loading of potentially large files in to banked ram (HiRam). +Also contains a helper function to calculate the file size of a loaded file (although that is truncated +to 16 bits, 64Kb) -cx16logo --------- -A 'fun' module that contains the Commander X16 logo and that allows you -to print it anywhere on the screen. - - -prog8_lib ---------- -Low level language support. You should not normally have to bother with this directly. -The compiler needs it for verious built-in system routines. diff --git a/examples/cxlogo.p8 b/examples/cxlogo.p8 index 037842e38..2fd8b3129 100644 --- a/examples/cxlogo.p8 +++ b/examples/cxlogo.p8 @@ -6,7 +6,7 @@ main { sub start() { repeat { - ubyte col = rnd() % (txt.DEFAULT_WIDTH-12) + 3 + ubyte col = rnd() % (txt.DEFAULT_WIDTH-13) + 3 ubyte row = rnd() % (txt.DEFAULT_HEIGHT-7) cx16logo.logo_at(col, row) txt.plot(col-3, row+7 )