diff --git a/C-lang-subset.md b/C-lang-subset.md index e6a03b8..d6f7431 100644 --- a/C-lang-subset.md +++ b/C-lang-subset.md @@ -22,11 +22,11 @@ accordingly. - No implicit `int f(int i)` function declaration. All functions must be declared or defined before first calling them. - No real preprocessor. -- - `#define` just defines a constant on the compiler level. There's no + - `#define` just defines a constant on the compiler level. There's no text substitution as such. -- - Accordingly no macros with parameters. No #undef. No #ifdef/#ifndef. -- - `#include` works as expected, with max 4 levels of include files. -- - `#pragma cc64` defines the memory layout for the code generator and is + - Accordingly no macros with parameters. No #undef. No #ifdef/#ifndef. + - `#include` works as expected, with max 4 levels of include files. + - `#pragma cc64` defines the memory layout for the code generator and is described in [runtime libraries](Runtime-libs.md). diff --git a/Makefile b/Makefile index e89fe33..007888f 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ c16: cc64-c16-t64 $(c16dir_files) cc64-c16files.zip cc64-c16files.d64 x16: $(x16dir_files) cc64-x16files.zip cc64-x16files-sdcard.zip -cc64-c64-t64: $(cc64_c64_t64_files) +cc64-c64-t64: $(cc64_c64_t64_files) autostart-c64/cc64prof.T64 cc64-c16-t64: $(cc64_c16_t64_files) @@ -84,10 +84,6 @@ cc64-x16files.zip: $(x16dir_files) COPYING rm -f $@ zip -r $@ $^ -$(recompile_dir).zip: $(recompile_srcs) $(recompile_forths) COPYING - rm -f $@ - zip -r $@ $^ - cc64-c64files.d64: $(c64dir_files) tmp/copying rm -f $@ c1541 -format cc64-c64,cc d64 $@ @@ -190,10 +186,10 @@ clean: rm -f c64files/*.fth c16files/*.fth x16files/*.fth rm -f c64files/*.log c16files/*.log x16files/*.log rm -f x16files.img recompile-readme - rm -f [cx][16][64]files/notdone - rm -f emulator/sdcard.img tmp/* cc64-doc.zip - rm -rf release + rm -f [cx][16][64]files/notdone cc64-doc.zip + rm -rf release tmp/* rm -rf $(recompile_dir) $(recompile_dir).zip + $(MAKE) -C emulator clean $(MAKE) -C tests/e2e clean $(MAKE) -C tests/integration clean $(MAKE) -C tests/peddi clean @@ -210,10 +206,14 @@ veryclean: clean rm -f autostart-c64/*.T64 autostart-c16/*.T64 rm -f runtime/* +# Convenience rule for interactive debugging/developing: +# Provide all Forth sources in c64files/ in PETSCII format. +petscii64: $(cc64srcs_c64) $(peddisrcs_c64) + test64: autostart-c64/cc64.T64 - $(MAKE) -C tests/e2e fasttests64 $(MAKE) -C tests/unit tests + $(MAKE) -C tests/e2e fasttests64 $(MAKE) -C tests/integration tests alltests: sut @@ -234,33 +234,41 @@ slowtests: sut $(MAKE) -C tests/integration tests $(MAKE) -C tests/peddi tests -sut: autostart-c64/cc64.T64 autostart-c16/cc64.T64 x16files/cc64 - +sut: autostart-c64/cc64.T64 autostart-c16/cc64.T64 x16files/cc64 \ + autostart-c64/cc64pe.T64 autostart-c16/cc64pe.T64 \ + autostart-c64/peddi.T64 autostart-c16/peddi.T64 \ + autostart-c64/cc64prof.T64 # cc64 build rules %files/cc64: $(cc64srcs_c64) $(cc64srcs_c16) \ - build/build-cc64.sh emulator/run-in-vice.sh \ + emulator/build-binary.sh emulator/run-in-vice.sh \ autostart-%/vf-build-base.T64 - build/build-cc64.sh $* + emulator/build-binary.sh $* cc64 %files/cc64pe: \ $(cc64srcs_c64) $(cc64srcs_c16) \ $(peddisrcs_c64) $(peddisrcs_c16) \ - build/build-cc64pe.sh emulator/run-in-vice.sh \ + emulator/build-binary.sh emulator/run-in-vice.sh \ autostart-%/vf-build-base.T64 - build/build-cc64pe.sh $* + emulator/build-binary.sh $* cc64pe %files/peddi: $(peddisrcs_c64) $(peddisrcs_c16) \ - build/build-peddi.sh emulator/run-in-vice.sh \ + emulator/build-binary.sh emulator/run-in-vice.sh \ autostart-%/vf-build-base.T64 - build/build-peddi.sh $* + emulator/build-binary.sh $* peddi x16files/cc64: $(cc64srcs_x16) \ - build/build-cc64.sh emulator/run-in-x16emu.sh \ - x16files/vf-build-base emulator/sdcard.img - build/build-cc64.sh x16 + emulator/build-binary.sh emulator/run-in-x16emu.sh \ + x16files/vf-build-base + emulator/build-binary.sh x16 cc64 + + +c64files/cc64prof: $(cc64srcs_c64) \ + emulator/build-binary.sh emulator/run-in-vice.sh \ + autostart-c64/vf-build-base.T64 + emulator/build-binary.sh c64 cc64prof # build base rule @@ -281,28 +289,28 @@ $(recompile_dir)/%: forth/% # Runtime module rules runtime/rt-c64-0801.o runtime/rt-c64-0801.h: \ - src/runtime/rt-c64-0801.a build/generate_pragma_cc64.awk + src/runtime/rt-c64-0801.a src/runtime/generate_pragma_cc64.awk test -d tmp || mkdir tmp acme -f cbm -l tmp/rt-c64-0801.sym -o runtime/rt-c64-0801.o \ src/runtime/rt-c64-0801.a - awk -f build/generate_pragma_cc64.awk -F '$$' tmp/rt-c64-0801.sym \ - > runtime/rt-c64-0801.h + awk -f src/runtime/generate_pragma_cc64.awk -F '$$' \ + tmp/rt-c64-0801.sym > runtime/rt-c64-0801.h runtime/rt-c16-1001.o runtime/rt-c16-1001.h: \ - src/runtime/rt-c16-1001.a build/generate_pragma_cc64.awk + src/runtime/rt-c16-1001.a src/runtime/generate_pragma_cc64.awk test -d tmp || mkdir tmp acme -f cbm -l tmp/rt-c16-1001.sym -o runtime/rt-c16-1001.o \ src/runtime/rt-c16-1001.a - awk -f build/generate_pragma_cc64.awk -F '$$' tmp/rt-c16-1001.sym \ - > runtime/rt-c16-1001.h + awk -f src/runtime/generate_pragma_cc64.awk -F '$$' \ + tmp/rt-c16-1001.sym > runtime/rt-c16-1001.h runtime/rt-x16-0801.o runtime/rt-x16-0801.h: \ - src/runtime/rt-x16-0801.a build/generate_pragma_cc64.awk + src/runtime/rt-x16-0801.a src/runtime/generate_pragma_cc64.awk test -d tmp || mkdir tmp acme -f cbm -l tmp/rt-x16-0801.sym -o runtime/rt-x16-0801.o \ src/runtime/rt-x16-0801.a - awk -f build/generate_pragma_cc64.awk -F '$$' tmp/rt-x16-0801.sym \ - > runtime/rt-x16-0801.h + awk -f src/runtime/generate_pragma_cc64.awk -F '$$' \ + tmp/rt-x16-0801.sym > runtime/rt-x16-0801.h runtime/rt-c64-0801.i: awk 'BEGIN{ printf("\x00\x90");}' > $@ @@ -390,12 +398,6 @@ autostart-x16/%.T64: x16files/% bin2t64 $< $@ -# X16 emulator rules - -emulator/sdcard.img: emulator/sdcard.sfdisk emulator/mk-sdcard.sh - emulator/mk-sdcard.sh emulator/sdcard.sfdisk $@ - - # Generic rules to populate c64files/, c16files/, x16files/ c64files/%.fth: src/*/%.fth diff --git a/Runtime-libs.md b/Runtime-libs.md index 506463b..5369c9e 100644 --- a/Runtime-libs.md +++ b/Runtime-libs.md @@ -85,21 +85,21 @@ in hex, and one string parameter, a file base name. It has the following form: *statics-start*, *statics-end*, *rt-basename* - *cc-sp*: -- - a zero page address pair used as stack pointer for C local variables + - a zero page address pair used as stack pointer for C local variables - *zp*: -- - a second zero page address pair that the compiled code may use + - a second zero page address pair that the compiled code may use - *rt-start*: -- - the first code address of the runtime module + - the first code address of the runtime module - *rt-jumplist*: -- - the address of the runtime modules jump list (see below) + - the address of the runtime modules jump list (see below) - *rt-end*: -- - the first free code address after the end of the runtime module + - the first free code address after the end of the runtime module - *statics-start*: -- - the lowest address of the runtime module's static vars + - the lowest address of the runtime module's static vars - *statics-end*: -- - the hightest address + 1 of the runtime module's static vars + - the hightest address + 1 of the runtime module's static vars - *rt-basename*: -- - the base filename of the runtime module. *basename*.o is then the + - the base filename of the runtime module. *basename*.o is then the code, *basename*.i the initialzation values of the module's static vars. (Of course *basename*.h is the header file containing the module's symbol definitions and the #pragma cc64 directive.) @@ -125,17 +125,17 @@ statics_last .word 0 The first part of the jumplist is a list of 4 addresses: - `rt_jumplist` -- - This address (equal to main_addr, of course) is #pragma cc64's 4th param + - This address (equal to main_addr, of course) is #pragma cc64's 4th param and the runtime module's anchor for the compiler. - `main_adr` -- - Here the main()-function's address is inserted by the compiler. The + - Here the main()-function's address is inserted by the compiler. The runtime module's initialization calls main() with a jmp (main.adr). - `code_last` -- - Here the last address + 1 of the generated code is inserted by the compiler. + - Here the last address + 1 of the generated code is inserted by the compiler. - `statics_first` -- - Here the first address of the generated code is inserted by the compiler. + - Here the first address of the generated code is inserted by the compiler. - `statics_last` -- - Here the last address + 1 of the generated code is inserted by the compiler. + - Here the last address + 1 of the generated code is inserted by the compiler. As described above, statics are allocated from the end of the used memory downwards. The statics' initialization values are placed by the @@ -147,10 +147,10 @@ In case of no static variables, init_first will be equal to init_last. After the addresses follows a list of 6 jmp instructions: - `jmp (zp)` -- - This it is used to emulate `jsr (zp)`. zp is the second zero + - This it is used to emulate `jsr (zp)`. zp is the second zero page pointer used by the compiler. - `jmp switch` -- - Code generated for switch statements consists of loading into a/x + - Code generated for switch statements consists of loading into a/x the 16 bit value to match to case statements and a jsr to this address. Following the calling jsr-instruction will be an array of pairs of 16 bit values, one pair per case statement. The second value in each pair is the case @@ -163,15 +163,15 @@ It then compares a/x to the 2nd value of each pair, jumps to the pair's first address in case of match, and in case of no match jumps behind the terminating 0 at the end of the list. - jmp mult -- - Multiplies (signed) the content of a/x with the integer in zp/zp+1, + - Multiplies (signed) the content of a/x with the integer in zp/zp+1, leaving the result in a/x. - jmp divmod -- - Divides (signed) zp/zp+1 by a/x, leaving the result in a/x and the + - Divides (signed) zp/zp+1 by a/x, leaving the result in a/x and the remainder in zp/zp+1. - jmp shl -- - Arithmetically shifts left a/x by y bits. + - Arithmetically shifts left a/x by y bits. - jmp shr -- - Arithmetically shifts right a/x by y bits. + - Arithmetically shifts right a/x by y bits. The jumplist may be positioned anywhere in the library. diff --git a/Usage.md b/Usage.md index c55f7ff..5d046b7 100644 --- a/Usage.md +++ b/Usage.md @@ -107,72 +107,72 @@ can be given either in decimal or, with a preceeding $, in hex. ### Main commands - `help` -- - shows a list of all commands + - shows a list of all commands - `cc` _file.c_ -- - compiles _file.c_, producing -- - - a binary executable _file_ if _file.c_ contains a `main()` function -- - - an extended runtime library consisting of _file.h_, _file.i_, _file.o_ + - compiles _file.c_, producing + - a binary executable _file_ if _file.c_ contains a `main()` function + - an extended runtime library consisting of _file.h_, _file.i_, _file.o_ otherwise - `ed` _file_ -- - opens _file_ in the text editor + - opens _file_ in the text editor - `cat` _file_ -- - displays the content of _file_ on the screen + - displays the content of _file_ on the screen - `bye` -- - exits cc64 + - exits cc64 ### Disk commands - `dos` -- - reads and prints the error channel of the cc64's configured main disk drive + - reads and prints the error channel of the cc64's configured main disk drive (see `device?` and `device` below) - `dos` _xxx_ -- - sends the command _xxx_ to cc64's configured main disk drive + - sends the command _xxx_ to cc64's configured main disk drive - `dir` -- - lists the directory of cc64's configured main disk drive + - lists the directory of cc64's configured main disk drive - `device?` -- - shows the device number of the disk drive cc64 uses for source files and + - shows the device number of the disk drive cc64 uses for source files and compilation outputs, and the device number of the auxiliary disk drive where cc64 places temporary files during compile. By default these are the same, and there's only a reason to change that if space on the main drive becomes an issue. Note: Currently the `dos` command only works on the main drive. - _n_ `device` -- - configures cc64 to use device _n_ as main disk drive + - configures cc64 to use device _n_ as main disk drive - _n_ `auxdev` -- - configures cc64 to use device _n_ as auxiliary disk drive for temp files + - configures cc64 to use device _n_ as auxiliary disk drive for temp files ### Memory commands - `mem` -- - displays the compiler's memory setup + - displays the compiler's memory setup - _nnn_ `set-himem` -- - sets the upper limit of the compiler's memory to _nnn_. Default value is + - sets the upper limit of the compiler's memory to _nnn_. Default value is $cbd0. The memory $cbd0-$cfff is needed by [c-charset](#c-charset) which cc64 recognizes and activates if it is installed. If a c-chargen rom generated by [c-char-rom-gen](#c-char-rom-gen) is used, e.g. in an emulator, or if no C charset (which provides the characters \^_{|}~) is desired, then himem can be set to $d000. - _nnn_ `set-heap` -- - sets the heap to _nnn_ elements. One heap element is needed for each forward + - sets the heap to _nnn_ elements. One heap element is needed for each forward function reference, i.e. for each function that is called before it is defined. A prototype, i.e. a declaraion, must exist before a function can be called. - _nnn_ `set-hash` -- - sets the hash table size for global symbols. Needs at least one element per + - sets the hash table size for global symbols. Needs at least one element per compiled global symbol and should be sized reasonably generous for hasing to be efficient. I'm sorry to say I don't have data yet, though. - _nnn_ `set-symtab` -- - sets the symbol table size in bytes. This is used both for local and + - sets the symbol table size in bytes. This is used both for local and global symbols and must be increased if a symbol table overflow error occurs. - _nnn_ `set-code` -- - sets the size of the code buffer in bytes. The compiled code for each + - sets the size of the code buffer in bytes. The compiled code for each individual compiled function must fit completely into this buffer. Otherwise, a function too long error is thrown. -- - The remaining memory aka staticbuffer is used to buffer initialization values + - The remaining memory aka staticbuffer is used to buffer initialization values of static variables. Its size isn't critical as it is flushed to file when full; it just needs to be positive. -- - Not available on the X16 where a fixed code buffer of 8 kB lives in + - Not available on the X16 where a fixed code buffer of 8 kB lives in banked RAM. - _nnn_ _mmm_ `set-stacks` -- - sets the size of data stack (_nnn_ bytes) and return stack (_mmm_ bytes) + - sets the size of data stack (_nnn_ bytes) and return stack (_mmm_ bytes) and resets the system. Note that the sizes shown by `mem` will be _nnn_ minus 6 and _mmm_ plus 6. The stack sizes determine the maximum depth of arithmetic expressions and the @@ -183,9 +183,19 @@ are, and alas again I don't have any data to guide by yet. Should the compiler behave strangely on some deeply nested code, it should be reloaded freshly from disk, and the stack sizes set to higher values. - `saveall` _name_ -- - saves the complete compiler together with its actual memory settings to a + f- saves the complete compiler together with its actual memory settings to a new file _name_ +### Misc commands + +- `1 list!` +- `0 list!` + - switches listing the C source while compiling on respectively off. Default is off. Listing can cause ~25% increase in pass1 compile time. +- `list?` + - shows whether listing is currently on or off. +- `exec` _file_ + - reads _file_ and executes the commands therein. This can be used e.g. to script compile operations. + ## Peddi @@ -194,7 +204,7 @@ There's no limit in line length (exept memory). Memory overflow is signalled by a double flash of the screen border. Peddi is called with - `ed filename` + `ed` _file_ Inside the editor, there are these key bindings: ``` @@ -370,3 +380,11 @@ run, will the ROM charset into RAM (at $c000), patch the needed characters, and then save the RAM $c000-$cfff to disk in a file named `c-chargen` which then can be used by an emulator as chargen or programmed into an (E)EPROM and used in a real C64. + +## Keyboard + +There are two custom keyboard maps for VICE available in the +[emulator/](https://github.com/pzembrod/cc64/tree/master/emulator) directory that I use under Linux to map the C characters \^_{|}~ symbolically to the respective keys on the host keymap, one for the +[C64](https://github.com/pzembrod/cc64/blob/master/emulator/x11_sym_c64_vf_de.vkm) and one for the [C16](https://github.com/pzembrod/cc64/blob/master/emulator/x11_sym_c16_vf_de.vkm). The options I use are visible [here](https://github.com/pzembrod/cc64/blob/master/emulator/which-vice.sh), and I should add the disclaimer that I use German keyboard layouts, though I believe this should not matter since the key mapping used is symbolic, not positional. + +For x16emu I currently actually don't know how to type those keys in PETSCII mode. The right thing to do is likely anyway to compile an ISO version of cc64 - which is on my road map. diff --git a/Versions.md b/Versions.md index c08d372..2ad1d2d 100644 --- a/Versions.md +++ b/Versions.md @@ -1,5 +1,16 @@ # cc64 versions +## v0.9 + +Main topic of v0.9 is compile speed. With the help of a simple profiler +I was able to optimize a few performance hotspots in the scanner and in +the scanner/parser interface, resulting in more than 20% compile time +saved or more than 30% speed gained. + +Also, Source code listing during compile can now be switched on and off. +Default is off; it turns out that switching off listing decreases +compile time by another ~10%. + ## v0.8.1 v0.8.1 brings fixes for 2 bugs around declaring and exporting symbols for new runtime libraries. Thanks to buzzphp for finding and reporting them. diff --git a/autostart-c16/cc64.T64 b/autostart-c16/cc64.T64 index cd263b8..4508ef0 100644 Binary files a/autostart-c16/cc64.T64 and b/autostart-c16/cc64.T64 differ diff --git a/autostart-c16/cc64pe.T64 b/autostart-c16/cc64pe.T64 index 990d58f..4844758 100644 Binary files a/autostart-c16/cc64pe.T64 and b/autostart-c16/cc64pe.T64 differ diff --git a/autostart-c16/peddi.T64 b/autostart-c16/peddi.T64 index 95ffe0c..ea3f6b6 100644 Binary files a/autostart-c16/peddi.T64 and b/autostart-c16/peddi.T64 differ diff --git a/autostart-c16/vf-build-base.T64 b/autostart-c16/vf-build-base.T64 index a4b7b21..3f1eb72 100644 Binary files a/autostart-c16/vf-build-base.T64 and b/autostart-c16/vf-build-base.T64 differ diff --git a/autostart-c64/cc64.T64 b/autostart-c64/cc64.T64 index fc9d457..4658c26 100644 Binary files a/autostart-c64/cc64.T64 and b/autostart-c64/cc64.T64 differ diff --git a/autostart-c64/cc64pe.T64 b/autostart-c64/cc64pe.T64 index 80dc89a..d9894db 100644 Binary files a/autostart-c64/cc64pe.T64 and b/autostart-c64/cc64pe.T64 differ diff --git a/autostart-c64/cc64prof.T64 b/autostart-c64/cc64prof.T64 new file mode 100644 index 0000000..070bdae Binary files /dev/null and b/autostart-c64/cc64prof.T64 differ diff --git a/autostart-c64/peddi.T64 b/autostart-c64/peddi.T64 index c178a10..05714d5 100644 Binary files a/autostart-c64/peddi.T64 and b/autostart-c64/peddi.T64 differ diff --git a/autostart-c64/vf-build-base.T64 b/autostart-c64/vf-build-base.T64 index 303b242..efca6af 100644 Binary files a/autostart-c64/vf-build-base.T64 and b/autostart-c64/vf-build-base.T64 differ diff --git a/build/build-cc64.sh b/build/build-cc64.sh deleted file mode 100755 index a206747..0000000 --- a/build/build-cc64.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -e - -platform="$1" - -builddir="$(dirname "${BASH_SOURCE[0]}")" -basedir="$(realpath --relative-to="$PWD" "${builddir}/..")" -emulatordir="$(realpath --relative-to="$PWD" "${basedir}/emulator")" -cbmfiles="$(realpath --relative-to="$PWD" "${basedir}/${platform}files")" -logfile="${cbmfiles}/cc64.log" - -rm -f "${cbmfiles}/cc64" -rm -f "${logfile}" - -keybuf="include cc64-main.fth\nsaveall cc64\ndos s0:notdone" - -export OUTFILES="cc64 cc64.log" -"${emulatordir}/run-in-${platform}emu.sh" "vf-build-base" "${keybuf}" - -petscii2ascii "${logfile}" | \ - grep -F 'compile successful' || \ - (echo "check logfile ${logfile}" && exit 1) diff --git a/build/build-cc64pe.sh b/build/build-cc64pe.sh deleted file mode 100755 index f3f59ea..0000000 --- a/build/build-cc64pe.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -e - -platform="$1" - -builddir="$(dirname "${BASH_SOURCE[0]}")" -basedir="$(realpath --relative-to="$PWD" "${builddir}/..")" -emulatordir="$(realpath --relative-to="$PWD" "${basedir}/emulator")" -cbmfiles="$(realpath --relative-to="$PWD" "${basedir}/${platform}files")" -logfile="${cbmfiles}/cc64pe.log" - -rm -f "${cbmfiles}/cc64pe" -rm -f "${logfile}" - -keybuf="include cc64pe-main.fth\nsaveall cc64pe\ndos s0:notdone" - -PLATFORM="${platform}" \ - "${emulatordir}/run-in-vice.sh" "vf-build-base" "${keybuf}" - -petscii2ascii "${logfile}" | \ - grep -F 'compile successful' || \ - (echo "check logfile ${logfile}" && exit 1) diff --git a/build/build-peddi.sh b/build/build-peddi.sh deleted file mode 100755 index a42ea90..0000000 --- a/build/build-peddi.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -e - -platform="$1" - -builddir="$(dirname "${BASH_SOURCE[0]}")" -basedir="$(realpath --relative-to="$PWD" "${builddir}/..")" -emulatordir="$(realpath --relative-to="$PWD" "${basedir}/emulator")" -cbmfiles="$(realpath --relative-to="$PWD" "${basedir}/${platform}files")" -logfile="${cbmfiles}/peddi.log" - -rm -f "${cbmfiles}/peddi" -rm -f "${logfile}" - -keybuf="include peddi-main.fth\nsaveall peddi\ndos s0:notdone" - -export OUTFILES="peddi peddi.log" -"${emulatordir}/run-in-${platform}emu.sh" "vf-build-base" "${keybuf}" - -petscii2ascii "${logfile}" | \ - grep -F 'compile successful' || \ - (echo "check logfile ${logfile}" && exit 1) diff --git a/build/notdone b/build/notdone deleted file mode 100644 index 7679df3..0000000 --- a/build/notdone +++ /dev/null @@ -1,5 +0,0 @@ -Flag file: -Build or test processes running in VICE signal that they are done -by scratching this file's copy from the c64files/ dir. -Corresponding build bash scripts watch for the existence of this -file in c64files/ and terminate VICE after the file disappeared. diff --git a/c16files/cc64 b/c16files/cc64 index 812702f..ffc488e 100644 Binary files a/c16files/cc64 and b/c16files/cc64 differ diff --git a/c16files/cc64pe b/c16files/cc64pe index f928978..4310ea9 100644 Binary files a/c16files/cc64pe and b/c16files/cc64pe differ diff --git a/c16files/peddi b/c16files/peddi index 7052810..ab846e2 100644 Binary files a/c16files/peddi and b/c16files/peddi differ diff --git a/c16files/vf-build-base b/c16files/vf-build-base index e2eb33b..899c199 100644 Binary files a/c16files/vf-build-base and b/c16files/vf-build-base differ diff --git a/c64files/cc64 b/c64files/cc64 index 8679f2c..458eb4b 100644 Binary files a/c64files/cc64 and b/c64files/cc64 differ diff --git a/c64files/cc64pe b/c64files/cc64pe index bfd0c09..09b3c06 100644 Binary files a/c64files/cc64pe and b/c64files/cc64pe differ diff --git a/c64files/cc64prof b/c64files/cc64prof new file mode 100644 index 0000000..4f01ff8 Binary files /dev/null and b/c64files/cc64prof differ diff --git a/c64files/peddi b/c64files/peddi index f9b5c6b..1e56a74 100644 Binary files a/c64files/peddi and b/c64files/peddi differ diff --git a/c64files/vf-build-base b/c64files/vf-build-base index c6f216a..04c7397 100644 Binary files a/c64files/vf-build-base and b/c64files/vf-build-base differ diff --git a/cc64-c16files.d64 b/cc64-c16files.d64 index bac06c8..3ea2c34 100644 Binary files a/cc64-c16files.d64 and b/cc64-c16files.d64 differ diff --git a/cc64-c16files.zip b/cc64-c16files.zip index f44a8df..1f134ba 100644 Binary files a/cc64-c16files.zip and b/cc64-c16files.zip differ diff --git a/cc64-c64files.d64 b/cc64-c64files.d64 index 68dd047..79beae9 100644 Binary files a/cc64-c64files.d64 and b/cc64-c64files.d64 differ diff --git a/cc64-c64files.zip b/cc64-c64files.zip index 12e0d3d..8de46de 100644 Binary files a/cc64-c64files.zip and b/cc64-c64files.zip differ diff --git a/cc64-x16files-sdcard.zip b/cc64-x16files-sdcard.zip index 1e22219..73b201c 100644 Binary files a/cc64-x16files-sdcard.zip and b/cc64-x16files-sdcard.zip differ diff --git a/cc64-x16files.zip b/cc64-x16files.zip index b4a56c2..adff80d 100644 Binary files a/cc64-x16files.zip and b/cc64-x16files.zip differ diff --git a/emulator/Makefile b/emulator/Makefile new file mode 100644 index 0000000..586ab9f --- /dev/null +++ b/emulator/Makefile @@ -0,0 +1,6 @@ + +sdcard.img: sdcard.sfdisk mk-sdcard.sh + ./mk-sdcard.sh sdcard.sfdisk $@ + +clean: + rm -f sdcard.img diff --git a/emulator/build-binary.sh b/emulator/build-binary.sh new file mode 100755 index 0000000..a42585b --- /dev/null +++ b/emulator/build-binary.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +platform="$1" +target="$2" +main_include="$3" +test -n "${main_include}" || main_include="${target}" + +emulatordir="$(dirname "${BASH_SOURCE[0]}")" +basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")" +cbmfiles="$(realpath --relative-to="$PWD" "${basedir}/${platform}files")" +logfile="${cbmfiles}/${target}.log" + +rm -f "${cbmfiles}/${target}" +rm -f "${logfile}" + +keybuf="include ${main_include}-log.fth\ninclude ${main_include}.fth\nsaveall ${target}\ndos s0:notdone" +if [ "${platform}" == "c64" ]; then + keybuf="include set-d000.fth\ncold\n${keybuf}" +fi + +export OUTFILES="${target} ${target}.log" +"${emulatordir}/run-in-${platform}emu.sh" "vf-build-base" "${keybuf}" + +petscii2ascii "${logfile}" | \ + grep -F 'compile successful' || \ + (echo "check logfile ${logfile}" && exit 1) diff --git a/emulator/run-in-x16emu.sh b/emulator/run-in-x16emu.sh index d77dd82..be27622 100755 --- a/emulator/run-in-x16emu.sh +++ b/emulator/run-in-x16emu.sh @@ -13,6 +13,7 @@ test -n "${x16filesdir}" || \ sdcard="${emulatordir}/sdcard.img" x16script="${basedir}/tmp/x16script" +make -C "${emulatordir}" sdcard.img mformat -i "${sdcard}" -F for asciifile in $(cd "${x16filesdir}" && ls *) do @@ -86,4 +87,7 @@ for outfile in ${OUTFILES} do sdfile="$(echo "${outfile}"|ascii2petscii - |tr -d '\r')" mcopy -i "${sdcard}" "::${sdfile}" "${x16filesdir}/${outfile}" + # Timestamps on the sdcard from x16emu seem to not be reliable. + # Touch the outfiles so make's dependency analysis works. + touch "${x16filesdir}/${outfile}" done diff --git a/forth/v4th-c16+ b/forth/v4th-c16+ index e2eb33b..899c199 100644 Binary files a/forth/v4th-c16+ and b/forth/v4th-c16+ differ diff --git a/forth/v4th-c64 b/forth/v4th-c64 index c6f216a..04c7397 100644 Binary files a/forth/v4th-c64 and b/forth/v4th-c64 differ diff --git a/forth/v4th-x16 b/forth/v4th-x16 index 3efa28c..ee12471 100644 Binary files a/forth/v4th-x16 and b/forth/v4th-x16 differ diff --git a/src/cc64/cc64-log.fth b/src/cc64/cc64-log.fth new file mode 100644 index 0000000..69d5c68 --- /dev/null +++ b/src/cc64/cc64-log.fth @@ -0,0 +1,5 @@ + +' noop alias \log + +include logtofile.fth +logopen cc64.log diff --git a/src/cc64/cc64-main.fth b/src/cc64/cc64.fth similarity index 62% rename from src/cc64/cc64-main.fth rename to src/cc64/cc64.fth index c85944a..5596413 100644 --- a/src/cc64/cc64-main.fth +++ b/src/cc64/cc64.fth @@ -1,57 +1,70 @@ -\ with build log: -' noop alias \log -\ without build log: -\ ' \ alias \log - -\log include logtofile.fth -\log logopen" cc64.log" +\needs \log ' \ alias \log immediate +\needs \prof | ' \ alias \prof immediate | ' | alias ~ | ' |on alias ~on | ' |off alias ~off - (64 include tmpheap.fth C) + (64 include trnstmpheap.fth C) (64 $2000 mk-tmp-heap C) (16 include notmpheap.fth C) - (CX include x16tmpheap.fth C) + (CX include x16trnstmphp.fth C) onlyforth decimal \ | : include include base push hex cr here u. heap u. up@ u. ; include util-words.fth - cr + (64 include tmp6502asm.fth C) \ 6502 assembler on tmpheap + (16 include trns6502asm.fth C) \ 6502 assembler on heap + (CX include tmp6502asm.fth C) \ 6502 assembler on tmpheap + \prof include 6526timer.fth + \prof include profiler.fth + \prof profiler-init-buckets + \prof profiler-bucket [strings] + include strings.fth + \prof [strings] end-bucket ~ vocabulary compiler compiler also definitions + \prof profiler-bucket [memman-etc] include init.fth include strtab.fth include errormsgs.fth include errorhandler.fth include memman.fth - tmpclear + tmp-clear + \prof [memman-etc] end-bucket + \prof profiler-bucket [file-handling] include fileio.fth include fileman.fth - tmpclear + tmp-clear include codehandler.fth - tmpclear + tmp-clear include rt-ptrs.fth + \prof [file-handling] end-bucket + \prof profiler-bucket [input] include input.fth + \prof [input] end-bucket + \prof profiler-bucket [scanner] include scanner.fth + \prof [scanner] end-bucket + \prof profiler-bucket [symtab] include symboltable.fth include preprocessor.fth - tmpclear + tmp-clear + \prof [symtab] end-bucket + \prof profiler-bucket [parser] include listman.fth - tmpclear + tmp-clear onlyforth (64 include tmp6502asm.fth C) \ 6502 assembler on tmpheap - (16 include trns6502asm.fth C) \ 6502 assembler on heap (CX include tmp6502asm.fth C) \ 6502 assembler on tmpheap include lowlevel.fth (CX include x16edit.fth C) @@ -59,12 +72,14 @@ include v-assembler.fth include codegen.fth include parser.fth - include p2write-decl.fth - tmpclear + \prof [parser] end-bucket + \prof profiler-bucket [pass2] + include p2write-decl.fth + tmp-clear include pass2.fth include invoke.fth - \ words + \prof [pass2] end-bucket forth definitions include savesystem.fth @@ -73,10 +88,14 @@ vocabulary shell compiler also shell definitions + \prof profiler-bucket [shell] include shell.fth include version.fth | : .binary-name ." cc64 C compiler" ; include init-shell.fth + \prof [shell] end-bucket + + \prof include prof-metrics.fth onlyforth @@ -89,12 +108,14 @@ .( here/heap/up@ = ) base @ hex here u. heap u. up@ u. cr base ! s0 @ here - u. .( dictionary bytes to spare pre save ) cr + tmp-clear \log display save \log alsologtofile s0 @ here - u. .( dictionary bytes to spare post save ) cr .( here/heap/up@ = ) base @ hex here u. heap u. up@ u. cr base ! + cr .( compile successful) cr \log logclose diff --git a/src/cc64/cc64pe-log.fth b/src/cc64/cc64pe-log.fth new file mode 100644 index 0000000..9dcbf32 --- /dev/null +++ b/src/cc64/cc64pe-log.fth @@ -0,0 +1,5 @@ + +' noop alias \log + +include logtofile.fth +logopen cc64pe.log diff --git a/src/cc64/cc64pe-main.fth b/src/cc64/cc64pe.fth similarity index 85% rename from src/cc64/cc64pe-main.fth rename to src/cc64/cc64pe.fth index d4cd7d2..5348606 100644 --- a/src/cc64/cc64pe-main.fth +++ b/src/cc64/cc64pe.fth @@ -1,17 +1,12 @@ -\ with build log: -' noop alias \log -\ without build log: -\ ' \ alias \log - -\log include logtofile.fth -\log logopen" cc64pe.log" +\needs \log ' \ alias \log immediate +\needs \prof | ' \ alias \prof immediate | ' | alias ~ | ' |on alias ~on | ' |off alias ~off - (64 include tmpheap.fth C) + (64 include trnstmpheap.fth C) (64 $2000 mk-tmp-heap C) (16 include notmpheap.fth C) (CX include x16tmpheap.fth C) @@ -20,6 +15,10 @@ \ | : include include base push hex cr here u. heap u. up@ u. ; include util-words.fth + (64 include tmp6502asm.fth C) \ 6502 assembler on tmpheap + (16 include trns6502asm.fth C) \ 6502 assembler on heap + (CX include tmp6502asm.fth C) \ 6502 assembler on tmpheap + include strings.fth cr | vocabulary compiler compiler also definitions @@ -30,38 +29,35 @@ include errormsgs.fth include errorhandler.fth include memman.fth - tmpclear + tmp-clear include fileio.fth include fileman.fth - tmpclear + tmp-clear include codehandler.fth - tmpclear + tmp-clear include rt-ptrs.fth include input.fth include scanner.fth include symboltable.fth include preprocessor.fth - tmpclear + tmp-clear include listman.fth - tmpclear + tmp-clear onlyforth (64 include tmp6502asm.fth C) \ 6502 assembler on tmpheap - (16 include trns6502asm.fth C) \ 6502 assembler on heap (CX include tmp6502asm.fth C) \ 6502 assembler on tmpheap include lowlevel.fth onlyforth compiler also definitions include v-assembler.fth - \ tmpclear - include codegen.fth include parser.fth include p2write-decl.fth - tmpclear + tmp-clear include pass2.fth include invoke.fth \ words @@ -94,7 +90,7 @@ ' dev ' compiler - clear + tmp-clear clear | alias compiler diff --git a/src/cc64/cc64prof-log.fth b/src/cc64/cc64prof-log.fth new file mode 100644 index 0000000..0363bfb --- /dev/null +++ b/src/cc64/cc64prof-log.fth @@ -0,0 +1,5 @@ + +' noop alias \log + +include logtofile.fth +logopen cc64prof.log diff --git a/src/cc64/cc64prof.fth b/src/cc64/cc64prof.fth new file mode 100644 index 0000000..6d0e689 --- /dev/null +++ b/src/cc64/cc64prof.fth @@ -0,0 +1,5 @@ + +(64 | ' noop alias \prof C) +\prof cr .( profiling cc64 on c64 ) cr + +include cc64.fth diff --git a/src/cc64/errormsgs.fth b/src/cc64/errormsgs.fth index 3810464..e62485f 100644 --- a/src/cc64/errormsgs.fth +++ b/src/cc64/errormsgs.fth @@ -6,7 +6,7 @@ \ errormessages 11sep94pz -~ stringtab errormessage +~ 40 string-tab errormessage ~ x *syntax* x" syntax error" \ x *in-file* x" source file error" @@ -75,7 +75,8 @@ ~ x *stack* x" stack overflow" ~ x *rstack* x" return stack overflow" ~ x *compiler* x" compiler error" - endtab + +end-tab \ see issue 11. this here was broken. \ ~ create err-blk 0 , diff --git a/src/cc64/input.fth b/src/cc64/input.fth index c43df2f..810673b 100644 --- a/src/cc64/input.fth +++ b/src/cc64/input.fth @@ -100,7 +100,7 @@ \ input : nextline 14sep94pz -~ variable listing listing on +~ variable listing listing off || : printsourceline ( -- ) linebuf /linebuf bounds diff --git a/src/cc64/invoke.fth b/src/cc64/invoke.fth index a03e1b8..f2517ad 100644 --- a/src/cc64/invoke.fth +++ b/src/cc64/invoke.fth @@ -44,10 +44,12 @@ \ invoke : start compiler 13sep94pz -forth definitions +\ forth definitions - : cc ( -- ) - clearstack init +~ : cc ( -- ) + clearstack + \prof profiler-start + init bl word dup c@ 0= ?usage dup exe-name strcpy source-name strcpy @@ -62,7 +64,10 @@ forth definitions IF ." error(s) occured" cr close-files scratchfiles exit THEN + \prof profiler-timestamp ." pass 2:" cr pass2 cr ." compilation done" cr - scratchfiles ; + scratchfiles + \prof profiler-end + ; diff --git a/src/cc64/memman.fth b/src/cc64/memman.fth index aa72909..9647869 100644 --- a/src/cc64/memman.fth +++ b/src/cc64/memman.fth @@ -141,8 +141,8 @@ WHILE rot drop REPEAT 2drop ! ; ~ : relocate ( stacklen rstacklen -- ) - empty 256 max 8192 min swap - 256 max 8192 min pad + 256 + + empty $100 max $2000 min swap + $100 max $2000 min pad + $100 + 2dup + 2+ limit u> abort" stacks beyond limit" under + origin $A + ! \ r0 diff --git a/src/cc64/parser.fth b/src/cc64/parser.fth index e216840..3e9add6 100644 --- a/src/cc64/parser.fth +++ b/src/cc64/parser.fth @@ -17,20 +17,27 @@ \ parser: tools 22feb91pz : comes? ( tokenvalue token -- flag ) - nextword dnegate d+ or - IF backword false ELSE true THEN ; + thisword dnegate d+ or + IF false ELSE accept true THEN ; : comes-a? ( token -- tokenvalue true ) ( token -- false ) - nextword rot = dup not - IF nip backword THEN ; + thisword rot = dup not + IF nip THEN ; : expect ( tokenvalue token -- ) 2dup comes? IF 2drop - ELSE *expected* error word. + ELSE word. *expected* error THEN ; +: expect';' ascii ; #char# expect ; +: expect':' ascii : #char# expect ; +: expect'(' ascii ( #char# expect ; +: expect')' ascii ) #char# expect ; +: expect']' ascii ] #char# expect ; + + \ : skipword ( -- ) \ *ignored* error nextword word. ; @@ -61,13 +68,14 @@ do$: compile$ ( -- adr ) : atom ( -- obj ) #number# comes-a? - IF do-numatom exit THEN + IF accept do-numatom exit THEN #id# comes-a? - IF do-idatom exit THEN + IF accept do-idatom exit THEN #string# comes-a? IF drop compile$ - do-stringatom exit THEN + do-stringatom accept exit THEN ." a value" *expected* error + \ consider skipword 0 do-numatom ; @@ -82,7 +90,7 @@ doer assign value expression value do-add do-pointer - ascii ] #char# expect ; + expect']' ; \ *** Block No. 52, Hexblock 34 @@ -102,12 +110,12 @@ doer assign %stdfctn is? IF ascii ) #char# comes? not IF std-arguments - ascii ) #char# expect THEN + expect')' THEN do-std-call ELSE prepare-call ascii ) #char# comes? not IF arguments - ascii ) #char# expect THEN + expect')' THEN do-call THEN ; @@ -119,7 +127,7 @@ doer assign teststack ascii ( #char# comes? IF expression - ascii ) #char# expect + expect')' ELSE atom THEN BEGIN mark >r ascii ( #char# comes? @@ -135,58 +143,52 @@ doer assign \ parser: unary 22feb91pz -: unary ( -- obj ) recursive +: comes-tab-token? ( tab token -- cfa true ) + ( tab token -- false ) + comes-a? + IF swap dup 2+ swap @ bounds + DO dup I @ = + IF accept drop I 2+ @ + true UNLOOP exit THEN + 4 +LOOP + THEN + drop false ; - #oper# comes-a? IF - <-> case? IF unary do-neg exit THEN - case? IF unary do-not exit THEN - case? - IF unary do-inv exit THEN - <*> case? - IF unary do-pointer exit THEN - case? - IF unary do-adress exit THEN - <++> case? - IF unary do-preinc exit THEN - <--> case? - IF unary do-predec exit THEN - drop backword THEN - primary - #oper# comes-a? IF - <++> case? IF do-postinc exit THEN - <--> case? IF do-postdec exit THEN - drop backword THEN ; +create unary-tab1 7 4 * , + <-> , ' do-neg , + , ' do-not , + , ' do-inv , + <*> , ' do-pointer , + , ' do-adress , + <++> , ' do-preinc , + <--> , ' do-predec , +create unary-tab2 2 4 * , + <++> , ' do-postinc , + <--> , ' do-postdec , + +: unary ( -- obj ) recursive + unary-tab1 #oper# comes-tab-token? + IF >r unary r> execute exit THEN + primary + unary-tab2 #oper# comes-tab-token? + IF execute exit THEN ; \ *** Block No. 55, Hexblock 37 \ parser: binary 06mar91pz -: comes-op? ( tab -- cfa true ) - ( tab -- false ) - #oper# comes-a? - IF swap dup 2+ swap @ bounds - DO dup I @ = - IF drop I 2+ @ true - UNLOOP exit THEN - 4 +LOOP - backword THEN - drop false ; - : binary ( tab -- ) create , dup 4 * , 0 DO swap , , LOOP does> ( tab -- obj ) dup @ execute - BEGIN 2 pick 2+ comes-op? WHILE >r + BEGIN 2 pick 2+ #oper# comes-tab-token? WHILE >r value 2 pick @ execute value r> execute REPEAT 2 roll drop ; -\ fuer assign wird 'von hand' eine -\ 'comes-op?'-tabelle angelegt ! - \ *** Block No. 56, Hexblock 38 @@ -252,7 +254,7 @@ doer assign IF do-cond1 recursive conditional do-cond2 - ascii : #char# expect + expect':' recursive conditional do-cond3 THEN ; @@ -262,22 +264,17 @@ doer assign \ parser: assign 06mar91pz create assign-oper 11 4 * , - <=> 0 swap , , - <*=> ' do-mult swap , , - ' do-div swap , , - <%=> ' do-mod swap , , - <+=> ' do-add swap , , - <-=> ' do-sub swap , , - <<<=> ' do-shl swap , , - <>>=> ' do-shr swap , , - ' do-and swap , , - ' do-xor swap , , - ' do-or swap , , - -\ hier wird eine tabelle angelegt, -\ die mit dem format der 'binary'- -\ tabellen uebereinstimmt, also -\ mit 'comes-op?' durchsucht wird. + <=> , 0 , + <*=> , ' do-mult , + , ' do-div , + <%=> , ' do-mod , + <+=> , ' do-add , + <-=> , ' do-sub , + <<<=> , ' do-shl , + <>>=> , ' do-shr , + , ' do-and , + , ' do-xor , + , ' do-or , \ *** Block No. 60, Hexblock 3c @@ -286,7 +283,7 @@ create assign-oper 11 4 * , make assign ( -- obj ) conditional - assign-oper comes-op? + assign-oper #oper# comes-tab-token? IF ?dup IF >r prepare-asgnop recursive assign value @@ -328,8 +325,6 @@ create assign-oper 11 4 * , doer compound doer statement -: expect';' ascii ; #char# expect ; - : expression-stmt ( -- ) expression expect';' ; @@ -344,9 +339,7 @@ doer statement \ parser: statement 22feb91pz : (expression) ( -- ) - ascii ( #char# expect - expression - ascii ) #char# expect ; + expect'(' expression expect')' ; : if-stmt ( -- ) (expression) @@ -412,7 +405,7 @@ variable cases : case-stmt ( -- ) constant-expression - ascii : #char# expect + expect':' switch-state @ 0= IF drop *noswitch* error exit THEN heap> ?dup 0= ?drop&exit @@ -420,7 +413,7 @@ variable cases 2+ .label over ! 2+ ! ; : default-stmt ( -- ) - ascii : #char# expect + expect':' switch-state @ 1+ IF *ill-default* error ELSE .label switch-state ! @@ -493,7 +486,7 @@ variable cases : 3rd-expression ( -- ) ascii ) #char# comes? not IF expression - ascii ) #char# expect THEN ; + expect')' THEN ; \ *** Block No. 70, Hexblock 46 @@ -502,7 +495,7 @@ variable cases : for-stmt ( -- ) breaks new conts new - ascii ( #char# expect + expect'(' 1st-expression .label \ X 2nd-expression? dup >r \ ^ @@ -525,35 +518,26 @@ variable cases \ parser: statement 12mar91pz -: statement? ( -- flag ) true - #keyword# comes-a? IF - case? IF break-stmt exit THEN - case? - IF continue-stmt exit THEN - case? IF if-stmt exit THEN - case? IF do-stmt exit THEN - case? IF while-stmt exit THEN - case? IF for-stmt exit THEN - case? IF case-stmt exit THEN - case? - IF default-stmt exit THEN - case? - IF switch-stmt exit THEN - case? - IF return-stmt exit THEN - drop backword THEN - - -\ *** Block No. 72, Hexblock 48 - -\ parser: statement 11sep94pz +create statement-tab 10 4 * , + , ' break-stmt , + , ' continue-stmt , + , ' if-stmt , + , ' do-stmt , + , ' while-stmt , + , ' for-stmt , + , ' case-stmt , + , ' default-stmt , + , ' switch-stmt , + , ' return-stmt , +: statement? ( -- flag ) true + statement-tab #keyword# comes-tab-token? + IF execute exit THEN #char# comes-a? IF - ascii { case? IF compound exit THEN - ascii ; case? IF exit THEN - ascii } case? IF backword not - exit THEN - drop backword THEN drop + ascii { case? IF accept compound exit THEN + ascii ; case? IF accept exit THEN + ascii } case? IF not exit THEN + drop THEN drop mark expression-stmt advanced? ; @@ -668,23 +652,20 @@ defer 'class? create id-buf /id 1+ allot -: handle-id ( -- ) - id-buf off #id# comes-a? - IF id-buf over c@ 1+ cmove - ELSE *expected* error - ." identifier" THEN ; +: expect-id,ok? ( -- tokenvalue true / -- false) + #id# comes-a? dup IF accept + ELSE ." identifier" *expected* error THEN ; +: handle-id ( -- ) + id-buf off expect-id,ok? IF id-buf over c@ 1+ cmove THEN ; : [parameters]) ( -- ) dyn-reset ascii ) #char# comes? not - IF BEGIN #id# comes-a? - IF putlocal - 2 dyn-allot %local rot 2! - ELSE *expected* error - ." identifier" THEN + IF BEGIN expect-id,ok? + IF putlocal 2 dyn-allot %local rot 2! THEN ascii , #char# comes? not UNTIL - ascii ) #char# expect THEN ; + expect')' THEN ; \ *** Block No. 79, Hexblock 4f @@ -704,7 +685,7 @@ create id-buf /id 1+ allot ELSE %reference clr THEN function? IF nestlocal [parameters]) - ELSE ascii ) #char# expect + ELSE expect')' THEN ; @@ -722,7 +703,7 @@ create id-buf /id 1+ allot constant-expression r> IF drop *???* error ELSE #/obj ! []dim'd on THEN - ascii ] #char# expect THEN + expect']' THEN set-pointer %function isn't? IF %reference clr THEN ; @@ -747,7 +728,7 @@ create id-buf /id 1+ allot *double-ptr* ?error true REPEAT >r ascii ( #char# comes? IF recursive (declarator - ascii ) #char# expect + expect')' ELSE handle-id THEN BEGIN mark >r ascii [ #char# comes? @@ -834,7 +815,7 @@ do$: init$ ( type -- values ) ascii { #char# comes? \ } IF init[] exit THEN #string# comes-a? - IF drop init$ exit THEN + IF drop init$ accept exit THEN >inittype 14 and 14 xor ?1more constant-expression '1more ; @@ -1021,8 +1002,7 @@ variable protos2resolve : define-function ( type -- ) #char# comes-a? - IF backword - dup ascii ; = swap ascii , = or + IF dup ascii ; = swap ascii , = or IF prototype exit THEN THEN 1st? IF .label swap @@ -1096,6 +1076,7 @@ variable protos2resolve ~ variable main()-adr ~ : compile-program ( -- ) + fetchword BEGIN definition? not UNTIL " main" findglobal ?dup 0= IF main()-adr off exit THEN diff --git a/src/cc64/preprocessor.fth b/src/cc64/preprocessor.fth index 552e9e1..6d710d9 100644 --- a/src/cc64/preprocessor.fth +++ b/src/cc64/preprocessor.fth @@ -17,31 +17,33 @@ \ preprocessor: 11sep94pz -|| : clearline ( -- ) +||on + + : clearline ( -- ) linebuf off res-inptr ; -|| : cpp-error ( -- ) + : cpp-error ( -- ) *preprocessor* error clearline ; -|| : check-eol ( -- ) + : check-eol ( -- ) skipblanks char> 0= IF rdrop cpp-error THEN ; -|| : ?cpp-errorexit ( flag -- ) + : ?cpp-errorexit ( flag -- ) IF rdrop cpp-error THEN ; -|| : ?cpp-fatal *preprocessor* ?fatal ; + : ?cpp-fatal *preprocessor* ?fatal ; -|| create include-name /filename allot + create include-name /filename allot -|| create delim 1 allot + create delim 1 allot \ *** Block No. 106, Hexblock 6a \ preprocessor: 11sep94pz -|| : cpp-include ( -- ) + : cpp-include ( -- ) check-eol char> ascii < = char> ascii " = @@ -67,14 +69,14 @@ \ preprocessor: 19apr94pz -|| variable minus + variable minus -|| : cpp-number? ( -- n false/ -- true ) + : cpp-number? ( -- n false/ -- true ) skipblanks char> num? 0= ?dup ?exit number drop false ; -|| : cpp-define ( -- ) + : cpp-define ( -- ) check-eol char> alpha? 0= ?cpp-errorexit get-id @@ -95,9 +97,9 @@ \ preprocessor: 19apr94pz -|| create cpp-word 17 allot + create cpp-word 17 allot -|| : cpp-nextword ( -- adr ) + : cpp-nextword ( -- adr ) skipblanks cpp-word 1+ 16 bounds DO char> 0= char> bl = or @@ -113,8 +115,8 @@ \ preprocessor: 07may95pz -|| : cpp-pragma ( -- ) - cpp-nextword " cc64" strcmp + : cpp-pragma ( -- ) + cpp-nextword " cc64" streq 0= ?cpp-errorexit cpp-number? ?cpp-fatal >base ! cpp-number? ?cpp-fatal >zp ! @@ -140,17 +142,23 @@ \ preprocessor: 07may95pz -|| stringtab cpp-keywords +3 string-tab cpp-keywords + + x #pragma x" pragma" + x #define x" define" + x #include x" include" -|| x #define x" define" -|| x #include x" include" -|| x #pragma x" pragma" +end-tab -endtab +create cpp-commands + ' cpp-pragma , ' cpp-define , ' cpp-include , -|| create cpp-commands - ' cpp-define , ' cpp-include , ' cpp-pragma , +cpp-keywords 6 7 length-index cpp-keywords-index + #pragma idx, + #include idx, +end-index +||off make preprocess ( -- ) $pending @ @@ -158,7 +166,7 @@ make preprocess ( -- ) clearline exit THEN comment-state @ ?exit char> ascii # - ?exit +char - cpp-nextword cpp-keywords scanword + cpp-nextword cpp-keywords-index find-via-index IF 2* cpp-commands + perform exit THEN cpp-error ; diff --git a/src/cc64/prof-metrics.fth b/src/cc64/prof-metrics.fth new file mode 100644 index 0000000..da46242 --- /dev/null +++ b/src/cc64/prof-metrics.fth @@ -0,0 +1,56 @@ + +profiler-metric:[ profile-cc64-1 + [strings] + [memman-etc] + [file-handling] + [input] + [scanner] + [symtab] + [parser] + [pass2] +]profiler-metric + +profiler-metric:[ profile-scanner1 + [scanner-alphanum] + [scanner-keyword] + [scanner-identifier] + [scanner-operator] + [scanner-number] + [scanner-char/string] + [scanner-(nextword] + [scanner-comment] +]profiler-metric + +profiler-metric:[ profile-scanner2 + [scanner-alphanum] + [scanner-identifier] + [scanner-operator] + [scanner-number] + [scanner-char/string] + [scanner-(nextword] + [scanner-comment] + [scanner-rest] +]profiler-metric + +profiler-metric:[ profile-scanner3 + [scanner-alphanum] + [scanner-identifier] + [scanner-operator] + [scanner-char/string] + [scanner-(nextword] + [scanner-comment] + [scanner-nextword] + [scanner-rest] +]profiler-metric + +profiler-metric:[ profile-scanner-nextword + [scanner-nextword-vars] + [scanner-fetchword] + [scanner-thisword] + [scanner-nextword-mark] + [scanner-nextword-advanced?] +]profiler-metric + +' profiler-report alias profile + +\log : profile2file logfile profiler-report logclose ; diff --git a/src/cc64/scanner.fth b/src/cc64/scanner.fth index 2d11f7c..6e20c4f 100644 --- a/src/cc64/scanner.fth +++ b/src/cc64/scanner.fth @@ -14,21 +14,15 @@ \ scanner: 26feb91pz -|| : alpha? ( c -- flag ) - dup ascii a ascii [ uwithin - over ascii A ascii { uwithin or \ } - swap ascii _ = or ; - -|| : num? ( c -- flag ) - ascii 0 ascii : uwithin ; - -|| : alphanum? ( c -- flag ) - dup alpha? swap num? or ; +\prof profiler-bucket [scanner-alphanum] || : skipblanks ( -- ) BEGIN char> bl = WHILE +char REPEAT ; +\prof [scanner-alphanum] end-bucket +\prof profiler-bucket [scanner-keyword] + ~ 0 constant #char# ~ 1 constant #id# ~ 2 constant #number# @@ -42,54 +36,55 @@ \ scanner: 12jan91pz -| stringtab keyword +|| 18 string-tab keywords +~ x x" do" +~ x x" if" +~ x x" for" +~ x x" int" ~ x x" auto" -~ x x" break" ~ x x" case" ~ x x" char" -~ x x" continue" -~ x x" default" -~ x x" do" ~ x x" else" -~ x x" extern" -~ x x" for" ~ x x" goto" -~ x x" if" -~ x x" int" -~ x x" register" +~ x x" break" +~ x x" while" +~ x x" extern" ~ x x" return" ~ x x" static" ~ x x" switch" -~ x x" while" +~ x x" default" +~ x x" continue" +~ x x" register" - endtab +end-tab +|| keywords 2 8 length-index keywords-index + idx, + idx, + idx, + idx, + idx, + idx, + idx, +end-index \ *** Block No. 39, Hexblock 27 \ scanner: 18apr94pz -|| variable token - -|| : scanword ( adr table -- false ) - ( adr table -- token true ) - token off - BEGIN ?dup WHILE - 2dup >string strcmp - IF 2drop token @ true exit THEN - +string 1 token +! REPEAT - drop false ; - || : keyword? ( adr -- false ) - ( adr -- token true ) - keyword scanword ; + ( adr -- token true ) + keywords-index find-via-index ; \ *** Block No. 40, Hexblock 28 \ scanner: 18apr94pz +\prof [scanner-keyword] end-bucket +\prof profiler-bucket [scanner-identifier] + || create id-buf /id 1+ allot || : get-id ( -- ) @@ -112,55 +107,58 @@ \ scanner: 08oct90pz +\prof [scanner-identifier] end-bucket +\prof profiler-bucket [scanner-operator] + here ," +++---**///%%&&&|||^^!!==<<<<>>>>~" 1+ || constant oper-1st-ch here ," += -= = =* = =& =| = = = <<= >>= " 1+ || constant oper-2nd-ch here ," = = " 1+ || constant oper-3rd-ch -|| stringtab op +enum ~on - x <++> x <+=> x <+> - x <--> x <-=> x <-> - x <*=> x <*> - x x x - x <%=> x <%> - x x x - x x x - x x - x x - x <==> x <=> - x <<<=> x <<<> x <<=> x <<> - x <>>=> x <>>> x <>=> x <>> - x + y <++> y <+=> y <+> + y <--> y <-=> y <-> + y <*=> y <*> + y y y + y <%=> y <%> + y y y + y y y + y y + y y + y <==> y <=> + y <<<=> y <<<> y <<=> y <<> + y <>>=> y <>>> y <>=> y <>> + y ~off - endtab +end-enum \ *** Block No. 42, Hexblock 2a \ scanner: 08oct90pz -|| create 2x-tab +|| create $2?-tab $ff c, c, $ff c, $ff c, $ff c, <%=> c, c, $ff c, $ff c, $ff c, <*=> c, <++> c, $ff c, <--> c, $ff c, c, -|| : 2x-oper? ( c -- tokenvalue t / c -- f ) - $0f and 2x-tab + c@ dup $ff = IF drop false ELSE +char true THEN ; +|| : $2?-oper? ( c -- tokenvalue t / c -- f ) + $0f and $2?-tab + c@ dup $ff = IF drop false ELSE +char true THEN ; -|| create xc-tab +|| create $?c-tab <<<=> c, <==> c, <>>=> c, $ff c, $ff c, $ff c, c, $ff c, c, $ff c, c, $ff c, -|| : xc-oper? ( c -- tokenvalue t / c -- f ) +|| : $?c-oper? ( c -- tokenvalue t / c -- f ) dup 3 and swap $e0 and $20 - dup $20 > IF $a0 - IF drop false exit THEN $40 THEN 2/ 2/ 2/ + - xc-tab + c@ dup $ff = IF drop false ELSE +char true THEN ; + $?c-tab + c@ dup $ff = IF drop false ELSE +char true THEN ; || : operator? ( c -- tokenvalue t / c -- f ) - dup $f0 and $20 = IF 2x-oper? exit THEN - dup $1f and $1b > IF xc-oper? exit THEN + dup $f0 and $20 = IF $2?-oper? exit THEN + dup $1f and $1b > IF $?c-oper? exit THEN drop false ; || : c@-bl=-if-#oper#-exit @@ -176,6 +174,8 @@ here ," = = " 1+ || constant oper-3rd-ch BEGIN dup oper-3rd-ch + c@-bl=-if-#oper#-exit char> - WHILE 1+ limit-oper-loop REPEAT +char #oper# ; +\prof [scanner-operator] end-bucket +\prof profiler-bucket [scanner-number] \ *** Block No. 43, Hexblock 2b @@ -215,6 +215,8 @@ here ," = = " 1+ || constant oper-3rd-ch ELSE octnum THEN ELSE deznum THEN #number# ; +\prof [scanner-number] end-bucket +\prof profiler-bucket [scanner-char/string] || create charlist ," ()[]{},;:" @@ -307,6 +309,8 @@ here ," = = " 1+ || constant oper-3rd-ch || : string ( -- ??? #string# ) $pending on 0 #string# ; +\prof [scanner-char/string] end-bucket +\prof profiler-bucket [scanner-(nextword] || : (nextword ( -- tokenvalue token ) $pending @ *compiler* ?fatal @@ -330,6 +334,9 @@ here ," = = " 1+ || constant oper-3rd-ch \ scanner: 09oct90pz +\prof [scanner-(nextword] end-bucket +\prof profiler-bucket [scanner-comment] + || : is-comment? ( w t -- w t flag ) 2dup #oper# dnegate d+ or 0= ; @@ -353,28 +360,48 @@ here ," = = " 1+ || constant oper-3rd-ch \ scanner: 11mar91pz +\prof [scanner-comment] end-bucket +\prof profiler-bucket [scanner-nextword] + +\prof profiler-bucket [scanner-nextword-vars] + || create word' 4 allot -|| variable back || variable word# -~ : nextword ( -- tokenvalue token ) - back @ back off IF word' 2@ ELSE - BEGIN (nextword is-comment? WHILE - 2drop skip-comment REPEAT - 2dup word' 2! THEN - 1 word# +! ; +\prof [scanner-nextword-vars] end-bucket +\prof profiler-bucket [scanner-fetchword] + +~ : fetchword ( -- tokenvalue token ) + BEGIN (nextword is-comment? WHILE + 2drop skip-comment REPEAT \ ." fetchword: " 2dup u. u. + word' 2! ; + +~ : accept ( -- ) + 1 word# +! fetchword ; + +\prof [scanner-fetchword] end-bucket +\prof profiler-bucket [scanner-thisword] + +~ : thisword ( -- tokenvalue token ) word' 2@ ; -~ : backword ( -- ) - back @ *compiler* ?fatal - back on -1 word# +! ; +\prof [scanner-thisword] end-bucket +\prof profiler-bucket [scanner-nextword-mark] ~ : mark ( -- word# ) word# @ ; +\prof [scanner-nextword-mark] end-bucket +\prof profiler-bucket [scanner-nextword-advanced?] + ~ : advanced? ( word# -- flag ) word# @ = 0= ; +\prof [scanner-nextword-advanced?] end-bucket + +\prof [scanner-nextword] end-bucket +\prof profiler-bucket [scanner-rest] + || : init-scanner - back off $pending off word# off ; + $pending off word# off ; init: init-scanner @@ -382,19 +409,19 @@ here ," = = " 1+ || constant oper-3rd-ch \ scanner: word. 03oct90pz -|| : keyword. ( n ) - keyword swap string[] +|| : keyword. ( tokenvalue ) + keywords swap string[] >string count type ; -|| : emit' ( c ) dup bl - +|| : emit' ( char ) dup bl - IF emit ELSE drop THEN ; -|| : oper. ( n ) +|| : oper. ( tokenvalue ) dup oper-1st-ch + c@ emit dup oper-2nd-ch + c@ emit' oper-3rd-ch + c@ emit' ; -~ : word. ( n typ ) +~ : word. ( tokenvalue token ) #keyword# case? IF keyword. exit THEN #oper# case? IF oper. exit THEN #number# case? IF . exit THEN @@ -404,3 +431,5 @@ here ," = = " 1+ || constant oper-3rd-ch #string# case? IF ." string @ " u. exit THEN ." token/val:" . . ; + +\prof [scanner-rest] end-bucket diff --git a/src/cc64/set-d000.fth b/src/cc64/set-d000.fth new file mode 100644 index 0000000..d89a466 --- /dev/null +++ b/src/cc64/set-d000.fth @@ -0,0 +1,13 @@ + +: relocate-tasks ( newUP -- ) + up@ dup BEGIN 1+ under @ 2dup - + WHILE rot drop REPEAT 2drop ! ; + +: abs-relocate ( s0 r0/limit -- ) + dup ['] limit >body ! + origin $A + ! \ r0 + dup relocate-tasks + up@ 1+ @ origin 1+ ! \ task + 6 - origin 8 + ! cold ; \ s0 + +$cc00 $d000 abs-relocate diff --git a/src/cc64/shell.fth b/src/cc64/shell.fth index e583148..b5ddfd4 100644 --- a/src/cc64/shell.fth +++ b/src/cc64/shell.fth @@ -60,6 +60,14 @@ i/o-status? UNTIL busoff dev 2 busclose ; +\log : logfile logopen alsologtofile ; + +\log ' logclose alias logclose + +' include alias exec + +: list! ( flag -- ) listing ! ; +: list? ( -- ) listing @ . ; \ *** Block No. 130, Hexblock 82 diff --git a/src/cc64/strings.fth b/src/cc64/strings.fth new file mode 100644 index 0000000..30546f7 --- /dev/null +++ b/src/cc64/strings.fth @@ -0,0 +1,53 @@ + +~ : streq ( str1 str2 -- flag ) + count rot count rot over = + IF 0 ?DO + over I + c@ over I + c@ - + IF 2drop false UNLOOP exit THEN + LOOP 2drop true + ELSE drop 2drop false THEN ; + +~ : strcpy ( src dst -- ) + over c@ 1+ move ; + +~ : strcat ( src dst -- ) + swap count >r over count + r@ move + dup c@ r> + swap c! ; + + + here ascii a ascii A xor $ff xor c, >label FoldCases + +~ Code alpha? ( c -- flag ) + SP )y lda 0<> ?[ label PutFalse txa + label PutAA SP x) sta SP )y sta Next jmp ]? + SP x) lda + label ContinueAlpha ascii _ # cmp 0= ?[ + label PutTrue $ff # lda PutAA bne ]? + FoldCases and $41 # cmp PutFalse bcc + $5b # cmp PutFalse bcs PutTrue bcc + end-code + +~ Code num? ( c -- flag ) + SP )y lda PutFalse bne + SP x) lda ascii 0 # cmp PutFalse bcc + ascii 9 1+ # cmp PutFalse bcs PutTrue bcc + end-code + +~ Code alphanum? ( c -- flag ) + SP )y lda PutFalse bne + SP x) lda ascii 0 # cmp PutFalse bcc + ascii 9 1+ # cmp PutTrue bcc ContinueAlpha bcs + end-code + +\ ~ : alpha? ( c -- flag ) +\ dup ascii a ascii [ uwithin +\ over ascii A ascii { uwithin or \ } +\ swap ascii _ = or ; + +\ ~ : num? ( c -- flag ) +\ ascii 0 ascii : uwithin ; + +\ ~ : alphanum? ( c -- flag ) +\ dup alpha? swap num? or ; + + diff --git a/src/cc64/strtab.fth b/src/cc64/strtab.fth index 25e89e0..43a5b7e 100644 --- a/src/cc64/strtab.fth +++ b/src/cc64/strtab.fth @@ -1,25 +1,48 @@ -\ *** Block No. 9, Hexblock 9 +\ enums and string tables -\ stringtabellen 30sep90pz +~ : enum ( -- next-idx 30 ) 0 30 ; +~ : y ( last-idx 30 -- next-idx 30 ) + 30 ?pairs dup constant 1+ 30 ; +~ : end-enum ( last-idx 30 -- ) 30 ?pairs drop ; -|| variable n -|| variable m +\ ~ : >string ( adr -- str ) @ ; +\ ~ : +string ( adr1 -- adr2/0 ) 2+ ; +~ ' @ alias >string ( adr -- str ) +~ ' 2+ alias +string ( adr1 -- adr2 ) +~ : string[] ( tab n -- adr ) 2* + 2+ ; -~ : x ( -- ) n @ 1 n +! constant ; -~ : x" ( -- ) here m @ ! here m ! - 2 allot [compile] ," ; +~ : x ( next-idx 31 -- next-idx 32 ) + 31 ?pairs dup constant 32 ; - here 0 , | constant nil - here nil , ," end of table" - | constant void +~ : x" ( tab last-idx 32 -- tab next-idx 31 ) + 32 ?pairs + 2dup string[] here swap ! + [compile] ," 1+ 31 ; -~ : stringtab ( -- ) - create here m ! 2 allot 0 n ! - does> ( -- 1.adr ) @ ; -~ : endtab ( -- ) nil m @ ! ; +~ : string-tab ( size -- tab next-idx 31 ) + create here swap dup , 2* allot 0 31 ; -~ : >string ( adr -- str ) 2+ ; -~ : +string ( adr1 -- adr2/0 ) @ ; -~ : string[] ( tab n -- adr ) - 0 ?DO +string ?dup 0= IF void THEN - LOOP ; +~ : end-tab ( tab next-idx 31 -- ) + 31 ?pairs over @ over - + IF . ." actual size" cr abort ELSE 2drop THEN ; + +~ : length-index ( stringtab min-idx max-idx -- stringtab 33 ) + create c, c, dup , 33 ; + +~ : end-index ( stringtab 33 -- ) + 33 ?pairs @ c, ; + +~ ' c, alias idx, + +~ : find-via-index ( adr idxtbl -- false ) + ( adr idxtbl -- token true ) + over c@ over c@ over ( adr idxtbl len idxmaxlen len ) + u< IF drop 2drop false exit THEN ( adr idxtbl len ) + over 1+ c@ - ( adr idxtbl len-idxminlen ) + dup 0< IF drop 2drop false exit THEN + over + 4 + ( adr idxtbl idxtbl[len-1] ) + swap >r dup 1+ c@ swap c@ r> 2+ @ over string[] -rot + ( adr str[len-1] token[len-1] token[len] ) + DO ( adr str[len-1] ) + 2dup >string streq IF 2drop I true UNLOOP exit THEN + +string LOOP 2drop false ; diff --git a/src/cc64/symboltable.fth b/src/cc64/symboltable.fth index ceada03..15a9fa1 100644 --- a/src/cc64/symboltable.fth +++ b/src/cc64/symboltable.fth @@ -57,7 +57,7 @@ ?DO dup I c@ > not IF 2drop 0 UNLOOP exit THEN I c@ /name > IF 1 - ELSE over I strcmp + ELSE over I streq IF 2drop I count + UNLOOP exit THEN I c@ 1+ /symbol + THEN @@ -116,7 +116,7 @@ DO I ]hash u< not IF hash[ >I THEN I @ ?dup - IF over strcmp + IF over streq IF drop I @ count + true UNLOOP exit THEN ELSE drop I false UNLOOP exit diff --git a/src/cc64/util-words.fth b/src/cc64/util-words.fth index d5c8162..8d0de5f 100644 --- a/src/cc64/util-words.fth +++ b/src/cc64/util-words.fth @@ -18,26 +18,6 @@ current @ context ! hide 0 ] ; -\ *** Block No. 7, Hexblock 7 - -\ strcmp 09may94pz - -~ : strcmp ( str1 str2 -- flag ) - count rot count rot over = - IF 0 ?DO - over I + c@ over I + c@ - - IF 2drop false UNLOOP exit THEN - LOOP 2drop true - ELSE drop 2drop false THEN ; - -~ : strcpy ( src dst -- ) - over c@ 1+ move ; - -~ : strcat ( src dst -- ) - swap count >r over count + r@ move - dup c@ r> + swap c! ; - - \ *** Block No. 8, Hexblock 8 \ doer/make (interaktiv) 02sep94pz diff --git a/src/common/6502asm.fth b/src/common/6502asm.fth index 13cfc16..b495583 100644 --- a/src/common/6502asm.fth +++ b/src/common/6502asm.fth @@ -1,3 +1,6 @@ + +Onlyforth Assembler also definitions + \ *** Block No. 122, Hexblock 7a \ Forth-83 6502-Assembler 20oct87re @@ -10,13 +13,13 @@ $8009 , $1D0D , $8019 , $8080 , $0080 , $1404 , $8014 , $8080 , $8080 , $1C0C , $801C , $2C80 , -| Variable mode +Variable mode : Mode: ( n -) Create c, Does> ( -) c@ mode ! ; 0 Mode: .A 1 Mode: # -2 | Mode: mem 3 Mode: ,X +2 Mode: mem 3 Mode: ,X 4 Mode: ,Y 5 Mode: X) 6 Mode: )Y $F Mode: ) @@ -25,7 +28,7 @@ $8080 , $1C0C , $801C , $2C80 , \ upmode cpu 20oct87re -| : upmode ( addr0 f0 - addr1 f1) +: upmode ( addr0 f0 - addr1 f1) IF mode @ 8 or mode ! THEN 1 mode @ $F and ?dup IF 0 DO dup + LOOP THEN @@ -76,7 +79,7 @@ $0484 $20 m/cpu bit \ Assembler conditionals 20oct87re -| : range? ( branch -- branch ) +: range? ( branch -- branch ) dup abs $7F u> Abort" out of range " ; : [[ ( BEGIN) here ; @@ -154,7 +157,7 @@ immediate : Code Create here dup 2- ! Assembler ; : >label ( adr -) - here | Create immediate swap , + here || Create immediate swap , 4 hallot heap 1 and hallot ( 6502-alig) here 4 - heap 4 cmove heap last @ count $1F and + ! dp ! @@ -163,3 +166,5 @@ immediate : Label [ Assembler ] here >label Assembler ; + +Onlyforth diff --git a/src/common/6526timer.fth b/src/common/6526timer.fth new file mode 100644 index 0000000..62c4aa1 --- /dev/null +++ b/src/common/6526timer.fth @@ -0,0 +1,36 @@ + +|| $dd00 >label CIA +|| CIA 4 + >label timerAlo +|| CIA 5 + >label timerAhi +|| CIA 6 + >label timerBlo +|| CIA 7 + >label timerBhi +|| CIA $e + >label timerActrl +|| CIA $f + >label timerBctrl + +~ Code reset-32bit-timer ( -- ) + $ff # lda timerAlo sta timerAhi sta timerBlo sta timerBhi sta + %11011001 # lda timerBctrl sta + %10010001 # lda timerActrl sta + Next jmp end-code + +~ Code read-32bit-timer ( -- ud ) + timerActrl lda pha $fe and timerActrl sta + SP 2dec timerAlo lda SP x) sta timerAhi lda SP )y sta + SP 2dec timerBlo lda SP x) sta timerBhi lda SP )y sta + pla timerActrl sta Next jmp end-code + +~ Code reset-50ms-timer ( -- ) + \ $c06e / 985248 Hz ( PAL C64 phi2 ) = 0.050 sec + $6e # lda timerAlo sta $c0 # lda timerAhi sta + $ff # lda timerBlo sta timerBhi sta + %11011001 # lda timerBctrl sta + %10010001 # lda timerActrl sta + Next jmp end-code + +~ Code read-50ms-timer ( -- u ) + timerActrl lda tax $fe and timerActrl sta + timerBlo lda pha timerBhi lda timerActrl stx + Push jmp end-code + +~ : ms. ( u -- ) + 20 u/mod u. 5 * u. ." sec ms" ; diff --git a/src/common/logtofile.fth b/src/common/logtofile.fth index 27286b8..3dce3cb 100644 --- a/src/common/logtofile.fth +++ b/src/common/logtofile.fth @@ -1,6 +1,6 @@ create log-dev 8 c, -create log-2nd 2 c, +create log-2nd 9 c, : log-dev-2nd@ log-dev c@ log-2nd c@ ; : log-emit @@ -16,12 +16,12 @@ Output: alsologtofile log-emit log-cr log-type c64del c64page c64at c64at? ; -: logopen" - ascii " parse log-dev-2nd@ busopen - 2dup type +: logopen + bl parse 2dup type + log-dev-2nd@ busopen bustype " ,s,w" count bustype busoff i/o-status? IF c64cr log-dev c@ dos-error abort THEN alsologtofile ; : logclose - log-dev-2nd@ busclose display ; + cr display log-dev-2nd@ busclose ; diff --git a/src/common/notmpheap.fth b/src/common/notmpheap.fth index d408633..af669a2 100644 --- a/src/common/notmpheap.fth +++ b/src/common/notmpheap.fth @@ -8,4 +8,4 @@ ~ ' |on alias ||on ~ ' |off alias ||off -~ ' noop alias tmpclear +~ ' noop alias tmp-clear diff --git a/src/common/profiler.fth b/src/common/profiler.fth new file mode 100644 index 0000000..a5ab723 --- /dev/null +++ b/src/common/profiler.fth @@ -0,0 +1,180 @@ + +8 constant #buckets +4 constant #timestamps + +create prevTime 4 allot +create deltaTime 4 allot +variable currentBucket +variable currentBucketOpen +variable metric-name + +create buckets[ #buckets 1+ allot +create <]buckets #buckets 1+ allot +create >]buckets #buckets 1+ allot +create bucketTimes #buckets 1+ 4 * allot +create bucketCounts #buckets 1+ 4 * allot + +create initialTimeStamp 4 allot +create timestamps[ #timestamps 4 * allot +here constant ]timestamps +variable timestamp> + +create mainCount 4 allot +create countstamps[ #timestamps 4 * allot +here constant ]countstamps +variable countstamps> + +Assembler also definitions + +: calcTime + sec + prevTime 2+ lda timerAlo sbc deltaTime 2+ sta + prevTime 3+ lda timerAhi sbc deltaTime 3+ sta + prevTime lda timerBlo sbc deltaTime sta + prevTime 1+ lda timerBhi sbc deltaTime 1+ sta +; + +: setPrevTime + timerAlo lda prevTime 2+ sta + timerAhi lda prevTime 3+ sta + timerBlo lda prevTime sta + timerBhi lda prevTime 1+ sta +; + +: addTimeToBucket + clc + bucketTimes 2+ ,x lda deltaTime 2+ adc bucketTimes 2+ ,x sta + bucketTimes 3+ ,x lda deltaTime 3+ adc bucketTimes 3+ ,x sta + bucketTimes ,x lda deltaTime adc bucketTimes ,x sta + bucketTimes 1+ ,x lda deltaTime 1+ adc bucketTimes 1+ ,x sta +; + +: incCountOfBucket + bucketCounts 2+ ,x inc 0= ?[ bucketCounts 3+ ,x inc 0= ?[ + bucketCounts ,x inc 0= ?[ bucketCounts 1+ ,x inc ]? ]? ]? +; + +: incMainCount + mainCount 2+ inc 0= ?[ mainCount 3+ inc 0= ?[ + mainCount inc 0= ?[ mainCount 1+ inc ]? ]? ]? +; + +Label compareIp + IP 1+ lda >buckets[ ,x cmp 0= ?[ IP lda ?[ CC ?[ dex dex ][ inx inx ]? + compareIp jsr 0<> ?[ CC ?[ dex ][ inx ]? + compareIp jsr CC ?[ dex ]? ]? ]? + + IP 1+ lda >]buckets ,x cmp 0= ?[ IP lda <]buckets ,x cmp ]? + CS ?[ 0 # ldx ]? + + txa .a asl .a asl tax + ]? + currentBucket stx + ]? +; + +Label prNext + timerActrl lda pha $fe and timerActrl sta + calcTime + findBucket + incCountOfBucket + addTimeToBucket + setPrevTime + incMainCount + 0 # ldx pla timerActrl sta + IP lda 2 # adc Next $e + jmp + +onlyforth + +Code install-prNext \ installs prNext + prNext 0 $100 m/mod + # lda Next $c + sta + # lda Next $b + sta + $4C # lda Next $a + sta Next jmp +end-code + +Code init-prevTime setPrevTime Next jmp end-code + +: profiler-init-buckets + currentBucket off currentBucketOpen off init-prevTime + buckets[ #buckets 2+ $ff fill + <]buckets #buckets 2+ $ff fill + >]buckets #buckets 2+ $ff fill + ['] forth-83 >lo/hi >buckets[ c! r currentBucket ! \ check for #buckets + dup @ >lo/hi >buckets[ r@ + c! lo/hi >]buckets r@ + c! <]buckets r> + c! ; + +: profiler-metric:[ + create last @ , here $0f ] + does> profiler-init-buckets dup @ metric-name ! 2+ + BEGIN dup @ ?dup WHILE execute activate-bucket 2+ REPEAT drop ; + +: ]profiler-metric $0f ?pairs [compile] [ + here swap - #buckets 2* > abort" too many buckets in metric" + 0 , ; immediate restrict + +: profiler-timestamp + read-32bit-timer timestamp> @ + dup 4+ dup ]timestamps > abort" too many timestamps" + timestamp> ! 2! + mainCount 2@ countstamps> @ dup 4+ countstamps> ! 2! ; + +: profiler-start + bucketTimes #buckets 1+ 4 * erase + bucketCounts #buckets 1+ 4 * erase + prevTime 4 erase timestamps[ timestamp> ! + mainCount 4 erase countstamps[ countstamps> ! + reset-32bit-timer read-32bit-timer initialTimeStamp 2! + install-prNext ; + +: profiler-end end-trace profiler-timestamp ; + +: d[]. ( addr I -- ) 2* 2* + 2@ 12 d.r ; + +: bucket[ ( I -- addr ) + buckets[ + c@ $100 * + ; + +: ]bucket ( I -- addr ) + <]buckets over + c@ swap >]buckets + c@ $100 * + ; + +: d.. ( d -- ) + <# # #s #> BEGIN swap dup c@ emit 1+ swap 1- dup WHILE + dup 3 mod 0= IF ascii . emit THEN REPEAT 2drop bl emit ; + +: profiler-report + cr ." profiler report " metric-name @ count $1f and type cr + ." timestamps" cr + timestamps[ BEGIN dup timestamp> @ < WHILE + dup 2@ dnegate initialTimestamp 2@ d+ d.. 4+ REPEAT drop cr + ." countstamps" cr + countstamps[ BEGIN dup countstamps> @ < WHILE + dup 2@ d.. 4+ REPEAT drop cr + cr ." buckets" cr + ." b# addr[ ]addr nextcounts clockticks name" cr + #buckets 1+ 0 DO + I . I bucket[ u. I ]bucket u. + bucketCounts I d[]. bucketTimes I d[]. + I IF I bucket[ 1+ IF ." " I bucket[ count $1f and type THEN + ELSE ." (etc)" THEN + cr + LOOP ; diff --git a/src/common/timertest.fth b/src/common/timertest.fth new file mode 100644 index 0000000..b45e29b --- /dev/null +++ b/src/common/timertest.fth @@ -0,0 +1,34 @@ + +\ with build log: +\ ' noop alias \log +\ without build log: +' \ alias \log + +\log include logtofile.fth +\log logopen timertest.log + +| ' noop alias ~ +| ' |on alias ~on +| ' |off alias ~off + + include notmpheap.fth + + onlyforth decimal + \ | : include include base push hex cr here u. heap u. up@ u. ; + + include util-words.fth + +Onlyforth Assembler also definitions + include 6502asm.fth +Onlyforth + include lowlevel.fth + include 6526timer.fth + include profiler.fth + + : test1 reset-32bit-timer ; + : test2 begin read-32bit-timer cr d. key? until ; + + : test3 reset-50ms-timer ; + : test4 begin read-50ms-timer cr dup u. ms. key? until ; + +\log logclose diff --git a/src/common/tmp6502asm.fth b/src/common/tmp6502asm.fth index 92b987a..f220469 100644 --- a/src/common/tmp6502asm.fth +++ b/src/common/tmp6502asm.fth @@ -1,30 +1,8 @@ -\ *** Block No. 120, Hexblock 78 - -\ transient Assembler c09may94pz - -\ needs code 1 +load - - -\ *** Block No. 121, Hexblock 79 - -\ Forth-6502 Assembler 20sep94pz -\ Basis: Forth Dimensions VOL III No. 5) cr .( tmpheap transient forth assembler) cr here $800 tmp-hallot dp ! -Onlyforth Assembler also definitions - ' noop alias | - include 6502asm.fth \ 1 7 +thru - -\ : .blk ( -) blk @ ?dup -\ IF ." Blk " u. ?cr THEN ; -\ ' .blk Is .status - -\ : rr ." error in scr " scr @ . -\ ." at position " r# @ . cr ; + include 6502asm.fth dp ! - -Onlyforth diff --git a/src/common/tmpheap.fth b/src/common/tmpheap.fth index cf4b516..0fab49c 100644 --- a/src/common/tmpheap.fth +++ b/src/common/tmpheap.fth @@ -2,7 +2,7 @@ \ This is the reference implementation of tmpheap which allocates \ the tmpheap on the regular heap and moves definitons prefixed \ with || or within a ||on to ||off range onto the tmpheap. -\ tmpclear will remove all words on the tmpheap, wheras regular clear +\ tmp-clear will remove all words on the tmpheap, wheras regular clear \ will remove all words on tmpheap and heap together. \ Before the first use of ||, the tmpheap size in bytes must be @@ -31,11 +31,11 @@ reset-tmp-heap tmpheap> @ over - ; | : tmp-heapmove1x ( from size -- from offset ) - tmp-heapmove ?heapmovetx off ; + tmp-heapmove ?headmove-xt off ; -~ : || ['] tmp-heapmove1x ?heapmovetx ! ; -~ : ||on ['] tmp-heapmove ?heapmovetx ! ; -~ : ||off ?heapmovetx off ; +~ : || ['] tmp-heapmove1x ?headmove-xt ! ; +~ : ||on ['] tmp-heapmove ?headmove-xt ! ; +~ : ||off ?headmove-xt off ; | : remove-tmp-words-in-voc ( voc -- ) @@ -48,10 +48,10 @@ reset-tmp-heap REPEAT drop ; | : remove-tmp-words ( -- ) - voc-link BEGIN @ ?dup + voc-link BEGIN @ ?dup WHILE dup 4 - remove-tmp-words-in-voc REPEAT ; -~ : tmpclear ( -- ) +~ : tmp-clear ( -- ) remove-tmp-words \ Uncomment the following line to help determine the ideal tmpheap \ size for your project. diff --git a/src/common/tracer.fth b/src/common/tracer.fth new file mode 100644 index 0000000..4f7a003 --- /dev/null +++ b/src/common/tracer.fth @@ -0,0 +1,214 @@ +\ *** Block No. 47, Hexblock 2f + +\ tracer: loadscreen cas16aug06 + +Onlyforth + +\needs Code include trns6502asm.fth + +\needs Tools Vocabulary Tools + +Tools also definitions + +\ This nice Forth Tracer has been +\ developed by B. Pennemann and co +\ for Atari ST. CL Vogt has ported it +\ back to the volksForth 6502 C-16 and +\ C-64 + + +\ *** Block No. 48, Hexblock 30 + +\ tracer: wcmp variables clv04aug87 + +Assembler also definitions + +: wcmp ( adr1 adr2--) \ Assembler-Macro + over lda dup cmp swap \ compares word + 1+ lda 1+ sbc ; + + +Only Forth also Tools also definitions + +| Variable (W +| Variable +| Variable nest? | Variable trap? +| Variable last' | Variable #spaces + + +\ *** Block No. 49, Hexblock 31 + +\ tracer:cpush oneline cas16aug06 + +| Create cpull 0 ] + rp@ count 2dup + rp! r> swap cmove ; + +: cpush ( addr len -) + r> -rot over >r + rp@ over 1+ - dup rp! place + cpull >r >r ; + +| : oneline &82 allot keyboard display + .status space query interpret + -&82 allot rdrop + ( delete quit from tnext ) ; + +: range ( adr--) \ gets + ip> off dup ! ; + + +\ *** Block No. 50, Hexblock 32 + +\ tracer:step tnext clv04aug87 + +| Code step + $ff # lda trap? sta trap? 1+ sta + RP X) lda IP sta + RP )Y lda IP 1+ sta RP 2inc + (W lda W sta (W 1+ lda W 1+ sta +Label W1- W 1- jmp end-code + +| Create: nextstep step ; + +Label tnext IP 2inc + trap? lda W1- beq + nest? lda 0= \ low(!)Byte test + ?[ IP wcmp W1- bcs + ][ nest? stx \ low(!)Byte clear + ]? + trap? dup stx 1+ stx \ disable tracer + W lda (W sta W 1+ lda (W 1+ sta + + +\ *** Block No. 51, Hexblock 33 + +\ tracer:..tnext clv12oct87 + + ;c: nest? @ + IF nest? off r> ip> push r THEN + r@ nextstep >r + input push output push + 2- dup last' ! + cr #spaces @ spaces + dup 4 u.r @ dup 5 u.r space + >name .name $10 col - 0 max spaces .s + state push blk push >in push + [ ' 'quit >body ] Literal push + [ ' >interpret >body ] Literal push + #tib push tib #tib @ cpush r0 push + rp@ r0 ! + ['] oneline Is 'quit quit ; + + +\ *** Block No. 52, Hexblock 34 + +\ tracer:do-trace traceable cas16aug06 + +| Code do-trace \ installs TNEXT + tnext 0 $100 m/mod + # lda Next $c + sta + # lda Next $b + sta + $4C # lda Next $a + sta Next jmp +end-code + +| : traceable ( cfa--body exit THEN + ['] key @ case? IF >body c@ Input @ + + @ traceable exit THEN + ['] type @ case? IF >body c@ Output @ + + @ traceable exit THEN + ['] r/w @ case? IF >body + @ traceable exit THEN + @ [ ' Forth @ @ ] Literal = + IF @ 3 + exit THEN + \ for defining words with DOES> + >name .name ." can't be DEBUGged" + quit ; + + +\ *** Block No. 53, Hexblock 35 + +\ tracer:User-Words cas16aug06 + +: nest \ trace into current word + last' @ @ traceable drop nest? on ; + +: unnest \ proceeds at calling word + off ; \ clears trap range + +: endloop last' @ 4 + name .name 2+ bl ; + +: k ( adr - adr+2) + ( print literal value) + ?: @? 2+ bl ; + + +\ *** Block No. 55, Hexblock 37 + +( tools for decompiling, interactive ) + +: d ( adr n - adr+n) ( dump n bytes) + 2dup swap ?: 3 spaces swap 0 + DO c? 1+ LOOP + 4 spaces -rot type bl ; + +: c ( adr - adr+1) + ( print byte as unsigned value) + 1 d ; + +: b ( adr - adr+2) + ( print branch target location ) + ?: @? dup @ over + 6 u.r 2+ bl ; + +( used for : ) +( Name String Literal Dump Clit Branch ) +( - - - - - - ) + + +Onlyforth diff --git a/src/common/trns6502asm.fth b/src/common/trns6502asm.fth index 61f6a39..ba29bc3 100644 --- a/src/common/trns6502asm.fth +++ b/src/common/trns6502asm.fth @@ -1,29 +1,8 @@ -\ *** Block No. 120, Hexblock 78 - -\ transient Assembler c09may94pz - -\ needs code 1 +load - - -\ *** Block No. 121, Hexblock 79 - -\ Forth-6502 Assembler 20sep94pz -\ Basis: Forth Dimensions VOL III No. 5) cr .( heap transient forth assembler) cr here $800 hallot heap dp ! -Onlyforth Assembler also definitions - include 6502asm.fth \ 1 7 +thru - -\ : .blk ( -) blk @ ?dup -\ IF ." Blk " u. ?cr THEN ; -\ ' .blk Is .status - -\ : rr ." error in scr " scr @ . -\ ." at position " r# @ . cr ; + include 6502asm.fth dp ! - -Onlyforth diff --git a/src/common/trnstmpheap.fth b/src/common/trnstmpheap.fth new file mode 100644 index 0000000..baac8ff --- /dev/null +++ b/src/common/trnstmpheap.fth @@ -0,0 +1,64 @@ + +\ This is a variant of the reference implementation tmpheap.fth +\ which places all the code for the tmpheap onto the heap, +\ just like the transient 6502 assembler trns6502asm.fth. +\ So after a SAVE or CLEAR, the tmpheap code is all gone, which is +\ nice since the compiled turnkey application will likely not need +\ it anymore, and so the compile time space saving that tmpheap offers +\ comes at zero cost in turnkey application size. + +heap cr .( trnstmpheap max end: ) u. cr + +here + +$200 hallot heap dp ! + +variable tmpheap[ +variable tmpheap> +variable ]tmpheap + +up@ dup ]tmpheap ! dup tmpheap> ! tmpheap[ ! + +: mk-tmp-heap ( size -- ) + heap dup ]tmpheap ! tmpheap> ! hallot heap tmpheap[ ! ; + +: tmp-hallot ( size -- addr ) + tmpheap> @ swap - + dup tmpheap[ @ u< abort" tmp heap overflow" + dup tmpheap> ! ; + +: tmp-heapmove ( from from size -- from offset ) + dup tmp-hallot swap cmove + tmpheap> @ over - ; + +: tmp-heapmove1x ( from size -- from offset ) + tmp-heapmove ?headmove-xt off ; + +: || ['] tmp-heapmove1x ?headmove-xt ! ; +: ||on ['] tmp-heapmove ?headmove-xt ! ; +: ||off ?headmove-xt off ; + + +: remove-tmp-words-in-voc ( voc -- ) + BEGIN dup @ ?dup WHILE ( thread next-in-thread ) + dup tmpheap[ @ ]tmpheap @ uwithin IF ( thread next-in-thread ) + @ ?dup IF ( thread next-next-in-thread ) over ! + ELSE ( thread ) off exit THEN + ELSE ( thread next-in-thread ) nip + THEN + REPEAT drop ; + +: remove-tmp-words ( -- ) + voc-link BEGIN @ ?dup + WHILE dup 4 - remove-tmp-words-in-voc REPEAT ; + +: tmp-clear ( -- ) + remove-tmp-words + \ Uncomment the following line to help determine the ideal tmpheap + \ size for your project. + \ tmpheap> @ tmpheap[ @ - cr u. ." spare tmpheap bytes" + ]tmpheap @ tmpheap> ! last off ; + +here cr .( trnstmpheap act end: ) u. cr + +dp ! diff --git a/src/common/version.fth b/src/common/version.fth index 651507d..230473a 100644 --- a/src/common/version.fth +++ b/src/common/version.fth @@ -1,2 +1,4 @@ -| : .version ." V0.8.1" ; +~ : .version ." V0.9" +\prof ." profiling" +; diff --git a/src/common/x16tmpheap.fth b/src/common/x16tmpheap.fth index 71e09e7..e50b633 100644 --- a/src/common/x16tmpheap.fth +++ b/src/common/x16tmpheap.fth @@ -2,7 +2,7 @@ \ This is a custom implementation of tmpheap for the X16 which \ allocates the tmpheap in a RAM bank and moves definitons prefixed \ with || or within a ||on to ||off range there. -\ tmpclear will remove all words on the tmpheap, wheras regular clear +\ tmp-clear will remove all words on the tmpheap, wheras regular clear \ will remove all words on tmpheap and heap together. \ Other than the reference tmpheap living on the regular heap, this @@ -25,11 +25,11 @@ tmpheap> @ over - ; | : tmp-heapmove1x ( from size -- from offset ) - tmp-heapmove ?heapmovetx off ; + tmp-heapmove ?headmove-xt off ; -~ : || ['] tmp-heapmove1x ?heapmovetx ! ; -~ : ||on ['] tmp-heapmove ?heapmovetx ! ; -~ : ||off ?heapmovetx off ; +~ : || ['] tmp-heapmove1x ?headmove-xt ! ; +~ : ||on ['] tmp-heapmove ?headmove-xt ! ; +~ : ||off ?headmove-xt off ; | : remove-tmp-words-in-voc ( voc -- ) @@ -42,14 +42,14 @@ REPEAT drop ; | : remove-tmp-words ( -- ) - voc-link BEGIN @ ?dup + voc-link BEGIN @ ?dup WHILE dup 4 - remove-tmp-words-in-voc REPEAT ; -~ : tmpclear ( -- ) +~ : tmp-clear ( -- ) remove-tmp-words \ Uncomment the following line to help determine the ideal tmpheap \ size for your project. \ tmpheap> @ tmpheap[ @ - cr u. ." tmpheap spare" ]tmpheap @ tmpheap> ! last off ; -' tmpclear is custom-remove +' tmp-clear is custom-remove diff --git a/src/common/x16trnstmphp.fth b/src/common/x16trnstmphp.fth new file mode 100644 index 0000000..a0ad3e5 --- /dev/null +++ b/src/common/x16trnstmphp.fth @@ -0,0 +1,61 @@ + +\ This is a variant of the X16 implementation x16tmpheap.fth +\ which places all the code for the tmpheap onto the heap, +\ just like the transient 6502 assembler trns6502asm.fth. +\ So after a SAVE or CLEAR, the tmpheap code is all gone, which is +\ nice since the compiled turnkey application will likely not need +\ it anymore, and so the compile time space saving that tmpheap offers +\ comes at zero cost in turnkey application size. + +heap cr .( trnstmpheap max end: ) u. cr + +here + +$200 hallot heap dp ! + +variable tmpheap[ +variable tmpheap> +variable ]tmpheap + + 1 $9f61 c! $a000 tmpheap[ ! $c000 dup ]tmpheap ! tmpheap> ! + +: tmp-hallot ( size -- addr ) + tmpheap> @ swap - + dup tmpheap[ @ u< abort" tmp heap overflow" + dup tmpheap> ! ; + +: tmp-heapmove ( from from size -- from offset ) + dup tmp-hallot swap cmove + tmpheap> @ over - ; + +: tmp-heapmove1x ( from size -- from offset ) + tmp-heapmove ?headmove-xt off ; + +: || ['] tmp-heapmove1x ?headmove-xt ! ; +: ||on ['] tmp-heapmove ?headmove-xt ! ; +: ||off ?headmove-xt off ; + + +: remove-tmp-words-in-voc ( voc -- ) + BEGIN dup @ ?dup WHILE ( thread next-in-thread ) + dup tmpheap[ @ ]tmpheap @ uwithin IF ( thread next-in-thread ) + @ ?dup IF ( thread next-next-in-thread ) over ! + ELSE ( thread ) off exit THEN + ELSE ( thread next-in-thread ) nip + THEN + REPEAT drop ; + +: remove-tmp-words ( -- ) + voc-link BEGIN @ ?dup + WHILE dup 4 - remove-tmp-words-in-voc REPEAT ; + +: tmp-clear ( -- ) + remove-tmp-words + \ Uncomment the following line to help determine the ideal tmpheap + \ size for your project. + \ tmpheap> @ tmpheap[ @ - cr u. ." tmpheap spare" + ]tmpheap @ tmpheap> ! last off ; + +here cr .( trnstmpheap act end: ) u. cr + +dp ! diff --git a/src/peddi/peddi-log.fth b/src/peddi/peddi-log.fth new file mode 100644 index 0000000..73cff17 --- /dev/null +++ b/src/peddi/peddi-log.fth @@ -0,0 +1,5 @@ + +' noop alias \log + +include logtofile.fth +logopen peddi.log diff --git a/src/peddi/peddi-main.fth b/src/peddi/peddi.fth similarity index 91% rename from src/peddi/peddi-main.fth rename to src/peddi/peddi.fth index 712988e..b39bd2e 100644 --- a/src/peddi/peddi-main.fth +++ b/src/peddi/peddi.fth @@ -1,15 +1,12 @@ -\ with build log: -' noop alias \log -\ without build log: -\ ' \ alias \log - -\log include logtofile.fth -\log logopen" peddi.log" +\needs \log ' \ alias \log immediate +\needs \prof | ' \ alias \prof immediate onlyforth decimal | ' | alias ~ + include notmpheap.fth + \ peddi loadscreen standalone 07may95pz | : 2@ ( adr -- d) dup 2+ @ swap @ ; diff --git a/build/generate_pragma_cc64.awk b/src/runtime/generate_pragma_cc64.awk similarity index 100% rename from build/generate_pragma_cc64.awk rename to src/runtime/generate_pragma_cc64.awk diff --git a/tests/e2e/Makefile b/tests/e2e/Makefile index 30355c9..d1f2ada 100644 --- a/tests/e2e/Makefile +++ b/tests/e2e/Makefile @@ -21,9 +21,12 @@ suite_c64_suffixes = $(patsubst %, suite-c64_%, $(suite_suffixes)) suite_c16_suffixes = $(patsubst %, suite-c16_%, $(suite_suffixes)) suite_x16_suffixes = $(patsubst %, suite-x16_%, $(suite_suffixes)) suite_results_c64_hosted = \ - $(patsubst %, cc64-% cc64pe-%, $(suite_c64_suffixes)) + $(patsubst %, cc64-%, $(suite_c64_suffixes)) \ + $(patsubst %, cc64pe-%, $(suite_c64_suffixes)) \ + cc64prof-suite-c64_c64.result suite.profile $(profiles) suite_results_c16_hosted = \ - $(patsubst %, cc64-% cc64pe-%, $(suite_c16_suffixes)) + $(patsubst %, cc64-%, $(suite_c16_suffixes)) \ + $(patsubst %, cc64pe-%, $(suite_c16_suffixes)) suite_results_x16_hosted = \ $(patsubst %, cc64-%, $(suite_x16_suffixes)) @@ -34,9 +37,14 @@ c16_rt_files = \ x16_rt_files = \ $(patsubst $(basedir)/runtime/%, x16files/%, $(wildcard $(basedir)/runtime/rt-*.[hio])) +profile_scripts = $(sort $(wildcard *.pfs)) +c64_profile_scripts = $(patsubst %, c64files/%, $(profile_scripts)) +profile_names = $(patsubst %.pfs, %, $(profile_scripts)) +profiles = $(patsubst %, %.profile, $(profile_names)) + tests: fasttests64 -alltests: fasttests slowtests petests +alltests: fasttests slowtests petests proftests fasttests64: cc64-suite-c64_c64.result @@ -49,6 +57,8 @@ slowtests: separate-tests-c64_c64.result petests: cc64pe-suite-c64_c64.result +proftests: cc64prof-suite-c64_c64.result suite.profile + allcrosstests: fastcrosstests slowcrosstests pecrosstests fastcrosstests: \ @@ -107,13 +117,13 @@ separate-tests-x16_x16.result: $(test_results_x16_x16) cat $^ >$@ $(test_results_c64_hosted) $(suite_results_c64_hosted): \ - $(basedir)/autostart-c64/cc64.T64 $(c64_rt_files) *.sh *.h + $(basedir)/autostart-c64/cc64.T64 $(c64_rt_files) *.sh *.shlib *.h $(test_results_c16_hosted) $(suite_results_c16_hosted): \ - $(basedir)/autostart-c16/cc64.T64 $(c16_rt_files) *.sh *.h + $(basedir)/autostart-c16/cc64.T64 $(c16_rt_files) *.sh *.shlib *.h $(test_results_x16_hosted) $(suite_results_x16_hosted): \ - x16files/cc64 $(x16_rt_files) *.sh *.h + x16files/cc64 $(x16_rt_files) *.sh *.shlib *.h $(test_results_c64_c64): %-c64_c64.result: %-test.c %.golden ./compile-run-test.sh $* c64_c64 @@ -149,26 +159,27 @@ cc64-suite-%.result: *-test.c *.golden cc64pe-suite-%.result: *-test.c *.golden ./compile-run-suite.sh cc64pe $* +cc64prof-suite-c64_c64.result: *-test.c *.golden + ./compile-run-suite.sh cc64prof c64_c64 -cc64-suite-c64_x16.result: $(basedir)/emulator/sdcard.img - -cc64pe-suite-c64_x16.result: $(basedir)/emulator/sdcard.img - -cc64-suite-c16_x16.result: $(basedir)/emulator/sdcard.img +suite.profile: *-test.c $(c64_profile_scripts) \ + $(basedir)/autostart-c64/cc64prof.T64 + rm -f c64files/*.profile + ./profile-suite.sh cc64prof $(profile_names) + cat $(profiles) >$@ -cc64pe-suite-c16_x16.result: $(basedir)/emulator/sdcard.img +%.profile: *-test.c c64files/%.pfs \ + $(basedir)/autostart-c64/cc64prof.T64 + rm -f c64files/$*.profile + ./profile-suite.sh cc64prof $* -cc64-suite-x16_x16.result: $(basedir)/emulator/sdcard.img - -$(basedir)/emulator/sdcard.img: $(basedir)/emulator/sdcard.sfdisk - $(basedir)/emulator/mk-sdcard.sh $< $@ clean: rm -f c64files/* c16files/* x16files/* - rm -f separate-tests-c??_c??.result libtest.result tmp.result rm -f cc64-suite-[cx]??_[cx]??.* cc64pe-suite-[cx]??_[cx]??.* rm -f suite.joined-* rm -f *.out *.T64 *.result *-generated.c + rm -f *.profile c64files/rt-%: $(basedir)/c64files/rt-% test -d c64files || mkdir c64files @@ -197,3 +208,7 @@ x16files/%.h: %.h x16files/cc64: $(basedir)/x16files/cc64 test -d x16files || mkdir x16files cp $< $@ + +c64files/%.pfs: %.pfs + test -d c64files || mkdir c64files + ascii2petscii $< $@ diff --git a/tests/e2e/basedir.sh b/tests/e2e/basedir.shlib similarity index 62% rename from tests/e2e/basedir.sh rename to tests/e2e/basedir.shlib index 225708d..c74916a 100644 --- a/tests/e2e/basedir.sh +++ b/tests/e2e/basedir.shlib @@ -1 +1,3 @@ +#!/bin/echo Please source this file + basedir="$(realpath --relative-to="$PWD" "${testdir}/../..")" diff --git a/tests/e2e/cc64-1.pfs b/tests/e2e/cc64-1.pfs new file mode 100644 index 0000000..34916f9 --- /dev/null +++ b/tests/e2e/cc64-1.pfs @@ -0,0 +1,4 @@ + +profile-cc64-1 +cc suite.c +profile2file cc64-1.profile diff --git a/tests/e2e/compile-in-emu.sh b/tests/e2e/compile-in-emu.sh index f5fcbbd..e45b3ed 100755 --- a/tests/e2e/compile-in-emu.sh +++ b/tests/e2e/compile-in-emu.sh @@ -4,14 +4,17 @@ set -e test -n "${CC64HOST}" || export CC64HOST=c64 test -n "${OUTFILES}" || export OUTFILES="" -keybuf="${1}" +testname="${1}" cc64="${2}" test -n "${cc64}" || cc64="cc64" testdir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" -source "${testdir}/basedir.sh" +source "${testdir}/basedir.shlib" emulatordir="$(realpath --relative-to="$PWD" "${basedir}/emulator")" hostfiles="$(realpath --relative-to="$PWD" "${testdir}/${CC64HOST}files")" +rm -f "${hostfiles}/${testname}.log" +keybuf="logfile ${testname}.log\ncc ${testname}.c\nlogclose\ndos s0:notdone" + export CBMFILES="${hostfiles}" "${emulatordir}/run-in-${CC64HOST}emu.sh" "${cc64}" "${keybuf}" diff --git a/tests/e2e/compile-run-suite.sh b/tests/e2e/compile-run-suite.sh index b24b4db..395d130 100755 --- a/tests/e2e/compile-run-suite.sh +++ b/tests/e2e/compile-run-suite.sh @@ -10,7 +10,7 @@ IFS=_ read host target <<< "${host_target}" cd "$(dirname "${BASH_SOURCE[0]}")" testdir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" -source "${testdir}/basedir.sh" +source "${testdir}/basedir.shlib" hostfiles="${testdir}/${host}files" targetfiles="${testdir}/${target}files" @@ -18,26 +18,14 @@ test -d "${hostfiles}" || mkdir "${hostfiles}" test -d "${targetfiles}" || mkdir "${targetfiles}" tests=$(echo *-test.c| sed 's/-test\.c//g') -goldens=*.golden + +# Create suite.c +source "${testdir}/concat-suite.shlib" # Build test binary -( - cat "test-setup-${target}.h" - echo "char *name(){ return \"suite.out,s,w\"; }" - for t in $tests; do - cat ${t}-test.c - done - echo "test(){" - for t in $tests; do - echo " println(\"${t}-test:\");" - echo " ${t}_test();" - done - echo "}" - cat test-main.h -) | tee suite-generated.c | ascii2petscii - "${hostfiles}/suite.c" rm -f "${hostfiles}/suite" "${targetfiles}/suite.T64" CC64HOST="${host}" OUTFILES=suite \ - ./compile-in-emu.sh "cc suite.c\ndos s0:notdone" "$cc64" + ./compile-in-emu.sh "suite" "$cc64" if [ "${hostfiles}" != "${targetfiles}" ] then @@ -46,33 +34,15 @@ fi bin2t64 "${hostfiles}/suite" "${targetfiles}/suite.T64" # Build golden (and silver) file. -# It is not named suite.golden so the make rules depending on *.golden -# don't trigger on this generated golden file being new. -rm -f suite.joined-golden suite.joined-silver -touch suite.joined-golden suite.joined-silver -for t in $tests; do - echo "${t}-test:" >> suite.joined-golden - cat ${t}.golden >> suite.joined-golden - # joined-silver doesn't contain test sections, so diffing against it - # will highlight the test sections as well as actuall output diffs. - cat ${t}.golden >> suite.joined-silver -done +source "${testdir}/concat-golden-silver.shlib" -suitename="${cc64}-suite-${host_target}" # Run test binary +suitename="${cc64}-suite-${host_target}" rm -f "${targetfiles}/suite.out" "${suitename}.out" CC64TARGET="${target}" ./run-in-emu.sh suite petscii2ascii "${targetfiles}/suite.out" "${suitename}.out" # Evaluate test output -rm -f "${suitename}.result" -set +e -diff suite.joined-golden "${suitename}.out" -result=$? -set -e -test $result -eq 0 \ - && echo "${suitename} PASS" > "${suitename}.result" \ - || diff suite.joined-silver "${suitename}.out" > "${suitename}.result" - # diff with suite.silver will additionally show test sections as diff. -cat "${suitename}.result" +source "${testdir}/evaluate-suite.shlib" + exit $result diff --git a/tests/e2e/compile-run-test.sh b/tests/e2e/compile-run-test.sh index f4484a3..d8203d9 100755 --- a/tests/e2e/compile-run-test.sh +++ b/tests/e2e/compile-run-test.sh @@ -10,7 +10,7 @@ IFS=_ read host target <<< "${host_target}" cd "$(dirname "${BASH_SOURCE[0]}")" testdir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" -source "${testdir}/basedir.sh" +source "${testdir}/basedir.shlib" hostfiles="${testdir}/${host}files" targetfiles="${testdir}/${target}files" @@ -24,7 +24,7 @@ echo "char *name(){ return \"${testname}.out,s,w\"; } test(){ ${testname}_test ( | ascii2petscii - "${hostfiles}/${testname}.c" rm -f "${hostfiles}/${testname}" "${targetfiles}/${testname}.T64" CC64HOST="${host}" OUTFILES="${testname}" \ - ./compile-in-emu.sh "cc ${testname}.c\ndos s0:notdone" + ./compile-in-emu.sh "${testname}" if [ "${hostfiles}" != "${targetfiles}" ] then diff --git a/tests/e2e/compound-test.c b/tests/e2e/compound-test.c new file mode 100644 index 0000000..df15aaf --- /dev/null +++ b/tests/e2e/compound-test.c @@ -0,0 +1,7 @@ + +compound_test() { + { + println("in compound"); + } + println("after compound"); +} diff --git a/tests/e2e/compound.golden b/tests/e2e/compound.golden new file mode 100644 index 0000000..9626979 --- /dev/null +++ b/tests/e2e/compound.golden @@ -0,0 +1,2 @@ +in compound +after compound diff --git a/tests/e2e/concat-golden-silver.shlib b/tests/e2e/concat-golden-silver.shlib new file mode 100644 index 0000000..5aee0dd --- /dev/null +++ b/tests/e2e/concat-golden-silver.shlib @@ -0,0 +1,17 @@ +#!/bin/echo Please source this file + +# imput: +# $tests + +# Build golden (and silver) file. +# It is not named suite.golden so the make rules depending on *.golden +# don't trigger on this generated golden file being new. +rm -f suite.joined-golden suite.joined-silver +touch suite.joined-golden suite.joined-silver +for t in $tests; do + echo "${t}-test:" >> suite.joined-golden + cat ${t}.golden >> suite.joined-golden + # joined-silver doesn't contain test sections, so diffing against it + # will highlight the test sections as well as actuall output diffs. + cat ${t}.golden >> suite.joined-silver +done diff --git a/tests/e2e/concat-suite.shlib b/tests/e2e/concat-suite.shlib new file mode 100644 index 0000000..d78dcaa --- /dev/null +++ b/tests/e2e/concat-suite.shlib @@ -0,0 +1,20 @@ +#!/bin/echo Please source this file + +# imput: +# $target $hostfiles $tests + +# Build test binary +( + cat "test-setup-${target}.h" + echo "char *name(){ return \"suite.out,s,w\"; }" + for t in $tests; do + cat ${t}-test.c + done + echo "test(){" + for t in $tests; do + echo " println(\"${t}-test:\");" + echo " ${t}_test();" + done + echo "}" + cat test-main.h +) | tee suite-generated.c | ascii2petscii - "${hostfiles}/suite.c" diff --git a/tests/e2e/debug-in-vice.sh b/tests/e2e/debug-in-vice.sh index 34e30c2..9725b9c 100755 --- a/tests/e2e/debug-in-vice.sh +++ b/tests/e2e/debug-in-vice.sh @@ -2,7 +2,7 @@ set -e testdir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" -source "${testdir}/basedir.sh" +source "${testdir}/basedir.shlib" emulatordir="$(realpath --relative-to="$PWD" "${basedir}/emulator")" c64files="$(realpath --relative-to="$PWD" "${testdir}/c64files")" diff --git a/tests/e2e/evaluate-suite.shlib b/tests/e2e/evaluate-suite.shlib new file mode 100644 index 0000000..a76915e --- /dev/null +++ b/tests/e2e/evaluate-suite.shlib @@ -0,0 +1,18 @@ +#!/bin/echo Please source this file + +# imput: +# $suitename + +# output: +# $result + +rm -f "${suitename}.result" +set +e +diff suite.joined-golden "${suitename}.out" +result=$? +set -e +test $result -eq 0 \ + && echo "${suitename} PASS" > "${suitename}.result" \ + || diff suite.joined-silver "${suitename}.out" > "${suitename}.result" + # diff with suite.silver will additionally show test sections as diff. +cat "${suitename}.result" diff --git a/tests/e2e/nextword.pfs b/tests/e2e/nextword.pfs new file mode 100644 index 0000000..f7b1949 --- /dev/null +++ b/tests/e2e/nextword.pfs @@ -0,0 +1,4 @@ + +profile-scanner-nextword +cc suite.c +profile2file nextword.profile diff --git a/tests/e2e/profile-register/cc64-1-2021-03-26-2120-orig-list.profile b/tests/e2e/profile-register/cc64-1-2021-03-26-2120-orig-list.profile new file mode 100644 index 0000000..6420f9a --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-03-26-2120-orig-list.profile @@ -0,0 +1,19 @@ +2021-03-26T21:20:39+01:00 +Original version with src list during compile + +profiler report PROFILE-CC64-1 +timestamps +919.522.732 1.078.906.060 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 475419 52822277 (etc) +1 19318 21455 1037243 114416784 [MEMMAN-ETC] +2 21459 22678 1384162 153154008 [FILE-HANDLING] +3 22682 23339 797224 122822197 [INPUT] +4 23343 25749 2695157 299076306 [SCANNER] +5 25753 27129 153639 17403250 [SYMTAB] +6 27133 35110 1826434 197679185 [PARSER] +7 35114 36672 1100491 121509788 [PASS2] +8 36815 37565 0 0 [SHELL] + diff --git a/tests/e2e/profile-register/cc64-1-2021-03-26-2131-orig-nolist.profile b/tests/e2e/profile-register/cc64-1-2021-03-26-2131-orig-nolist.profile new file mode 100644 index 0000000..19b0173 --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-03-26-2131-orig-nolist.profile @@ -0,0 +1,19 @@ +2021-03-26T21:31:18+01:00 +Original version without src list during compile + +profiler report PROFILE-CC64-1 +timestamps +830.786.988 989.908.172 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 475419 52854657 (etc) +1 19318 21455 1035458 114210370 [MEMMAN-ETC] +2 21459 22678 1384162 153117590 [FILE-HANDLING] +3 22682 23339 313708 34373231 [INPUT] +4 23343 25749 2695157 299094501 [SCANNER] +5 25753 27129 153639 17396511 [SYMTAB] +6 27133 35110 1826434 197594285 [PARSER] +7 35114 36672 1100491 121235385 [PASS2] +8 36815 37565 0 0 [SHELL] + diff --git a/tests/e2e/profile-register/cc64-1-2021-03-28-0110-operq.profile b/tests/e2e/profile-register/cc64-1-2021-03-28-0110-operq.profile new file mode 100644 index 0000000..13b62c2 --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-03-28-0110-operq.profile @@ -0,0 +1,19 @@ +2021-03-28T01:10:29+01:00 +operator? in scanner optimized for speed, no more loop + +profiler report PROFILE-CC64-1 +timestamps +728.681.644 887.934.157 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 475431 52874525 (etc) +1 19316 21453 1035478 114299050 [MEMMAN-ETC] +2 21457 22676 1384214 153217916 [FILE-HANDLING] +3 22680 23337 313708 34400869 [INPUT] +4 23341 25905 1750140 196516875 [SCANNER] +5 25909 27285 153639 17400568 [SYMTAB] +6 27289 35263 1826434 197743285 [PARSER] +7 35267 36825 1100611 121544654 [PASS2] +8 36968 37719 0 0 [SHELL] + diff --git a/tests/e2e/profile-register/cc64-1-2021-03-28-1948-oper.profile b/tests/e2e/profile-register/cc64-1-2021-03-28-1948-oper.profile new file mode 100644 index 0000000..51a0f98 --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-03-28-1948-oper.profile @@ -0,0 +1,19 @@ +2021-03-28T19:48:20+02:00 +operator optimized for speed, too, after operator? + +profiler report PROFILE-CC64-1 +timestamps +724.749.484 884.001.997 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 475431 52856950 (etc) +1 19316 21453 1038030 114537078 [MEMMAN-ETC] +2 21457 22676 1384214 153200867 [FILE-HANDLING] +3 22680 23337 313708 34374813 [INPUT] +4 23341 25905 1713684 192370861 [SCANNER] +5 25909 27285 153639 17406319 [SYMTAB] +6 27289 35263 1826434 197768726 [PARSER] +7 35267 36825 1100611 121532616 [PASS2] +8 36968 37719 0 0 [SHELL] + diff --git a/tests/e2e/profile-register/cc64-1-2021-03-28-2144-nextword.profile b/tests/e2e/profile-register/cc64-1-2021-03-28-2144-nextword.profile new file mode 100644 index 0000000..4563bdb --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-03-28-2144-nextword.profile @@ -0,0 +1,19 @@ +2021-03-28T21:44:31+02:00 +more detailed profiles of scanner exposing usage of nextword + +profiler report PROFILE-CC64-1 +timestamps +724.815.020 883.936.461 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 475479 52862071 (etc) +1 19316 21453 1038110 114573443 [MEMMAN-ETC] +2 21457 22676 1384422 153186858 [FILE-HANDLING] +3 22680 23337 313708 34349430 [INPUT] +4 23341 26113 1713684 192260377 [SCANNER] +5 26117 27493 153639 17412410 [SYMTAB] +6 27497 35472 1826434 198032869 [PARSER] +7 35476 37034 1101091 121328995 [PASS2] +8 37177 37927 0 0 [SHELL] + diff --git a/tests/e2e/profile-register/cc64-1-2021-04-03-2337-thisword.profile b/tests/e2e/profile-register/cc64-1-2021-04-03-2337-thisword.profile new file mode 100644 index 0000000..3d20b7f --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-04-03-2337-thisword.profile @@ -0,0 +1,19 @@ +2021-04-03T23:37:17+02:00 +nextword/backword replaced by thisword/accept + +profiler report PROFILE-CC64-1 +timestamps +635.227.308 794.348.749 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 497891 55192602 (etc) +1 19316 21453 939654 103578004 [MEMMAN-ETC] +2 21457 22676 1384422 153259960 [FILE-HANDLING] +3 22680 23337 313716 34378460 [INPUT] +4 23341 26062 1019251 113532446 [SCANNER] +5 26066 27442 153639 17411979 [SYMTAB] +6 27446 35465 1805554 195706591 [PARSER] +7 35469 37027 1101091 121325306 [PASS2] +8 37170 37920 0 0 [SHELL] + diff --git a/tests/e2e/profile-register/cc64-1-2021-04-04-0011-parser.profile b/tests/e2e/profile-register/cc64-1-2021-04-04-0011-parser.profile new file mode 100644 index 0000000..b59d28e --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-04-04-0011-parser.profile @@ -0,0 +1,19 @@ +2021-04-04T00:11:31+02:00 +smaller parser code, common snippets extracted, case? replaced by tables + +profiler report PROFILE-CC64-1 +timestamps +639.684.012 799.132.876 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 497825 55193807 (etc) +1 19047 21184 939544 103535790 [MEMMAN-ETC] +2 21188 22407 1384136 153433132 [FILE-HANDLING] +3 22411 23069 313716 34332998 [INPUT] +4 23073 25793 1019251 113561580 [SCANNER] +5 25797 27173 153639 17404624 [SYMTAB] +6 27177 34979 1846111 200060753 [PARSER] +7 34983 36541 1100431 121572943 [PASS2] +8 36684 37434 0 0 [SHELL] + diff --git a/tests/e2e/profile-register/cc64-1-2021-04-04-0015-compound.profile b/tests/e2e/profile-register/cc64-1-2021-04-04-0015-compound.profile new file mode 100644 index 0000000..26385c7 --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-04-04-0015-compound.profile @@ -0,0 +1,19 @@ +2021-04-04T00:15:14+02:00 +same compacted parser code, but with extra compound test in test suite + +profiler report PROFILE-CC64-1 +timestamps +644.861.356 805.555.404 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 501416 55569437 (etc) +1 19047 21184 947268 104440768 [MEMMAN-ETC] +2 21188 22407 1396439 154831260 [FILE-HANDLING] +3 22411 23069 316896 34682755 [INPUT] +4 23073 25793 1027858 114523479 [SCANNER] +5 25797 27173 155294 17592184 [SYMTAB] +6 27177 34979 1858844 201359581 [PARSER] +7 34983 36541 1109557 122555828 [PASS2] +8 36684 37434 0 0 [SHELL] + diff --git a/tests/e2e/profile-register/cc64-1-2021-04-16-0131-strings.profile b/tests/e2e/profile-register/cc64-1-2021-04-16-0131-strings.profile new file mode 100644 index 0000000..3861b68 --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-04-16-0131-strings.profile @@ -0,0 +1,19 @@ +2021-04-16T01:31:47+02:00 +strcmp/spy/cat and alpha/num/alphanum moved to strings.fth + +profiler report PROFILE-CC64-1 +timestamps +644.730.028 805.359.052 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 216494 22948435 (etc) +1 18921 19116 480396 56645293 [STRINGS] +2 19128 21266 947278 104421341 [MEMMAN-ETC] +3 21270 22490 1396465 154541959 [FILE-HANDLING] +4 22494 23151 316896 34711112 [INPUT] +5 23155 25816 832390 90610649 [SCANNER] +6 25820 27196 155294 17603763 [SYMTAB] +7 27200 35003 1858844 201343115 [PARSER] +8 35007 36565 1109617 122555758 [PASS2] + diff --git a/tests/e2e/profile-register/cc64-1-2021-04-17-0112-alphanum.profile b/tests/e2e/profile-register/cc64-1-2021-04-17-0112-alphanum.profile new file mode 100644 index 0000000..5007507 --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-04-17-0112-alphanum.profile @@ -0,0 +1,19 @@ +2021-04-17T01:12:41+02:00 +alpha? num? alphanum? ported to assembly + +profiler report PROFILE-CC64-1 +timestamps +621.071.532 781.438.412 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 216494 22931496 (etc) +1 18921 19129 284928 32796137 [STRINGS] +2 19141 21278 947278 104463375 [MEMMAN-ETC] +3 21282 22501 1396465 154563720 [FILE-HANDLING] +4 22505 23163 316896 34718023 [INPUT] +5 23167 25826 832390 90769071 [SCANNER] +6 25830 27206 155294 17584803 [SYMTAB] +7 27210 35013 1858844 201386042 [PARSER] +8 35017 36575 1109617 122256703 [PASS2] + diff --git a/tests/e2e/profile-register/cc64-1-2021-04-23-1012-findstr2.profile b/tests/e2e/profile-register/cc64-1-2021-04-23-1012-findstr2.profile new file mode 100644 index 0000000..35f9888 --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-04-23-1012-findstr2.profile @@ -0,0 +1,19 @@ +2021-04-23T10:12:41+02:00 +string-length indexed string search in string tabs. + +profiler report PROFILE-CC64-1 +timestamps +579.980.460 740.543.948 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 216506 22950222 (etc) +1 18921 19129 114310 12976436 [STRINGS] +2 19141 21392 742175 83029931 [MEMMAN-ETC] +3 21396 22616 1396517 154575151 [FILE-HANDLING] +4 22620 23277 316896 34740882 [INPUT] +5 23281 25976 832390 90869725 [SCANNER] +6 25980 27372 155294 17623890 [SYMTAB] +7 27376 35180 1858844 201608564 [PARSER] +8 35184 36735 1109737 122235615 [PASS2] + diff --git a/tests/e2e/profile-register/cc64-1-2021-04-23-2148-countstamps.profile b/tests/e2e/profile-register/cc64-1-2021-04-23-2148-countstamps.profile new file mode 100644 index 0000000..883b30b --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-04-23-2148-countstamps.profile @@ -0,0 +1,21 @@ +2021-04-23T21:48:00+02:00 +added deterministic countstamps. fixed timestamps low word random bug + +profiler report PROFILE-CC64-1 +timestamps +579.731.026 740.298.316 +countstamps +5.290.027 6.743.516 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 216585 22962235 (etc) +1 19222 19430 114310 12967362 [STRINGS] +2 19443 21696 742255 82442808 [MEMMAN-ETC] +3 21700 22919 1396725 154817330 [FILE-HANDLING] +4 22923 23581 316896 34709753 [INPUT] +5 23585 26282 832390 90931471 [SCANNER] +6 26286 27678 155294 17579470 [SYMTAB] +7 27682 35485 1858844 201521741 [PARSER] +8 35489 37040 1110217 122366024 [PASS2] + diff --git a/tests/e2e/profile-register/cc64-1-2021-04-25-1623-stringarray.profile b/tests/e2e/profile-register/cc64-1-2021-04-25-1623-stringarray.profile new file mode 100644 index 0000000..ae13f3d --- /dev/null +++ b/tests/e2e/profile-register/cc64-1-2021-04-25-1623-stringarray.profile @@ -0,0 +1,21 @@ +2021-04-25T16:23:23+02:00 +stringtab switched from linked list to array. length index formalized. + +profiler report PROFILE-CC64-1 +timestamps +579.700.575 740.468.880 +countstamps +5.291.411 6.744.798 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 216579 22974429 (etc) +1 19222 19430 114310 12968193 [STRINGS] +2 19443 21684 743629 83032569 [MEMMAN-ETC] +3 21688 22907 1396699 154557722 [FILE-HANDLING] +4 22911 23569 316896 34747986 [INPUT] +5 23573 26242 832390 90765063 [SCANNER] +6 26246 27631 155294 17596849 [SYMTAB] +7 27635 35436 1858844 201523105 [PARSER] +8 35440 36991 1110157 122302842 [PASS2] + diff --git a/tests/e2e/profile-register/nextword-2021-03-28-2144-nextword.profile b/tests/e2e/profile-register/nextword-2021-03-28-2144-nextword.profile new file mode 100644 index 0000000..f8b841e --- /dev/null +++ b/tests/e2e/profile-register/nextword-2021-03-28-2144-nextword.profile @@ -0,0 +1,19 @@ +2021-03-28T21:44:31+02:00 +more detailed profiles of scanner exposing usage of nextword + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +725.142.700 884.460.749 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7162208 789492144 (etc) +1 25608 25652 0 0 [SCANNER-NEXTWORD-VARS] +2 25656 25738 476000 53392834 [SCANNER-NEXTWORD-CORE] +3 25742 25798 344610 39090310 [SCANNER-NEXTWORD-BACKWORD] +4 25802 25840 6477 716030 [SCANNER-NEXTWORD-MARK] +5 25844 25891 17272 1817512 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + diff --git a/tests/e2e/profile-register/nextword-2021-04-03-2337-thisword.profile b/tests/e2e/profile-register/nextword-2021-04-03-2337-thisword.profile new file mode 100644 index 0000000..e2c4f0c --- /dev/null +++ b/tests/e2e/profile-register/nextword-2021-04-03-2337-thisword.profile @@ -0,0 +1,19 @@ +2021-04-03T23:37:17+02:00 +nextword/backword replaced by thisword/accept + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +635.423.916 794.807.501 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7065330 778562120 (etc) +1 25608 25648 0 0 [SCANNER-NEXTWORD-VARS] +2 25652 25714 41092 4523890 [SCANNER-FETCHWORD] +3 25718 25751 85047 9205894 [SCANNER-THISWORD] +4 25755 25793 6477 711890 [SCANNER-NEXTWORD-MARK] +5 25797 25844 17272 1824100 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + diff --git a/tests/e2e/profile-register/nextword-2021-04-04-0011-parser.profile b/tests/e2e/profile-register/nextword-2021-04-04-0011-parser.profile new file mode 100644 index 0000000..c0050a5 --- /dev/null +++ b/tests/e2e/profile-register/nextword-2021-04-04-0011-parser.profile @@ -0,0 +1,19 @@ +2021-04-04T00:11:31+02:00 +smaller parser code, common snippets extracted, case? replaced by tables + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +639.946.156 799.657.164 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7104765 783352437 (etc) +1 25339 25379 0 0 [SCANNER-NEXTWORD-VARS] +2 25383 25445 41092 4539839 [SCANNER-FETCHWORD] +3 25449 25482 85047 9202876 [SCANNER-THISWORD] +4 25486 25524 6477 713775 [SCANNER-NEXTWORD-MARK] +5 25528 25575 17272 1821540 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + diff --git a/tests/e2e/profile-register/nextword-2021-04-04-0015-compound.profile b/tests/e2e/profile-register/nextword-2021-04-04-0015-compound.profile new file mode 100644 index 0000000..9bd219e --- /dev/null +++ b/tests/e2e/profile-register/nextword-2021-04-04-0015-compound.profile @@ -0,0 +1,19 @@ +2021-04-04T00:15:14+02:00 +same compacted parser code, but with extra compound test in test suite + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +645.123.500 806.276.300 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7162570 789862400 (etc) +1 25339 25379 0 0 [SCANNER-NEXTWORD-VARS] +2 25383 25445 41378 4564296 [SCANNER-FETCHWORD] +3 25449 25482 85677 9274954 [SCANNER-THISWORD] +4 25486 25524 6531 716487 [SCANNER-NEXTWORD-MARK] +5 25528 25575 17416 1839717 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + diff --git a/tests/e2e/profile-register/nextword-2021-04-16-0131-strings.profile b/tests/e2e/profile-register/nextword-2021-04-16-0131-strings.profile new file mode 100644 index 0000000..b499751 --- /dev/null +++ b/tests/e2e/profile-register/nextword-2021-04-16-0131-strings.profile @@ -0,0 +1,19 @@ +2021-04-16T01:31:47+02:00 +strcmp/spy/cat and alpha/num/alphanum moved to strings.fth + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +644.926.636 805.752.268 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7162672 789423856 (etc) +1 25362 25402 0 0 [SCANNER-NEXTWORD-VARS] +2 25406 25468 41378 4556485 [SCANNER-FETCHWORD] +3 25472 25505 85677 9285933 [SCANNER-THISWORD] +4 25509 25547 6531 718081 [SCANNER-NEXTWORD-MARK] +5 25551 25598 17416 1833785 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + diff --git a/tests/e2e/profile-register/nextword-2021-04-17-0112-alphanum.profile b/tests/e2e/profile-register/nextword-2021-04-17-0112-alphanum.profile new file mode 100644 index 0000000..a516125 --- /dev/null +++ b/tests/e2e/profile-register/nextword-2021-04-17-0112-alphanum.profile @@ -0,0 +1,19 @@ +2021-04-17T01:12:41+02:00 +alpha? num? alphanum? ported to assembly + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +621.268.140 781.766.092 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6967204 765429279 (etc) +1 25372 25412 0 0 [SCANNER-NEXTWORD-VARS] +2 25416 25478 41378 4549285 [SCANNER-FETCHWORD] +3 25482 25515 85677 9291539 [SCANNER-THISWORD] +4 25519 25557 6531 715377 [SCANNER-NEXTWORD-MARK] +5 25561 25608 17416 1853952 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + diff --git a/tests/e2e/profile-register/nextword-2021-04-23-1012-findstr2.profile b/tests/e2e/profile-register/nextword-2021-04-23-1012-findstr2.profile new file mode 100644 index 0000000..eb466bf --- /dev/null +++ b/tests/e2e/profile-register/nextword-2021-04-23-1012-findstr2.profile @@ -0,0 +1,19 @@ +2021-04-23T10:12:41+02:00 +string-length indexed string search in string tabs. + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +580.242.604 741.133.772 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6591667 724768559 (etc) +1 25522 25562 0 0 [SCANNER-NEXTWORD-VARS] +2 25566 25628 41378 4596294 [SCANNER-FETCHWORD] +3 25632 25665 85677 9294071 [SCANNER-THISWORD] +4 25669 25707 6531 717783 [SCANNER-NEXTWORD-MARK] +5 25711 25758 17416 1833906 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + diff --git a/tests/e2e/profile-register/nextword-2021-04-23-2148-countstamps.profile b/tests/e2e/profile-register/nextword-2021-04-23-2148-countstamps.profile new file mode 100644 index 0000000..bdbc591 --- /dev/null +++ b/tests/e2e/profile-register/nextword-2021-04-23-2148-countstamps.profile @@ -0,0 +1,21 @@ +2021-04-23T21:48:00+02:00 +added deterministic countstamps. fixed timestamps low word random bug + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +580.019.275 740.844.536 +countstamps +5.290.027 6.743.516 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6592514 724416147 (etc) +1 25828 25868 0 0 [SCANNER-NEXTWORD-VARS] +2 25872 25934 41378 4577552 [SCANNER-FETCHWORD] +3 25938 25971 85677 9296837 [SCANNER-THISWORD] +4 25975 26013 6531 722558 [SCANNER-NEXTWORD-MARK] +5 26017 26064 17416 1831278 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + diff --git a/tests/e2e/profile-register/nextword-2021-04-25-1623-stringarray.profile b/tests/e2e/profile-register/nextword-2021-04-25-1623-stringarray.profile new file mode 100644 index 0000000..8e7ae26 --- /dev/null +++ b/tests/e2e/profile-register/nextword-2021-04-25-1623-stringarray.profile @@ -0,0 +1,21 @@ +2021-04-25T16:23:23+02:00 +stringtab switched from linked list to array. length index formalized. + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +580.005.047 741.008.108 +countstamps +5.291.411 6.744.798 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6593796 724606930 (etc) +1 25788 25828 0 0 [SCANNER-NEXTWORD-VARS] +2 25832 25894 41378 4554536 [SCANNER-FETCHWORD] +3 25898 25931 85677 9290749 [SCANNER-THISWORD] +4 25935 25973 6531 719806 [SCANNER-NEXTWORD-MARK] +5 25977 26024 17416 1835965 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + diff --git a/tests/e2e/profile-register/scanner1-2021-03-26-2120-orig-list.profile b/tests/e2e/profile-register/scanner1-2021-03-26-2120-orig-list.profile new file mode 100644 index 0000000..712db6c --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-03-26-2120-orig-list.profile @@ -0,0 +1,19 @@ +2021-03-26T21:20:39+01:00 +Original version with src list during compile + +profiler report PROFILE-SCANNER1 +timestamps +920.243.628 1.079.561.420 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 7618991 875514859 (etc) +1 23363 23469 247516 29344925 [SCANNER-ALPHANUM] +2 23473 23754 2331 234777 [SCANNER-KEYWORD] +3 23758 23913 66366 7035253 [SCANNER-IDENTIFIER] +4 23917 24334 1075233 116817276 [SCANNER-OPERATOR] +5 24338 24578 27320 3487023 [SCANNER-NUMBER] +6 24582 25095 237738 26088943 [SCANNER-CHAR/STRING] +7 25099 25258 150400 15854402 [SCANNER-NEXTWORD] +8 25262 25408 43874 5185639 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-03-26-2131-orig-nolist.profile b/tests/e2e/profile-register/scanner1-2021-03-26-2131-orig-nolist.profile new file mode 100644 index 0000000..d610bf6 --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-03-26-2131-orig-nolist.profile @@ -0,0 +1,19 @@ +2021-03-26T21:31:18+01:00 +Original version without src list during compile + +profiler report PROFILE-SCANNER1 +timestamps +831.049.132 990.432.460 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 7133690 786419989 (etc) +1 23363 23469 247516 29307096 [SCANNER-ALPHANUM] +2 23473 23754 2331 235295 [SCANNER-KEYWORD] +3 23758 23913 66366 7041541 [SCANNER-IDENTIFIER] +4 23917 24334 1075233 116806593 [SCANNER-OPERATOR] +5 24338 24578 27320 3492260 [SCANNER-NUMBER] +6 24582 25095 237738 26065758 [SCANNER-CHAR/STRING] +7 25099 25258 150400 15852898 [SCANNER-NEXTWORD] +8 25262 25408 43874 5184366 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-03-28-0110-operq.profile b/tests/e2e/profile-register/scanner1-2021-03-28-0110-operq.profile new file mode 100644 index 0000000..eaa5d3c --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-03-28-0110-operq.profile @@ -0,0 +1,19 @@ +2021-03-28T01:10:29+01:00 +operator? in scanner optimized for speed, no more loop + +profiler report PROFILE-SCANNER1 +timestamps +728.878.252 888.458.445 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7133894 787089569 (etc) +1 23361 23467 247516 29358035 [SCANNER-ALPHANUM] +2 23471 23752 2331 234212 [SCANNER-KEYWORD] +3 23756 23911 66366 7039409 [SCANNER-IDENTIFIER] +4 23915 24490 130216 14189317 [SCANNER-OPERATOR] +5 24494 24734 27320 3491442 [SCANNER-NUMBER] +6 24738 25252 237738 26062387 [SCANNER-CHAR/STRING] +7 25256 25415 150400 15879314 [SCANNER-NEXTWORD] +8 25419 25565 43874 5182983 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-03-28-1948-oper.profile b/tests/e2e/profile-register/scanner1-2021-03-28-1948-oper.profile new file mode 100644 index 0000000..a9b6ac2 --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-03-28-1948-oper.profile @@ -0,0 +1,19 @@ +2021-03-28T19:48:20+02:00 +operator optimized for speed, too, after operator? + +profiler report PROFILE-SCANNER1 +timestamps +725.011.628 884.591.821 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7136446 787316895 (etc) +1 23361 23467 247516 29364175 [SCANNER-ALPHANUM] +2 23471 23752 2331 234640 [SCANNER-KEYWORD] +3 23756 23911 66366 7050685 [SCANNER-IDENTIFIER] +4 23915 24499 93760 10025392 [SCANNER-OPERATOR] +5 24503 24743 27320 3491184 [SCANNER-NUMBER] +6 24747 25261 237738 26107841 [SCANNER-CHAR/STRING] +7 25265 25424 150400 15860971 [SCANNER-NEXTWORD] +8 25428 25574 43874 5209751 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-03-28-2144-nextword.profile b/tests/e2e/profile-register/scanner1-2021-03-28-2144-nextword.profile new file mode 100644 index 0000000..5fd43a0 --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-03-28-2144-nextword.profile @@ -0,0 +1,19 @@ +2021-03-28T21:44:31+02:00 +more detailed profiles of scanner exposing usage of nextword + +profiler report PROFILE-SCANNER1 +timestamps +725.011.628 884.395.213 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7137262 787217837 (etc) +1 23361 23467 247516 29351452 [SCANNER-ALPHANUM] +2 23471 23752 2331 230714 [SCANNER-KEYWORD] +3 23756 23911 66366 7033670 [SCANNER-IDENTIFIER] +4 23915 24499 93760 10010089 [SCANNER-OPERATOR] +5 24503 24743 27320 3490370 [SCANNER-NUMBER] +6 24747 25261 237738 26062064 [SCANNER-CHAR/STRING] +7 25265 25425 150400 15865910 [SCANNER-(NEXTWORD] +8 25429 25575 43874 5190840 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-04-03-2337-thisword.profile b/tests/e2e/profile-register/scanner1-2021-04-03-2337-thisword.profile new file mode 100644 index 0000000..456f5a9 --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-04-03-2337-thisword.profile @@ -0,0 +1,19 @@ +2021-04-03T23:37:17+02:00 +nextword/backword replaced by thisword/accept + +profiler report PROFILE-SCANNER1 +timestamps +635.423.916 794.741.965 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6345869 697567146 (etc) +1 23361 23467 247524 29349827 [SCANNER-ALPHANUM] +2 23471 23752 2334 236122 [SCANNER-KEYWORD] +3 23756 23911 66366 7038192 [SCANNER-IDENTIFIER] +4 23915 24499 93760 9999244 [SCANNER-OPERATOR] +5 24503 24743 27320 3484075 [SCANNER-NUMBER] +6 24747 25261 237738 26069501 [SCANNER-CHAR/STRING] +7 25265 25425 150422 15885237 [SCANNER-(NEXTWORD] +8 25429 25575 43885 5177003 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-04-04-0011-parser.profile b/tests/e2e/profile-register/scanner1-2021-04-04-0011-parser.profile new file mode 100644 index 0000000..c01448d --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-04-04-0011-parser.profile @@ -0,0 +1,19 @@ +2021-04-04T00:11:31+02:00 +smaller parser code, common snippets extracted, case? replaced by tables + +profiler report PROFILE-SCANNER1 +timestamps +639.880.620 799.526.092 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6385304 702309026 (etc) +1 23093 23199 247524 29343382 [SCANNER-ALPHANUM] +2 23203 23484 2334 235547 [SCANNER-KEYWORD] +3 23488 23643 66366 7056143 [SCANNER-IDENTIFIER] +4 23647 24231 93760 10006119 [SCANNER-OPERATOR] +5 24235 24475 27320 3490842 [SCANNER-NUMBER] +6 24479 24992 237738 26044467 [SCANNER-CHAR/STRING] +7 24996 25156 150422 15846323 [SCANNER-(NEXTWORD] +8 25160 25306 43885 5193126 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-04-04-0015-compound.profile b/tests/e2e/profile-register/scanner1-2021-04-04-0015-compound.profile new file mode 100644 index 0000000..93e68da --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-04-04-0015-compound.profile @@ -0,0 +1,19 @@ +2021-04-04T00:15:14+02:00 +same compacted parser code, but with extra compound test in test suite + +profiler report PROFILE-SCANNER1 +timestamps +645.123.500 806.145.228 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6436730 708039370 (etc) +1 23093 23199 249734 29585156 [SCANNER-ALPHANUM] +2 23203 23484 2352 237721 [SCANNER-KEYWORD] +3 23488 23643 66969 7120305 [SCANNER-IDENTIFIER] +4 23647 24231 94351 10073526 [SCANNER-OPERATOR] +5 24235 24475 27320 3493271 [SCANNER-NUMBER] +6 24479 24992 240309 26349162 [SCANNER-CHAR/STRING] +7 24996 25156 151636 16000127 [SCANNER-(NEXTWORD] +8 25160 25306 44171 5233350 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-04-16-0131-strings.profile b/tests/e2e/profile-register/scanner1-2021-04-16-0131-strings.profile new file mode 100644 index 0000000..dcb04cf --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-04-16-0131-strings.profile @@ -0,0 +1,19 @@ +2021-04-16T01:31:47+02:00 +strcmp/spy/cat and alpha/num/alphanum moved to strings.fth + +profiler report PROFILE-SCANNER1 +timestamps +644.926.636 805.817.804 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6632300 731620342 (etc) +1 23175 23220 54266 5722992 [SCANNER-ALPHANUM] +2 23224 23506 2352 236518 [SCANNER-KEYWORD] +3 23510 23665 66969 7111107 [SCANNER-IDENTIFIER] +4 23669 24254 94351 10063310 [SCANNER-OPERATOR] +5 24258 24498 27320 3485874 [SCANNER-NUMBER] +6 24502 25015 240309 26374868 [SCANNER-CHAR/STRING] +7 25019 25179 151636 16024651 [SCANNER-(NEXTWORD] +8 25183 25329 44171 5224637 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-04-17-0112-alphanum.profile b/tests/e2e/profile-register/scanner1-2021-04-17-0112-alphanum.profile new file mode 100644 index 0000000..9a3894e --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-04-17-0112-alphanum.profile @@ -0,0 +1,19 @@ +2021-04-17T01:12:41+02:00 +alpha? num? alphanum? ported to assembly + +profiler report PROFILE-SCANNER1 +timestamps +621.202.604 781.766.092 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6436832 707492868 (etc) +1 23187 23232 54266 5724423 [SCANNER-ALPHANUM] +2 23236 23517 2352 237456 [SCANNER-KEYWORD] +3 23521 23676 66969 7213777 [SCANNER-IDENTIFIER] +4 23680 24264 94351 10070185 [SCANNER-OPERATOR] +5 24268 24508 27320 3480745 [SCANNER-NUMBER] +6 24512 25025 240309 26368044 [SCANNER-CHAR/STRING] +7 25029 25189 151636 16028241 [SCANNER-(NEXTWORD] +8 25193 25339 44171 5214794 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-04-23-1012-findstr2.profile b/tests/e2e/profile-register/scanner1-2021-04-23-1012-findstr2.profile new file mode 100644 index 0000000..319f2e8 --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-04-23-1012-findstr2.profile @@ -0,0 +1,19 @@ +2021-04-23T10:12:41+02:00 +string-length indexed string search in string tabs. + +profiler report PROFILE-SCANNER1 +timestamps +580.177.068 741.068.236 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6061295 666704155 (etc) +1 23301 23346 54266 5729865 [SCANNER-ALPHANUM] +2 23350 23667 2352 255274 [SCANNER-KEYWORD] +3 23671 23826 66969 7212879 [SCANNER-IDENTIFIER] +4 23830 24414 94351 10070844 [SCANNER-OPERATOR] +5 24418 24658 27320 3482676 [SCANNER-NUMBER] +6 24662 25175 240309 26404574 [SCANNER-CHAR/STRING] +7 25179 25339 151636 16035538 [SCANNER-(NEXTWORD] +8 25343 25489 44171 5236110 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-04-23-2148-countstamps.profile b/tests/e2e/profile-register/scanner1-2021-04-23-2148-countstamps.profile new file mode 100644 index 0000000..ee1880f --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-04-23-2148-countstamps.profile @@ -0,0 +1,21 @@ +2021-04-23T21:48:00+02:00 +added deterministic countstamps. fixed timestamps low word random bug + +profiler report PROFILE-SCANNER1 +timestamps +580.021.390 740.847.461 +countstamps +5.290.027 6.743.516 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6062142 666297372 (etc) +1 23605 23650 54266 5723234 [SCANNER-ALPHANUM] +2 23654 23972 2352 254626 [SCANNER-KEYWORD] +3 23976 24131 66969 7263907 [SCANNER-IDENTIFIER] +4 24135 24720 94351 10076657 [SCANNER-OPERATOR] +5 24724 24964 27320 3486299 [SCANNER-NUMBER] +6 24968 25481 240309 26428778 [SCANNER-CHAR/STRING] +7 25485 25645 151636 16086836 [SCANNER-(NEXTWORD] +8 25649 25795 44171 5229673 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner1-2021-04-25-1623-stringarray.profile b/tests/e2e/profile-register/scanner1-2021-04-25-1623-stringarray.profile new file mode 100644 index 0000000..9ed088f --- /dev/null +++ b/tests/e2e/profile-register/scanner1-2021-04-25-1623-stringarray.profile @@ -0,0 +1,21 @@ +2021-04-25T16:23:23+02:00 +stringtab switched from linked list to array. length index formalized. + +profiler report PROFILE-SCANNER1 +timestamps +579.863.859 740.904.951 +countstamps +5.291.411 6.744.798 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6063424 666530799 (etc) +1 23593 23638 54266 5736626 [SCANNER-ALPHANUM] +2 23642 23937 2352 254502 [SCANNER-KEYWORD] +3 23941 24096 66969 7213797 [SCANNER-IDENTIFIER] +4 24100 24680 94351 10056313 [SCANNER-OPERATOR] +5 24684 24924 27320 3479557 [SCANNER-NUMBER] +6 24928 25441 240309 26358918 [SCANNER-CHAR/STRING] +7 25445 25605 151636 16050286 [SCANNER-(NEXTWORD] +8 25609 25755 44171 5224074 [SCANNER-COMMENT] + diff --git a/tests/e2e/profile-register/scanner2-2021-03-26-2120-orig-list.profile b/tests/e2e/profile-register/scanner2-2021-03-26-2120-orig-list.profile new file mode 100644 index 0000000..e3597d6 --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-03-26-2120-orig-list.profile @@ -0,0 +1,19 @@ +2021-03-26T21:20:39+01:00 +Original version with src list during compile + +profiler report PROFILE-SCANNER2 +timestamps +920.112.556 1.079.495.884 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 6776943 780683319 (etc) +1 23363 23469 247516 29294112 [SCANNER-ALPHANUM] +2 23758 23913 66366 7047299 [SCANNER-IDENTIFIER] +3 23917 24334 1075233 116795039 [SCANNER-OPERATOR] +4 24338 24578 27320 3487877 [SCANNER-NUMBER] +5 24582 25095 237738 26069639 [SCANNER-CHAR/STRING] +6 25099 25258 150400 15856910 [SCANNER-NEXTWORD] +7 25262 25408 43874 5184709 [SCANNER-COMMENT] +8 25412 25749 844379 95087655 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-03-26-2131-orig-nolist.profile b/tests/e2e/profile-register/scanner2-2021-03-26-2131-orig-nolist.profile new file mode 100644 index 0000000..7cd4ecc --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-03-26-2131-orig-nolist.profile @@ -0,0 +1,19 @@ +2021-03-26T21:31:18+01:00 +Original version without src list during compile + +profiler report PROFILE-SCANNER2 +timestamps +831.180.204 990.563.532 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 6291642 691659740 (etc) +1 23363 23469 247516 29308255 [SCANNER-ALPHANUM] +2 23758 23913 66366 7040651 [SCANNER-IDENTIFIER] +3 23917 24334 1075233 116814924 [SCANNER-OPERATOR] +4 24338 24578 27320 3487498 [SCANNER-NUMBER] +5 24582 25095 237738 26065205 [SCANNER-CHAR/STRING] +6 25099 25258 150400 15851841 [SCANNER-NEXTWORD] +7 25262 25408 43874 5189985 [SCANNER-COMMENT] +8 25412 25749 844379 95121698 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-03-28-0110-operq.profile b/tests/e2e/profile-register/scanner2-2021-03-28-0110-operq.profile new file mode 100644 index 0000000..160a93b --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-03-28-0110-operq.profile @@ -0,0 +1,19 @@ +2021-03-28T01:10:29+01:00 +operator? in scanner optimized for speed, no more loop + +profiler report PROFILE-SCANNER2 +timestamps +729.074.860 888.655.053 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6291846 692377419 (etc) +1 23361 23467 247516 29334001 [SCANNER-ALPHANUM] +2 23756 23911 66366 7058792 [SCANNER-IDENTIFIER] +3 23915 24490 130216 14205404 [SCANNER-OPERATOR] +4 24494 24734 27320 3496614 [SCANNER-NUMBER] +5 24738 25252 237738 26103783 [SCANNER-CHAR/STRING] +6 25256 25415 150400 15854807 [SCANNER-NEXTWORD] +7 25419 25565 43874 5192172 [SCANNER-COMMENT] +8 25569 25905 844379 95076546 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-03-28-1948-oper.profile b/tests/e2e/profile-register/scanner2-2021-03-28-1948-oper.profile new file mode 100644 index 0000000..882458d --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-03-28-1948-oper.profile @@ -0,0 +1,19 @@ +2021-03-28T19:48:20+02:00 +operator optimized for speed, too, after operator? + +profiler report PROFILE-SCANNER2 +timestamps +725.077.164 884.722.893 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6294398 692597293 (etc) +1 23361 23467 247516 29374038 [SCANNER-ALPHANUM] +2 23756 23911 66366 7035251 [SCANNER-IDENTIFIER] +3 23915 24499 93760 10011918 [SCANNER-OPERATOR] +4 24503 24743 27320 3483433 [SCANNER-NUMBER] +5 24747 25261 237738 26075738 [SCANNER-CHAR/STRING] +6 25265 25424 150400 15872668 [SCANNER-NEXTWORD] +7 25428 25574 43874 5198813 [SCANNER-COMMENT] +8 25578 25905 844379 95104859 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-03-28-2144-nextword.profile b/tests/e2e/profile-register/scanner2-2021-03-28-2144-nextword.profile new file mode 100644 index 0000000..3ce8da1 --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-03-28-2144-nextword.profile @@ -0,0 +1,19 @@ +2021-03-28T21:44:31+02:00 +more detailed profiles of scanner exposing usage of nextword + +profiler report PROFILE-SCANNER2 +timestamps +725.077.164 884.395.213 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7139573 787437159 (etc) +1 23361 23467 247516 29351494 [SCANNER-ALPHANUM] +2 23756 23911 66366 7054191 [SCANNER-IDENTIFIER] +3 23915 24499 93760 10007451 [SCANNER-OPERATOR] +4 24503 24743 27320 3477329 [SCANNER-NUMBER] +5 24747 25261 237738 26067862 [SCANNER-CHAR/STRING] +6 25265 25425 150400 15867833 [SCANNER-(NEXTWORD] +7 25429 25575 43874 5194667 [SCANNER-COMMENT] +8 25895 26113 20 2233 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-04-03-2337-thisword.profile b/tests/e2e/profile-register/scanner2-2021-04-03-2337-thisword.profile new file mode 100644 index 0000000..ac1474e --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-04-03-2337-thisword.profile @@ -0,0 +1,19 @@ +2021-04-03T23:37:17+02:00 +nextword/backword replaced by thisword/accept + +profiler report PROFILE-SCANNER2 +timestamps +635.620.524 795.004.109 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6348189 698027776 (etc) +1 23361 23467 247524 29372800 [SCANNER-ALPHANUM] +2 23756 23911 66366 7044998 [SCANNER-IDENTIFIER] +3 23915 24499 93760 10006165 [SCANNER-OPERATOR] +4 24503 24743 27320 3484340 [SCANNER-NUMBER] +5 24747 25261 237738 26065845 [SCANNER-CHAR/STRING] +6 25265 25425 150422 15870590 [SCANNER-(NEXTWORD] +7 25429 25575 43885 5195541 [SCANNER-COMMENT] +8 25848 26062 14 1897 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-04-04-0011-parser.profile b/tests/e2e/profile-register/scanner2-2021-04-04-0011-parser.profile new file mode 100644 index 0000000..4c4fbde --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-04-04-0011-parser.profile @@ -0,0 +1,19 @@ +2021-04-04T00:11:31+02:00 +smaller parser code, common snippets extracted, case? replaced by tables + +profiler report PROFILE-SCANNER2 +timestamps +639.880.620 799.657.164 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6387624 702592982 (etc) +1 23093 23199 247524 29352218 [SCANNER-ALPHANUM] +2 23488 23643 66366 7048216 [SCANNER-IDENTIFIER] +3 23647 24231 93760 10001112 [SCANNER-OPERATOR] +4 24235 24475 27320 3490233 [SCANNER-NUMBER] +5 24479 24992 237738 26069586 [SCANNER-CHAR/STRING] +6 24996 25156 150422 15868836 [SCANNER-(NEXTWORD] +7 25160 25306 43885 5187677 [SCANNER-COMMENT] +8 25579 25793 14 1551 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-04-04-0015-compound.profile b/tests/e2e/profile-register/scanner2-2021-04-04-0015-compound.profile new file mode 100644 index 0000000..e4ba8c4 --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-04-04-0015-compound.profile @@ -0,0 +1,19 @@ +2021-04-04T00:15:14+02:00 +same compacted parser code, but with extra compound test in test suite + +profiler report PROFILE-SCANNER2 +timestamps +645.057.964 806.079.692 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6439068 708199980 (etc) +1 23093 23199 249734 29608769 [SCANNER-ALPHANUM] +2 23488 23643 66969 7116341 [SCANNER-IDENTIFIER] +3 23647 24231 94351 10056614 [SCANNER-OPERATOR] +4 24235 24475 27320 3490986 [SCANNER-NUMBER] +5 24479 24992 240309 26349198 [SCANNER-CHAR/STRING] +6 24996 25156 151636 15992366 [SCANNER-(NEXTWORD] +7 25160 25306 44171 5220390 [SCANNER-COMMENT] +8 25579 25793 14 1551 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-04-16-0131-strings.profile b/tests/e2e/profile-register/scanner2-2021-04-16-0131-strings.profile new file mode 100644 index 0000000..97c4702 --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-04-16-0131-strings.profile @@ -0,0 +1,19 @@ +2021-04-16T01:31:47+02:00 +strcmp/spy/cat and alpha/num/alphanum moved to strings.fth + +profiler report PROFILE-SCANNER2 +timestamps +644.861.100 805.817.804 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6634638 731951815 (etc) +1 23175 23220 54266 5723691 [SCANNER-ALPHANUM] +2 23510 23665 66969 7104316 [SCANNER-IDENTIFIER] +3 23669 24254 94351 10055535 [SCANNER-OPERATOR] +4 24258 24498 27320 3476829 [SCANNER-NUMBER] +5 24502 25015 240309 26307133 [SCANNER-CHAR/STRING] +6 25019 25179 151636 16038155 [SCANNER-(NEXTWORD] +7 25183 25329 44171 5222754 [SCANNER-COMMENT] +8 25602 25816 14 1551 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-04-17-0112-alphanum.profile b/tests/e2e/profile-register/scanner2-2021-04-17-0112-alphanum.profile new file mode 100644 index 0000000..efcbd5f --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-04-17-0112-alphanum.profile @@ -0,0 +1,19 @@ +2021-04-17T01:12:41+02:00 +alpha? num? alphanum? ported to assembly + +profiler report PROFILE-SCANNER2 +timestamps +621.333.676 781.897.164 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6439170 707828080 (etc) +1 23187 23232 54266 5727810 [SCANNER-ALPHANUM] +2 23521 23676 66969 7227164 [SCANNER-IDENTIFIER] +3 23680 24264 94351 10070169 [SCANNER-OPERATOR] +4 24268 24508 27320 3489144 [SCANNER-NUMBER] +5 24512 25025 240309 26351319 [SCANNER-CHAR/STRING] +6 25029 25189 151636 16029215 [SCANNER-(NEXTWORD] +7 25193 25339 44171 5224767 [SCANNER-COMMENT] +8 25612 25826 14 1551 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-04-23-1012-findstr2.profile b/tests/e2e/profile-register/scanner2-2021-04-23-1012-findstr2.profile new file mode 100644 index 0000000..acea513 --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-04-23-1012-findstr2.profile @@ -0,0 +1,19 @@ +2021-04-23T10:12:41+02:00 +string-length indexed string search in string tabs. + +profiler report PROFILE-SCANNER2 +timestamps +580.177.068 741.068.236 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6063633 666944637 (etc) +1 23301 23346 54266 5733514 [SCANNER-ALPHANUM] +2 23671 23826 66969 7230785 [SCANNER-IDENTIFIER] +3 23830 24414 94351 10075131 [SCANNER-OPERATOR] +4 24418 24658 27320 3484720 [SCANNER-NUMBER] +5 24662 25175 240309 26420393 [SCANNER-CHAR/STRING] +6 25179 25339 151636 16026576 [SCANNER-(NEXTWORD] +7 25343 25489 44171 5222886 [SCANNER-COMMENT] +8 25762 25976 14 1593 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-04-23-2148-countstamps.profile b/tests/e2e/profile-register/scanner2-2021-04-23-2148-countstamps.profile new file mode 100644 index 0000000..a5e5c6e --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-04-23-2148-countstamps.profile @@ -0,0 +1,21 @@ +2021-04-23T21:48:00+02:00 +added deterministic countstamps. fixed timestamps low word random bug + +profiler report PROFILE-SCANNER2 +timestamps +579.999.656 740.837.617 +countstamps +5.290.027 6.743.516 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6064480 666575373 (etc) +1 23605 23650 54266 5737381 [SCANNER-ALPHANUM] +2 23976 24131 66969 7264370 [SCANNER-IDENTIFIER] +3 24135 24720 94351 10067124 [SCANNER-OPERATOR] +4 24724 24964 27320 3471712 [SCANNER-NUMBER] +5 24968 25481 240309 26414713 [SCANNER-CHAR/STRING] +6 25485 25645 151636 16069120 [SCANNER-(NEXTWORD] +7 25649 25795 44171 5236194 [SCANNER-COMMENT] +8 26068 26282 14 1508 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner2-2021-04-25-1623-stringarray.profile b/tests/e2e/profile-register/scanner2-2021-04-25-1623-stringarray.profile new file mode 100644 index 0000000..40c0ffd --- /dev/null +++ b/tests/e2e/profile-register/scanner2-2021-04-25-1623-stringarray.profile @@ -0,0 +1,21 @@ +2021-04-25T16:23:23+02:00 +stringtab switched from linked list to array. length index formalized. + +profiler report PROFILE-SCANNER2 +timestamps +579.930.574 740.943.092 +countstamps +5.291.411 6.744.798 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6065762 666815132 (etc) +1 23593 23638 54266 5726575 [SCANNER-ALPHANUM] +2 23941 24096 66969 7200667 [SCANNER-IDENTIFIER] +3 24100 24680 94351 10065769 [SCANNER-OPERATOR] +4 24684 24924 27320 3483379 [SCANNER-NUMBER] +5 24928 25441 240309 26375943 [SCANNER-CHAR/STRING] +6 25445 25605 151636 16053170 [SCANNER-(NEXTWORD] +7 25609 25755 44171 5220784 [SCANNER-COMMENT] +8 26028 26242 14 1551 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner3-2021-03-28-2144-nextword.profile b/tests/e2e/profile-register/scanner3-2021-03-28-2144-nextword.profile new file mode 100644 index 0000000..633fc5a --- /dev/null +++ b/tests/e2e/profile-register/scanner3-2021-03-28-2144-nextword.profile @@ -0,0 +1,19 @@ +2021-03-28T21:44:31+02:00 +more detailed profiles of scanner exposing usage of nextword + +profiler report PROFILE-SCANNER3 +timestamps +725.011.628 884.395.213 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6322534 695897987 (etc) +1 23361 23467 247516 29341777 [SCANNER-ALPHANUM] +2 23756 23911 66366 7045787 [SCANNER-IDENTIFIER] +3 23915 24499 93760 9996178 [SCANNER-OPERATOR] +4 24747 25261 237738 26092982 [SCANNER-CHAR/STRING] +5 25265 25425 150400 15872100 [SCANNER-(NEXTWORD] +6 25429 25575 43874 5190433 [SCANNER-COMMENT] +7 25579 25891 844359 95006489 [SCANNER-NEXTWORD] +8 25895 26113 20 2405 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner3-2021-04-03-2337-thisword.profile b/tests/e2e/profile-register/scanner3-2021-04-03-2337-thisword.profile new file mode 100644 index 0000000..91a6805 --- /dev/null +++ b/tests/e2e/profile-register/scanner3-2021-04-03-2337-thisword.profile @@ -0,0 +1,19 @@ +2021-04-03T23:37:17+02:00 +nextword/backword replaced by thisword/accept + +profiler report PROFILE-SCANNER3 +timestamps +635.489.452 794.873.037 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6225621 685133179 (etc) +1 23361 23467 247524 29335672 [SCANNER-ALPHANUM] +2 23756 23911 66366 7032118 [SCANNER-IDENTIFIER] +3 23915 24499 93760 9997433 [SCANNER-OPERATOR] +4 24747 25261 237738 26098202 [SCANNER-CHAR/STRING] +5 25265 25425 150422 15861717 [SCANNER-(NEXTWORD] +6 25429 25575 43885 5193847 [SCANNER-COMMENT] +7 25579 25844 149888 16295019 [SCANNER-NEXTWORD] +8 25848 26062 14 1679 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner3-2021-04-04-0011-parser.profile b/tests/e2e/profile-register/scanner3-2021-04-04-0011-parser.profile new file mode 100644 index 0000000..89089e9 --- /dev/null +++ b/tests/e2e/profile-register/scanner3-2021-04-04-0011-parser.profile @@ -0,0 +1,19 @@ +2021-04-04T00:11:31+02:00 +smaller parser code, common snippets extracted, case? replaced by tables + +profiler report PROFILE-SCANNER3 +timestamps +640.011.692 799.722.700 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6265056 689853324 (etc) +1 23093 23199 247524 29367527 [SCANNER-ALPHANUM] +2 23488 23643 66366 7062563 [SCANNER-IDENTIFIER] +3 23647 24231 93760 10014730 [SCANNER-OPERATOR] +4 24479 24992 237738 26067131 [SCANNER-CHAR/STRING] +5 24996 25156 150422 15856893 [SCANNER-(NEXTWORD] +6 25160 25306 43885 5188368 [SCANNER-COMMENT] +7 25310 25575 149888 16283567 [SCANNER-NEXTWORD] +8 25579 25793 14 1680 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner3-2021-04-04-0015-compound.profile b/tests/e2e/profile-register/scanner3-2021-04-04-0015-compound.profile new file mode 100644 index 0000000..23bce9d --- /dev/null +++ b/tests/e2e/profile-register/scanner3-2021-04-04-0015-compound.profile @@ -0,0 +1,19 @@ +2021-04-04T00:15:14+02:00 +same compacted parser code, but with extra compound test in test suite + +profiler report PROFILE-SCANNER3 +timestamps +645.057.964 806.079.692 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6315386 695272669 (etc) +1 23093 23199 249734 29616808 [SCANNER-ALPHANUM] +2 23488 23643 66969 7122265 [SCANNER-IDENTIFIER] +3 23647 24231 94351 10077046 [SCANNER-OPERATOR] +4 24479 24992 240309 26378733 [SCANNER-CHAR/STRING] +5 24996 25156 151636 15987130 [SCANNER-(NEXTWORD] +6 25160 25306 44171 5220870 [SCANNER-COMMENT] +7 25310 25575 151002 16401194 [SCANNER-NEXTWORD] +8 25579 25793 14 1637 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner3-2021-04-16-0131-strings.profile b/tests/e2e/profile-register/scanner3-2021-04-16-0131-strings.profile new file mode 100644 index 0000000..6ddc698 --- /dev/null +++ b/tests/e2e/profile-register/scanner3-2021-04-16-0131-strings.profile @@ -0,0 +1,19 @@ +2021-04-16T01:31:47+02:00 +strcmp/spy/cat and alpha/num/alphanum moved to strings.fth + +profiler report PROFILE-SCANNER3 +timestamps +644.861.100 805.817.804 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6510956 718981003 (etc) +1 23175 23220 54266 5725444 [SCANNER-ALPHANUM] +2 23510 23665 66969 7105778 [SCANNER-IDENTIFIER] +3 23669 24254 94351 10069234 [SCANNER-OPERATOR] +4 24502 25015 240309 26298438 [SCANNER-CHAR/STRING] +5 25019 25179 151636 16025784 [SCANNER-(NEXTWORD] +6 25183 25329 44171 5223322 [SCANNER-COMMENT] +7 25333 25598 151002 16403397 [SCANNER-NEXTWORD] +8 25602 25816 14 1680 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner3-2021-04-17-0112-alphanum.profile b/tests/e2e/profile-register/scanner3-2021-04-17-0112-alphanum.profile new file mode 100644 index 0000000..067344e --- /dev/null +++ b/tests/e2e/profile-register/scanner3-2021-04-17-0112-alphanum.profile @@ -0,0 +1,19 @@ +2021-04-17T01:12:41+02:00 +alpha? num? alphanum? ported to assembly + +profiler report PROFILE-SCANNER3 +timestamps +621.333.676 781.897.164 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6315488 694901193 (etc) +1 23187 23232 54266 5732275 [SCANNER-ALPHANUM] +2 23521 23676 66969 7210038 [SCANNER-IDENTIFIER] +3 23680 24264 94351 10072662 [SCANNER-OPERATOR] +4 24512 25025 240309 26347195 [SCANNER-CHAR/STRING] +5 25029 25189 151636 16028905 [SCANNER-(NEXTWORD] +6 25193 25339 44171 5230705 [SCANNER-COMMENT] +7 25343 25608 151002 16411159 [SCANNER-NEXTWORD] +8 25612 25826 14 1723 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner3-2021-04-23-1012-findstr2.profile b/tests/e2e/profile-register/scanner3-2021-04-23-1012-findstr2.profile new file mode 100644 index 0000000..b167af4 --- /dev/null +++ b/tests/e2e/profile-register/scanner3-2021-04-23-1012-findstr2.profile @@ -0,0 +1,19 @@ +2021-04-23T10:12:41+02:00 +string-length indexed string search in string tabs. + +profiler report PROFILE-SCANNER3 +timestamps +580.308.140 741.199.308 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 5939951 654138021 (etc) +1 23301 23346 54266 5732347 [SCANNER-ALPHANUM] +2 23671 23826 66969 7216960 [SCANNER-IDENTIFIER] +3 23830 24414 94351 10064995 [SCANNER-OPERATOR] +4 24662 25175 240309 26394811 [SCANNER-CHAR/STRING] +5 25179 25339 151636 16040259 [SCANNER-(NEXTWORD] +6 25343 25489 44171 5216070 [SCANNER-COMMENT] +7 25493 25758 151002 16435092 [SCANNER-NEXTWORD] +8 25762 25976 14 1550 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner3-2021-04-23-2148-countstamps.profile b/tests/e2e/profile-register/scanner3-2021-04-23-2148-countstamps.profile new file mode 100644 index 0000000..05394ba --- /dev/null +++ b/tests/e2e/profile-register/scanner3-2021-04-23-2148-countstamps.profile @@ -0,0 +1,21 @@ +2021-04-23T21:48:00+02:00 +added deterministic countstamps. fixed timestamps low word random bug + +profiler report PROFILE-SCANNER3 +timestamps +580.067.407 740.896.170 +countstamps +5.290.027 6.743.516 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 5940798 653712513 (etc) +1 23605 23650 54266 5722063 [SCANNER-ALPHANUM] +2 23976 24131 66969 7266538 [SCANNER-IDENTIFIER] +3 24135 24720 94351 10069873 [SCANNER-OPERATOR] +4 24968 25481 240309 26389396 [SCANNER-CHAR/STRING] +5 25485 25645 151636 16066251 [SCANNER-(NEXTWORD] +6 25649 25795 44171 5230882 [SCANNER-COMMENT] +7 25799 26064 151002 16436938 [SCANNER-NEXTWORD] +8 26068 26282 14 1637 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/scanner3-2021-04-25-1623-stringarray.profile b/tests/e2e/profile-register/scanner3-2021-04-25-1623-stringarray.profile new file mode 100644 index 0000000..0e3bd90 --- /dev/null +++ b/tests/e2e/profile-register/scanner3-2021-04-25-1623-stringarray.profile @@ -0,0 +1,21 @@ +2021-04-25T16:23:23+02:00 +stringtab switched from linked list to array. length index formalized. + +profiler report PROFILE-SCANNER3 +timestamps +579.960.678 741.006.321 +countstamps +5.291.411 6.744.798 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 5942080 653937471 (etc) +1 23593 23638 54266 5739682 [SCANNER-ALPHANUM] +2 23941 24096 66969 7214216 [SCANNER-IDENTIFIER] +3 24100 24680 94351 10077598 [SCANNER-OPERATOR] +4 24928 25441 240309 26381021 [SCANNER-CHAR/STRING] +5 25445 25605 151636 16043648 [SCANNER-(NEXTWORD] +6 25609 25755 44171 5234848 [SCANNER-COMMENT] +7 25759 26024 151002 16376079 [SCANNER-NEXTWORD] +8 26028 26242 14 1636 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-03-26-2120-orig-list.profile b/tests/e2e/profile-register/suite-2021-03-26-2120-orig-list.profile new file mode 100644 index 0000000..3ac93b8 --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-03-26-2120-orig-list.profile @@ -0,0 +1,53 @@ +2021-03-26T21:20:39+01:00 +Original version with src list during compile + +profiler report PROFILE-CC64-1 +timestamps +919.522.732 1.078.906.060 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 475419 52822277 (etc) +1 19318 21455 1037243 114416784 [MEMMAN-ETC] +2 21459 22678 1384162 153154008 [FILE-HANDLING] +3 22682 23339 797224 122822197 [INPUT] +4 23343 25749 2695157 299076306 [SCANNER] +5 25753 27129 153639 17403250 [SYMTAB] +6 27133 35110 1826434 197679185 [PARSER] +7 35114 36672 1100491 121509788 [PASS2] +8 36815 37565 0 0 [SHELL] + + +profiler report PROFILE-SCANNER1 +timestamps +920.243.628 1.079.561.420 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 7618991 875514859 (etc) +1 23363 23469 247516 29344925 [SCANNER-ALPHANUM] +2 23473 23754 2331 234777 [SCANNER-KEYWORD] +3 23758 23913 66366 7035253 [SCANNER-IDENTIFIER] +4 23917 24334 1075233 116817276 [SCANNER-OPERATOR] +5 24338 24578 27320 3487023 [SCANNER-NUMBER] +6 24582 25095 237738 26088943 [SCANNER-CHAR/STRING] +7 25099 25258 150400 15854402 [SCANNER-NEXTWORD] +8 25262 25408 43874 5185639 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +920.112.556 1.079.495.884 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 6776943 780683319 (etc) +1 23363 23469 247516 29294112 [SCANNER-ALPHANUM] +2 23758 23913 66366 7047299 [SCANNER-IDENTIFIER] +3 23917 24334 1075233 116795039 [SCANNER-OPERATOR] +4 24338 24578 27320 3487877 [SCANNER-NUMBER] +5 24582 25095 237738 26069639 [SCANNER-CHAR/STRING] +6 25099 25258 150400 15856910 [SCANNER-NEXTWORD] +7 25262 25408 43874 5184709 [SCANNER-COMMENT] +8 25412 25749 844379 95087655 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-03-26-2131-orig-nolist.profile b/tests/e2e/profile-register/suite-2021-03-26-2131-orig-nolist.profile new file mode 100644 index 0000000..f1889f7 --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-03-26-2131-orig-nolist.profile @@ -0,0 +1,53 @@ +2021-03-26T21:31:18+01:00 +Original version without src list during compile + +profiler report PROFILE-CC64-1 +timestamps +830.786.988 989.908.172 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 475419 52854657 (etc) +1 19318 21455 1035458 114210370 [MEMMAN-ETC] +2 21459 22678 1384162 153117590 [FILE-HANDLING] +3 22682 23339 313708 34373231 [INPUT] +4 23343 25749 2695157 299094501 [SCANNER] +5 25753 27129 153639 17396511 [SYMTAB] +6 27133 35110 1826434 197594285 [PARSER] +7 35114 36672 1100491 121235385 [PASS2] +8 36815 37565 0 0 [SHELL] + + +profiler report PROFILE-SCANNER1 +timestamps +831.049.132 990.432.460 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 7133690 786419989 (etc) +1 23363 23469 247516 29307096 [SCANNER-ALPHANUM] +2 23473 23754 2331 235295 [SCANNER-KEYWORD] +3 23758 23913 66366 7041541 [SCANNER-IDENTIFIER] +4 23917 24334 1075233 116806593 [SCANNER-OPERATOR] +5 24338 24578 27320 3492260 [SCANNER-NUMBER] +6 24582 25095 237738 26065758 [SCANNER-CHAR/STRING] +7 25099 25258 150400 15852898 [SCANNER-NEXTWORD] +8 25262 25408 43874 5184366 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +831.180.204 990.563.532 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15887 65535 6291642 691659740 (etc) +1 23363 23469 247516 29308255 [SCANNER-ALPHANUM] +2 23758 23913 66366 7040651 [SCANNER-IDENTIFIER] +3 23917 24334 1075233 116814924 [SCANNER-OPERATOR] +4 24338 24578 27320 3487498 [SCANNER-NUMBER] +5 24582 25095 237738 26065205 [SCANNER-CHAR/STRING] +6 25099 25258 150400 15851841 [SCANNER-NEXTWORD] +7 25262 25408 43874 5189985 [SCANNER-COMMENT] +8 25412 25749 844379 95121698 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-03-28-0110-operq.profile b/tests/e2e/profile-register/suite-2021-03-28-0110-operq.profile new file mode 100644 index 0000000..c43954e --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-03-28-0110-operq.profile @@ -0,0 +1,53 @@ +2021-03-28T01:10:29+01:00 +operator? in scanner optimized for speed, no more loop + +profiler report PROFILE-CC64-1 +timestamps +728.681.644 887.934.157 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 475431 52874525 (etc) +1 19316 21453 1035478 114299050 [MEMMAN-ETC] +2 21457 22676 1384214 153217916 [FILE-HANDLING] +3 22680 23337 313708 34400869 [INPUT] +4 23341 25905 1750140 196516875 [SCANNER] +5 25909 27285 153639 17400568 [SYMTAB] +6 27289 35263 1826434 197743285 [PARSER] +7 35267 36825 1100611 121544654 [PASS2] +8 36968 37719 0 0 [SHELL] + + +profiler report PROFILE-SCANNER1 +timestamps +728.878.252 888.458.445 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7133894 787089569 (etc) +1 23361 23467 247516 29358035 [SCANNER-ALPHANUM] +2 23471 23752 2331 234212 [SCANNER-KEYWORD] +3 23756 23911 66366 7039409 [SCANNER-IDENTIFIER] +4 23915 24490 130216 14189317 [SCANNER-OPERATOR] +5 24494 24734 27320 3491442 [SCANNER-NUMBER] +6 24738 25252 237738 26062387 [SCANNER-CHAR/STRING] +7 25256 25415 150400 15879314 [SCANNER-NEXTWORD] +8 25419 25565 43874 5182983 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +729.074.860 888.655.053 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6291846 692377419 (etc) +1 23361 23467 247516 29334001 [SCANNER-ALPHANUM] +2 23756 23911 66366 7058792 [SCANNER-IDENTIFIER] +3 23915 24490 130216 14205404 [SCANNER-OPERATOR] +4 24494 24734 27320 3496614 [SCANNER-NUMBER] +5 24738 25252 237738 26103783 [SCANNER-CHAR/STRING] +6 25256 25415 150400 15854807 [SCANNER-NEXTWORD] +7 25419 25565 43874 5192172 [SCANNER-COMMENT] +8 25569 25905 844379 95076546 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-03-28-1948-oper.profile b/tests/e2e/profile-register/suite-2021-03-28-1948-oper.profile new file mode 100644 index 0000000..06c2523 --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-03-28-1948-oper.profile @@ -0,0 +1,53 @@ +2021-03-28T19:48:20+02:00 +operator optimized for speed, too, after operator? + +profiler report PROFILE-CC64-1 +timestamps +724.749.484 884.001.997 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 475431 52856950 (etc) +1 19316 21453 1038030 114537078 [MEMMAN-ETC] +2 21457 22676 1384214 153200867 [FILE-HANDLING] +3 22680 23337 313708 34374813 [INPUT] +4 23341 25905 1713684 192370861 [SCANNER] +5 25909 27285 153639 17406319 [SYMTAB] +6 27289 35263 1826434 197768726 [PARSER] +7 35267 36825 1100611 121532616 [PASS2] +8 36968 37719 0 0 [SHELL] + + +profiler report PROFILE-SCANNER1 +timestamps +725.011.628 884.591.821 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7136446 787316895 (etc) +1 23361 23467 247516 29364175 [SCANNER-ALPHANUM] +2 23471 23752 2331 234640 [SCANNER-KEYWORD] +3 23756 23911 66366 7050685 [SCANNER-IDENTIFIER] +4 23915 24499 93760 10025392 [SCANNER-OPERATOR] +5 24503 24743 27320 3491184 [SCANNER-NUMBER] +6 24747 25261 237738 26107841 [SCANNER-CHAR/STRING] +7 25265 25424 150400 15860971 [SCANNER-NEXTWORD] +8 25428 25574 43874 5209751 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +725.077.164 884.722.893 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6294398 692597293 (etc) +1 23361 23467 247516 29374038 [SCANNER-ALPHANUM] +2 23756 23911 66366 7035251 [SCANNER-IDENTIFIER] +3 23915 24499 93760 10011918 [SCANNER-OPERATOR] +4 24503 24743 27320 3483433 [SCANNER-NUMBER] +5 24747 25261 237738 26075738 [SCANNER-CHAR/STRING] +6 25265 25424 150400 15872668 [SCANNER-NEXTWORD] +7 25428 25574 43874 5198813 [SCANNER-COMMENT] +8 25578 25905 844379 95104859 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-03-28-2144-nextword.profile b/tests/e2e/profile-register/suite-2021-03-28-2144-nextword.profile new file mode 100644 index 0000000..ea76a2c --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-03-28-2144-nextword.profile @@ -0,0 +1,87 @@ +2021-03-28T21:44:31+02:00 +more detailed profiles of scanner exposing usage of nextword + +profiler report PROFILE-CC64-1 +timestamps +724.815.020 883.936.461 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 475479 52862071 (etc) +1 19316 21453 1038110 114573443 [MEMMAN-ETC] +2 21457 22676 1384422 153186858 [FILE-HANDLING] +3 22680 23337 313708 34349430 [INPUT] +4 23341 26113 1713684 192260377 [SCANNER] +5 26117 27493 153639 17412410 [SYMTAB] +6 27497 35472 1826434 198032869 [PARSER] +7 35476 37034 1101091 121328995 [PASS2] +8 37177 37927 0 0 [SHELL] + + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +725.142.700 884.460.749 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7162208 789492144 (etc) +1 25608 25652 0 0 [SCANNER-NEXTWORD-VARS] +2 25656 25738 476000 53392834 [SCANNER-NEXTWORD-CORE] +3 25742 25798 344610 39090310 [SCANNER-NEXTWORD-BACKWORD] +4 25802 25840 6477 716030 [SCANNER-NEXTWORD-MARK] +5 25844 25891 17272 1817512 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + + +profiler report PROFILE-SCANNER1 +timestamps +725.011.628 884.395.213 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7137262 787217837 (etc) +1 23361 23467 247516 29351452 [SCANNER-ALPHANUM] +2 23471 23752 2331 230714 [SCANNER-KEYWORD] +3 23756 23911 66366 7033670 [SCANNER-IDENTIFIER] +4 23915 24499 93760 10010089 [SCANNER-OPERATOR] +5 24503 24743 27320 3490370 [SCANNER-NUMBER] +6 24747 25261 237738 26062064 [SCANNER-CHAR/STRING] +7 25265 25425 150400 15865910 [SCANNER-(NEXTWORD] +8 25429 25575 43874 5190840 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +725.077.164 884.395.213 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7139573 787437159 (etc) +1 23361 23467 247516 29351494 [SCANNER-ALPHANUM] +2 23756 23911 66366 7054191 [SCANNER-IDENTIFIER] +3 23915 24499 93760 10007451 [SCANNER-OPERATOR] +4 24503 24743 27320 3477329 [SCANNER-NUMBER] +5 24747 25261 237738 26067862 [SCANNER-CHAR/STRING] +6 25265 25425 150400 15867833 [SCANNER-(NEXTWORD] +7 25429 25575 43874 5194667 [SCANNER-COMMENT] +8 25895 26113 20 2233 [SCANNER-REST] + + +profiler report PROFILE-SCANNER3 +timestamps +725.011.628 884.395.213 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6322534 695897987 (etc) +1 23361 23467 247516 29341777 [SCANNER-ALPHANUM] +2 23756 23911 66366 7045787 [SCANNER-IDENTIFIER] +3 23915 24499 93760 9996178 [SCANNER-OPERATOR] +4 24747 25261 237738 26092982 [SCANNER-CHAR/STRING] +5 25265 25425 150400 15872100 [SCANNER-(NEXTWORD] +6 25429 25575 43874 5190433 [SCANNER-COMMENT] +7 25579 25891 844359 95006489 [SCANNER-NEXTWORD] +8 25895 26113 20 2405 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-04-03-2337-thisword.profile b/tests/e2e/profile-register/suite-2021-04-03-2337-thisword.profile new file mode 100644 index 0000000..ffb3fbf --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-04-03-2337-thisword.profile @@ -0,0 +1,87 @@ +2021-04-03T23:37:17+02:00 +nextword/backword replaced by thisword/accept + +profiler report PROFILE-CC64-1 +timestamps +635.227.308 794.348.749 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 497891 55192602 (etc) +1 19316 21453 939654 103578004 [MEMMAN-ETC] +2 21457 22676 1384422 153259960 [FILE-HANDLING] +3 22680 23337 313716 34378460 [INPUT] +4 23341 26062 1019251 113532446 [SCANNER] +5 26066 27442 153639 17411979 [SYMTAB] +6 27446 35465 1805554 195706591 [PARSER] +7 35469 37027 1101091 121325306 [PASS2] +8 37170 37920 0 0 [SHELL] + + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +635.423.916 794.807.501 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7065330 778562120 (etc) +1 25608 25648 0 0 [SCANNER-NEXTWORD-VARS] +2 25652 25714 41092 4523890 [SCANNER-FETCHWORD] +3 25718 25751 85047 9205894 [SCANNER-THISWORD] +4 25755 25793 6477 711890 [SCANNER-NEXTWORD-MARK] +5 25797 25844 17272 1824100 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + + +profiler report PROFILE-SCANNER1 +timestamps +635.423.916 794.741.965 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6345869 697567146 (etc) +1 23361 23467 247524 29349827 [SCANNER-ALPHANUM] +2 23471 23752 2334 236122 [SCANNER-KEYWORD] +3 23756 23911 66366 7038192 [SCANNER-IDENTIFIER] +4 23915 24499 93760 9999244 [SCANNER-OPERATOR] +5 24503 24743 27320 3484075 [SCANNER-NUMBER] +6 24747 25261 237738 26069501 [SCANNER-CHAR/STRING] +7 25265 25425 150422 15885237 [SCANNER-(NEXTWORD] +8 25429 25575 43885 5177003 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +635.620.524 795.004.109 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6348189 698027776 (etc) +1 23361 23467 247524 29372800 [SCANNER-ALPHANUM] +2 23756 23911 66366 7044998 [SCANNER-IDENTIFIER] +3 23915 24499 93760 10006165 [SCANNER-OPERATOR] +4 24503 24743 27320 3484340 [SCANNER-NUMBER] +5 24747 25261 237738 26065845 [SCANNER-CHAR/STRING] +6 25265 25425 150422 15870590 [SCANNER-(NEXTWORD] +7 25429 25575 43885 5195541 [SCANNER-COMMENT] +8 25848 26062 14 1897 [SCANNER-REST] + + +profiler report PROFILE-SCANNER3 +timestamps +635.489.452 794.873.037 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6225621 685133179 (etc) +1 23361 23467 247524 29335672 [SCANNER-ALPHANUM] +2 23756 23911 66366 7032118 [SCANNER-IDENTIFIER] +3 23915 24499 93760 9997433 [SCANNER-OPERATOR] +4 24747 25261 237738 26098202 [SCANNER-CHAR/STRING] +5 25265 25425 150422 15861717 [SCANNER-(NEXTWORD] +6 25429 25575 43885 5193847 [SCANNER-COMMENT] +7 25579 25844 149888 16295019 [SCANNER-NEXTWORD] +8 25848 26062 14 1679 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-04-04-0011-parser.profile b/tests/e2e/profile-register/suite-2021-04-04-0011-parser.profile new file mode 100644 index 0000000..7c4f876 --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-04-04-0011-parser.profile @@ -0,0 +1,87 @@ +2021-04-04T00:11:31+02:00 +smaller parser code, common snippets extracted, case? replaced by tables + +profiler report PROFILE-CC64-1 +timestamps +639.684.012 799.132.876 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 497825 55193807 (etc) +1 19047 21184 939544 103535790 [MEMMAN-ETC] +2 21188 22407 1384136 153433132 [FILE-HANDLING] +3 22411 23069 313716 34332998 [INPUT] +4 23073 25793 1019251 113561580 [SCANNER] +5 25797 27173 153639 17404624 [SYMTAB] +6 27177 34979 1846111 200060753 [PARSER] +7 34983 36541 1100431 121572943 [PASS2] +8 36684 37434 0 0 [SHELL] + + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +639.946.156 799.657.164 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7104765 783352437 (etc) +1 25339 25379 0 0 [SCANNER-NEXTWORD-VARS] +2 25383 25445 41092 4539839 [SCANNER-FETCHWORD] +3 25449 25482 85047 9202876 [SCANNER-THISWORD] +4 25486 25524 6477 713775 [SCANNER-NEXTWORD-MARK] +5 25528 25575 17272 1821540 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + + +profiler report PROFILE-SCANNER1 +timestamps +639.880.620 799.526.092 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6385304 702309026 (etc) +1 23093 23199 247524 29343382 [SCANNER-ALPHANUM] +2 23203 23484 2334 235547 [SCANNER-KEYWORD] +3 23488 23643 66366 7056143 [SCANNER-IDENTIFIER] +4 23647 24231 93760 10006119 [SCANNER-OPERATOR] +5 24235 24475 27320 3490842 [SCANNER-NUMBER] +6 24479 24992 237738 26044467 [SCANNER-CHAR/STRING] +7 24996 25156 150422 15846323 [SCANNER-(NEXTWORD] +8 25160 25306 43885 5193126 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +639.880.620 799.657.164 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6387624 702592982 (etc) +1 23093 23199 247524 29352218 [SCANNER-ALPHANUM] +2 23488 23643 66366 7048216 [SCANNER-IDENTIFIER] +3 23647 24231 93760 10001112 [SCANNER-OPERATOR] +4 24235 24475 27320 3490233 [SCANNER-NUMBER] +5 24479 24992 237738 26069586 [SCANNER-CHAR/STRING] +6 24996 25156 150422 15868836 [SCANNER-(NEXTWORD] +7 25160 25306 43885 5187677 [SCANNER-COMMENT] +8 25579 25793 14 1551 [SCANNER-REST] + + +profiler report PROFILE-SCANNER3 +timestamps +640.011.692 799.722.700 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6265056 689853324 (etc) +1 23093 23199 247524 29367527 [SCANNER-ALPHANUM] +2 23488 23643 66366 7062563 [SCANNER-IDENTIFIER] +3 23647 24231 93760 10014730 [SCANNER-OPERATOR] +4 24479 24992 237738 26067131 [SCANNER-CHAR/STRING] +5 24996 25156 150422 15856893 [SCANNER-(NEXTWORD] +6 25160 25306 43885 5188368 [SCANNER-COMMENT] +7 25310 25575 149888 16283567 [SCANNER-NEXTWORD] +8 25579 25793 14 1680 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-04-04-0015-compound.profile b/tests/e2e/profile-register/suite-2021-04-04-0015-compound.profile new file mode 100644 index 0000000..497c701 --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-04-04-0015-compound.profile @@ -0,0 +1,87 @@ +2021-04-04T00:15:14+02:00 +same compacted parser code, but with extra compound test in test suite + +profiler report PROFILE-CC64-1 +timestamps +644.861.356 805.555.404 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 501416 55569437 (etc) +1 19047 21184 947268 104440768 [MEMMAN-ETC] +2 21188 22407 1396439 154831260 [FILE-HANDLING] +3 22411 23069 316896 34682755 [INPUT] +4 23073 25793 1027858 114523479 [SCANNER] +5 25797 27173 155294 17592184 [SYMTAB] +6 27177 34979 1858844 201359581 [PARSER] +7 34983 36541 1109557 122555828 [PASS2] +8 36684 37434 0 0 [SHELL] + + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +645.123.500 806.276.300 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7162570 789862400 (etc) +1 25339 25379 0 0 [SCANNER-NEXTWORD-VARS] +2 25383 25445 41378 4564296 [SCANNER-FETCHWORD] +3 25449 25482 85677 9274954 [SCANNER-THISWORD] +4 25486 25524 6531 716487 [SCANNER-NEXTWORD-MARK] +5 25528 25575 17416 1839717 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + + +profiler report PROFILE-SCANNER1 +timestamps +645.123.500 806.145.228 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6436730 708039370 (etc) +1 23093 23199 249734 29585156 [SCANNER-ALPHANUM] +2 23203 23484 2352 237721 [SCANNER-KEYWORD] +3 23488 23643 66969 7120305 [SCANNER-IDENTIFIER] +4 23647 24231 94351 10073526 [SCANNER-OPERATOR] +5 24235 24475 27320 3493271 [SCANNER-NUMBER] +6 24479 24992 240309 26349162 [SCANNER-CHAR/STRING] +7 24996 25156 151636 16000127 [SCANNER-(NEXTWORD] +8 25160 25306 44171 5233350 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +645.057.964 806.079.692 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6439068 708199980 (etc) +1 23093 23199 249734 29608769 [SCANNER-ALPHANUM] +2 23488 23643 66969 7116341 [SCANNER-IDENTIFIER] +3 23647 24231 94351 10056614 [SCANNER-OPERATOR] +4 24235 24475 27320 3490986 [SCANNER-NUMBER] +5 24479 24992 240309 26349198 [SCANNER-CHAR/STRING] +6 24996 25156 151636 15992366 [SCANNER-(NEXTWORD] +7 25160 25306 44171 5220390 [SCANNER-COMMENT] +8 25579 25793 14 1551 [SCANNER-REST] + + +profiler report PROFILE-SCANNER3 +timestamps +645.057.964 806.079.692 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6315386 695272669 (etc) +1 23093 23199 249734 29616808 [SCANNER-ALPHANUM] +2 23488 23643 66969 7122265 [SCANNER-IDENTIFIER] +3 23647 24231 94351 10077046 [SCANNER-OPERATOR] +4 24479 24992 240309 26378733 [SCANNER-CHAR/STRING] +5 24996 25156 151636 15987130 [SCANNER-(NEXTWORD] +6 25160 25306 44171 5220870 [SCANNER-COMMENT] +7 25310 25575 151002 16401194 [SCANNER-NEXTWORD] +8 25579 25793 14 1637 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-04-16-0131-strings.profile b/tests/e2e/profile-register/suite-2021-04-16-0131-strings.profile new file mode 100644 index 0000000..9c5d1ad --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-04-16-0131-strings.profile @@ -0,0 +1,87 @@ +2021-04-16T01:31:47+02:00 +strcmp/spy/cat and alpha/num/alphanum moved to strings.fth + +profiler report PROFILE-CC64-1 +timestamps +644.730.028 805.359.052 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 216494 22948435 (etc) +1 18921 19116 480396 56645293 [STRINGS] +2 19128 21266 947278 104421341 [MEMMAN-ETC] +3 21270 22490 1396465 154541959 [FILE-HANDLING] +4 22494 23151 316896 34711112 [INPUT] +5 23155 25816 832390 90610649 [SCANNER] +6 25820 27196 155294 17603763 [SYMTAB] +7 27200 35003 1858844 201343115 [PARSER] +8 35007 36565 1109617 122555758 [PASS2] + + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +644.926.636 805.752.268 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 7162672 789423856 (etc) +1 25362 25402 0 0 [SCANNER-NEXTWORD-VARS] +2 25406 25468 41378 4556485 [SCANNER-FETCHWORD] +3 25472 25505 85677 9285933 [SCANNER-THISWORD] +4 25509 25547 6531 718081 [SCANNER-NEXTWORD-MARK] +5 25551 25598 17416 1833785 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + + +profiler report PROFILE-SCANNER1 +timestamps +644.926.636 805.817.804 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6632300 731620342 (etc) +1 23175 23220 54266 5722992 [SCANNER-ALPHANUM] +2 23224 23506 2352 236518 [SCANNER-KEYWORD] +3 23510 23665 66969 7111107 [SCANNER-IDENTIFIER] +4 23669 24254 94351 10063310 [SCANNER-OPERATOR] +5 24258 24498 27320 3485874 [SCANNER-NUMBER] +6 24502 25015 240309 26374868 [SCANNER-CHAR/STRING] +7 25019 25179 151636 16024651 [SCANNER-(NEXTWORD] +8 25183 25329 44171 5224637 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +644.861.100 805.817.804 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6634638 731951815 (etc) +1 23175 23220 54266 5723691 [SCANNER-ALPHANUM] +2 23510 23665 66969 7104316 [SCANNER-IDENTIFIER] +3 23669 24254 94351 10055535 [SCANNER-OPERATOR] +4 24258 24498 27320 3476829 [SCANNER-NUMBER] +5 24502 25015 240309 26307133 [SCANNER-CHAR/STRING] +6 25019 25179 151636 16038155 [SCANNER-(NEXTWORD] +7 25183 25329 44171 5222754 [SCANNER-COMMENT] +8 25602 25816 14 1551 [SCANNER-REST] + + +profiler report PROFILE-SCANNER3 +timestamps +644.861.100 805.817.804 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6510956 718981003 (etc) +1 23175 23220 54266 5725444 [SCANNER-ALPHANUM] +2 23510 23665 66969 7105778 [SCANNER-IDENTIFIER] +3 23669 24254 94351 10069234 [SCANNER-OPERATOR] +4 24502 25015 240309 26298438 [SCANNER-CHAR/STRING] +5 25019 25179 151636 16025784 [SCANNER-(NEXTWORD] +6 25183 25329 44171 5223322 [SCANNER-COMMENT] +7 25333 25598 151002 16403397 [SCANNER-NEXTWORD] +8 25602 25816 14 1680 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-04-17-0112-alphanum.profile b/tests/e2e/profile-register/suite-2021-04-17-0112-alphanum.profile new file mode 100644 index 0000000..6fedf35 --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-04-17-0112-alphanum.profile @@ -0,0 +1,87 @@ +2021-04-17T01:12:41+02:00 +alpha? num? alphanum? ported to assembly + +profiler report PROFILE-CC64-1 +timestamps +621.071.532 781.438.412 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 216494 22931496 (etc) +1 18921 19129 284928 32796137 [STRINGS] +2 19141 21278 947278 104463375 [MEMMAN-ETC] +3 21282 22501 1396465 154563720 [FILE-HANDLING] +4 22505 23163 316896 34718023 [INPUT] +5 23167 25826 832390 90769071 [SCANNER] +6 25830 27206 155294 17584803 [SYMTAB] +7 27210 35013 1858844 201386042 [PARSER] +8 35017 36575 1109617 122256703 [PASS2] + + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +621.268.140 781.766.092 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6967204 765429279 (etc) +1 25372 25412 0 0 [SCANNER-NEXTWORD-VARS] +2 25416 25478 41378 4549285 [SCANNER-FETCHWORD] +3 25482 25515 85677 9291539 [SCANNER-THISWORD] +4 25519 25557 6531 715377 [SCANNER-NEXTWORD-MARK] +5 25561 25608 17416 1853952 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + + +profiler report PROFILE-SCANNER1 +timestamps +621.202.604 781.766.092 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6436832 707492868 (etc) +1 23187 23232 54266 5724423 [SCANNER-ALPHANUM] +2 23236 23517 2352 237456 [SCANNER-KEYWORD] +3 23521 23676 66969 7213777 [SCANNER-IDENTIFIER] +4 23680 24264 94351 10070185 [SCANNER-OPERATOR] +5 24268 24508 27320 3480745 [SCANNER-NUMBER] +6 24512 25025 240309 26368044 [SCANNER-CHAR/STRING] +7 25029 25189 151636 16028241 [SCANNER-(NEXTWORD] +8 25193 25339 44171 5214794 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +621.333.676 781.897.164 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6439170 707828080 (etc) +1 23187 23232 54266 5727810 [SCANNER-ALPHANUM] +2 23521 23676 66969 7227164 [SCANNER-IDENTIFIER] +3 23680 24264 94351 10070169 [SCANNER-OPERATOR] +4 24268 24508 27320 3489144 [SCANNER-NUMBER] +5 24512 25025 240309 26351319 [SCANNER-CHAR/STRING] +6 25029 25189 151636 16029215 [SCANNER-(NEXTWORD] +7 25193 25339 44171 5224767 [SCANNER-COMMENT] +8 25612 25826 14 1551 [SCANNER-REST] + + +profiler report PROFILE-SCANNER3 +timestamps +621.333.676 781.897.164 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6315488 694901193 (etc) +1 23187 23232 54266 5732275 [SCANNER-ALPHANUM] +2 23521 23676 66969 7210038 [SCANNER-IDENTIFIER] +3 23680 24264 94351 10072662 [SCANNER-OPERATOR] +4 24512 25025 240309 26347195 [SCANNER-CHAR/STRING] +5 25029 25189 151636 16028905 [SCANNER-(NEXTWORD] +6 25193 25339 44171 5230705 [SCANNER-COMMENT] +7 25343 25608 151002 16411159 [SCANNER-NEXTWORD] +8 25612 25826 14 1723 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-04-23-1012-findstr2.profile b/tests/e2e/profile-register/suite-2021-04-23-1012-findstr2.profile new file mode 100644 index 0000000..6e0c3b3 --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-04-23-1012-findstr2.profile @@ -0,0 +1,87 @@ +2021-04-23T10:12:41+02:00 +string-length indexed string search in string tabs. + +profiler report PROFILE-CC64-1 +timestamps +579.980.460 740.543.948 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 216506 22950222 (etc) +1 18921 19129 114310 12976436 [STRINGS] +2 19141 21392 742175 83029931 [MEMMAN-ETC] +3 21396 22616 1396517 154575151 [FILE-HANDLING] +4 22620 23277 316896 34740882 [INPUT] +5 23281 25976 832390 90869725 [SCANNER] +6 25980 27372 155294 17623890 [SYMTAB] +7 27376 35180 1858844 201608564 [PARSER] +8 35184 36735 1109737 122235615 [PASS2] + + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +580.242.604 741.133.772 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6591667 724768559 (etc) +1 25522 25562 0 0 [SCANNER-NEXTWORD-VARS] +2 25566 25628 41378 4596294 [SCANNER-FETCHWORD] +3 25632 25665 85677 9294071 [SCANNER-THISWORD] +4 25669 25707 6531 717783 [SCANNER-NEXTWORD-MARK] +5 25711 25758 17416 1833906 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + + +profiler report PROFILE-SCANNER1 +timestamps +580.177.068 741.068.236 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6061295 666704155 (etc) +1 23301 23346 54266 5729865 [SCANNER-ALPHANUM] +2 23350 23667 2352 255274 [SCANNER-KEYWORD] +3 23671 23826 66969 7212879 [SCANNER-IDENTIFIER] +4 23830 24414 94351 10070844 [SCANNER-OPERATOR] +5 24418 24658 27320 3482676 [SCANNER-NUMBER] +6 24662 25175 240309 26404574 [SCANNER-CHAR/STRING] +7 25179 25339 151636 16035538 [SCANNER-(NEXTWORD] +8 25343 25489 44171 5236110 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +580.177.068 741.068.236 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6063633 666944637 (etc) +1 23301 23346 54266 5733514 [SCANNER-ALPHANUM] +2 23671 23826 66969 7230785 [SCANNER-IDENTIFIER] +3 23830 24414 94351 10075131 [SCANNER-OPERATOR] +4 24418 24658 27320 3484720 [SCANNER-NUMBER] +5 24662 25175 240309 26420393 [SCANNER-CHAR/STRING] +6 25179 25339 151636 16026576 [SCANNER-(NEXTWORD] +7 25343 25489 44171 5222886 [SCANNER-COMMENT] +8 25762 25976 14 1593 [SCANNER-REST] + + +profiler report PROFILE-SCANNER3 +timestamps +580.308.140 741.199.308 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 5939951 654138021 (etc) +1 23301 23346 54266 5732347 [SCANNER-ALPHANUM] +2 23671 23826 66969 7216960 [SCANNER-IDENTIFIER] +3 23830 24414 94351 10064995 [SCANNER-OPERATOR] +4 24662 25175 240309 26394811 [SCANNER-CHAR/STRING] +5 25179 25339 151636 16040259 [SCANNER-(NEXTWORD] +6 25343 25489 44171 5216070 [SCANNER-COMMENT] +7 25493 25758 151002 16435092 [SCANNER-NEXTWORD] +8 25762 25976 14 1550 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-04-23-2148-countstamps.profile b/tests/e2e/profile-register/suite-2021-04-23-2148-countstamps.profile new file mode 100644 index 0000000..902ca45 --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-04-23-2148-countstamps.profile @@ -0,0 +1,97 @@ +2021-04-23T21:48:00+02:00 +added deterministic countstamps. fixed timestamps low word random bug + +profiler report PROFILE-CC64-1 +timestamps +579.731.026 740.298.316 +countstamps +5.290.027 6.743.516 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 216585 22962235 (etc) +1 19222 19430 114310 12967362 [STRINGS] +2 19443 21696 742255 82442808 [MEMMAN-ETC] +3 21700 22919 1396725 154817330 [FILE-HANDLING] +4 22923 23581 316896 34709753 [INPUT] +5 23585 26282 832390 90931471 [SCANNER] +6 26286 27678 155294 17579470 [SYMTAB] +7 27682 35485 1858844 201521741 [PARSER] +8 35489 37040 1110217 122366024 [PASS2] + + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +580.019.275 740.844.536 +countstamps +5.290.027 6.743.516 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6592514 724416147 (etc) +1 25828 25868 0 0 [SCANNER-NEXTWORD-VARS] +2 25872 25934 41378 4577552 [SCANNER-FETCHWORD] +3 25938 25971 85677 9296837 [SCANNER-THISWORD] +4 25975 26013 6531 722558 [SCANNER-NEXTWORD-MARK] +5 26017 26064 17416 1831278 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + + +profiler report PROFILE-SCANNER1 +timestamps +580.021.390 740.847.461 +countstamps +5.290.027 6.743.516 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6062142 666297372 (etc) +1 23605 23650 54266 5723234 [SCANNER-ALPHANUM] +2 23654 23972 2352 254626 [SCANNER-KEYWORD] +3 23976 24131 66969 7263907 [SCANNER-IDENTIFIER] +4 24135 24720 94351 10076657 [SCANNER-OPERATOR] +5 24724 24964 27320 3486299 [SCANNER-NUMBER] +6 24968 25481 240309 26428778 [SCANNER-CHAR/STRING] +7 25485 25645 151636 16086836 [SCANNER-(NEXTWORD] +8 25649 25795 44171 5229673 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +579.999.656 740.837.617 +countstamps +5.290.027 6.743.516 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6064480 666575373 (etc) +1 23605 23650 54266 5737381 [SCANNER-ALPHANUM] +2 23976 24131 66969 7264370 [SCANNER-IDENTIFIER] +3 24135 24720 94351 10067124 [SCANNER-OPERATOR] +4 24724 24964 27320 3471712 [SCANNER-NUMBER] +5 24968 25481 240309 26414713 [SCANNER-CHAR/STRING] +6 25485 25645 151636 16069120 [SCANNER-(NEXTWORD] +7 25649 25795 44171 5236194 [SCANNER-COMMENT] +8 26068 26282 14 1508 [SCANNER-REST] + + +profiler report PROFILE-SCANNER3 +timestamps +580.067.407 740.896.170 +countstamps +5.290.027 6.743.516 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 5940798 653712513 (etc) +1 23605 23650 54266 5722063 [SCANNER-ALPHANUM] +2 23976 24131 66969 7266538 [SCANNER-IDENTIFIER] +3 24135 24720 94351 10069873 [SCANNER-OPERATOR] +4 24968 25481 240309 26389396 [SCANNER-CHAR/STRING] +5 25485 25645 151636 16066251 [SCANNER-(NEXTWORD] +6 25649 25795 44171 5230882 [SCANNER-COMMENT] +7 25799 26064 151002 16436938 [SCANNER-NEXTWORD] +8 26068 26282 14 1637 [SCANNER-REST] + diff --git a/tests/e2e/profile-register/suite-2021-04-25-1623-stringarray.profile b/tests/e2e/profile-register/suite-2021-04-25-1623-stringarray.profile new file mode 100644 index 0000000..fb7ed44 --- /dev/null +++ b/tests/e2e/profile-register/suite-2021-04-25-1623-stringarray.profile @@ -0,0 +1,97 @@ +2021-04-25T16:23:23+02:00 +stringtab switched from linked list to array. length index formalized. + +profiler report PROFILE-CC64-1 +timestamps +579.700.575 740.468.880 +countstamps +5.291.411 6.744.798 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 216579 22974429 (etc) +1 19222 19430 114310 12968193 [STRINGS] +2 19443 21684 743629 83032569 [MEMMAN-ETC] +3 21688 22907 1396699 154557722 [FILE-HANDLING] +4 22911 23569 316896 34747986 [INPUT] +5 23573 26242 832390 90765063 [SCANNER] +6 26246 27631 155294 17596849 [SYMTAB] +7 27635 35436 1858844 201523105 [PARSER] +8 35440 36991 1110157 122302842 [PASS2] + + +profiler report PROFILE-SCANNER-NEXTWORD +timestamps +580.005.047 741.008.108 +countstamps +5.291.411 6.744.798 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6593796 724606930 (etc) +1 25788 25828 0 0 [SCANNER-NEXTWORD-VARS] +2 25832 25894 41378 4554536 [SCANNER-FETCHWORD] +3 25898 25931 85677 9290749 [SCANNER-THISWORD] +4 25935 25973 6531 719806 [SCANNER-NEXTWORD-MARK] +5 25977 26024 17416 1835965 [SCANNER-NEXTWORD-ADVANCED?] +6 65535 65535 0 0 +7 65535 65535 0 0 +8 65535 65535 0 0 + + +profiler report PROFILE-SCANNER1 +timestamps +579.863.859 740.904.951 +countstamps +5.291.411 6.744.798 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6063424 666530799 (etc) +1 23593 23638 54266 5736626 [SCANNER-ALPHANUM] +2 23642 23937 2352 254502 [SCANNER-KEYWORD] +3 23941 24096 66969 7213797 [SCANNER-IDENTIFIER] +4 24100 24680 94351 10056313 [SCANNER-OPERATOR] +5 24684 24924 27320 3479557 [SCANNER-NUMBER] +6 24928 25441 240309 26358918 [SCANNER-CHAR/STRING] +7 25445 25605 151636 16050286 [SCANNER-(NEXTWORD] +8 25609 25755 44171 5224074 [SCANNER-COMMENT] + + +profiler report PROFILE-SCANNER2 +timestamps +579.930.574 740.943.092 +countstamps +5.291.411 6.744.798 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 6065762 666815132 (etc) +1 23593 23638 54266 5726575 [SCANNER-ALPHANUM] +2 23941 24096 66969 7200667 [SCANNER-IDENTIFIER] +3 24100 24680 94351 10065769 [SCANNER-OPERATOR] +4 24684 24924 27320 3483379 [SCANNER-NUMBER] +5 24928 25441 240309 26375943 [SCANNER-CHAR/STRING] +6 25445 25605 151636 16053170 [SCANNER-(NEXTWORD] +7 25609 25755 44171 5220784 [SCANNER-COMMENT] +8 26028 26242 14 1551 [SCANNER-REST] + + +profiler report PROFILE-SCANNER3 +timestamps +579.960.678 741.006.321 +countstamps +5.291.411 6.744.798 + +buckets +b# addr[ ]addr nextcounts clockticks name +0 15885 65535 5942080 653937471 (etc) +1 23593 23638 54266 5739682 [SCANNER-ALPHANUM] +2 23941 24096 66969 7214216 [SCANNER-IDENTIFIER] +3 24100 24680 94351 10077598 [SCANNER-OPERATOR] +4 24928 25441 240309 26381021 [SCANNER-CHAR/STRING] +5 25445 25605 151636 16043648 [SCANNER-(NEXTWORD] +6 25609 25755 44171 5234848 [SCANNER-COMMENT] +7 25759 26024 151002 16376079 [SCANNER-NEXTWORD] +8 26028 26242 14 1636 [SCANNER-REST] + diff --git a/tests/e2e/profile-suite.sh b/tests/e2e/profile-suite.sh new file mode 100755 index 0000000..821993f --- /dev/null +++ b/tests/e2e/profile-suite.sh @@ -0,0 +1,49 @@ +#!/bin/bash +set -e + +cc64="$1" +shift +metrics="$@" + +host="c64" + +cd "$(dirname "${BASH_SOURCE[0]}")" + +testdir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" +source "${testdir}/basedir.shlib" +emulatordir="$(realpath --relative-to="$PWD" "${basedir}/emulator")" +hostfiles="${testdir}/${host}files" + +test -d "${hostfiles}" || mkdir "${hostfiles}" + +tests=$(echo *-test.c| sed 's/-test\.c//g') + +# Create suite.c +target="${host}" +source "${testdir}/concat-suite.shlib" + +# Build test binary +rm -f "${hostfiles}/suite" "${hostfiles}/suite.T64" +testname="suite" +rm -f "${hostfiles}/${testname}.log" + +keybuf="" +outfiles="" +for metric in "$@"; do + keybuf="${keybuf}exec ${metric}.pfs\n" + outfiles="${outfiles} ${metric}.profile" +done +keybuf="${keybuf}dos s0:notdone" +#if [ -n "${metric}" ]; then +# keybuf="exec ${metric}.pfs\ndos s0:notdone" +#fi +export CC64HOST="${host}" +export OUTFILES="${outfiles}" +export CBMFILES="${hostfiles}" +"${emulatordir}/run-in-${host}emu.sh" "${cc64}" "${keybuf}" + +for profile in ${outfiles}; do + petscii2ascii "${hostfiles}/${profile}" "${profile}" +done + +# cmp "${hostfiles}/suite" reference/suite_c64 diff --git a/tests/e2e/register-profiles.sh b/tests/e2e/register-profiles.sh new file mode 100755 index 0000000..1f61d57 --- /dev/null +++ b/tests/e2e/register-profiles.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -e + +name="$1" +shift +description="$@" + +date_full="$(date -Iseconds)" +date_name="$(date -d "${date_full}" +%F-%H%M)" + +profiles=$(echo *.profile|sort) + +echo "name=name-${date_name}-${name}" +echo "${date_full}" +echo "description=y${description}y" +echo "profiles=${profiles}" + +for p in ${profiles}; do + echo $p + p_base="$(basename -s .profile "${p}")" + ( echo "${date_full}" + echo "${description}" + cat "${p}" + ) > "./profile-register/${p_base}-${date_name}-${name}.profile" +done diff --git a/tests/e2e/run-in-emu.sh b/tests/e2e/run-in-emu.sh index b995f93..8378c51 100755 --- a/tests/e2e/run-in-emu.sh +++ b/tests/e2e/run-in-emu.sh @@ -7,7 +7,7 @@ testbinary="${1}" test -n "${testbinary}" || exit 1 testdir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" -source "${testdir}/basedir.sh" +source "${testdir}/basedir.shlib" emulatordir="$(realpath --relative-to="$PWD" "${basedir}/emulator")" targetfiles="$(realpath --relative-to="$PWD" "${testdir}/${CC64TARGET}files")" diff --git a/tests/e2e/scanner1.pfs b/tests/e2e/scanner1.pfs new file mode 100644 index 0000000..108023c --- /dev/null +++ b/tests/e2e/scanner1.pfs @@ -0,0 +1,4 @@ + +profile-scanner1 +cc suite.c +profile2file scanner1.profile diff --git a/tests/e2e/scanner2.pfs b/tests/e2e/scanner2.pfs new file mode 100644 index 0000000..89b2030 --- /dev/null +++ b/tests/e2e/scanner2.pfs @@ -0,0 +1,4 @@ + +profile-scanner2 +cc suite.c +profile2file scanner2.profile diff --git a/tests/e2e/scanner3.pfs b/tests/e2e/scanner3.pfs new file mode 100644 index 0000000..16b2153 --- /dev/null +++ b/tests/e2e/scanner3.pfs @@ -0,0 +1,4 @@ + +profile-scanner3 +cc suite.c +profile2file scanner3.profile diff --git a/tests/integration/basedir.sh b/tests/integration/basedir.shlib similarity index 62% rename from tests/integration/basedir.sh rename to tests/integration/basedir.shlib index 225708d..c74916a 100644 --- a/tests/integration/basedir.sh +++ b/tests/integration/basedir.shlib @@ -1 +1,3 @@ +#!/bin/echo Please source this file + basedir="$(realpath --relative-to="$PWD" "${testdir}/../..")" diff --git a/tests/integration/compile-in-emu.sh b/tests/integration/compile-in-emu.sh index f5fcbbd..482b758 100755 --- a/tests/integration/compile-in-emu.sh +++ b/tests/integration/compile-in-emu.sh @@ -4,14 +4,16 @@ set -e test -n "${CC64HOST}" || export CC64HOST=c64 test -n "${OUTFILES}" || export OUTFILES="" -keybuf="${1}" +testname="${1}" cc64="${2}" test -n "${cc64}" || cc64="cc64" testdir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" -source "${testdir}/basedir.sh" +source "${testdir}/basedir.shlib" emulatordir="$(realpath --relative-to="$PWD" "${basedir}/emulator")" hostfiles="$(realpath --relative-to="$PWD" "${testdir}/${CC64HOST}files")" +keybuf="cc ${testname}.c\ndos s0:notdone" + export CBMFILES="${hostfiles}" "${emulatordir}/run-in-${CC64HOST}emu.sh" "${cc64}" "${keybuf}" diff --git a/tests/integration/compile-lib.sh b/tests/integration/compile-lib.sh index 2e0945c..0d1badb 100755 --- a/tests/integration/compile-lib.sh +++ b/tests/integration/compile-lib.sh @@ -18,7 +18,7 @@ test -d "${hostfiles}" || mkdir "${hostfiles}" rm -f "${hostfiles}/${testname}"* ascii2petscii "${testname}.c" "${hostfiles}/${testname}.c" CC64HOST="${host}" OUTFILES="${testname}.h" \ - ./compile-in-emu.sh "cc ${testname}.c\ndos s0:notdone" + ./compile-in-emu.sh "${testname}" petscii2ascii "${hostfiles}/${testname}.h" "${testname}.h.out" diff --git a/tests/unit/Makefile b/tests/unit/Makefile index 4a51179..6f53906 100644 --- a/tests/unit/Makefile +++ b/tests/unit/Makefile @@ -10,15 +10,21 @@ testsrcs_ascii = $(wildcard *.fth) testsrcs_c64 = $(patsubst %, c64files/%, $(testsrcs_ascii)) -tests: parser-test scanner-test +tests: strings-test scanner-test parser-test parser-test: $(cc64srcs_c64) $(commonsrcs_c64) $(testsrcs_c64) ./build-run-test.sh parser-test +profilertest: $(cc64srcs_c64) $(commonsrcs_c64) $(testsrcs_c64) + ./build-run-test.sh profilertest + scanner-test: $(cc64srcs_c64) $(commonsrcs_c64) $(testsrcs_c64) ./build-run-test.sh scanner-test +strings-test: $(cc64srcs_c64) $(commonsrcs_c64) $(testsrcs_c64) + ./build-run-test.sh strings-test + clean: rm -f c64files/* c16files/* x16files/* rm -f *.result *.out diff --git a/tests/unit/basedir.sh b/tests/unit/basedir.shlib similarity index 62% rename from tests/unit/basedir.sh rename to tests/unit/basedir.shlib index 225708d..c74916a 100644 --- a/tests/unit/basedir.sh +++ b/tests/unit/basedir.shlib @@ -1 +1,3 @@ +#!/bin/echo Please source this file + basedir="$(realpath --relative-to="$PWD" "${testdir}/../..")" diff --git a/tests/unit/build-run-test.sh b/tests/unit/build-run-test.sh index 3a67d0e..2db4e13 100755 --- a/tests/unit/build-run-test.sh +++ b/tests/unit/build-run-test.sh @@ -5,7 +5,7 @@ testname="${1}" platform="c64" testdir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" -source "${testdir}/basedir.sh" +source "${testdir}/basedir.shlib" emulatordir="$(realpath --relative-to="$PWD" "${basedir}/emulator")" cbmfiles="$(realpath --relative-to="$PWD" "${testdir}/${platform}files")" logfile="${cbmfiles}/${testname}.log" @@ -32,6 +32,6 @@ petscii2ascii "${logfile}" | \ (echo "Test completed with errors: ${logfile}" && exit 1) if [[ -f "${goldenfile}" ]]; then - petscii2ascii "${logfile}" | diff "${goldenfile}" - + petscii2ascii "${logfile}" | ./filter.awk | diff "${goldenfile}" - fi diff --git a/tests/unit/fake-memsym.fth b/tests/unit/fake-memsym.fth index af2c5a3..a844722 100644 --- a/tests/unit/fake-memsym.fth +++ b/tests/unit/fake-memsym.fth @@ -1,7 +1,7 @@ 31 constant /id 4 constant /symbol \ datenfeldgroesse - 6 constant #globals + 8 constant #globals 100 constant symtabsize create hash[ #globals 2+ allot here constant ]hash create symtab[ symtabsize allot here constant ]symtab diff --git a/tests/unit/filter.awk b/tests/unit/filter.awk new file mode 100755 index 0000000..eea9b40 --- /dev/null +++ b/tests/unit/filter.awk @@ -0,0 +1,5 @@ +#!/usr/bin/awk -f +BEGIN { out=0; } +/SECTION-END/ { out=0; } +{ if(out) { print; } } +/SECTION-START/ { out=1; } diff --git a/tests/unit/parser-test.fth b/tests/unit/parser-test.fth index e46d30e..3051c12 100644 --- a/tests/unit/parser-test.fth +++ b/tests/unit/parser-test.fth @@ -5,7 +5,9 @@ \ ' \ alias \log \log include logtofile.fth -\log logopen" parser-test.log" +\log logopen parser-test.log + +\needs \prof ' \ alias \prof immediate ' noop alias ~ ' noop alias ~on @@ -25,6 +27,8 @@ onlyforth decimal include util-words.fth + include tmp6502asm.fth + include strings.fth cr vocabulary compiler compiler also definitions @@ -34,19 +38,19 @@ include strtab.fth include errormsgs.fth include errorhandler.fth - tmpclear + tmp-clear include fake-memsym.fth include symboltable.fth - tmpclear + tmp-clear include fake-input.fth include scanner.fth - tmpclear + tmp-clear include fake-memheap.fth include listman.fth - tmpclear + tmp-clear include fake-codeh.fth include fake-v-asm.fth @@ -62,25 +66,41 @@ : fetchglobal" ascii " word findglobal 2@ ; src-begin test-src1 - src@ int i; @ + src@ int i = 0; @ src@ static char x; @ src@ extern char a /= 0x0a; @ src@ static int e /= 0x0e; @ + src@ char *p; @ src-end init $a000 >staticadr - test-src1 + test-src1 fetchword + T{ definition? -> true }T T{ definition? -> true }T T{ definition? -> true }T T{ definition? -> true }T T{ definition? -> true }T T{ definition? -> false }T + T{ thisword -> #eof# }T T{ fetchglobal" i" -> $9ffe %int %extern %reference + + }T T{ fetchglobal" x" -> $9ffd %reference }T T{ fetchglobal" a" -> $0a %extern %reference + }T T{ fetchglobal" e" -> $0e %int %reference + }T + T{ fetchglobal" p" -> $9ffb %extern %reference + %pointer + }T + + src-begin test-stmt + src@ for @ + src@ for(;;); @ + src@ {for(;;);} @ + src-end + + init test-stmt fetchword + T{ statement-tab #keyword# comes-tab-token? -> ' for-stmt true }T + T{ statement? -> true }T + T{ statement? -> true }T + T{ thisword -> #eof# }T cr hex .( here, s0: ) here u. s0 @ u. diff --git a/tests/unit/profilertest.fth b/tests/unit/profilertest.fth new file mode 100644 index 0000000..4e64001 --- /dev/null +++ b/tests/unit/profilertest.fth @@ -0,0 +1,171 @@ + +\ with build log: +' noop alias \log +\ without build log: +\ alias \log + +\log include logtofile.fth +\log logopen profilertest.log + + ' noop alias ~ + ' noop alias ~on + ' noop alias ~off + + include notmpheap.fth + + : dos ( -- ) + bl word count ?dup + IF 8 15 busout bustype + busoff cr ELSE drop THEN + 8 15 busin + BEGIN bus@ con! i/o-status? UNTIL + busoff ; + + include tester.fth + + onlyforth decimal + + include util-words.fth + + onlyforth assembler also definitions + include 6502asm.fth + + onlyforth assembler also definitions + variable ip + create CIA 16 allot + CIA 4 + constant timerAlo + CIA 5 + constant timerAhi + CIA 6 + constant timerBlo + CIA 7 + constant timerBhi + CIA $e + constant timerActrl + CIA $f + constant timerBctrl + onlyforth + : reset-32bit-timer ; + + include profiler.fth + + : .blk|tib + blk @ ?dup IF ." Blk " u. ?cr exit THEN + factive? IF tib #tib @ cr type THEN ; + + \ ' .blk|tib Is .status + + Code callFindBucket ( -- ) findBucket 0 # ldx Next jmp end-code + + assembler also + + : testFindBucket ( addr -- x ) + ip ! $ff currentBucket c! callFindBucket currentBucket c@ ; + + hex + + profiler-init-buckets + variable var-bucket-1 + profiler-bucket number-1 + variable var-bucket0 + number-1 end-bucket + profiler-bucket number-2 + variable var-bucket1a + number-2 end-bucket + variable var1 + variable var-bucket1b + profiler-bucket number-3 + variable var-bucket2 + number-3 end-bucket + profiler-bucket number-4 + variable var-bucket3 + number-4 end-bucket + profiler-bucket number-5 + variable var-bucket4 + number-5 end-bucket + profiler-bucket number-6 + variable var-bucket5 + number-6 end-bucket + profiler-bucket number-7 + variable var-bucket6 + number-7 end-bucket + + profiler-init-buckets + number-1 measure-bucket + number-2 measure-bucket + number-3 measure-bucket + number-4 measure-bucket + number-5 measure-bucket + number-6 measure-bucket + number-7 measure-bucket + + T{ ' dup testFindBucket -> $ff }T + T{ var-bucket-1 testFindBucket -> 0 }T + T{ var-bucket0 testFindBucket -> $4 }T + T{ var-bucket1a testFindBucket -> $8 }T + T{ var-bucket1b testFindBucket -> 0 }T + T{ var-bucket2 testFindBucket -> $c }T + T{ var-bucket3 testFindBucket -> $10 }T + T{ var-bucket4 testFindBucket -> $14 }T + T{ var-bucket5 testFindBucket -> $18 }T + T{ var-bucket6 testFindBucket -> $1c }T + + code callCalcTime calcTime Next jmp end-code + $dddd timerBlo ! + $cccc timerAlo ! + $eeeeeeee. prevTime 2! + T{ callCalcTime deltaTime 2@ -> $11112222. }T + + code callSetPrevTime setPrevTime Next jmp end-code + $1234 timerBlo ! + $abcd timerAlo ! + T{ callSetPrevTime prevTime 2@ -> $1234abcd. }T + + : fetch-dwords ( addr n -- d0 d1 ... dn-1 ) + 2* 2* bounds ?DO I 2@ 4 +LOOP ; + + code callAddTimeToBucket ( x -- ) + sp X) lda tax addTimeToBucket 0 # ldx Pop jmp end-code + bucketTimes $24 erase + T{ bucketTimes 9 fetch-dwords + -> 0. 0. 0. 0. 0. 0. 0. 0. 0. }T + $12345678. deltaTime 2! + T{ 4 callAddTimeToBucket bucketTimes 9 fetch-dwords + -> 0. $12345678. 0. 0. 0. 0. 0. 0. 0. }T + $87654321. deltaTime 2! + T{ 4 callAddTimeToBucket bucketTimes 9 fetch-dwords + -> 0. $99999999. 0. 0. 0. 0. 0. 0. 0. }T + $00ffffff. deltaTime 2! + T{ $10 callAddTimeToBucket bucketTimes 9 fetch-dwords + -> 0. $99999999. 0. 0. $00ffffff. 0. 0. 0. 0. }T + $00020305. deltaTime 2! + T{ $10 callAddTimeToBucket bucketTimes 9 fetch-dwords + -> 0. $99999999. 0. 0. $01020304. 0. 0. 0. 0. }T + 1. deltaTime 2! + T{ $20 callAddTimeToBucket bucketTimes 9 fetch-dwords + -> 0. $99999999. 0. 0. $01020304. 0. 0. 0. 1. }T + + code callIncCountOfBucket ( x -- ) + sp X) lda tax incCountOfBucket 0 # ldx Pop jmp end-code + bucketCounts $24 erase + T{ bucketCounts 9 fetch-dwords + -> 0. 0. 0. 0. 0. 0. 0. 0. 0. }T + T{ 4 callIncCountOfBucket bucketCounts 9 fetch-dwords + -> 0. 1. 0. 0. 0. 0. 0. 0. 0. }T + T{ 4 callIncCountOfBucket bucketCounts 9 fetch-dwords + -> 0. 2. 0. 0. 0. 0. 0. 0. 0. }T + T{ $20 callIncCountOfBucket bucketCounts 9 fetch-dwords + -> 0. 2. 0. 0. 0. 0. 0. 0. 1. }T + T{ 0 callIncCountOfBucket bucketCounts 9 fetch-dwords + -> 1. 2. 0. 0. 0. 0. 0. 0. 1. }T + $ff. bucketCounts 8 + 2! + T{ 8 callIncCountOfBucket bucketCounts 9 fetch-dwords + -> 1. 2. $100. 0. 0. 0. 0. 0. 1. }T + $ffff. bucketCounts $c + 2! + T{ $0c callIncCountOfBucket bucketCounts 9 fetch-dwords + -> 1. 2. $100. $10000. 0. 0. 0. 0. 1. }T + $ffffff. bucketCounts $10 + 2! + T{ $10 callIncCountOfBucket bucketCounts 9 fetch-dwords + -> 1. 2. $100. $10000. $1000000. 0. 0. 0. 1. }T + + cr .( report) cr + profiler-report + + cr .( test completed with ) #errors @ . .( errors) cr + +\log logclose diff --git a/tests/unit/scanner-test.fth b/tests/unit/scanner-test.fth index 35732c2..4731791 100644 --- a/tests/unit/scanner-test.fth +++ b/tests/unit/scanner-test.fth @@ -5,15 +5,16 @@ \ ' \ alias \log \log include logtofile.fth -\log logopen" scanner-test.log" +\log logopen scanner-test.log + +\needs \prof ' \ alias \prof immediate ' noop alias ~ ' noop alias ~on ' noop alias ~off - (64 include tmpheap.fth C) - (64 $2000 mk-tmp-heap C) - (16 include notmpheap.fth C) + include tmpheap.fth + $2000 mk-tmp-heap : dos ( -- ) bl word count ?dup @@ -27,6 +28,8 @@ onlyforth decimal include util-words.fth + include tmp6502asm.fth + include strings.fth cr vocabulary compiler compiler also definitions @@ -36,18 +39,19 @@ include strtab.fth include errormsgs.fth include errorhandler.fth - tmpclear + tmp-clear include fake-memsym.fth include symboltable.fth - tmpclear + tmp-clear include fake-input.fth include scanner.fth ' id-buf alias idbuf - tmpclear + tmp-clear do$: string2stack noop noop noop ; + : nextword thisword accept ; init src-begin test-src1 @@ -55,14 +59,15 @@ src@ i = c + 5 && 'x'; @ src-end - test-src1 + test-src1 fetchword T{ nextword -> #keyword# }T T{ nextword -> idbuf #id# }T - cr idbuf count .s type cr + cr .( idbuf: ) idbuf count type cr T{ idbuf count swap c@ -> 1 ascii i }T T{ nextword -> ascii ; #char# }T - T{ nextword -> 0 #string# }T + T{ thisword -> 0 #string# }T T{ string2stack -> ascii a ascii s ascii d 0 }T + accept T{ nextword -> idbuf #id# }T T{ idbuf count swap c@ -> 1 ascii i }T T{ nextword -> <=> #oper# }T @@ -75,6 +80,34 @@ T{ nextword -> ascii ; #char# }T T{ nextword -> #eof# }T + init + src-begin test-keyword + src@ auto break case char continue default @ + src@ do else extern for goto if @ + src@ int register return static switch while @ + src-end + + test-keyword fetchword + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #keyword# }T + T{ nextword -> #eof# }T + init src-begin test-operator src@ ++ += + -- -= - *= * /= /* bla */ / %= % @ @@ -82,7 +115,7 @@ src@ <<= << <= < >>= >> >= > ~ @ src-end - test-operator + test-operator fetchword T{ nextword -> <++> #oper# }T T{ nextword -> <+=> #oper# }T T{ nextword -> <+> #oper# }T @@ -118,13 +151,15 @@ T{ nextword -> #oper# }T T{ nextword -> #eof# }T + .( SECTION-START) cr : bl/cr ( I cols -- ) swap 1+ swap mod 0= IF cr ELSE bl emit THEN ; : test-word. ." testing word." cr - 1+ 0 DO I #keyword# word. I 6 bl/cr LOOP cr + 1+ 0 DO I #keyword# word. I 6 bl/cr LOOP cr 1+ 0 DO I #oper# word. I 12 bl/cr LOOP cr ; cr test-word. + .( SECTION-END) cr cr .( test completed with ) #errors @ . .( errors) cr diff --git a/tests/unit/scanner-test.golden b/tests/unit/scanner-test.golden index bdb4a4e..c7f2842 100644 --- a/tests/unit/scanner-test.golden +++ b/tests/unit/scanner-test.golden @@ -1,26 +1,9 @@ -tmpheap.fth -tester.fth -util-words.fth - -init.fth -strtab.fth -errormsgs.fth -errorhandler.fth -fake-memsym.fth -symboltable.fth -fake-input.fth -scanner.fth -1 21996 i - testing word. -auto break case char continue default -do else extern for goto if -int register return static switch while +do if for int auto case +char else goto break while extern +return static switch default continue register ++ += + -- -= - *= * /= /* / %= % &= && & |= || | ^= ^ != ! == = <<= << <= < >>= >> >= > ~ - -test completed with 0 errors - diff --git a/tests/unit/strings-test.fth b/tests/unit/strings-test.fth new file mode 100644 index 0000000..c0677fe --- /dev/null +++ b/tests/unit/strings-test.fth @@ -0,0 +1,120 @@ + +\ with build log: +' noop alias \log +\ without build log: +\ ' \ alias \log + +\log include logtofile.fth +\log logopen strings-test.log + +\needs \prof ' \ alias \prof immediate + + ' noop alias ~ + ' noop alias ~on + ' noop alias ~off + + include notmpheap.fth + \ $1000 mk-tmp-heap + + : dos ( -- ) + bl word count ?dup + IF 8 15 busout bustype + busoff cr ELSE drop THEN + 8 15 busin + BEGIN bus@ con! i/o-status? UNTIL + busoff ; + + include tester.fth + + decimal + include util-words.fth + include trns6502asm.fth + include tracer.fth + include strings.fth + clear + include strtab.fth + cr + + T{ $100 alpha? -> 0 }T + T{ 0 alpha? -> 0 }T + T{ ascii a alpha? -> -1 }T + T{ ascii z alpha? -> -1 }T + T{ ascii A alpha? -> -1 }T + T{ ascii Z alpha? -> -1 }T + T{ ascii a 1- alpha? -> 0 }T + T{ ascii z 1+ alpha? -> 0 }T + T{ ascii A 1- alpha? -> 0 }T + T{ ascii Z 1+ alpha? -> 0 }T + + T{ $100 num? -> 0 }T + T{ 0 num? -> 0 }T + T{ ascii 0 num? -> -1 }T + T{ ascii 9 num? -> -1 }T + T{ ascii 0 1- num? -> 0 }T + T{ ascii 9 1+ num? -> 0 }T + + T{ $100 alphanum? -> 0 }T + T{ 0 alphanum? -> 0 }T + T{ ascii a alphanum? -> -1 }T + T{ ascii z alphanum? -> -1 }T + T{ ascii A alphanum? -> -1 }T + T{ ascii Z alphanum? -> -1 }T + T{ ascii a 1- alphanum? -> 0 }T + T{ ascii z 1+ alphanum? -> 0 }T + T{ ascii A 1- alphanum? -> 0 }T + T{ ascii Z 1+ alphanum? -> 0 }T + T{ ascii 0 alphanum? -> -1 }T + T{ ascii 9 alphanum? -> -1 }T + T{ ascii 0 1- alphanum? -> 0 }T + T{ ascii 9 1+ alphanum? -> 0 }T + + +18 string-tab keywords + +~ x x" do" +~ x x" if" +~ x x" for" +~ x x" int" +~ x x" auto" +~ x x" case" +~ x x" char" +~ x x" else" +~ x x" goto" +~ x x" break" +~ x x" while" +~ x x" extern" +~ x x" return" +~ x x" static" +~ x x" switch" +~ x x" default" +~ x x" continue" +~ x x" register" + +end-tab + + T{ keywords string[] -> keywords 2+ }T + .( string[]) cr + keywords string[] >string count type cr + +keywords 2 8 length-index keywords-index + idx, + idx, + idx, + idx, + idx, + idx, + idx, +end-index + +create "goto" ," goto" +create "next" ," next" +create "long" ," somethingverylong" + hex + \ debug find-via-index + T{ "long" keywords-index find-via-index -> false }T + T{ "next" keywords-index find-via-index -> false }T + T{ "goto" keywords-index find-via-index -> true }T + + cr .( test completed with ) #errors @ . .( errors) cr + +\log logclose diff --git a/tests/unit/tester.fth b/tests/unit/tester.fth index 6348897..9fbbba1 100644 --- a/tests/unit/tester.fth +++ b/tests/unit/tester.fth @@ -52,21 +52,22 @@ CREATE ACTUAL-RESULTS 20 CELLS ALLOT 0 DO ACTUAL-RESULTS I CELLS + ! LOOP \ SAVE THEM THEN ; +: .actual-result ( -- ) + cr ." Actual result: " actual-depth @ 0 ?DO + actual-results actual-depth @ 1- I - cells + @ u. LOOP ; + : }T \ ( ... -- ) COMPARE STACK (EXPECTED) CONTENTS WITH SAVED \ (ACTUAL) CONTENTS. DEPTH ACTUAL-DEPTH @ = IF \ IF DEPTHS MATCH DEPTH ?DUP IF \ IF THERE IS SOMETHING ON THE STACK 0 DO \ FOR EACH STACK ITEM ACTUAL-RESULTS I CELLS + @ \ COMPARE ACTUAL WITH EXPECTED - = 0= IF S" INCORRECT RESULT: " ERROR - cr ." Actual result: " - 0 ACTUAL-DEPTH @ 1- ?DO - actual-results I cells + @ u. -1 +LOOP + = 0= IF S" INCORRECT RESULT: " ERROR .actual-result LEAVE THEN LOOP THEN ELSE \ DEPTH MISMATCH - S" WRONG NUMBER OF RESULTS: " ERROR + S" WRONG NUMBER OF RESULTS: " ERROR .actual-result THEN ; : TESTING \ ( -- ) TALKING COMMENT. diff --git a/tools/Makefile b/tools/Makefile index eb757b4..3df2039 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -10,6 +10,7 @@ all: $(tools) clean: rm -f $(tools) rm -f *.o test_*.fth + rm petscii_test ascii2petscii: ascii2petscii.o petscii.o openfiles.o @@ -60,7 +61,8 @@ petscii.o: petscii.c petscii.h install: $(tools) cp $+ $(bindir)/ -test: test_ufscr2file_file test_ufscr2file_stdout test_petscii +test: test_ufscr2file_file test_ufscr2file_stdout test_petscii \ + test_ufscr2file_buffered test_ufscr2file_shadow test_ufscr2file_file: ufscr2file ./ufscr2file testdata/testsrc.d64 test_file.fth @@ -70,6 +72,14 @@ test_ufscr2file_stdout: ufscr2file ./ufscr2file testdata/testsrc.d64 >test_stdout.fth diff test_stdout.fth testdata/testsrc.fth +test_ufscr2file_buffered: ufscr2file + ./ufscr2file -b testdata/testsrc.d64 test_file.fth + diff test_file.fth testdata/testsrc.fth + +test_ufscr2file_shadow: ufscr2file + ./ufscr2file -s testdata/testshadow.d64 test_file.fth + diff test_file.fth testdata/testshadow.fth + test_petscii: petscii_test ./petscii_test diff --git a/tools/testdata/testshadow.d64 b/tools/testdata/testshadow.d64 new file mode 100644 index 0000000..cc3f35e --- /dev/null +++ b/tools/testdata/testshadow.d64 @@ -0,0 +1 @@ +\\ ÄIRECTORY ULTRAÆÏÒÔÈ 3OF4 26OCT87RE . &0 .. &0 ROM-RAM-SYS &2 ÔRANSIENT-ÁSSEMBLER &4 ÁSSEMBLER-6502 &5 2WORDS &14 UNLINK &15 SCR<>CBM &16 (SEARCH &17 ÅDITOR &19 .BLK &46 ÔRACER/ÔOOLS &47 ÍULTI-ÔASKER &57 ÅPSONÒØ80 &63 ÖÃ1526 &75 ÃÐ-80 &78 \\ ÃONTENT VOLKSÆORTH 3.81.02 CAS16AUG06 ROM RAM SYS 2 - 3 ÔRANSIENT ÁSSEMBLER 4 ÁSSEMBLER-6502 5 - 12 13 FREE 2WORDS 14 UNLINK 15 SCR<>CBM 16 (SEARCH 17 ÅDITOR 19 .BLK 46 ÔRACER ÔOOLS 47 ÍULTI-ÔASKER 57 ÐRINTER: ÅPSONÒØ80 63 ÐRINTER: ÖÃ1526 75 ÐRINTER: ÃÐ-80 78 ÓHADOWS 85 ... \ ROM RAM SYS CAS16AUG06 \ ÓHADOW WITH ÃTRL+×---> \ NEEDED FOR JUMPS \ IN THE ÒÏÍ ÁREA ÁSSEMBLER ALSO DEFINITIONS (16 \ ÓWITCH ÂANK 8000-ÆÆÆÆ : ROM HERE 9 + $8000 U> ABORT" NOT HERE" $FF3E STA ; : RAM $FF3F STA ; : SYS ROM JSR RAM ; \ IF SUFFERING FROM ABORT" NOT HERE" \ SEE NEXT SCREEN ÓCREEN --> Ã) (64 \ ÓWITCH ÂANK Á000-ÂÆÆÆ : ROM HERE 9 + $Á000 U> ABORT" NOT HERE" $37 # LDA 1 STA ; : RAM $36 # LDA 1 STA ; Ã) \ SYSÍACRO ÌONG CAS16AUG06 (64 .( NOT FOR Ã64 !) \\ Ã) \ FOR ADVANCED USERS, USE MACROS HERE $8000 $20 - U> ?EXIT \ NOT POSSIBLE ' 0 Ü ÁLIAS ??? ÌABEL LONG ÒÏÍ ÌABEL LONG1 ??? JSR ÒÁÍ RTS END-CODE Ü : SYSÍACRO ( ADR -- ) $100 U/MOD PHA # LDA LONG1 2+ STA # LDA LONG1 1+ STA PLA LONG JSR ; : SYS ( ADR -- ) \ FOR ÊSR TO ÒÏÍ HERE 9 + $8000 U> ÉÆ SYSÍACRO ÅÌÓÅ SYS ÔÈÅÎ ; \ TRANSIENT ÁSSEMBLER CLV10OCT87 \ ÂASIS: ÆORTH ÄIMENSIONS ÖÏÌ ÉÉÉ ÎO. 5) \ INTERNAL LOADING 04MAY85ÂÐ/RE) HERE $800 HALLOT HEAP DP ! 1 +LOAD DP ! ÏNLYFORTH \ ÆORTH-6502 ÁSSEMBLER CLV10OCT87 \ ÂASIS: ÆORTH ÄIMENSIONS ÖÏÌ ÉÉÉ ÎO. 5) ÏNLYFORTH ÁSSEMBLER ALSO DEFINITIONS 1 7 +THRU -3 +LOAD \ ÍAKROS: ROM RAM SYS ÏNLYFORTH \ ÆORTH-83 6502-ÁSSEMBLER 20OCT87RE : END-CODE CONTEXT 2- @ CONTEXT ! ; ÃREATE INDEX $0909 , $1505 , $0115 , $8011 , $8009 , $1Ä0Ä , $8019 , $8080 , $0080 , $1404 , $8014 , $8080 , $8080 , $1Ã0à , $801à , $2Ã80 , Ü ÖARIABLE MODE : ÍODE: ( N -) ÃREATE C, ÄOES> ( -) C@ MODE ! ; 0 ÍODE: .Á 1 ÍODE: # 2 Ü ÍODE: MEM 3 ÍODE: ,Ø 4 ÍODE: ,Ù 5 ÍODE: Ø) 6 ÍODE: )Ù $Æ ÍODE: ) \ UPMODE CPU 20OCT87RE Ü : UPMODE ( ADDR0 F0 - ADDR1 F1) ÉÆ MODE @ 8 OR MODE ! ÔÈÅÎ 1 MODE @ $Æ AND ?DUP ÉÆ 0 ÄÏ DUP + ÌÏÏÐ ÔÈÅÎ OVER 1+ @ AND 0= ; : CPU ( 8B -) ÃREATE C, ÄOES> ( -) C@ C, MEM ; 00 CPU BRK $18 CPU CLC $Ä8 CPU CLD $58 CPU CLI $Â8 CPU CLV $ÃÁ CPU DEX $88 CPU DEY $Å8 CPU INX $Ã8 CPU INY $ÅÁ CPU NOP $48 CPU PHA $08 CPU PHP $68 CPU PLA $28 CPU PLP $40 CPU RTI $60 CPU RTS $38 CPU SEC $Æ8 CPU SED $78 CPU SEI $ÁÁ CPU TAX $Á8 CPU TAY $ÂÁ CPU TSX $8Á CPU TXA $9Á CPU TXS $98 CPU TYA \ M/CPU 20OCT87RE : M/CPU ( MODE OPCODE -) ÃREATE C, , ÄOES> DUP 1+ @ $80 AND ÉÆ $10 MODE +! ÔÈÅÎ OVER $ÆÆ00 AND UPMODE UPMODE ÉÆ MEM TRUE ÁBORT" INVALID" ÔÈÅÎ C@ MODE @ INDEX + C@ + C, MODE @ 7 AND ÉÆ MODE @ $Æ AND 7 < ÉÆ C, ÅÌÓÅ , ÔÈÅÎ ÔÈÅÎ MEM ; $1Ã6Å $60 M/CPU ADC $1Ã6Å $20 M/CPU AND $1Ã6Å $Ã0 M/CPU CMP $1Ã6Å $40 M/CPU EOR $1Ã6Å $Á0 M/CPU LDA $1Ã6Å $00 M/CPU ORA $1Ã6Å $Å0 M/CPU SBC $1Ã6à $80 M/CPU STA $0Ä0Ä $01 M/CPU ASL $0Ã0à $Ã1 M/CPU DEC $0Ã0à $Å1 M/CPU INC $0Ä0Ä $41 M/CPU LSR $0Ä0Ä $21 M/CPU ROL $0Ä0Ä $61 M/CPU ROR $0414 $81 M/CPU STX $0486 $Å0 M/CPU CPX $0486 $Ã0 M/CPU CPY $1496 $Á2 M/CPU LDX $0Ã8Å $Á0 M/CPU LDY $048à $80 M/CPU STY $0480 $14 M/CPU JSR $8480 $40 M/CPU JMP $0484 $20 M/CPU BIT \ ÁSSEMBLER CONDITIONALS 20OCT87RE Ü : RANGE? ( BRANCH -- BRANCH ) DUP ABS $7Æ U> ÁBORT" OUT OF RANGE " ; : [[ ( ÂÅÇÉÎ) HERE ; : ?] ( ÕÎÔÉÌ) C, HERE 1+ - RANGE? C, ; : ?[ ( ÉÆ) C, HERE 0 C, ; : ?[[ ( ×ÈÉÌÅ) ?[ SWAP ; : ]? ( ÔÈÅÎ) HERE OVER C@ ÉÆ SWAP ! ÅÌÓÅ OVER 1+ - RANGE? SWAP C! ÔÈÅÎ ; : ][ ( ÅÌÓÅ) HERE 1+ 1 JMP SWAP HERE OVER 1+ - RANGE? SWAP C! ; : ]] ( ÁÇÁÉÎ) JMP ; : ]]? ( ÒÅÐÅÁÔ) JMP ]? ; \ ÁSSEMBLER CONDITIONALS 20OCT87RE $90 ÃONSTANT ÃÓ $Â0 ÃONSTANT Ãà $Ä0 ÃONSTANT 0= $Æ0 ÃONSTANT 0<> $10 ÃONSTANT 0< $30 ÃONSTANT 0>= $50 ÃONSTANT ÖÓ $70 ÃONSTANT Öà : NOT $20 [ ÆORTH ] XOR ; : BEQ 0<> ?] ; : BMI 0>= ?] ; : BNE 0= ?] ; : BPL 0< ?] ; : BCC ÃÓ ?] ; : BVC ÖÓ ?] ; : BCS Ãà ?] ; : BVS Öà ?] ; \ 2INC/2DEC WINC/WDEC 20OCT87RE : 2INC ( ADR -- ) DUP LDA CLC 2 # ADC DUP STA ÃÓ ?[ SWAP 1+ INC ]? ; : 2DEC ( ADR -- ) DUP LDA SEC 2 # SBC DUP STA Ãà ?[ SWAP 1+ DEC ]? ; : WINC ( ADR -- ) DUP INC 0= ?[ SWAP 1+ INC ]? ; : WDEC ( ADR -- ) DUP LDA 0= ?[ OVER 1+ DEC ]? DEC ; : ;C: RECOVER JSR END-CODE ] 0 LAST ! 0 ; \ ;CODE ÃODE CODE> BP/RE03FEB85 ÏNLYFORTH : ÁSSEMBLER ÁSSEMBLER [ ÁSSEMBLER ] MEM ; : ;ÃODE [COMPILE] ÄOES> -3 ALLOT [COMPILE] ; -2 ALLOT ÁSSEMBLER ; IMMEDIATE : ÃODE ÃREATE HERE DUP 2- ! ÁSSEMBLER ; : >LABEL ( ADR -) HERE Ü ÃREATE IMMEDIATE SWAP , 4 HALLOT HEAP 1 AND HALLOT ( 6502-ALIG) HERE 4 - HEAP 4 CMOVE HEAP LAST @ COUNT $1Æ AND + ! DP ! ÄOES> ( - ADR) @ STATE @ ÉÆ [COMPILE] ÌITERAL ÔÈÅÎ ; : ÌABEL [ ÁSSEMBLER ] HERE >LABEL ÁSSEMBLER ; \ FREE CAS16AUG06 \ 2! 2@ 2VARIABLE 2CONSTANT CLV20AUG87RE ÃODE 2! ( D ADR --) TYA SETUP JSR 3 # LDY [[ ÓÐ )Ù LDA Î )Ù STA DEY 0< ?] 1 # LDY ÐOPTWO JMP END-CODE ÃODE 2@ ( ADR -- D) ÓÐ Ø) LDA Î STA ÓÐ )Ù LDA Î 1+ STA ÓÐ 2DEC 3 # LDY [[ Î )Ù LDA ÓÐ )Ù STA DEY 0< ?] XYÎEXT JMP END-CODE : 2ÖARIABLE ( --) ÃREATE 4 ALLOT ; ( -- ADR) : 2ÃONSTANT ( D --) ÃREATE , , ÄOES> ( -- D) 2@ ; \ 2DUP EXISTS \ 2SWAP EXISTS \ 2DROP EXISTS \ UNLINK CLV20AUG87RE $ÆÆÆ0 >LABEL PLOT (64 ÃODE UNLINK ( -- ) $288 LDA $80 # ORA TAY TXA [[ $Ä9 ,Ø STY CLC $28 # ADC ÃÓ ?[ INY ]? INX $1Á # CPX 0= ?] $Ä3 LDA $28 # CMP ÃÓ ?[ $28 # SBC $Ä3 STA ]? $Ä3 LDY $Ä6 LDX CLC PLOT JSR Ã) (16 : UNLINK 0 0 $7ÅÅ 2! ; Ã) ÌABEL SETPTRS 0 # LDX 1 # LDY ÎEXT JMP END-CODE \ CHANGING CODES CAS16AUG06 ( MAPPING COMMODORE SCREEN CODES ) ÌABEL (SCR>CBM Î 6 + STA $3Æ # AND Î 6 + ASL Î 6 + BIT 0< ?[ $80 # ORA ]? Öà ?[ $40 # ORA ]? RTS ÌABEL (CBM>SCR Î 6 + STA $7Æ # AND $20 # CMP ÃÓ ?[ $40 # CMP ÃÓ ?[ $1Æ # AND Î 6 + BIT 0< ?[ $40 # ORA ]? ]? RTS ]? ÁSCII . # LDA RTS ÃODE CBM>SCR ( 8B1 -- 8B2) ÓÐ Ø) LDA (CBM>SCR JSR ÓÐ Ø) STA ÎEXT JMP END-CODE ÃODE SCR>CBM ( 8B1 -- 8B2) ÓÐ Ø) LDA (SCR>CBM JSR ÓÐ Ø) STA ÎEXT JMP END-CODE \ FAST SEARCH CAS16AUG06 \NEEDS ÃODE -$Ä +LOAD \ ÔRANS ÁSSEMBLER ÏNLYFORTH ' 0< @ 4 + >LABEL PUTTRUE PUTTRUE 3 + >LABEL PUTFALSE ÃODE (SEARCH ( TEXT TLEN BUFFER BLEN -- ADR TF / FF) 7 # LDY [[ ÓÐ )Ù LDA Î ,Ù STA DEY 0< ?] [[ Î 4 + LDA Î 5 + ORA 0<> ?[ [[ Î LDA Î 1+ ORA 0<> ?[ Î 2+ Ø) LDA Î 6 + Ø) CMP SWAP 0<> ?[[ Î WDEC Î 2+ WINC ]]? --> \ ÅDIOR FAST SEARCH CAS16AUG06 7 # LDY [[ Î ,Ù LDA ÓÐ )Ù STA DEY 0< ?] [[ Î 2+ WINC Î 6 + WINC Î WDEC Î 4 + WDEC Î 4 + LDA Î 5 + ORA 0= ?[ ÓÐ LDA CLC 4 # ADC ÓÐ STA ÃÓ ?[ ÓÐ 1+ INC ]? 3 # LDY Î 3 + LDA ÓÐ )Ù STA Î 2+ LDA DEY ÓÐ )Ù STA DEY PUTTRUE JMP ]? Î LDA Î 1+ ORA 0= ?[ 3 ROLL 3 ROLL ]? ]? ÓÐ LDA CLC 6 # ADC ÓÐ STA ÃÓ ?[ ÓÐ 1+ INC ]? 1 # LDY PUTFALSE JMP ]? Î 2+ Ø) LDA Î 6 + Ø) CMP 0= NOT ?] 7 # LDY [[ ÓÐ )Ù LDA Î ,Ù STA DEY 0< ?] Î WDEC Î 2+ WINC ( NEXT CHAR AS FIRST ) ]] END-CODE \ ÅDITOR LOADSCREEN CLV13JUL87 \ ÉDEA AND FIRST IMPLEMENTATION: ×Å/RE ÏNLYFORTH \NEEDS .BLK $1 +LOAD \ .BLK \NEEDS ÃODE -$Æ +LOAD \ ÁSSEMBL \NEEDS (SEARCH -2 +LOAD \ (SEARCH ÏNLYFORTH (64 Ü : AT AT CUROFF ; Ã) \ SORRY \NEEDS 2VARIABLE -5 +LOAD \NEEDS UNLINK -4 +LOAD \ UNLINK \NEEDS SCR>CBM -3 +LOAD \ CBM>ÌABEL SCRADR (64 $D800 Ã) (16 $800 Ã) >ÌABEL COLADR $D1 (16 DROP $C8 Ã) Ü ÃONSTANT LINPTR $D3 (16 DROP $CA Ã) Ü ÃONSTANT CUROFS (64 $Ä020 Ã) (16 $FF19 Ã) Ü ÃONSTANT BORDER (64 $286 Ã) (16 $53B Ã) Ü ÃONSTANT PEN (64 $D021 Ã) (16 $FF15 Ã) Ü ÃONSTANT BKGRND \ ÅDI SPECIAL CMOVES CAS16AUG06 ( THANKS TO COMMODORE.... ) ÌABEL INCPOINTER Î LDA CLC #COL 1+ # ADC Î STA ÃÓ ?[ Î 1+ INC ]? Î 2+ LDA CLC #COL # ADC Î 2+ STA ÃÓ ?[ Î 3 + INC ]? RTS Ü ÃODE B>SC ( BLKADR --) TYA SETUP JSR Î 2+ STX SCRADR LDA Î 3 + STA #ROW # LDX [[ #COL 1- # LDY [[ Î )Ù LDA (CBM>SCR JSR Î 2+ )Ù STA DEY 0< ?] INCPOINTER JSR DEX 0= ?] PEN LDA [[ COLADR ,Ø STA COLADR $100 + ,Ø STA COLADR $200 + ,Ø STA COLADR $300 + ,Ø STA INX 0= ?] SETPTRS JMP END-CODE \ ÅDI SPECIAL CMOVES CONT. CAS16AUG06 ( ... FOR SCREEN FORMAT ) Ü ÃODE SC>B ( BLKADR --) TYA SETUP JSR Î 2+ STX SCRADR LDA Î 3 + STA #ROW # LDX [[ 0 # LDY [[ Î 2+ )Ù LDA (SCR>CBM JSR Î )Ù STA INY #COL # CPY ÃÓ ?] DEX 0<> ?[[ BL # LDA Î )Ù STA INCPOINTER JSR ]]? SETPTRS JMP END-CODE Ü ÃODE >SCRMOVE ( FROM TO 8BQUAN --) 3 # LDA SETUP JSR DEY [[ Î CPY 0= ?[ SETPTRS JMP ]? Î 4 + )Ù LDA (CBM>SCR JSR Î 2+ )Ù STA INY 0= ?] END-CODE \ ÅDI CHANGED? CAS16AUG06 Ü ÃODE CHANGED? ( BLKADR -- F) TYA SETUP JSR Î 2+ STX SCRADR LDA Î 3 + STA #ROW # LDX [[ #COL 1- # LDY [[ Î )Ù LDA (CBM>SCR JSR Î 2+ )Ù CMP 0<> ?[ $ÆÆ # LDA ÐUSHÁ JMP ]? DEY 0< ?] INCPOINTER JSR DEX 0= ?] TXA ÐUSHÁ JMP END-CODE Ü : MEMTOP SP@ #COL 2* - ; \ ÅDI C64-SPECIALS CLV2:JULL87 Ü ÃODE SCRSTART ( -- ADR) TXA PHA SCRADR LDA ÐUSH JMP END-CODE Ü ÃODE ROWADR ( -- ADR) CUROFS LDA #COL # CMP TXA ÃÓ ?[ #COL 1- # LDA ]? LINPTR ADC PHA LINPTR 1 + LDA 0 # ADC ÐUSH JMP END-CODE Ü ÃODE CURADR ( -- ADR) CLC CUROFS LDA LINPTR ADC PHA LINPTR 1 + LDA 0 # ADC ÐUSH JMP END-CODE (64 Ü ÃODE UNLINKED? \ -- F $Ä5 LDA #COL # CMP Ãà ?[ DEX ]? TXA ÐUSHÁ JMP END-CODE Ã) \ ÅDI SCROLL? PUT/INSERT/DO CLV2:JULL87 Ü : BLANK.END? ( -- F) SCRSTART [ B/SCR #COL - ] ÌITERAL + #COL -TRAILING NIP 0= SCROLL @ OR ; Ü : ATLAST? ( -- F) CURADR SCRSTART B/SCR + 1- = SCROLL @ 0= AND ; Ü : PUTCHAR ( -- F) CHAR C@ CON! FALSE ; Ü : INSERT ( -- F) ATLAST? ?DUP ?EXIT (64 UNLINKED? Ã) (16 TRUE Ã) ROWADR #COL + 1- C@ BL = NOT AND BLANK.END? NOT AND DUP ?EXIT $94 CON! ; Ü : DOCHAR ( -- F) ATLAST? ?DUP ?EXIT IMODE @ ÉÆ INSERT ?DUP ?EXIT ÔÈÅÎ PUTCHAR ; \ ÅDI CURSOR CONTROL CAS16AUG06 Ü : CURDOWN ( -- F) SCROLL @ 0= ROW #ROW 2- U> AND DUP ?EXIT $11 CON! ; Ü : CURRITE ( -- F) ATLAST? DUP ?EXIT $1Ä CON! ; ' PUTCHAR Ü ÁLIAS CURUP ' PUTCHAR Ü ÁLIAS CURLEFT ' PUTCHAR Ü ÁLIAS HOME ' PUTCHAR Ü ÁLIAS DELETE Ü : >""END ( -- FF) SCRSTART B/SCR -TRAILING NIP B/SCR 1- MIN #COL /MOD SWAP AT FALSE ; Ü : +TAB ( -- F) 0 $A 0 ÄÏ DROP CURRITE DUP ÉÆ ÌÅÁÖÅ ÔÈÅÎ ÌÏÏÐ ; Ü : -TAB ( -- F) 5 0 ÄÏ $9Ä CON! ÌÏÏÐ FALSE ; \ ÅDI CR, CLEAR/NEWLINE CAS16AUG06 Ü : ( -- F) ROW 0 AT UNLINK IMODE OFF CURDOWN ; Ü : CLRLINE ( -- FF) ROWADR #COL BL FILL FALSE ; Ü : CLRRIGHT ( -- FF) CURADR #COL COL - BL FILL FALSE ; Ü : KILLINE ( -- F) ROWADR DUP #COL + SWAP SCRSTART $3Ã0 + DUP >R OVER - CMOVE R> #COL BL FILL FALSE ; Ü : NEWLINE ( -- F) BLANK.END? NOT ?DUP ?EXIT ROWADR DUP #COL + SCRSTART B/SCR + OVER - CMOVE> CLRLINE ; \ ÅDI CHARACTER HANDLING CAS16AUG06 Ü : DCHAR ( -- F) CURRITE DUP ?EXIT $14 CON! ; Ü : @CHAR ( -- F) CHARS 2@ + 1+ LINES @ MEMTOP MIN U> DUP ?EXIT CURADR C@ CHARS 2@ + C! 1 CHARS 2+ +! ; Ü : COPYCHAR ( -- F) @CHAR ?DUP ?EXIT CURRITE ; Ü : CHAR>BUF ( -- F) @CHAR ?DUP ?EXIT DCHAR ; Ü : BUF>CHAR ( -- F) CHARS 2+ @ 0= ?DUP ?EXIT INSERT DUP ?EXIT -1 CHARS 2+ +! CHARS 2@ + C@ CURADR C! ; \ ÅDI LINE HANDLING, IMODE CAS16AUG06 Ü : @LINE ( -- F) LINES 2@ + MEMTOP U> DUP ?EXIT ROWADR LINES 2@ + #COL CMOVE #COL LINES 2+ +! ; Ü : COPYLINE ( -- F) @LINE ?DUP ?EXIT CURDOWN ; Ü : LINE>BUF ( -- F) @LINE ?DUP ?EXIT KILLINE ; Ü : !LINE ( --) #COL NEGATE LINES 2+ +! LINES 2@ + ROWADR #COL CMOVE ; Ü : BUF>LINE ( -- F) LINES 2+ @ 0= ?DUP ?EXIT NEWLINE DUP ?EXIT !LINE ; Ü : SETIMD ( -- F) IMODE ON FALSE ; Ü : CLRIMD ( -- F) IMODE OFF FALSE ; \ ÅDI THE STAMP CAS16AUG06 ÆORTH DEFINITIONS : RVSON $12 CON! ; : RVSOFF $92 CON! ; ÃODE ***VOLKSÆÏÒÔÈ83*** ÎEXT HERE 2- ! END-CODE : ÆORTH-ÇESELLSCHAFT [COMPILE] \\ ; IMMEDIATE ÅDITOR DEFINITIONS ÃREATE STAMP$ $12 ALLOT STAMP$ $12 ERASE Ü : .STAMP ( -- FF) STAMP$ 1+ COUNT SCRSTART #COL + OVER - SWAP >SCRMOVE FALSE ; : GETSTAMP ( --) INPUT PUSH KEYBOARD STAMP$ ON CR ." YOUR STAMP: " RVSON $10 SPACES ROW $à AT STAMP$ 2+ $10 EXPECT RVSOFF SPAN @ STAMP$ 1+ C! ; Ü : STAMP? ( --) STAMP$ C@ ?EXIT GETSTAMP ; \ ÅDI THE SCREEN# CAS16AUG06 Ü : SAVETOP ( --) SCRSTART PAD #COL 2* CMOVE SCRSTART #COL 2* $Á0 FILL ; Ü : RESTTOP ( --) PAD SCRSTART #COL 2* CMOVE ; Ü : UPDATED? ( SCR# -- N) BLOCK 2- @ ; Ü : SPECIAL ( --) CURON ÂÅÇÉÎ PAUSE KEY? ÕÎÔÉÌ CUROFF ; Ü : DRVÓCR ( --DRV SCR') SCR @ OFFSET @ + BLK/DRV U/MOD SWAP ; Ü : .SCR# ( -- FF) AT? SAVETOP RVSON 0 0 AT DRVÓCR ." ÓCR # " . ." ÄRV " . SCR @ UPDATED? 0= ÉÆ ." NOT " ÔÈÅÎ ." UPDATED" 1 1 AT [ ' ***VOLKSÆÏÒÔÈ83*** >NAME ] ÌITERAL COUNT TYPE 2 SPACES [ ' ÆORTH-ÇESELLSCHAFT >NAME ] ÌITERAL COUNT $1Æ AND TYPE RVSOFF AT SPECIAL RESTTOP FALSE ; \ ÅDI EXITS CAS16AUG06 Ü : AT?>R# ( --) AT? SWAP #COL 1+ * + R# ! ; Ü : R#>AT ( --) R# @ DUP #COL 1+ MOD #COL = - B/BLK 1- MIN #COL 1+ /MOD SWAP AT ; Ü : CANCEL ( -- N) UNLINK %0001 AT?>R# ; Ü : EUPDATE ( -- N) CANCEL SCR @ BLOCK CHANGED? ÉÆ .STAMP DROP SCR @ BLOCK SC>B UPDATE %0010 OR ÔÈÅÎ ; Ü : ESAVE ( -- N) EUPDATE %0100 OR ; Ü : ELOAD ( -- N) ESAVE %1000 OR ; \ LEAF THRU ÅDI CLV01AUG87 Ü : ELIST ( -- FF) SCR @ BLOCK B>SC IMODE OFF UNLINK R#>AT FALSE ; Ü : NEXT ( -- FF) EUPDATE DROP 1 SCR +! ELIST ; Ü : BACK ( -- FF) EUPDATE DROP -1 SCR +! ELIST ; Ü : >SHADOW ( -- FF) EUPDATE DROP SHADOW @ DUP DRVÓCR NIP U> NOT ÉÆ NEGATE ÔÈÅÎ SCR +! ELIST ; Ü : ALTER ( -- FF) EUPDATE DROP ASCR @ SCR @ ASCR ! SCR ! ELIST ; \ ÅDI DIGITS 2OCT87RE ÆORTH DEFINITIONS : DIGDECODE ( ADR CNT1 KEY -- ADR CNT2) #BS CASE? ÉÆ DUP ÉÆ DEL 1- ÔÈÅÎ EXIT ÔÈÅÎ #CR CASE? ÉÆ DUP SPAN ! EXIT ÔÈÅÎ CAPITAL DUP DIGIT? ÉÆ DROP >R 2DUP + R@ SWAP C! R> EMIT 1+ EXIT ÔÈÅÎ DROP ; ÉNPUT: DIGITS C64KEY C64KEY? DIGDECODE C64EXPECT ; ÅDITOR DEFINITIONS Ü : REPLACE ( -- F) FBUF @ 0 ÄÏ #BS CON! ÌÏÏÐ FALSE RBUF @ 0 ÄÏ INSERT OR ÌÏÏÐ DUP ?EXIT RBUF 2@ CURADR SWAP >SCRMOVE EUPDATE DROP ; \ ÅDI >BUFS CAS16AUG06 Ü : .BUF ( ADR COUNT --) TYPE ÁSCII < EMIT #COL 1- COL - SPACES ; Ü : >BUFS ( --) INPUT PUSH UNLINK SAVETOP AT? RVSON 1 0 AT ." REPLACE WITH: " AT? RBUF 2@ .BUF 0 0 AT ." > SEARCH: " AT? FBUF 2@ .BUF 0 2 2DUP AT SEND @ 3 U.R 2DUP AT HERE 1+ 3 DIGITS EXPECT SPAN @ ?DUP ÉÆ HERE UNDER C! NUMBER DROP SEND ! ÔÈÅÎ AT SEND @ 3 U.R KEYBOARD 2DUP AT FBUF 2+ @ #COL 2- COL - EXPECT SPAN @ ?DUP ÉÆ FBUF ! ÔÈÅÎ AT FBUF 2@ .BUF 2DUP AT RBUF 2+ @ #COL 2- COL - EXPECT SPAN @ ?DUP ÉÆ RBUF ! ÔÈÅÎ AT RBUF 2@ .BUF RVSOFF RESTTOP AT ; \ ÅDI ESEARCH CLV06AUG87 Ü : (F ELIST DROP FBUF 2@ R# @ SCR @ BLOCK + B/BLK R# @ - (SEARCH 0= ÉÆ 0 ÅÌÓÅ SCR @ BLOCK - ÔÈÅÎ R# ! R#>AT ; Ü : ESEARCH ( -- F) EUPDATE DROP >BUFS ÂÅÇÉÎ ÂÅÇÉÎ (F R# @ ×ÈÉÌÅ KEY DUP ÁSCII R = ÉÆ REPLACE ?DUP ÉÆ NIP EXIT ÔÈÅÎ ÔÈÅÎ 3 = ?DUP ?EXIT ÒÅÐÅÁÔ DRVÓCR NIP SEND @ - STOP? 0= AND ?DUP ×ÈÉÌÅ 0< ÉÆ NEXT DROP ÅÌÓÅ BACK DROP ÔÈÅÎ ÒÅÐÅÁÔ TRUE ; \ ÅDI KEYTABLE CAS16AUG06 Ü : ÃTRL ( -- 8B) [COMPILE] ÁSCII $40 - ; IMMEDIATE Ü ÃREATE KEYTABLE ÃTRL N C, ÃTRL B C, ÃTRL W C, ÃTRL A C, $1Æ C, (64 ÃTRL ^ Ã) (16 $92 Ã) C, $0Ä C, $8Ä C, ÃTRL C C, ÃTRL X C, ÃTRL F C, ÃTRL L C, $85 C, $89 C, $86 C, $8Á C, $9Æ C, $1à C, (64 00 Ã) (16 $1E Ã) C, $8 C, $87 C, $88 C, $8à C, $1Ä C, $11 C, $9Ä C, $91 C, $13 C, $93 C, $94 C, $14 C, ÃTRL D C, ÃTRL E C, ÃTRL R C, ÃTRL I C, ÃTRL O C, $FF C, \ ÅDI ACTIONTABLE CAS16AUG06 Ü ÃREATE ACTIONTABLE ] NEXT BACK >SHADOW ALTER ESEARCH COPYLINE CANCEL EUPDATE ESAVE ELOAD NEWLINE KILLINE BUF>LINE LINE>BUF .STAMP .SCR# COPYCHAR CHAR>BUF BUF>CHAR +TAB -TAB CURRITE CURDOWN CURLEFT CURUP HOME >""END INSERT DELETE DCHAR CLRLINE CLRRIGHT SETIMD CLRIMD DOCHAR [ Ü ÃODE FINDKEY ( KEY N -- ADR) 2 # LDA SETUP JSR Î LDY DEY [[ INY KEYTABLE ,Ù LDA $ÆÆ # CMP 0<> ?[ Î 2+ CMP ]? 0= ?] TYA .Á ASL TAY ACTIONTABLE ,Ù LDA PHA ACTIONTABLE 1+ ,Ù LDA ÐUSH JMP END-CODE \ ÅDI SHOW ERRORS CAS16AUG06 ' 0 Ü ÁLIAS DARK ' 1 Ü ÁLIAS LIGHT Ü : HALF ( N --) BORDER C! PAUSE $80 0 ÄÏ ÌÏÏÐ ; Ü : BLINK ( --) BORDER PUSH DARK HALF LIGHT HALF DARK HALF LIGHT HALF ; Ü : ?BLINK ( F1 -- F2) DUP TRUE = ÉÆ BLINK 0= ÔÈÅÎ ; \ ÅDI INIT CAS16AUG06 ' ÌITERAL Ü ÁLIAS ÌI IMMEDIATE ÖARIABLE (PAD 0 (PAD ! Ü : CLEARBUFFER ( --) PAD DUP (PAD ! #COL 2* + DUP FBUF 2+ ! #COL + DUP RBUF 2+ ! #COL + DUP CHARS ! #COL 2* + LINES ! CHARS 2+ OFF LINES 2+ OFF [ ' ***VOLKSÆÏÒÔÈ83*** >NAME ] ÌI COUNT >R FBUF 2+ @ R@ CMOVE R> FBUF ! [ ' ÆORTH-ÇESELLSCHAFT >NAME ] ÌI COUNT $1Æ AND >R RBUF 2+ @ R@ CMOVE R> RBUF ! ; Ü : INITPTR ( --) PAD (PAD @ = ?EXIT CLEARBUFFER ; \ ÅDI SHOW CAS16AUG06 ' NAME >BODY 6 + Ü ÃONSTANT 'NAME (16 \ C16 IS USING STANDARD Ã) (64 Ü ÃODE CURON $Ä3 LDY $Ä1 )Ù LDA $ÃÅ STA $80 # EOR $Ä1 )Ù STA XYÎEXT JMP END-CODE Ü ÃODE CUROFF $ÃÅ LDA $Ä3 LDY $Ä1 )Ù STA XYÎEXT JMP END-CODE Ã) \ ÅDI SHOW CAS16AUG06 Ü : SHOWOFF ['] EXIT 'NAME ! RVSOFF CUROFF ; Ü : SHOW ( --) BLK @ ?DUP 0= ÉÆ SHOWOFF EXIT ÔÈÅÎ >IN @ 1- R# ! RVSOFF CUROFF RVSON SCR @ OVER - ÉÆ SCR ! ELIST 1 0 AT .STATUS ÔÈÅÎ R#>AT CURON DROP ; ÆORTH DEFINITIONS : (LOAD ( BLK POS --) >IN PUSH >IN ! ?DUP 0= ?EXIT BLK PUSH BLK ! .STATUS INTERPRET ; : SHOWLOAD ( BLK POS -) SCR PUSH SCR OFF R# PUSH ['] SHOW 'NAME ! (LOAD SHOWOFF ; ÅDITOR DEFINITIONS \ ÅDI EDIT CLV01AUG87 Ü : SETCOL ( 0 / 4 / 8 --) INK-POT + DUP C@ BORDER C! DUP 1+ C@ BKGRND C! 2+ C@ PEN C! ; Ü : (EDIT ( -- N) 4 SETCOL $93 CON! ELIST DROP SCROLL OFF ÂÅÇÉÎ KEY DUP CHAR C! 0 FINDKEY EXECUTE ?BLINK ?DUP ÕÎÔÉÌ 0 0 AT KILLINE DROP SCROLL ON 0 SETCOL (16 0 $7EA C! Ã) \ ÁPPEND-ÍODE ; ÆORTH DEFINITIONS : EDIT ( SCR# -) (16 C64FKEYS Ã) SCR ! STAMP? INITPTR (EDIT $18 0 AT DRVÓCR ." ÓCR " . ." ÄRV " . DUP 2 AND 0= ÉÆ ." NOT " ÔÈÅÎ ." CHANGED" DUP 4 AND ÉÆ SAVE-BUFFERS ÔÈÅÎ DUP 6 AND 6 = ÉÆ ." , SAVED" ÔÈÅÎ 8 AND ÉÆ ." , LOADING" CR SCR @ R# @ SHOWLOAD ÔÈÅÎ ; \ ÅDITOR ÆORTH83 CLV2:JULL87 : L ( SCR -) R# OFF EDIT ; : R ( -) SCR @ EDIT ; : +L ( N -) SCR @ + L ; : V ( -) ( TEXT) ' >NAME ?DUP ÉÆ 4 - @ ÔÈÅÎ ; : VIEW ( -) ( TEXT) V ?DUP ÉÆ L ÅÌÓÅ ." FROM KEYBOARD" ÔÈÅÎ ; ÅDITOR DEFINITIONS (16 Ü : CURADDR \ --ÁDDR LINPTR @ CUROFS C@ + ; Ã) : CURLIN ( --CURÁDDR LINÌEN) \ & ÅÏÌN (64 LINPTR @ $Ä5 C@ -TRAILING DUP $D3 C! Ã) (16 $1B CON! ASCII J CON! CURADDR $1B CON! ASCII K CON! $1D CON! CURADDR OVER - Ã) ; \ ÅDIDECODE CCAS16AUG06 : EDIDECODE ( ADR CNT1 KEY -- ADR CNT2) $8Ä CASE? ÉÆ IMODE OFF CR EXIT ÔÈÅÎ #CR CASE? ÉÆ IMODE OFF CURLIN DUP SPAN @ U> ÉÆ DROP SPAN @ ÔÈÅÎ BOUNDS ?ÄÏ 2DUP + É C@ SCR>CBM SWAP C! 1+ ÌÏÏÐ DUP SPAN ! EXIT ÔÈÅÎ DUP CHAR C! $12 FINDKEY EXECUTE ?BLINK DROP ; : EDIEXPECT ( ADDR LEN1 -- ) INITPTR SPAN ! 0 ÂÅÇÉÎ DUP SPAN @ U< ×ÈÉÌÅ KEY DECODE ÒÅÐÅÁÔ 2DROP SPACE ; ÉNPUT: EDIBOARD C64KEY C64KEY? EDIDECODE EDIEXPECT ; EDIBOARD \ .STATUS CAS16AUG06 ' NOOP ÉS .STATUS : .BLK ( -) BLK @ ?DUP ÉÆ ." ÂLK " U. ?CR ÔÈÅÎ ; ' .BLK ÉS .STATUS \ TRACER: LOADSCREEN CAS16AUG06 ÏNLYFORTH \NEEDS ÃODE -$2 +LOAD \ ÔRANS ÁSSEMBLER \NEEDS ÔOOLS ÖOCABULARY ÔOOLS ÔOOLS ALSO DEFINITIONS 1 6 +THRU \ ÔRACER 7 8 +THRU \ ÔOOLS FOR DECOMPILING ÏNLYFORTH \\ ÔHIS NICE ÆORTH ÔRACER HAS BEEN DEVELOPED BY Â. ÐENNEMANN AND CO FOR ÁTARI ÓÔ. ÃÌ ÖOGT HAS PORTED IT BACK TO THE VOLKSÆORTH 6502 Ã-16 AND Ã-64 \ TRACER: WCMP VARIABLES CLV04AUG87 ÁSSEMBLER ALSO DEFINITIONS : WCMP ( ADR1 ADR2--) \ ÁSSEMBLER-ÍACRO OVER LDA DUP CMP SWAP \ COMPARES WORD 1+ LDA 1+ SBC ; ÏNLY ÆORTH ALSO ÔOOLS ALSO DEFINITIONS Ü ÖARIABLE (× Ü ÖARIABLE Ü ÖARIABLE NEST? Ü ÖARIABLE TRAP? Ü ÖARIABLE LAST' Ü ÖARIABLE #SPACES \ TRACER:CPUSH ONELINE CAS16AUG06 Ü ÃREATE CPULL 0 ] RP@ COUNT 2DUP + RP! R> SWAP CMOVE ; : CPUSH ( ADDR LEN -) R> -ROT OVER >R RP@ OVER 1+ - DUP RP! PLACE CPULL >R >R ; Ü : ONELINE &82 ALLOT KEYBOARD DISPLAY .STATUS SPACE QUERY INTERPRET -&82 ALLOT RDROP ( DELETE QUIT FROM TNEXT ) ; : RANGE ( ADR--) \ GETS IP> OFF DUP ! ; \ TRACER:STEP TNEXT CLV04AUG87 Ü ÃODE STEP $FF # LDA TRAP? STA TRAP? 1+ STA ÒÐ Ø) LDA ÉÐ STA ÒÐ )Ù LDA ÉÐ 1+ STA ÒÐ 2INC (× LDA × STA (× 1+ LDA × 1+ STA ÌABEL ×1- × 1- JMP END-CODE Ü ÃREATE: NEXTSTEP STEP ; ÌABEL TNEXT ÉÐ 2INC TRAP? LDA ×1- BEQ NEST? LDA 0= \ LOW(!)ÂYTE TEST ?[ ÉÐ WCMP ×1- BCS ][ NEST? STX \ LOW(!)ÂYTE CLEAR ]? TRAP? DUP STX 1+ STX \ DISABLE TRACER × LDA (× STA × 1+ LDA (× 1+ STA \ TRACER:..TNEXT CLV12OCT87 ;C: NEST? @ ÉÆ NEST? OFF R> IP> PUSH R ÔÈÅÎ R@ NEXTSTEP >R INPUT PUSH OUTPUT PUSH 2- DUP LAST' ! CR #SPACES @ SPACES DUP 4 U.R @ DUP 5 U.R SPACE >NAME .NAME $10 COL - 0 MAX SPACES .S STATE PUSH BLK PUSH >IN PUSH [ ' 'QUIT >BODY ] ÌITERAL PUSH [ ' >INTERPRET >BODY ] ÌITERAL PUSH #TIB PUSH TIB #TIB @ CPUSH R0 PUSH RP@ R0 ! ['] ONELINE ÉS 'QUIT QUIT ; \ TRACER:DO-TRACE TRACEABLE CAS16AUG06 Ü ÃODE DO-TRACE \ INSTALLS ÔÎÅØÔ TNEXT 0 $100 M/MOD # LDA ÎEXT $C + STA # LDA ÎEXT $B + STA $4à # LDA ÎEXT $A + STA ÎEXT JMP END-CODE Ü : TRACEABLE ( CFA--<ÉÐ ) RECURSIVE DUP @ ['] : @ CASE? ÉÆ >BODY EXIT ÔÈÅÎ ['] KEY @ CASE? ÉÆ >BODY C@ ÉNPUT @ + @ TRACEABLE EXIT ÔÈÅÎ ['] TYPE @ CASE? ÉÆ >BODY C@ ÏUTPUT @ + @ TRACEABLE EXIT ÔÈÅÎ ['] R/W @ CASE? ÉÆ >BODY @ TRACEABLE EXIT ÔÈÅÎ @ [ ' ÆORTH @ @ ] ÌITERAL = ÉÆ @ 3 + EXIT ÔÈÅÎ \ FOR DEFINING WORDS WITH ÄÏÅÓ> >NAME .NAME ." CAN'T BE ÄÅÂÕÇGED" QUIT ; \ TRACER:ÕSER-×ORDS CAS16AUG06 : NEST \ TRACE INTO CURRENT WORD LAST' @ @ TRACEABLE DROP NEST? ON ; : UNNEST \ PROCEEDS AT CALLING WORD OFF ; \ CLEARS TRAP RANGE : ENDLOOP LAST' @ 4 + NAME .NAME 2+ BL ; : K ( ADR - ADR+2) ( PRINT LITERAL VALUE) ?: @? 2+ BL ; ( TOOLS FOR DECOMPILING, INTERACTIVE ) : D ( ADR N - ADR+N) ( DUMP N BYTES) 2DUP SWAP ?: 3 SPACES SWAP 0 ÄÏ C? 1+ ÌÏÏÐ 4 SPACES -ROT TYPE BL ; : C ( ADR - ADR+1) ( PRINT BYTE AS UNSIGNED VALUE) 1 D ; : B ( ADR - ADR+2) ( PRINT BRANCH TARGET LOCATION ) ?: @? DUP @ OVER + 6 U.R 2+ BL ; ( USED FOR : ) ( ÎAME ÓTRING ÌITERAL ÄUMP ÃLIT ÂRANCH ) ( - - - - - - ) ( DEBUGGING UTILITIES BP 19 02 85 ) : UNRAVEL \ UNRAVEL PERFORM (ABORT" RDROP RDROP RDROP CR ." TRACE DUMP IS " CR ÂÅÇÉÎ RP@ R0 @ - ×ÈÉÌÅ R> DUP 8 U.R SPACE 2- @ >NAME .NAME CR ÒÅÐÅÁÔ (ERROR ; ' UNRAVEL ERRORHANDLER ! \ ÍULTITASKER ÂÐ 13.9.84 ) ÏNLYFORTH \NEEDS MULTITASK 1 +LOAD SAVE 2 4 +THRU \ ÔASKER \ 5 +LOAD \ ÄEMOTASK \ ÍULTITASKER ÂÐ 13.9.84 ) \NEEDS ÃODE -$36 +LOAD \ TRANSIENT ÁSS ÃODE STOP ÓÐ 2DEC ÉÐ LDA ÓÐ Ø) STA ÉÐ 1+ LDA ÓÐ )Ù STA ÓÐ 2DEC ÒÐ LDA ÓÐ Ø) STA ÒÐ 1+ LDA ÓÐ )Ù STA 6 # LDY ÓÐ LDA ÕÐ )Ù STA INY ÓÐ 1+ LDA ÕÐ )Ù STA 1 # LDY TYA CLC ÕÐ ADC × STA TXA ÕÐ 1+ ADC × 1+ STA × 1- JMP END-CODE Ü ÃREATE TASKPAUSE ÁSSEMBLER $2à # LDA ÕÐ Ø) STA ' STOP @ JMP END-CODE : SINGLETASK [ ' PAUSE @ ] ÌITERAL ['] PAUSE ! ; : MULTITASK TASKPAUSE ['] PAUSE ! ; \ PASS ACTIVATE KS 8 MAY 84 ) : PASS ( N0 .. NR-1 ÔADR R -- ) ÂÅÇÉÎ [ ROT ( ÔRICK ! ) ] SWAP $2à OVER C! \ AWAKE ÔASK R> -ROT \ ÉÐ R ADDR 8 + >R \ S0 OF ÔASK R@ 2+ @ SWAP \ ÉÐ R0 R 2+ 2* \ BYTES ON ÔASKSTACK \ INCL. R0 & ÉÐ R@ @ OVER - \ NEW ÓÐ DUP R> 2- ! \ INTO SSAVE SWAP BOUNDS ?ÄÏ É ! 2 +ÌÏÏÐ ; RESTRICT : ACTIVATE ( ÔADR --) 0 [ -ROT ( ÔRICK ! ) ] ÒÅÐÅÁÔ ; -2 ALLOT RESTRICT : SLEEP ( ÔADR --) $4à SWAP C! ; \ ÊÍÐ-ÏPCODE : WAKE ( ÔADR --) $2à SWAP C! ; \ ÂÉÔ-ÏPCODE \ BUILDING A ÔASK ÂÐ 13.9.84 ) Ü : TASKERROR ( STRING -) STANDARDI/O SINGLETASK ." ÔASK ERROR : " COUNT TYPE MULTITASK STOP ; : ÔASK ( RLEN SLEN -- ) ALLOT \ ÓTACK HERE $ÆÆ AND $ÆÅ = ÉÆ 1 ALLOT ÔÈÅÎ \ 6502-ALIGN UP@ HERE $100 CMOVE \ INIT USER AREA HERE $4à C, \ ÊÍÐ OPCODE \ TO SLEEP ÔASK UP@ 1+ @ , DUP UP@ 1+ ! \ LINK ÔASK 3 ALLOT \ ALLOT ÊÓÒ WAKE DUP 6 - DUP , , \ SSAVE AND S0 2DUP + , \ HERE + RLEN = R0 UNDER + HERE - 2+ ALLOT ['] TASKERROR OVER [ ' ERRORHANDLER >BODY C@ ] ÌITERAL + ! ÃONSTANT ; \ MORE ÔASKS KS/BP 26APR85RE) : RENDEZVOUS ( SEMAPHORADR -) DUP UNLOCK PAUSE LOCK ; Ü : STATESMART STATE @ ÉÆ [COMPILE] ÌITERAL ÔÈÅÎ ; : 'S ( ÔADR - ADR.OF.TASKUSERVAR) ' >BODY C@ + STATESMART ; IMMEDIATE \ ÓYNTAX: 2 ÄEMOTASK 'S BASE ! \ MAKES ÄEMOTASK WORKING BINARY : TASKS ( -) ." ÍÁÉÎ " CR UP@ DUP 1+ @ ÂÅÇÉÎ 2DUP - ×ÈÉÌÅ DUP [ ' R0 >BODY C@ ] ÌITERAL + @ 6 + NAME> >NAME .NAME DUP C@ $4à = ÉÆ ." SLEEPING" ÔÈÅÎ CR 1+ @ ÒÅÐÅÁÔ 2DROP ; \ ÔASKDEMO CLV12AUG87 : TASKMARK ; \NEEDS CBM>SCR : CBM>SCR ; : SCRSTART ( -- ADR) (64 $288 Ã) (16 $53E Ã) C@ $100 * ; ÖARIABLE COUNTER COUNTER OFF $100 $100 ÔASK ÂACKGROUND : >COUNT ( N -) ÂACKGROUND 1 PASS COUNTER ! ÂÅÇÉÎ COUNTER @ -1 COUNTER +! ?DUP ×ÈÉÌÅ PAUSE 0 <# #S #> 0 ÄÏ PAUSE DUP É + C@ CBM>SCR SCRSTART É + C! ÌÏÏÐ DROP ÒÅÐÅÁÔ ÂÅÇÉÎ STOP ÒÅÐÅÁÔ ; \ STOP'S FOREVER : WAIT ÂACKGROUND SLEEP ; : GO ÂACKGROUND WAKE ; MULTITASK $100 >COUNT PAGE \ PRINTER LOADSCREEN 27JUL85RE) ÏNLYFORTH HEX ÖOCABULARY ÐRINT ÐRINT DEFINITIONS ALSO ÃREATE ÐRTER 2 ALLOT ( ÓEMAPHOR) ÐRTER OFF : ) ; IMMEDIATE : (U ; IMMEDIATE \ FOR USER-PORT : (S [COMPILE] ( ; IMMEDIATE \ : (S ; IMMEDIATE \ FOR SERIAL BUS \ : (U [COMPILE] ( ; IMMEDIATE (S 1 +LOAD ) 2 $Á +THRU ÏNLYFORTH CLEAR \ ÂUFFER FOR THE UGLY ÓERÂUS 28JUL85RE) $100 Ü ÃONSTANT BUFLEN Ü ÖARIABLE ÐRBUF BUFLEN ALLOT ÐRBUF OFF Ü : >BUF ( CHAR --) ÐRBUF COUNT + C! 1 ÐRBUF +! ; Ü : FULL? ( -- F) ÐRBUF C@ BUFLEN = ; Ü : .BUF ( --) ÐRBUF COUNT -TRAILING 4 0 BUSOUT BUSTYPE BUSOFF ÐRBUF OFF ; : P! ( CHAR --) PAUSE >R R@ $à ( ÆORMFEED ) = ÉÆ R> >BUF .BUF EXIT ÔÈÅÎ R@ $Á ( ÌINEFEED ) = R@ $Ä ( ÃARÒETURN ) = OR FULL? OR ÉÆ .BUF ÔÈÅÎ R> >BUF ; \ P! CTRL: ÅÓà ESC: 28JUL85RE) (U : P! \ CHAR -- $ÄÄ01 C! $ÄÄ00 DUP C@ 2DUP 4 OR SWAP C! $Æ AND SWAP C! ÂÅÇÉÎ PAUSE $ÄÄ0Ä C@ $10 AND ÕÎÔÉÌ ; ) Ü : CTRL: ( 8B --) ÃREATE C, DOES> ( --) C@ P! ; 7 CTRL: ÂÅÌ Ü $7Æ CTRL: ÄÅÌ Ü $D CTRL: ÃÒÅÔ Ü $1 CTRL: ÅÓà $A CTRL: ÌÆ $0à CTRL: ÆÆ Ü : ESC: ( 8B --) ÃREATE C, DOES> ( --) ÅÓà C@ P! ; $30 ESC: 1/8" $31 ESC: 1/10" $32 ESC: 1/6" $54 ESC: SUOFF $4Å ESC: +JUMP $4Æ ESC: -JUMP \ PRINTER CONTROLS 28JUL85RE) Ü : ÅÓÃ2 ÅÓà P! P! ; : GORLITZ ( 8B --) ÂÌ ÅÓÃ2 ; Ü : ÅÓÃ"!" ( 8B --) $21 ÅÓÃ2 ; Ü ÖARIABLE ÍODUS ÍODUS OFF Ü : ON: ( 8B --) ÃREATE C, DOES> ( --) C@ ÍODUS C@ OR DUP ÍODUS C! ÅÓÃ"!" ; Ü : OFF: ( 8B --) ÃREATE $ÆÆ XOR C, DOES> ( --) C@ ÍODUS C@ AND DUP ÍODUS C! ÅÓÃ"!" ; $10 ON: +DARK $10 OFF: -DARK $20 ON: +WIDE $20 OFF: -WIDE $40 ON: +CURSIV $40 OFF: -CURSIV $80 ON: +UNDER $80 OFF: -UNDER Ü 1 ON: (12CPI Ü 4 ON: (17CPI 5 OFF: 10CPI \ PRINTER CONTROLS 28JUL85RE) : 12CPI 10CPI (12CPI ; : 17CPI 10CPI (17CPI ; : SUPER 0 $53 ÅÓÃ2 ; : SUB 1 $53 ÅÓÃ2 ; : LINES ( #LINES --) $43 ÅÓÃ2 ; : "LONG ( INCHES --) 0 LINES P! ; : AMERICAN 0 $52 ÅÓÃ2 ; : GERMAN 2 $52 ÅÓÃ2 ; : PRINIT (S ÁSCII X GORLITZ ÁSCII B GORLITZ ÁSCII E GORLITZ ÁSCII T GORLITZ ÁSCII Z GORLITZ ÁSCII L GORLITZ ) (U $ÆÆ $ÄÄ03 C! $ÄÄ02 DUP C@ 4 OR SWAP C! ) ; Ü ÖARIABLE >ASCII >ASCII ON : NORMAL >ASCII ON ÍODUS OFF 10CPI AMERICAN SUOFF 1/6" $C "LONG ÃÒÅÔ ; \ ÅPSON PRINTER INTERFACE 08SEP85RE) Ü : C>A ( 8B0 -- 8B1) >ASCII @ ÉÆ DUP $41 $5 UWITHIN ÉÆ $20 OR EXIT ÔÈÅÎ DUP $Ã1 $Ä UWITHIN ÉÆ $7Æ AND EXIT ÔÈÅÎ DUP $Äà $Å0 UWITHIN ÉÆ $Á0 XOR ÔÈÅÎ ÔÈÅÎ ; Ü ÖARIABLE PCOL PCOL OFF Ü ÖARIABLE PROW PROW OFF Ü : PEMIT C>A P! 1 PCOL +! ; Ü : PCR ÃÒÅÔ ÌÆ 1 PROW +! 0 PCOL ! ; Ü : PDEL ÄÅÌ -1 PCOL +! ; Ü : PPAGE ÆÆ 0 PROW ! 0 PCOL ! ; Ü : PAT ( ZEILE SPALTE -- ) OVER PROW @ < ÉÆ PPAGE ÔÈÅÎ SWAP PROW @ - 0 ?ÄÏ PCR ÌÏÏÐ DUP PCOL < ÉÆ ÃÒÅÔ PCOL OFF ÔÈÅÎ PCOL @ - SPACES ; Ü : PAT? PROW @ PCOL @ ; Ü : PTYPE ( ADR COUNT --) DUP PCOL +! BOUNDS ?ÄÏ É C@ C>A P! ÌÏÏÐ ; \ PRINT PL 02OCT87RE Ü ÏUTPUT: >PRINTER PEMIT PCR PTYPE PDEL PPAGE PAT PAT? ; : BEMIT DUP C64EMIT PEMIT ; : BCR C64CR PCR ; : BTYPE 2DUP C64TYPE PTYPE ; : BDEL C64DEL PDEL ; : BPAGE C64PAGE PPAGE ; : BAT 2DUP C64AT PAT ; Ü ÏUTPUT: >BOTH BEMIT BCR BTYPE BDEL BPAGE BAT PAT? ; ÆORTH DEFINITIONS : ÐRINTER NORMAL (U PRINIT ) >PRINTER ; : ÂOTH NORMAL >BOTH ; \ 2SCR'S NSCR'S THRU KS 28JUL85RE) ÆORTH DEFINITIONS Ü : 2SCR'S ( BLK1 BLK2 --) CR ÌÆ 17CPI +WIDE +DARK $15 SPACES OVER 3 .R $13 SPACES DUP 3 .R -DARK -WIDE CR B/BLK 0 ÄÏ CR É C/L / $15 .R 4 SPACES OVER BLOCK É + Ã/Ì 1- TYPE 5 SPACES DUP BLOCK É + Ã/Ì 1- -TRAILING TYPE Ã/Ì +ÌÏÏÐ 2DROP CR ; Ü : NSCR'S ( BLK1 N -- BLK2) 2DUP BOUNDS ÄÏ É OVER É + 2SCR'S ÌÏÏÐ + ; : PTHRU ( FROM TO --) ÐRTER LOCK ÏUTPUT PUSH ÐRINTER 1/8" 1+ OVER - 1+ -2 AND 6 /MOD ?DUP ÉÆ SWAP >R 0 ÄÏ 3 NSCR'S 2+ 1+ PAGE ÌÏÏÐ R> ÔÈÅÎ ?DUP ÉÆ 1+ 2/ NSCR'S PAGE ÔÈÅÎ DROP ÐRTER UNLOCK ; \ ÐRINTING WITH SHADOWS 28JUL85RE) ÆORTH DEFINITIONS Ü : 2SCR'S ( BLK1 BLK2 --) CR ÌÆ 17CPI +WIDE +DARK $15 SPACES DUP 3 .R -DARK -WIDE CR B/BLK 0 ÄÏ CR É C/L / $15 .R 4 SPACES DUP BLOCK É + Ã/Ì 1- TYPE 5 SPACES OVER BLOCK É + Ã/Ì 1- -TRAILING TYPE Ã/Ì +ÌÏÏÐ 2DROP CR ; Ü : NSCR'S ( BLK1 N -- BLK2) 0 ÄÏ DUP [ ÅDITOR ] SHADOW @ 2DUP U> ÉÆ NEGATE ÔÈÅÎ + OVER 2SCR'S 1+ ÌÏÏÐ ; : DOKUMENT ( FROM TO --) ÐRTER LOCK ÏUTPUT PUSH ÐRINTER 1/8" 1+ OVER - 3 /MOD ?DUP ÉÆ SWAP >R 0 ÄÏ 3 NSCR'S PAGE ÌÏÏÐ R> ÔÈÅÎ ?DUP ÉÆ NSCR'S PAGE ÔÈÅÎ DROP ÐRTER UNLOCK ; \ 2SCR'S NSCR'S THRU KS 28JUL85RE) ÆORTH DEFINITIONS $40 Ü ÃONSTANT Ã/Ì Ü : 2SCR'S ( BLK1 BLK2 --) PCR ÌÆ ÌÆ 10CPI +DARK $12 SPACES OVER 3 .R $20 SPACES DUP 3 .R CR 17CPI -DARK $10 Ã/Ì * 0 ÄÏ CR OVER BLOCK É + Ã/Ì 6 SPACES TYPE 2 SPACES DUP BLOCK É + Ã/Ì -TRAILING TYPE Ã/Ì +ÌÏÏÐ 2DROP CR ; Ü : NSCR'S ( BLK1 N -- BLK2) UNDER 0 ÄÏ 2DUP DUP ROT + 2SCR'S 1+ ÌÏÏÐ NIP ; : 64PTHRU ( FROM TO --) ÐRTER LOCK >ASCII PUSH >ASCII OFF ÏUTPUT PUSH ÐRINTER 1/6" 1+ OVER - 1+ -2 AND 6 /MOD ?DUP ÉÆ SWAP >R 0 ÄÏ 3 NSCR'S 2+ 1+ PAGE ÌÏÏÐ R> ÔÈÅÎ ?DUP ÉÆ 1+ 2/ NSCR'S PAGE ÔÈÅÎ DROP ÐRTER UNLOCK ; \ PFINDEX 02OCT87RE ÏNLYFORTH ÐRINT ALSO : PFINDEX ( FROM TO --) ÐRTER LOCK ÐRINTER &12 "LONG +JUMP FINDEX CR PAGE -JUMP ÐRTER UNLOCK DISPLAY ; \ ÐRINTSPOOL 02OCT87RE \NEEDS TASKS .( ÔASKER?!) \\ $100 $100 ÔASK ÐRINTSPOOL : SPOOL ( FROM TO --) ÐRINTSPOOL 2 PASS PTHRU STOP ; : ENDSPOOL ( --) ÐRINTSPOOL ACTIVATE STOP ; \ ÐRINTER ÒOUTINE Ã1526 CAS16AUG06 ( NOT USEABLE FOR ÐRINTSPOOL!! RE) ÏNLYFORTH ÖOCABULARY ÐRINT ÐRINT ALSO ÄEFINITIONS : PRINIT 4 7 BUSOUT ; \NEEDS ÆÆ : ÆÆ NOOP ; : ÃÒÅÔ $D BUS! ; : PSPACES ( N -) 0 ?ÄÏ ÂÌ BUS! ÌÏÏÐ ; 1 2 +THRU ÏNLY ÆORTH ALSO ÄEFINITIONS ( SAVE ) \ ÐRINTER INTERFACE 1526 02OCT87RE ÖARIABLE ÐCOL ÖARIABLE ÐROW Ü : PEMIT BUS! 1 ÐCOL +! ; Ü : PCR ÃÒÅÔ 1 ÐROW +! 0 ÐCOL ! ; Ü : PDEL ; Ü : PPAGE ÆÆ 0 ÐROW ! 0 ÐCOL ! ; Ü : PAT ( ZEILE SPALTE -- ) OVER ÐROW @ < ÉÆ PPAGE ÔÈÅÎ 0 ROT ÐROW @ - BOUNDS ?ÄÏ PCR ÌÏÏÐ DUP ÐCOL @ - PSPACES ÐCOL ! ; Ü : PAT? ÐROW @ ÐCOL @ ; Ü : PTYPE ( ADR COUNT -) DUP ÐCOL +! BOUNDS ?ÄÏ É C@ BUS! ÌÏÏÐ ; Ü ÏUTPUT: >PRINTER PEMIT PCR PTYPE PDEL PPAGE PAT PAT? ; ÆORTH DEFINITIONS : PRINTER PRINIT >PRINTER ; : DISPLAY CR BUSOFF DISPLAY ; \ PRINTER ROUTINEN 20OCT87RE ÏNLY ÆORTH ALSO DEFINITIONS 4 ÃONSTANT Â/SCR : .LINE ( LINE# SCR# --) BLOCK SWAP C/L * + C/L 1- TYPE ; : .=== C/L 1- 0 ÄÏ ÁSCII = EMIT ÌÏÏÐ ; : PRLIST ( SCR# --) DUP BLOCK DROP PRINTER $Å EMIT ." ÓCREEN ÎR. " DUP . $14 EMIT CR .=== L/S 0 ÄÏ É OVER .LINE CR ÌÏÏÐ DROP .=== CR CR CR DISPLAY ; \ ÃÐ-80 ÐRINTER LOADSCREEN CLV14OCT87 ÏNLYFORTH HEX ÖOCABULARY ÐRINT ÐRINT DEFINITIONS ALSO ÃREATE ÐRTER 2 ALLOT ( ÓEMAPHOR) 0 ÐRTER ! \ ÐRTER UNLOCK /CLV 1 6 +THRU ÏNLY ÆORTH ALSO DEFINITIONS ( CLEAR ) \ P! CTRL: ÅÓà ESC: 07MAY85MAWE) ÐRINT DEFINITIONS : P! ( 8B -) ÂÅÇÉÎ PAUSE $ÄÄ0Ä C@ $10 AND ÕÎÔÉÌ $ÄÄ01 C! ; Ü : CTRL: (  -) ÃREATE C, DOES> ( -) C@ P! ; 07 CTRL: ÂÅÌ Ü $7Æ CTRL: ÄÅÌ Ü $0Ä CTRL: ÃÒÅÔ Ü $1 CTRL: ÅÓà $0Á CTRL: ÌÆ $0à CTRL: ÆÆ Ü : ESC: (  -) ÃREATE C, DOES> ( -) ÅÓà C@ P! ; $30 ESC: 1/8" $31 ESC: 1/10" $32 ESC: 1/6" $20 ESC: GORLITZ Ü : ÅÓÃ2 ÅÓà P! P! ; ( PRINTER CONTROLS 07MAY85MAWE) $0E ESC: +WIDE $14 ESC: -WIDE $45 ESC: +DARK $46 ESC: -DARK $47 ESC: +DUB $48 ESC: -DUB $0F ESC: +COMP $12 ESC: -COMP : +UNDER 1 $2Ä ESC2 ; : -UNDER 0 $2Ä ESC2 ; ( PRINTER CONTROLS 07MAY85MAWE) $54 ESC: SUOFF : SUPER 0 $53 ÅÓÃ2 ; : SUB 1 $53 ÅÓÃ2 ; : LINES ( LINES -) $43 ÅÓÃ2 ; : "LONG ( INCHES -) 0 LINES P! ; : AMERICAN 0 $52 ÅÓÃ2 ; : GERMAN 2 $52 ÅÓÃ2 ; : PSPACES ( N -) 0 SWAP BOUNDS ?ÄÏ ÂÌ P! ÌÏÏÐ ; Ü : INITPORT 0 $ÄÄ01 C! $ÆÆ $ÄÄ03 C! ; : PRINIT INITPORT AMERICAN SUOFF 1/6" &12 "LONG ÃÒÅÔ ; ( ÃÐ80 PRINTER INTERFACE 26MAR85RE) Ü ÖARIABLE UNCHANGED? UNCHANGED? OFF Ü : C>A ( 8B0 - 8B1) UNCHANGED? @ ?EXIT DUP $41 $5 UWITHIN ÉÆ $20 OR EXIT ÔÈÅÎ DUP $Ã1 $Ä UWITHIN ÉÆ $7Æ AND EXIT ÔÈÅÎ DUP $Äà $Å0 UWITHIN ÉÆ $Á0 XOR ÔÈÅÎ ; ( PRINT PL 06MAY85WE) ÖARIABLE ÐCOL ÖARIABLE ÐROW Ü : PEMIT C>A P! 1 ÐCOL +! ; Ü : PCR ÃÒÅÔ 1 ÐROW +! 0 ÐCOL ! ; Ü : PDEL ÄÅÌ -1 ÐCOL +! ; Ü : PPAGE ÆÆ 0 ÐROW ! 0 ÐCOL ! ; Ü : PAT ( ZEILE SPALTE -- ) OVER ÐROW @ < ÉÆ PPAGE ÔÈÅÎ 0 ROT ÐROW @ - BOUNDS ?ÄÏ PCR ÌÏÏÐ DUP ÐCOL @ - PSPACES ÐCOL ! ; Ü : PAT? ÐROW @ ÐCOL @ ; Ü : PTYPE ( ADR COUNT -) DUP ÐCOL +! BOUNDS ?ÄÏ É C@ C>A P! ÌÏÏÐ ; Ü ÏUTPUT: >PRINTER PEMIT PCR PTYPE PDEL PPAGE PAT PAT? ; ÆORTH DEFINITIONS : ÐRINTER PRINIT >PRINTER ; ( 3SCR'S NSCR'S THRU KS07MAY85MAWE) ÆORTH DEFINITIONS Ü : 3SCR'S ( BLK -) CR -COMP +DARK $ SPACES DUP 3 .R $19 SPACES DUP 1+ 3 .R $19 SPACES DUP 2+ 3 .R CR +COMP -DARK Ì/Ó Ã/Ì * 0 ÄÏ CR 5 SPACES DUP BLOCK É + Ã/Ì 1- TYPE 8 SPACES DUP 1+ BLOCK É + Ã/Ì 1- TYPE 8 SPACES DUP 2+ BLOCK É + Ã/Ì 1- TYPE Ã/Ì +ÌÏÏÐ DROP CR ÌÆ ; Ü : NSCR'S ( BLK1 N - BLK2) UNDER 0 ÄÏ DUP 3SCR'S OVER + ÌÏÏÐ NIP ; : PTHRU ( FROM TO -) ÏUTPUT @ -ROT ÐRINTER ÐRTER LOCK 1/8" 1+ OVER - 1+ 9 /MOD ?DUP ÉÆ SWAP >R 0 ÄÏ 3 NSCR'S PAGE ÌÏÏÐ R> ÔÈÅÎ ?DUP ÉÆ 1- 3 / 1+ 0 ÄÏ DUP 3SCR'S 3 + ÌÏÏÐ ÔÈÅÎ DROP ÐRTER UNLOCK ÏUTPUT ! ; \\ ÌONGÊSR FOR Ã16 CAS16AUG06 ÍEMORY MODEL $0000 - $8000 : ÌOWÒÁÍ $8000 - $FFFF : ÈIGHÒÁÍ & ÒÏÍ SWITCH TO ÒÁÍ ÓWITCH TO ÒÏÍ SYS CAN BE USED LIKE JSR ÒÏÍ-ÃALL LIKE '0FFD2 SYS' ROM JSR RAM == $FF3E STA JSR $FF3F STA NOT POSSIBLE IF ÈÅÒÅ > $8000 ÇUESS WHY? --- ÏN THE Ã64 ÂÁÓÉà AND ÏÓ CAN BE BANKED SEPERATLY. ÔHIS MACROS ARE ONLY NEEDED FOR THE BASIC ÒÏÍ \\ ÌONGÊSR FOR Ã16 CAS16AUG06 ×ÁÒÎÉÎÇ! ÓYSTEMCRASH IF USED INCORRECT THIS MAKRO MUST BE UNDER $8000 A CALL LIKE ' $FFD2 SYSÍACRO' WILL GENERATE PHA $FF # LDA ÌÏÎÇ1 2+ STA $D2 # LDA ÌÏÎÇ1 1+ STA PLA ÌÏÎÇ JSR CALL IN ÒÏÍ WILL BE DONE WITH A DETOUR SYS DECIDED IF DIRECT OR INDIRECT CALL ×ÁÒÎÉÎÇ! ÚERO-ÆLAG WILL BE DESTROYED! ( TRANSIENT ÆORTH-6502 ÁSSEMCLCAS16AUG06 ( ÂASIS: ÆORTH ÄIMENSIONS ÖÏÌ ÉÉÉ ÎO. 5) ÔHE ÁSSEMBLER WILL BE LOADED COMPLETELY INTO THE ÈÅÁÐ AND IS ONLY USABLE TILL THE NEXT 'CLEAR' OR 'SAVE', AFTER THAT HE IS COMPAVOLKSFORTH 3.8-3  U3 2A    ÿLETE REMOVED FROM THE MEMORY. ÙOU CANNOT USE IT, BUT IT ALSO DON'T EATS UP VALUABLE MEMORY. \ FREE CAS16AUG06 \\ FOR TRACER:LOADSCREEN CAS16AUG06 ÔOÄO ***ÆOR THE NEXT VOLKS4TH VERSION **** ÓYNC <ÉÐ ÉÐ>-HANDLING WITH ÁTARI AND ÃÐÍ HERE SOME EXAMPLES TO TEST Ü : AA DUP DROP ; Ü : BB AA ; \\ DEBUG BB TRACE' AA TRACE' ÆORTH ÉÐ 2INC IS DONE ON ÃÂÍ-ÁTARI BEFORE OR AFTER \\ FOR TRACER:WCMP VARIABLES CAS16AUG06 USED LIKE THIS ADR1 ADR2 WCMP COMPARES WHOLE WORD, RESULT IS ÃARRY=1 : (ADR1) >= (ADR2) ÃARRY=0 : (ADR1) < (ADR2) ALL OTHER FLAGS ARE NOT DEFINED ÔEMPORARY STORAGE FOR × AREA TO BE TRACED ÆLAG: TRACE WORD ÆLAG: TRACE YES?NO UNKNOWN LEVEL OF NESTING \ FOR TRACER:CPUSH ONELINE CAS16AUG06 SAVES ÌÅÎ BYTES FROM ÁÄÄÒ ON THE RETURN STACK. THE NEXT ÕÎÎÅÓÔ OR ÅØÉÔ WILL PLACE THEM BACK ÍAIN LOOP COMMAND CAN BE ENTERED GETS AREA TO TRACE \ FOR TRACER:STEP TNEXT CAS16AUG06 WILL BE USED AT THE END OF ÔÎÅØÔ, TO ENABLE ÔÒÁÐ? AGAIN AND TO FIX THE BROKEN ÎÅØÔ-ÒOUTINE ÔHIS ÒOUTINE WILL BE PATCHED ON ÎÅØÔ AND IS THE KEY PART OF THE TRACER IF NO TRACED: TRACE CURRENT ×ÏÒÄ? NO: IS ÉÐ INSIDE THE DEBUG AREA? NO: THEN GO YES: DELETE HALF! PART DISABLE TRAP? ( THE TRACER SHOULDN'T TRACE ITSELF ) \ TRACER:..TNEXT CAS16AUG06 ÆORTH-ÐART OF ÔÎÅØÔ TRACE INTO CURRENT ×ÏÒÄ? YES: PUSH ÄÅÂÕÇ AREA, INCREMENT NEW NESTINGLEVEL ÓÔÅÐ SHOULD BE EXECUTED LATER ÐÕÓÈED ALL IMPORTANT DATA PRINT INFORMATION LINE ÐÕÓÈED MORE DATA ÐÕÓÈED THE ÒETURN-ÓTACK-ÐOINTER !! AND PRETENDS AN EMPTY ÒETURN-ÓTACK CONNECTS ÏÎÅÌÉÎÅ INTO THE ÍÁÉÎ-ÃÏÍÍÁÎÄ-ÌÏÏÐ AND CALLS IT \ TRACER:DO-TRACE TRACEABLE CAS16AUG06 INSTALLS (PATCHED) ÔÎÅØÔ INTO ÎÅØÔ (ÎÅØÔ IS THE INNERST ÒOUTINE, THAT ENDS EVERY WORD DEFINITION) CHECKS, WETHR A WORD CAN BE TRACED AND LOOKS UP ITS ADDRESS : -DEF. <ÉÐ=CFA+2 ÉÎÐÕÔ: -DEF. <ÉÐ FROM INPUT-ÖEKTOR ÏÕÔÐÕÔ:-DEF. <ÉÐ FROM OUTPUT-ÖEKTOR ÄÅÆÅÒ -DEF. <ÉÐ FROM [CFA+2] ÄÏÅÓ> -DEF. <ÉÐ=[CFA]+3 ALL OTHER DEFINITIONS WON'T WORK \ TRACER:USER WORDS CAS16AUG06 ÎÅÓÔ ENTERS A WORD FOR TRACING ÕÎÎÅÓÔ CONTINUES PROGRAM EXECUTION TO THE END OF TRACED WORD ÅÎÄÌÏÏÐ START TRACING AFTER NEXT WORD (USABLE INSIDE LOOPS) ÕÎÂÕÇ DISABLES TRACING ÄÅÂÕÇ MARKS THE WORD TO BE TRACED. ÉF IS CALLED, THE TRACER KICKS IN ÔÒÁÃÅ' WILL CALL AND START TRACE. \\ TOOLS FOR DECOMPIL CAS16AUG06 \ IF THE WORD : TEST 5 0 ÄÏ ." DO YOU LIKE ME?" KEY ÁSCII Y = ÉÆ ." YOUR FAULT " LEAVE ÅÌÓÅ ." YES SURE! " ÔÈÅÎ ÌÏÏÐ ." !" ; \\ SHOULD BE INSPECTED, PLEASE TURN PAGE..> \ TOOLS FOR DECOMPIL CAS16AUG06 CR TOOLS TRACE' TEST \ CAS16AUG06 SET ORDER TO ÆÏÒÔÈ ÆÏÒÔÈ ÏÎÌÙ ÆÏÒÔÈ FOR MULTITASKING ÃENTRONICS-ÉNTERFACE ON ÕSER-ÐORT (S ÔEXT TILL ) WILL BE SKIPPED SERIAL ÉNTERFACE (COMMENTED OUT) (U ÔEXT TILL ) WILL BE SKIPPED LOAD NEXT SCREEN ONLY FOR SERIAL BUS REMOVE UNNEDED WORD HEADERS \ ×HEN USING THE SERIAL CAS16AUG06 BUS, SENDIND CHARS ONE BY ONE IS TOO SLOW ÂUFFER FOR CHRS TO SEND TO PRINTER ADD CHAR TO BUFFER ÂUFFER FULL? PRINT BUFFER AND CLEAN ÍAINROUTINE TO SEND TO SERIAL BUS STORE CHAR IS ÆORMFEED? YES, PRINT BUFFER INCL. ÆORMFEED IS ÌINEFEED? OR ÃÒ, OR IS THE BUFFER FILLED? YES, PRINT BUFFER AND ÃÒ/ÌÆ MARKED \ CAS16AUG06 ÍAINROUTINE FOR CENTRONICS INTRFACE SEND CHAR TO PORT , EMIT ÓTROBE-ÅDGE WAIT FOR ÂUSY-ÓIGNAL TO DISAPPEAR SEND CONTROLCODES TO PRINTR ÃONTROLCODES FOR ÐRINTER IN ÈEX REPRESENTATION ÁDJUST IF NEEDED! SEND ÅÓÃ-ÓEQUENCE TO PRINTER ÌINEFEED IN ÉNCH DISABLE ÓUPERSCRIPT AND ÓUBSCRIPT SKIP PERFORATION ON/OFF \ CAS16AUG06 ÅSCAPE + 2 ÃHARS ONLY FOR ÇOERLITZ-ÉNTERFACE SPECIAL ÅPSON-ÃONTROLMODE ÃOPY OF ÐRINTER-ÃONTROL-ÒEGISTER SWITCH ÂIT IN CONTROL REGISTER ON SWITCH ÂIT IN CONTROL REGISTER OFF ÔHESE ÃONTROLCODES NEED TO BE ADJUSTED FOR OTHER PRINTERS WITH CTRL: ÅÓÃ2 AND PRN ÌINEWIDTH IN CHARACTERS PER INCH REPLACE WITH ÅLITE, ÐICA OR ÃOMPRESS IF NEEDED \ CAS16AUG06 ADJUST THESE IF NEEDED ÃALL AS 66 LINES ÃALL AS 11 "LONG ÆONTS, CAN BE EXTENDED ÉNITIALIZING ... . FOR ÇOERLITZ-ÉNTERFACE . FOR ÃENTRONICS: ÐORT  ON SEND ÐÁ2 ON SEND FOR ÓTROBE ÆLAG FOR CHAR-CONVERT ENABLE PRINTER WITH STANDARDVALUES CAS16AUG06 CONVERT ÃOMMODORE'S ÓPECIAL-ÁSCII IN STANDARD ÁÓÃÉÉ ÒOUTINES FOR PRINTING COMMAND SEND CHR TO PRINTER EMIT ÃÒ AND ÌÆ TO PRINTER CR DELETE CHAR (?!) DEL EMIT FORMFEED PAGE POSITION PROTERHEAD ON COLUMN AT AND ROW, NEW PAGE IF NECESSARY GET PRINTHEAD POSITION AT? EMIT STRING TYPE CAS16AUG06 CREATE OUTPUTTABLE >PRINTER ÒOUTINES FOR PRINTER AND SCREEN (BOTH) ÏUTPUT FIRST ON ÓCREEN ( ÒOUTINES FROM ÄÉÓÐÌÁÙ ) AND ON PRINTER ( ÒOUTINES FROM >ÐÒÉÎÔÅÒ ) CREATE OUTPUTTABLE >BOTH WORDS ARE AVALABLE FROM ÆORTH SWITCH OUTPUT TO PRINTER SWITCH OUTPUT TO SCREEN AND PRINTER CAS16AUG06 PRINT TWO SCREEN SIDE BY SIDE SCREENNUMBER IN BOLD AND 17CPI FORMATTED OUTPUT OF BOTH ÓCREENS WILL PRINT SCREEN THIS: 1 3 WAY 2 4 PRINTS SCRREN FROM TO STORE ÏUTPUTDEVICE AND ENABLE PRINTER CALCULATE PRINTPOSITION FOR EACH ÓCREEN AND PRINT ACCORDING TO LAYOUT CAS16AUG06 LIKE 2SCR'S (WITH ÓHADOW) LIKE NSCR'S (WITH ÓHADOW) SCREEN ÓHADOW SCR+1 ÓH+1 LIKE PTHRU (WITH ÓHADOW) CAS16AUG06 SAME AGAIN FOR STANDARD FORTH SCREENS WITH 16 LINES AND 64 CHARS SEE ABOVE LIKE PTHRU, BUT FOR STANDARD SCREENS CAS16AUG06 PRINT FAST INDEX ON PRINTER 12" ÐAPIERSIZE SKIP PERFORATION ÂACKGROUND PRINT CAS16AUG06 ÍULTITASKER IS NEEDED ÃREATE WORKAREA FOR TASK ENABLE BACKGROUD PRINTING FROM TO WILL BE PASSED TO TASK ON NEXT ÐÁÕÓÅ THE TASK WILL EXECUTE PTHRU AND WILL GO TO SLEEP ABORT BACKGROUND TASK TASK WILL BE ACTIVATED TO GO TO SLEEP AGAIN IMMEDITALY \\ ÐRINTER INTERFACE 1526 CAS16AUG06 ÔHIS DRIVER ALSO WORKS WITH: Ã16 & ÃÉÔÉÚÅÎ-100ÄÍ \ SEE ÈANDBOOK ÆÆ : ÆORMFEED IS MISSING HERE CLV14OCT87 \ No newline at end of file diff --git a/tools/testdata/testshadow.fth b/tools/testdata/testshadow.fth new file mode 100644 index 0000000..ed521b8 --- /dev/null +++ b/tools/testdata/testshadow.fth @@ -0,0 +1,2380 @@ + +\ *** Block No. 0, Hexblock 0 + +\\ Directory ultraFORTH 3of4 26oct87re + +. &0 +.. &0 +rom-ram-sys &2 +Transient-Assembler &4 +Assembler-6502 &5 +2words &14 +unlink &15 +scr<>cbm &16 +(search &17 +Editor &19 +.blk &46 +Tracer/Tools &47 +Multi-Tasker &57 +EpsonRX80 &63 +VC1526 &75 +CP-80 &78 + + + + + + + + +\ *** Block No. 1, Hexblock 1 + +\\ Content volksForth 3.81.02 cas16aug06 + + +rom ram sys 2 - 3 +Transient Assembler 4 +Assembler-6502 5 - 12 + 13 free +2words 14 +unlink 15 +scr<>cbm 16 +(search 17 +Editor 19 +.blk 46 +Tracer Tools 47 +Multi-Tasker 57 +Printer: EpsonRX80 63 +Printer: VC1526 75 +Printer: CP-80 78 + +Shadows 85 ... + + + + + + +\ *** Block No. 2, Hexblock 2 + +\ rom ram sys cas16aug06 \ \\ LongJsr for C16 cas16aug06 +\ Shadow with Ctrl+W---> + +\ needed for jumps \ Memory model +\ in the ROM Area + \ $0000 - $8000 : LowRAM +Assembler also definitions \ $8000 - $ffff : HighRAM & ROM +(16 \ Switch Bank 8000-FFFF +: rom here 9 + $8000 u> abort" not here" \ switch to RAM Switch to ROM + $ff3e sta ; \ sys can be used like jsr +: ram $ff3f sta ; +: sys rom jsr ram ; +\ if suffering from abort" not here" \ ROM-Call like '0ffd2 sys' +\ see next screen Screen --> C) + \ rom jsr ram == $ff3e sta jsr $ff3f sta + +(64 \ Switch Bank A000-BFFF \ not possible if HERE > $8000 +: rom here 9 + $A000 u> abort" not here" \ Guess why? + $37 # lda 1 sta ; +: ram $36 # lda 1 sta ; \ --- On the C64 BASIC and OS can be +C) \ banked seperatly. This macros are + \ only needed for the basic ROM + + + + +\ *** Block No. 3, Hexblock 3 + +\ sysMacro Long cas16aug06 \ \\ LongJsr for C16 cas16aug06 + +(64 .( not for C64 !) \\ C) \ WARNING! Systemcrash if used incorrect + +\ for advanced users, use macros + +here $8000 $20 - u> ?exit \ not possible \ this makro must be under $8000 + + \ a call like ' $ffd2 sysMacro' +' 0 | Alias ??? \ will generate + \ pha +Label long ROM \ $ff # lda LONG1 2+ sta +Label long1 ??? jsr RAM rts end-code \ $d2 # lda LONG1 1+ sta + \ pla LONG jsr +| : sysMacro ( adr -- ) \ call in ROM will be done with a detour + $100 u/mod pha # lda long1 2+ sta + # lda long1 1+ sta pla long jsr ; + \ sys decided if direct or indirect call +: sys ( adr -- ) \ for Jsr to ROM + here 9 + $8000 u> + IF sysMacro ELSE sys THEN ; + \ WARNING! Zero-Flag will be destroyed! + + + + +\ *** Block No. 4, Hexblock 4 + +\ transient Assembler clv10oct87 \ ( transient Forth-6502 Assemclcas16aug06 + \ ( Basis: Forth Dimensions VOL III No. 5) +\ Basis: Forth Dimensions VOL III No. 5) + \ The Assembler will be loaded completely +\ internal loading 04may85BP/re) \ into the HEAP and is only usable till + \ the next 'clear' or 'save', after that +here $800 hallot heap dp ! \ he is complete removed from the memory. + \ You cannot use it, but it also don't + 1 +load \ eats up valuable memory. + +dp ! + +Onlyforth + + + + + + + + + + + + + +\ *** Block No. 5, Hexblock 5 + +\ Forth-6502 Assembler clv10oct87 + +\ Basis: Forth Dimensions VOL III No. 5) + +Onlyforth Assembler also definitions + +1 7 +thru + -3 +load \ Makros: rom ram sys + +Onlyforth + + + + + + + + + + + + + + + + +\ *** Block No. 6, Hexblock 6 + +\ Forth-83 6502-Assembler 20oct87re + +: end-code context 2- @ context ! ; + +Create index +$0909 , $1505 , $0115 , $8011 , +$8009 , $1D0D , $8019 , $8080 , +$0080 , $1404 , $8014 , $8080 , +$8080 , $1C0C , $801C , $2C80 , + +| Variable mode + +: Mode: ( n -) Create c, + Does> ( -) c@ mode ! ; + +0 Mode: .A 1 Mode: # +2 | Mode: mem 3 Mode: ,X +4 Mode: ,Y 5 Mode: X) +6 Mode: )Y $F Mode: ) + + + + + + + +\ *** Block No. 7, Hexblock 7 + +\ upmode cpu 20oct87re + +| : upmode ( addr0 f0 - addr1 f1) + IF mode @ 8 or mode ! THEN + 1 mode @ $F and ?dup IF + 0 DO dup + LOOP THEN + over 1+ @ and 0= ; + +: cpu ( 8b -) Create c, + Does> ( -) c@ c, mem ; + + 00 cpu brk $18 cpu clc $D8 cpu cld +$58 cpu cli $B8 cpu clv $CA cpu dex +$88 cpu dey $E8 cpu inx $C8 cpu iny +$EA cpu nop $48 cpu pha $08 cpu php +$68 cpu pla $28 cpu plp $40 cpu rti +$60 cpu rts $38 cpu sec $F8 cpu sed +$78 cpu sei $AA cpu tax $A8 cpu tay +$BA cpu tsx $8A cpu txa $9A cpu txs +$98 cpu tya + + + + + + +\ *** Block No. 8, Hexblock 8 + +\ m/cpu 20oct87re + +: m/cpu ( mode opcode -) Create c, , + Does> + dup 1+ @ $80 and IF $10 mode +! THEN + over $FF00 and upmode upmode + IF mem true Abort" invalid" THEN + c@ mode @ index + c@ + c, mode @ 7 and + IF mode @ $F and 7 < + IF c, ELSE , THEN THEN mem ; + +$1C6E $60 m/cpu adc $1C6E $20 m/cpu and +$1C6E $C0 m/cpu cmp $1C6E $40 m/cpu eor +$1C6E $A0 m/cpu lda $1C6E $00 m/cpu ora +$1C6E $E0 m/cpu sbc $1C6C $80 m/cpu sta +$0D0D $01 m/cpu asl $0C0C $C1 m/cpu dec +$0C0C $E1 m/cpu inc $0D0D $41 m/cpu lsr +$0D0D $21 m/cpu rol $0D0D $61 m/cpu ror +$0414 $81 m/cpu stx $0486 $E0 m/cpu cpx +$0486 $C0 m/cpu cpy $1496 $A2 m/cpu ldx +$0C8E $A0 m/cpu ldy $048C $80 m/cpu sty +$0480 $14 m/cpu jsr $8480 $40 m/cpu jmp +$0484 $20 m/cpu bit + + + +\ *** Block No. 9, Hexblock 9 + +\ Assembler conditionals 20oct87re + +| : range? ( branch -- branch ) + dup abs $7F u> Abort" out of range " ; + +: [[ ( BEGIN) here ; + +: ?] ( UNTIL) c, here 1+ - range? c, ; + +: ?[ ( IF) c, here 0 c, ; + +: ?[[ ( WHILE) ?[ swap ; + +: ]? ( THEN) here over c@ IF swap ! + ELSE over 1+ - range? swap c! THEN ; + +: ][ ( ELSE) here 1+ 1 jmp + swap here over 1+ - range? swap c! ; + +: ]] ( AGAIN) jmp ; + +: ]]? ( REPEAT) jmp ]? ; + + + + +\ *** Block No. 10, Hexblock a + +\ Assembler conditionals 20oct87re + +$90 Constant CS $B0 Constant CC +$D0 Constant 0= $F0 Constant 0<> +$10 Constant 0< $30 Constant 0>= +$50 Constant VS $70 Constant VC + +: not $20 [ Forth ] xor ; + +: beq 0<> ?] ; : bmi 0>= ?] ; +: bne 0= ?] ; : bpl 0< ?] ; +: bcc CS ?] ; : bvc VS ?] ; +: bcs CC ?] ; : bvs VC ?] ; + + + + + + + + + + + + + +\ *** Block No. 11, Hexblock b + +\ 2inc/2dec winc/wdec 20oct87re + +: 2inc ( adr -- ) + dup lda clc 2 # adc + dup sta CS ?[ swap 1+ inc ]? ; + +: 2dec ( adr -- ) + dup lda sec 2 # sbc + dup sta CC ?[ swap 1+ dec ]? ; + +: winc ( adr -- ) + dup inc 0= ?[ swap 1+ inc ]? ; + +: wdec ( adr -- ) + dup lda 0= ?[ over 1+ dec ]? dec ; + +: ;c: + recover jsr end-code ] 0 last ! 0 ; + + + + + + + + +\ *** Block No. 12, Hexblock c + +\ ;code Code code> bp/re03feb85 + +Onlyforth + +: Assembler + Assembler [ Assembler ] mem ; + +: ;Code + [compile] Does> -3 allot + [compile] ; -2 allot Assembler ; +immediate + +: Code Create here dup 2- ! Assembler ; + +: >label ( adr -) + here | Create immediate swap , + 4 hallot heap 1 and hallot ( 6502-alig) + here 4 - heap 4 cmove + heap last @ count $1F and + ! dp ! + Does> ( - adr) @ + state @ IF [compile] Literal THEN ; + +: Label + [ Assembler ] here >label Assembler ; + + +\ *** Block No. 13, Hexblock d + +\ free cas16aug06 \ \ free cas16aug06 + + + + + + + + + + + + + + + + + + + + + + + + + +\ *** Block No. 14, Hexblock e + +\ 2! 2@ 2variable 2constant clv20aug87re + +Code 2! ( d adr --) + tya setup jsr 3 # ldy + [[ SP )Y lda N )Y sta dey 0< ?] + 1 # ldy Poptwo jmp end-code + +Code 2@ ( adr -- d) + SP X) lda N sta SP )Y lda N 1+ sta + SP 2dec 3 # ldy + [[ N )Y lda SP )Y sta dey 0< ?] + xyNext jmp end-code + +: 2Variable ( --) Create 4 allot ; + ( -- adr) + +: 2Constant ( d --) Create , , + Does> ( -- d) 2@ ; + +\ 2dup exists +\ 2swap exists +\ 2drop exists + + + + +\ *** Block No. 15, Hexblock f + +\ unlink clv20aug87re + +$FFF0 >label plot + +(64 + +Code unlink ( -- ) + $288 lda $80 # ora tay txa + [[ $D9 ,X sty clc $28 # adc + CS ?[ iny ]? inx $1A # cpx 0= ?] + $D3 lda $28 # cmp + CS ?[ $28 # sbc $D3 sta ]? + $D3 ldy $D6 ldx clc plot jsr C) + +(16 : unlink 0 0 $7EE 2! ; C) + +Label setptrs + 0 # ldx 1 # ldy Next jmp end-code + + + + + + + + +\ *** Block No. 16, Hexblock 10 + +\ changing codes cas16aug06 + +( mapping commodore screen codes ) + + +Label (scr>cbm + N 6 + sta $3F # and N 6 + asl + N 6 + bit 0< ?[ $80 # ora ]? + VC ?[ $40 # ora ]? rts + +Label (cbm>scr + N 6 + sta $7F # and $20 # cmp + CS ?[ $40 # cmp + CS ?[ $1F # and N 6 + bit + 0< ?[ $40 # ora ]? ]? rts ]? + Ascii . # lda rts + +Code cbm>scr ( 8b1 -- 8b2) + SP X) lda (cbm>scr jsr SP X) sta + Next jmp end-code + +Code scr>cbm ( 8b1 -- 8b2) + SP X) lda (scr>cbm jsr SP X) sta + Next jmp end-code + + +\ *** Block No. 17, Hexblock 11 + +\ fast search cas16aug06 + +\needs Code -$D +load \ Trans Assembler + +Onlyforth + + ' 0< @ 4 + >label puttrue +puttrue 3 + >label putfalse + +Code (search +( text tlen buffer blen -- adr tf / ff) + 7 # ldy + [[ SP )Y lda N ,Y sta dey 0< ?] + [[ N 4 + lda N 5 + ora 0<> ?[ + [[ N lda N 1+ ora 0<> ?[ + N 2+ X) lda N 6 + X) cmp swap + 0<> ?[[ N wdec N 2+ winc ]]? + +--> + + + + + + + +\ *** Block No. 18, Hexblock 12 + +\ Edior fast search cas16aug06 + + 7 # ldy + [[ N ,Y lda SP )Y sta dey 0< ?] + [[ N 2+ winc N 6 + winc N wdec + N 4 + wdec N 4 + lda N 5 + ora + 0= ?[ SP lda clc 4 # adc SP sta + CS ?[ SP 1+ inc ]? + 3 # ldy N 3 + lda SP )Y sta + N 2+ lda dey SP )Y sta dey + puttrue jmp ]? + N lda N 1+ ora 0= ?[ + 3 roll 3 roll ]? ]? + SP lda clc 6 # adc SP sta + CS ?[ SP 1+ inc ]? 1 # ldy + putfalse jmp ]? + N 2+ X) lda N 6 + X) cmp 0= not ?] + 7 # ldy + [[ SP )Y lda N ,Y sta dey 0< ?] + N wdec N 2+ winc + ( next char as first ) ]] end-code + + + + + +\ *** Block No. 19, Hexblock 13 + +\ Editor loadscreen clv13jul87 +\ Idea and first implementation: WE/re + +Onlyforth +\needs .blk $1B +load \ .blk +\needs Code -$F +load \ Assembl +\needs (search -2 +load \ (search + +Onlyforth +(64 | : at at curoff ; C) \ sorry + +\needs 2variable -5 +load +\needs unlink -4 +load \ unlink +\needs scr>cbm -3 +load \ cbm>Label scradr +(64 $d800 C) (16 $800 C) >Label coladr + +$d1 (16 drop $c8 C) | Constant linptr +$d3 (16 drop $ca C) | Constant curofs + +(64 $D020 C) (16 $ff19 C) + | Constant border +(64 $286 C) (16 $53b C) | Constant pen +(64 $d021 C) (16 $ff15 C) + | Constant bkgrnd + + +\ *** Block No. 21, Hexblock 15 + +\ Edi special cmoves cas16aug06 +( thanks to commodore.... ) + +Label incpointer + N lda clc #col 1+ # adc + N sta CS ?[ N 1+ inc ]? + N 2+ lda clc #col # adc + N 2+ sta CS ?[ N 3 + inc ]? rts + +| Code b>sc ( blkadr --) + tya setup jsr + N 2+ stx scradr lda N 3 + sta + #row # ldx + [[ #col 1- # ldy + [[ N )Y lda (cbm>scr jsr + N 2+ )Y sta dey 0< ?] + incpointer jsr dex + 0= ?] + pen lda + [[ coladr ,X sta + coladr $100 + ,X sta + coladr $200 + ,X sta + coladr $300 + ,X sta + inx 0= ?] setptrs jmp end-code + + +\ *** Block No. 22, Hexblock 16 + +\ Edi special cmoves cont. cas16aug06 +( ... for screen format ) + +| Code sc>b ( blkadr --) + tya setup jsr + N 2+ stx scradr lda N 3 + sta + #row # ldx + [[ 0 # ldy + [[ N 2+ )Y lda (scr>cbm jsr + N )Y sta iny #col # cpy CS ?] + dex + 0<> ?[[ + bl # lda N )Y sta + incpointer jsr + ]]? setptrs jmp end-code + +| Code >scrmove ( from to 8bquan --) + 3 # lda setup jsr dey + [[ N cpy 0= ?[ setptrs jmp ]? + N 4 + )Y lda (cbm>scr jsr + N 2+ )Y sta iny 0= ?] end-code + + + + + +\ *** Block No. 23, Hexblock 17 + +\ Edi changed? cas16aug06 + +| Code changed? ( blkadr -- f) + tya setup jsr + N 2+ stx scradr lda N 3 + sta + #row # ldx + [[ #col 1- # ldy + [[ N )Y lda (cbm>scr jsr + N 2+ )Y cmp + 0<> ?[ $FF # lda PushA jmp ]? + dey 0< ?] + incpointer jsr dex + 0= ?] + txa PushA jmp end-code + +| : memtop sp@ #col 2* - ; + + + + + + + + + + +\ *** Block No. 24, Hexblock 18 + +\ Edi c64-specials clv2:jull87 + +| Code scrstart ( -- adr) + txa pha scradr lda Push jmp end-code + + +| Code rowadr ( -- adr) + curofs lda #col # cmp txa + CS ?[ #col 1- # lda ]? + linptr adc pha linptr 1 + lda 0 # adc + Push jmp end-code + +| Code curadr ( -- adr) + clc curofs lda linptr adc pha + linptr 1 + lda 0 # adc Push jmp + end-code +(64 +| Code unlinked? \ -- f + $D5 lda #col # cmp CC ?[ dex ]? + txa PushA jmp end-code C) + + + + + + +\ *** Block No. 25, Hexblock 19 + +\ Edi scroll? put/insert/do clv2:jull87 + +| : blank.end? ( -- f) + scrstart [ b/scr #col - ] Literal + + #col -trailing nip 0= scroll @ or ; + +| : atlast? ( -- f) + curadr scrstart b/scr + 1- = + scroll @ 0= and ; + +| : putchar ( -- f) + char c@ con! false ; + +| : insert ( -- f) + atlast? ?dup ?exit +(64 unlinked? C) (16 true C) + rowadr #col + 1- c@ bl = not and + blank.end? not and dup ?exit + $94 con! ; + +| : dochar ( -- f) + atlast? ?dup ?exit + imode @ IF insert ?dup ?exit + THEN putchar ; + + +\ *** Block No. 26, Hexblock 1a + +\ Edi cursor control cas16aug06 + +| : curdown ( -- f) + scroll @ 0= row #row 2- u> and + dup ?exit $11 con! ; + +| : currite ( -- f) + atlast? dup ?exit $1D con! ; + +' putchar | Alias curup +' putchar | Alias curleft +' putchar | Alias home +' putchar | Alias delete + +| : >""end ( -- ff) + scrstart b/scr -trailing nip + b/scr 1- min #col /mod swap at false ; + +| : +tab ( -- f) + 0 $a 0 DO drop currite dup + IF LEAVE THEN LOOP ; + +| : -tab ( -- f) + 5 0 DO $9D con! LOOP false ; + + +\ *** Block No. 27, Hexblock 1b + +\ Edi cr, clear/newline cas16aug06 + +| : ( -- f) + row 0 at unlink imode off curdown ; + +| : clrline ( -- ff) + rowadr #col bl fill false ; + +| : clrright ( -- ff) + curadr #col col - bl fill false ; + +| : killine ( -- f) + rowadr dup #col + swap + scrstart $3C0 + dup >r + over - cmove + r> #col bl fill false ; + +| : newline ( -- f) + blank.end? not ?dup ?exit + rowadr dup #col + scrstart b/scr + + over - cmove> clrline ; + + + + + +\ *** Block No. 28, Hexblock 1c + +\ Edi character handling cas16aug06 + +| : dchar ( -- f) + currite dup ?exit $14 con! ; + +| : @char ( -- f) + chars 2@ + 1+ lines @ memtop min + u> dup ?exit + curadr c@ chars 2@ + c! + 1 chars 2+ +! ; + +| : copychar ( -- f) + @char ?dup ?exit currite ; + +| : char>buf ( -- f) + @char ?dup ?exit dchar ; + +| : buf>char ( -- f) + chars 2+ @ 0= ?dup ?exit + insert dup ?exit + -1 chars 2+ +! + chars 2@ + c@ curadr c! ; + + + + +\ *** Block No. 29, Hexblock 1d + +\ Edi line handling, imode cas16aug06 + +| : @line ( -- f) + lines 2@ + memtop u> dup ?exit + rowadr lines 2@ + #col cmove + #col lines 2+ +! ; + +| : copyline ( -- f) + @line ?dup ?exit curdown ; + +| : line>buf ( -- f) + @line ?dup ?exit killine ; + +| : !line ( --) + #col negate lines 2+ +! + lines 2@ + rowadr #col cmove ; + +| : buf>line ( -- f) + lines 2+ @ 0= ?dup ?exit + newline dup ?exit !line ; + +| : setimd ( -- f) imode on false ; + +| : clrimd ( -- f) imode off false ; + + +\ *** Block No. 30, Hexblock 1e + +\ Edi the stamp cas16aug06 + +Forth definitions +: rvson $12 con! ; : rvsoff $92 con! ; + +Code ***volksFORTH83*** + Next here 2- ! end-code +: Forth-Gesellschaft [compile] \\ ; +immediate + +Editor definitions +Create stamp$ $12 allot stamp$ $12 erase + +| : .stamp ( -- ff) + stamp$ 1+ count scrstart #col + + over - swap >scrmove false ; + +: getstamp ( --) + input push keyboard stamp$ on + cr ." your stamp: " rvson $10 spaces + row $C at stamp$ 2+ $10 expect + rvsoff span @ stamp$ 1+ c! ; + +| : stamp? ( --) + stamp$ c@ ?exit getstamp ; + +\ *** Block No. 31, Hexblock 1f + +\ Edi the screen# cas16aug06 + +| : savetop ( --) + scrstart pad #col 2* cmove + scrstart #col 2* $A0 fill ; +| : resttop ( --) + pad scrstart #col 2* cmove ; +| : updated? ( scr# -- n) + block 2- @ ; +| : special ( --) + curon BEGIN pause key? UNTIL curoff ; + +| : drvScr ( --drv scr') + scr @ offset @ + blk/drv u/mod swap ; + +| : .scr# ( -- ff) at? savetop rvson + 0 0 at drvScr ." Scr # " . ." Drv " . + scr @ updated? 0= + IF ." not " THEN ." updated" 1 1 at + [ ' ***volksFORTH83*** >name ] Literal + count type 2 spaces + [ ' Forth-Gesellschaft >name ] Literal + count $1F and type + rvsoff at special resttop false ; + + +\ *** Block No. 32, Hexblock 20 + +\ Edi exits cas16aug06 + +| : at?>r# ( --) + at? swap #col 1+ * + r# ! ; + +| : r#>at ( --) + r# @ dup #col 1+ mod #col = - + b/blk 1- min #col 1+ /mod swap at ; + +| : cancel ( -- n) + unlink %0001 at?>r# ; + +| : eupdate ( -- n) + cancel scr @ block changed? + IF .stamp drop scr @ block sc>b + update %0010 or THEN ; + +| : esave ( -- n) eupdate %0100 or ; + +| : eload ( -- n) esave %1000 or ; + + + + + + +\ *** Block No. 33, Hexblock 21 + +\ leaf thru Edi clv01aug87 + +| : elist ( -- ff) + scr @ block b>sc imode off unlink + r#>at false ; + +| : next ( -- ff) + eupdate drop 1 scr +! elist ; + +| : back ( -- ff) + eupdate drop -1 scr +! elist ; + +| : >shadow ( -- ff) + eupdate drop shadow @ dup drvScr nip + u> not IF negate THEN scr +! elist ; + +| : alter ( -- ff) + eupdate drop ascr @ scr @ + ascr ! scr ! elist ; + + + + + + + +\ *** Block No. 34, Hexblock 22 + +\ Edi digits 2oct87re + +Forth definitions + +: digdecode ( adr cnt1 key -- adr cnt2) + #bs case? IF dup IF + del 1- THEN exit THEN + #cr case? IF dup span ! exit THEN + capital dup digit? + IF drop >r 2dup + r@ swap c! + r> emit 1+ exit THEN drop ; + +Input: digits + c64key c64key? digdecode c64expect ; + +Editor definitions + +| : replace ( -- f) + fbuf @ 0 DO #bs con! LOOP + false rbuf @ 0 DO insert or LOOP + dup ?exit + rbuf 2@ curadr swap >scrmove + eupdate drop ; + + + +\ *** Block No. 35, Hexblock 23 + +\ Edi >bufs cas16aug06 + +| : .buf ( adr count --) + type Ascii < emit + #col 1- col - spaces ; + +| : >bufs ( --) + input push + unlink savetop at? rvson + 1 0 at ." replace with: " + at? rbuf 2@ .buf + 0 0 at ." > search: " + at? fbuf 2@ .buf + 0 2 2dup at send @ 3 u.r 2dup at + here 1+ 3 digits expect span @ ?dup + IF here under c! number drop send ! + THEN at send @ 3 u.r keyboard + 2dup at fbuf 2+ @ #col 2- col - expect + span @ ?dup IF fbuf ! THEN + at fbuf 2@ .buf + 2dup at rbuf 2+ @ #col 2- col - expect + span @ ?dup IF rbuf ! THEN + at rbuf 2@ .buf + rvsoff resttop at ; + + +\ *** Block No. 36, Hexblock 24 + +\ Edi esearch clv06aug87 + +| : (f elist drop + fbuf 2@ r# @ scr @ block + + b/blk r# @ - (search 0= + IF 0 ELSE scr @ block - THEN + r# ! r#>at ; + +| : esearch ( -- f) + eupdate drop >bufs + BEGIN BEGIN (f r# @ + WHILE key dup Ascii r = + IF replace ?dup + IF nip exit THEN THEN + 3 = ?dup ?exit + REPEAT drvScr nip send @ - + stop? 0= and ?dup + WHILE 0< IF next drop + ELSE back drop THEN + REPEAT true ; + + + + + + +\ *** Block No. 37, Hexblock 25 + +\ Edi keytable cas16aug06 +| : Ctrl ( -- 8b) + [compile] Ascii $40 - ; immediate +| Create keytable +Ctrl n c, Ctrl b c, Ctrl w c, Ctrl a c, +$1F c, (64 Ctrl ^ C) (16 $92 C) c, +$0D c, $8D c, +Ctrl c c, Ctrl x c, Ctrl f c, Ctrl l c, +$85 c, $89 c, $86 c, $8A c, +$9F c, $1C c, (64 00 C) (16 $1e C) c, +$8B c, $87 c, $88 c, $8C c, +$1D c, $11 c, $9D c, $91 c, +$13 c, $93 c, $94 c, +$14 c, Ctrl d c, Ctrl e c, Ctrl r c, +Ctrl i c, Ctrl o c, + $ff c, + + + + + + + + + + +\ *** Block No. 38, Hexblock 26 + +\ Edi actiontable cas16aug06 + + +| Create actiontable ] +next back >shadow alter +esearch copyline + +cancel eupdate esave eload +newline killine buf>line line>buf +.stamp .scr# copychar +char>buf buf>char +tab -tab +currite curdown curleft curup +home >""end insert +delete dchar clrline clrright +setimd clrimd + dochar [ +| Code findkey ( key n -- adr) + 2 # lda setup jsr N ldy dey + [[ iny keytable ,Y lda $FF # cmp + 0<> ?[ N 2+ cmp ]? 0= ?] + tya .A asl tay + actiontable ,Y lda pha + actiontable 1+ ,Y lda Push jmp +end-code + + +\ *** Block No. 39, Hexblock 27 + +\ Edi show errors cas16aug06 + + +' 0 | Alias dark + +' 1 | Alias light + +| : half ( n --) + border c! pause $80 0 DO LOOP ; + +| : blink ( --) + border push dark half light half + dark half light half ; + +| : ?blink ( f1 -- f2) + dup true = IF blink 0= THEN ; + + + + + + + + + + +\ *** Block No. 40, Hexblock 28 + +\ Edi init cas16aug06 + +' Literal | Alias Li immediate + +Variable (pad 0 (pad ! + +| : clearbuffer ( --) + pad dup (pad ! + #col 2* + dup fbuf 2+ ! + #col + dup rbuf 2+ ! + #col + dup chars ! + #col 2* + lines ! + chars 2+ off lines 2+ off + [ ' ***volksFORTH83*** >name ] Li + count >r fbuf 2+ @ r@ cmove r> fbuf ! + [ ' Forth-Gesellschaft >name ] Li + count $1F and >r + rbuf 2+ @ r@ cmove r> rbuf ! ; + +| : initptr ( --) + pad (pad @ = ?exit clearbuffer ; + + + + + +\ *** Block No. 41, Hexblock 29 + +\ Edi show cas16aug06 + +' name >body 6 + | Constant 'name +(16 \ c16 is using standard C) + +(64 +| Code curon + $D3 ldy $D1 )Y lda $CE sta + $80 # eor $D1 )Y sta + xyNext jmp end-code + +| Code curoff + $CE lda $D3 ldy $D1 )Y sta + xyNext jmp end-code + +C) + + + + + + + + + + +\ *** Block No. 42, Hexblock 2a + +\ Edi show cas16aug06 + +| : showoff + ['] exit 'name ! rvsoff curoff ; + +| : show ( --) + blk @ ?dup 0= IF showoff exit THEN + >in @ 1- r# ! rvsoff curoff rvson + scr @ over - IF scr ! elist + 1 0 at .status THEN r#>at curon drop ; + +Forth definitions + +: (load ( blk pos --) + >in push >in ! ?dup 0= ?exit + blk push blk ! .status interpret ; + +: showload ( blk pos -) + scr push scr off r# push + ['] show 'name ! (load showoff ; + +Editor definitions + + + + +\ *** Block No. 43, Hexblock 2b + +\ Edi edit clv01aug87 +| : setcol ( 0 / 4 / 8 --) + ink-pot + + dup c@ border c! dup 1+ c@ bkgrnd c! + 2+ c@ pen c! ; +| : (edit ( -- n) + 4 setcol $93 con! + elist drop scroll off + BEGIN key dup char c! + 0 findkey execute ?blink ?dup UNTIL + 0 0 at killine drop scroll on + 0 setcol (16 0 $7ea c! C) \ Append-Mode +; +Forth definitions +: edit ( scr# -) (16 c64fkeys C) + scr ! stamp? initptr (edit + $18 0 at drvScr ." Scr " . ." Drv " . + dup 2 and 0= IF ." not " THEN + ." changed" + dup 4 and IF save-buffers THEN + dup 6 and 6 = IF ." , saved" THEN + 8 and IF ." , loading" cr + scr @ r# @ showload THEN ; + + + +\ *** Block No. 44, Hexblock 2c + +\ Editor Forth83 clv2:jull87 + +: l ( scr -) r# off edit ; +: r ( -) scr @ edit ; +: +l ( n -) scr @ + l ; + +: v ( -) ( text) + ' >name ?dup IF 4 - @ THEN ; + +: view ( -) ( text) + v ?dup + IF l ELSE ." from keyboard" THEN ; + +Editor definitions + +(16 | : curaddr \ --Addr + linptr @ curofs c@ + ; C) + +: curlin ( --curAddr linLen) \ & EOLn +(64 linptr @ $D5 c@ -trailing + dup $d3 c! C) +(16 $1b con! ascii j con! curaddr + $1b con! ascii k con! $1d con! + curaddr over - C) ; + + +\ *** Block No. 45, Hexblock 2d + +\ Edidecode ccas16aug06 + +: edidecode ( adr cnt1 key -- adr cnt2) + $8D case? IF imode off cr exit THEN + #cr case? IF imode off +curlin dup span @ u> IF drop span @ THEN + bounds ?DO + 2dup + I c@ scr>cbm swap c! 1+ LOOP + dup span ! exit THEN + dup char c! + $12 findkey execute ?blink drop ; + + +: ediexpect ( addr len1 -- ) + initptr span ! + 0 BEGIN dup span @ u< + WHILE key decode REPEAT + 2drop space ; + +Input: ediboard + c64key c64key? edidecode ediexpect ; + +ediboard + + + +\ *** Block No. 46, Hexblock 2e + +\ .status cas16aug06 + +' noop Is .status + +: .blk ( -) + blk @ ?dup IF ." Blk " u. ?cr THEN ; + +' .blk Is .status + + + + + + + + + + + + + + + + + + +\ *** Block No. 47, Hexblock 2f + +\ tracer: loadscreen cas16aug06 \ \\ for tracer:loadscreen cas16aug06 + +Onlyforth + \ ToDo +\needs Code -$2B +load \ Trans Assembler \ ***For the next volks4th version **** + +\needs Tools Vocabulary Tools \ Sync -handling with Atari and + \ CPM +Tools also definitions \ here some examples to test + + 1 6 +thru \ Tracer + 7 8 +thru \ Tools for decompiling \ | : aa dup drop ; + \ | : bb aa ; +Onlyforth \ \\ + \ debug bb +\\ \ trace' aa + +This nice Forth Tracer has been \ trace' Forth +developed by B. Pennemann and co +for Atari ST. CL Vogt has ported it +back to the volksForth 6502 C-16 and +C-64 \ IP 2inc is done on CBM-Atari before or + \ after + + + +\ *** Block No. 48, Hexblock 30 + +\ tracer: wcmp variables clv04aug87 \ \\ for tracer:wcmp variables cas16aug06 + +Assembler also definitions + +: wcmp ( adr1 adr2--) \ Assembler-Macro \ used like this adr1 adr2 wcmp + over lda dup cmp swap \ compares word \ compares whole word, result is + 1+ lda 1+ sbc ; \ Carry=1 : (adr1) >= (adr2) + \ Carry=0 : (adr1) < (adr2) + \ all other flags are not defined +Only Forth also Tools also definitions + +| Variable (W \ Temporary storage for W +| Variable \ area to be traced +| Variable nest? | Variable trap? \ Flag: trace word Flag: trace yes?no +| Variable last' | Variable #spaces \ unknown level of nesting + + + + + + + + + + + +\ *** Block No. 49, Hexblock 31 + +\ tracer:cpush oneline cas16aug06 \ \ for tracer:cpush oneline cas16aug06 + +| Create cpull 0 ] + rp@ count 2dup + rp! r> swap cmove ; + +: cpush ( addr len -) \ saves LEN bytes from ADDR on the return + r> -rot over >r \ stack. the next UNNEST or EXIT will + rp@ over 1+ - dup rp! place \ place them back + cpull >r >r ; + +| : oneline &82 allot keyboard display \ Main loop + .status space query interpret \ command can be entered + -&82 allot rdrop + ( delete quit from tnext ) ; + +: range ( adr--) \ gets \ gets area to trace + ip> off dup ! ; + + + + + + +\ *** Block No. 50, Hexblock 32 + +\ tracer:step tnext clv04aug87 \ \ for tracer:step tnext cas16aug06 + +| Code step \ will be used at the end of TNEXT, + $ff # lda trap? sta trap? 1+ sta \ to enable TRAP? again and to fix the + RP X) lda IP sta \ broken NEXT-Routine + RP )Y lda IP 1+ sta RP 2inc + (W lda W sta (W 1+ lda W 1+ sta +Label W1- W 1- jmp end-code + +| Create: nextstep step ; + \ This Routine will be patched on NEXT +Label tnext IP 2inc \ and is the key part of the tracer + trap? lda W1- beq \ if no traced: + nest? lda 0= \ low(!)Byte test \ trace current WORD? + ?[ IP wcmp W1- bcs \ no: then go + ][ nest? stx \ low(!)Byte clear \ yes: delete half! part + ]? + trap? dup stx 1+ stx \ disable tracer \ disable trap? ( the tracer shouldn't + W lda (W sta W 1+ lda (W 1+ sta \ trace itself ) + + + + + + +\ *** Block No. 51, Hexblock 33 + +\ tracer:..tnext clv12oct87 \ \ tracer:..tnext cas16aug06 + + ;c: nest? @ \ Forth-Part of TNEXT + IF nest? off r> ip> push r THEN \ nestinglevel + r@ nextstep >r \ STEP should be executed later + input push output push \ PUSHed all important data + 2- dup last' ! + cr #spaces @ spaces \ print information line + dup 4 u.r @ dup 5 u.r space + >name .name $10 col - 0 max spaces .s + state push blk push >in push + [ ' 'quit >body ] Literal push \ PUSHed more data + [ ' >interpret >body ] Literal push + #tib push tib #tib @ cpush r0 push \ PUSHed the Return-Stack-Pointer !! + rp@ r0 ! \ and pretends an empty Return-Stack + ['] oneline Is 'quit quit ; \ connects ONELINE into the + \ MAIN-COMMAND-LOOP and calls it + + + + + + + +\ *** Block No. 52, Hexblock 34 + +\ tracer:do-trace traceable cas16aug06 \ \ tracer:do-trace traceable cas16aug06 + +| Code do-trace \ installs TNEXT \ installs (patched) TNEXT into NEXT + tnext 0 $100 m/mod \ (NEXT is the innerst Routine, + # lda Next $c + sta \ that ends every word definition) + # lda Next $b + sta + $4C # lda Next $a + sta Next jmp +end-code + +| : traceable ( cfa--body exit THEN \ : -def. body c@ Input @ + \ INPUT: -def. body c@ Output @ + \ OUTPUT:-def. body \ DEFER -def. -def. \ all other definitions won't work + >name .name ." can't be DEBUGged" + quit ; + + + +\ *** Block No. 53, Hexblock 35 + +\ tracer:User-Words cas16aug06 \ \ tracer:user words cas16aug06 + +: nest \ trace into current word \ NEST enters a word for tracing + last' @ @ traceable drop nest? on ; + +: unnest \ proceeds at calling word \ UNNEST continues program execution to + off ; \ clears trap range \ the end of traced word + +: endloop last' @ 4 + marks the word to be + \ traced. If is called, the +: debug ' (debug ; \ word follows \ tracer kicks in + +: trace' \ word follows + ' dup (debug execute end-trace ; \ TRACE' will call and start trace. + + +\ *** Block No. 54, Hexblock 36 + +\ tools for decompiling, clv12oct87 \ \\ tools for decompil cas16aug06 + +( interactive use ) \ \ if the word + +Onlyforth Tools also definitions + \ : test 5 0 DO ." do you like me?" +| : ?: ?cr dup 4 u.r ." :" ; \ key Ascii y = +| : @? dup @ 6 u.r ; \ IF ." your fault " leave +| : c? dup c@ 3 .r ; \ ELSE ." yes sure! " THEN LOOP +| : bl $24 col - 0 max spaces ; \ ." !" ; + +: s ( adr - adr+) \ \\ should be inspected, + ( print literal string) + ?: space c? 4 spaces dup count type + dup c@ + 1+ bl ; ( count + re) \ please turn page..> + +: n ( adr - adr+2) + ( print name of next word by its cfa) + ?: @? 2 spaces + dup @ >name .name 2+ bl ; + +: k ( adr - adr+2) + ( print literal value) + ?: @? 2+ bl ; + + +\ *** Block No. 55, Hexblock 37 + +( tools for decompiling, interactive ) \ \ tools for decompil cas16aug06 + +: d ( adr n - adr+n) ( dump n bytes) \ cr + 2dup swap ?: 3 spaces swap 0 \ tools + DO c? 1+ LOOP \ trace' test + 4 spaces -rot type bl ; + +: c ( adr - adr+1) + ( print byte as unsigned value) + 1 d ; + +: b ( adr - adr+2) + ( print branch target location ) + ?: @? dup @ over + 6 u.r 2+ bl ; + +( used for : ) +( Name String Literal Dump Clit Branch ) +( - - - - - - ) + + + + + + + + +\ *** Block No. 56, Hexblock 38 + +( debugging utilities bp 19 02 85 ) + + +: unravel \ unravel perform (abort" + rdrop rdrop rdrop + cr ." trace dump is " cr + BEGIN rp@ r0 @ - + WHILE r> dup 8 u.r space + 2- @ >name .name cr + REPEAT (error ; + +' unravel errorhandler ! + + + + + + + + + + + + + + +\ *** Block No. 57, Hexblock 39 + +\ Multitasker BP 13.9.84 ) + +Onlyforth + +\needs multitask 1 +load save + + 2 4 +thru \ Tasker +\ 5 +load \ Demotask + + + + + + + + + + + + + + + + + + +\ *** Block No. 58, Hexblock 3a + +\ Multitasker BP 13.9.84 ) + +\needs Code -$36 +load \ transient Ass + +Code stop + SP 2dec IP lda SP X) sta + IP 1+ lda SP )Y sta + SP 2dec RP lda SP X) sta + RP 1+ lda SP )Y sta + 6 # ldy SP lda UP )Y sta + iny SP 1+ lda UP )Y sta + 1 # ldy tya clc UP adc W sta + txa UP 1+ adc W 1+ sta + W 1- jmp end-code + +| Create taskpause Assembler + $2C # lda UP X) sta ' stop @ jmp +end-code + +: singletask + [ ' pause @ ] Literal ['] pause ! ; + +: multitask taskpause ['] pause ! ; + + + +\ *** Block No. 59, Hexblock 3b + +\ pass activate ks 8 may 84 ) + +: pass ( n0 .. nr-1 Tadr r -- ) + BEGIN [ rot ( Trick ! ) ] + swap $2C over c! \ awake Task + r> -rot \ IP r addr + 8 + >r \ s0 of Task + r@ 2+ @ swap \ IP r0 r + 2+ 2* \ bytes on Taskstack + \ incl. r0 & IP + r@ @ over - \ new SP + dup r> 2- ! \ into ssave + swap bounds ?DO I ! 2 +LOOP ; +restrict + +: activate ( Tadr --) + 0 [ -rot ( Trick ! ) ] REPEAT ; +-2 allot restrict + +: sleep ( Tadr --) + $4C swap c! ; \ JMP-Opcode + +: wake ( Tadr --) + $2C swap c! ; \ BIT-Opcode + + +\ *** Block No. 60, Hexblock 3c + +\ building a Task BP 13.9.84 ) + +| : taskerror ( string -) + standardi/o singletask + ." Task error : " count type + multitask stop ; + +: Task ( rlen slen -- ) + allot \ Stack + here $FF and $FE = + IF 1 allot THEN \ 6502-align + up@ here $100 cmove \ init user area + here $4C c, \ JMP opcode + \ to sleep Task + up@ 1+ @ , + dup up@ 1+ ! \ link Task + 3 allot \ allot JSR wake + dup 6 - dup , , \ ssave and s0 + 2dup + , \ here + rlen = r0 + under + here - 2+ allot + ['] taskerror over + [ ' errorhandler >body c@ ] Literal + ! + Constant ; + + + +\ *** Block No. 61, Hexblock 3d + +\ more Tasks ks/bp 26apr85re) + +: rendezvous ( semaphoradr -) + dup unlock pause lock ; + +| : statesmart + state @ IF [compile] Literal THEN ; + +: 's ( Tadr - adr.of.taskuservar) + ' >body c@ + statesmart ; immediate + +\ Syntax: 2 Demotask 's base ! +\ makes Demotask working binary + +: tasks ( -) + ." MAIN " cr up@ dup 1+ @ + BEGIN 2dup - WHILE + dup [ ' r0 >body c@ ] Literal + @ + 6 + name> >name .name + dup c@ $4C = IF ." sleeping" THEN cr + 1+ @ REPEAT 2drop ; + + + + + +\ *** Block No. 62, Hexblock 3e + +\ Taskdemo clv12aug87 + +: taskmark ; \needs cbm>scr : cbm>scr ; + +: scrstart ( -- adr) + (64 $288 C) (16 $53e C) c@ $100 * ; + +Variable counter counter off + +$100 $100 Task Background + +: >count ( n -) + Background 1 pass + counter ! + BEGIN counter @ -1 counter +! ?dup + WHILE pause 0 <# #s #> + 0 DO pause dup I + c@ cbm>scr + scrstart I + c! LOOP drop + REPEAT + BEGIN stop REPEAT ; \ stop's forever +: wait Background sleep ; +: go Background wake ; + +multitask $100 >count page + + +\ *** Block No. 63, Hexblock 3f + +\ printer loadscreen 27jul85re) \ \ cas16aug06 + +Onlyforth hex \ set order to FORTH FORTH ONLY FORTH + +Vocabulary Print +Print definitions also + +Create Prter 2 allot ( Semaphor) \ for multitasking +Prter off + + : ) ; immediate + : (u ; immediate \ for user-port \ Centronics-Interface on User-Port + : (s [compile] ( ; immediate \ (s Text till ) will be skipped +\ : (s ; immediate \ for serial bus \ serial Interface (commented out) +\ : (u [compile] ( ; immediate \ (u Text till ) will be skipped + +(s 1 +load ) \ load next screen only for serial bus + + 2 $A +thru + +Onlyforth + +clear \ remove unneded word headers + + + +\ *** Block No. 64, Hexblock 40 + +\ Buffer for the ugly SerBus 28jul85re) \ \ When using the serial cas16aug06 + \ bus, sendind chars one by one is too +$100 | Constant buflen \ slow + +| Variable Prbuf buflen allot Prbuf off \ Buffer for chrs to send to printer + +| : >buf ( char --) \ add char to buffer + Prbuf count + c! 1 Prbuf +! ; + +| : full? ( -- f) Prbuf c@ buflen = ; \ Buffer full? + +| : .buf ( --) \ print buffer and clean + Prbuf count -trailing + 4 0 busout bustype busoff Prbuf off ; + +: p! ( char --) \ Mainroutine to send to serial bus + pause >r \ store char + r@ $C ( Formfeed ) = \ is Formfeed? + IF r> >buf .buf exit THEN \ yes, print buffer incl. Formfeed + r@ $A ( Linefeed ) = \ is Linefeed? + r@ $D ( CarReturn ) = or full? or \ or CR, or is the buffer filled? + IF .buf THEN r> >buf ; \ yes, print buffer and CR/LF marked + + + + +\ *** Block No. 65, Hexblock 41 + +\ p! ctrl: ESC esc: 28jul85re) \ \ cas16aug06 + +(u +: p! \ char -- \ Mainroutine for centronics intrface + $DD01 c! $DD00 dup c@ 2dup \ send char to port , emit Strobe-Edge + 4 or swap c! $FB and swap c! + BEGIN pause $DD0D c@ $10 and \ wait for Busy-Signal to disappear + UNTIL ; ) + +| : ctrl: ( 8b --) Create c, \ send controlcodes to printr + does> ( --) c@ p! ; + + 7 ctrl: BEL | $7F ctrl: DEL \ Controlcodes for Printer in Hex +| $d ctrl: CRET | $1B ctrl: ESC \ representation + $a ctrl: LF $0C ctrl: FF + \ Adjust if needed! +| : esc: ( 8b --) Create c, + does> ( --) ESC c@ p! ; \ send ESC-Sequence to printer + + $30 esc: 1/8" $31 esc: 1/10" + $32 esc: 1/6" \ Linefeed in Inch + $54 esc: suoff + $4E esc: +jump $4F esc: -jump \ disable Superscript and Subscript + \ skip perforation on/off + + +\ *** Block No. 66, Hexblock 42 + +\ printer controls 28jul85re) \ \ cas16aug06 + +| : ESC2 ESC p! p! ; \ Escape + 2 Chars + + : gorlitz ( 8b --) BL ESC2 ; \ only for Goerlitz-Interface + +| : ESC"!" ( 8b --) $21 ESC2 ; \ special Epson-Controlmode + +| Variable Modus Modus off \ Copy of Printer-Control-Register + +| : on: ( 8b --) Create c, \ switch Bit in control register on + does> ( --) + c@ Modus c@ or dup Modus c! ESC"!" ; + +| : off: ( 8b --) Create $FF xor c, \ switch Bit in control register off + does> ( --) + c@ Modus c@ and dup Modus c! ESC"!" ; + + $10 on: +dark $10 off: -dark \ These Controlcodes need to be adjusted + $20 on: +wide $20 off: -wide \ for other printers with ctrl: ESC2 + $40 on: +cursiv $40 off: -cursiv \ and prn + $80 on: +under $80 off: -under +| 1 on: (12cpi \ Linewidth in characters per inch +| 4 on: (17cpi 5 off: 10cpi \ replace with Elite, Pica or Compress if + \ needed + +\ *** Block No. 67, Hexblock 43 + +\ printer controls 28jul85re) \ \ cas16aug06 + +: 12cpi 10cpi (12cpi ; \ adjust these if needed +: 17cpi 10cpi (17cpi ; +: super 0 $53 ESC2 ; +: sub 1 $53 ESC2 ; +: lines ( #lines --) $43 ESC2 ; \ Call as 66 lines +: "long ( inches --) 0 lines p! ; \ Call as 11 "long +: american 0 $52 ESC2 ; \ Fonts, can be extended +: german 2 $52 ESC2 ; + +: prinit \ Initializing ... +(s Ascii x gorlitz Ascii b gorlitz \ . for Goerlitz-Interface + Ascii e gorlitz Ascii t gorlitz + Ascii z gorlitz Ascii l gorlitz ) +(u $FF $DD03 c! \ . for Centronics: Port B on send + $DD02 dup c@ 4 or swap c! ) ; \ PA2 on send for Strobe + +| Variable >ascii >ascii on \ Flag for char-convert + +: normal >ascii on \ enable printer with standardvalues + Modus off 10cpi american suoff + 1/6" $c "long CRET ; + + + +\ *** Block No. 68, Hexblock 44 + +\ Epson printer interface 08sep85re) \ cas16aug06 + +| : c>a ( 8b0 -- 8b1) \ convert Commodore's Special-Ascii in + >ascii @ IF \ standard ASCII +dup $41 $5B uwithin IF $20 or exit THEN +dup $C1 $DB uwithin IF $7F and exit THEN +dup $DC $E0 uwithin IF $A0 xor THEN + THEN ; + +| Variable pcol pcol off +| Variable prow prow off \ Routines for printing command + +| : pemit c>a p! 1 pcol +! ; +| : pcr CRET LF 1 prow +! 0 pcol ! ; \ send chr to printer emit +| : pdel DEL -1 pcol +! ; \ CR and LF to printer cr +| : ppage FF 0 prow ! 0 pcol ! ; \ delete char (?!) del +| : pat ( zeile spalte -- ) \ emit formfeed page + over prow @ < IF ppage THEN \ position proterhead on column at + swap prow @ - 0 ?DO pcr LOOP \ and row, new page if necessary + dup pcol < IF CRET pcol off THEN + pcol @ - spaces ; +| : pat? prow @ pcol @ ; +| : ptype ( adr count --) dup pcol +! \ get printhead position at? + bounds ?DO I c@ c>a p! LOOP ; \ emit string type + + +\ *** Block No. 69, Hexblock 45 + +\ print pl 02oct87re \ cas16aug06 + +| Output: >printer \ create outputtable >printer + pemit pcr ptype pdel ppage pat pat? ; + \ Routines for printer and screen + \ (both) +: bemit dup c64emit pemit ; +: bcr c64cr pcr ; \ Output first on Screen +: btype 2dup c64type ptype ; \ ( Routines from DISPLAY ) +: bdel c64del pdel ; \ and on printer +: bpage c64page ppage ; \ ( Routines from >PRINTER ) +: bat 2dup c64at pat ; + +| Output: >both + bemit bcr btype bdel bpage bat pat? ; \ create outputtable >both + +Forth definitions + +: Printer \ words are avalable from Forth + normal (u prinit ) >printer ; +: Both \ switch output to printer + normal >both ; + \ switch output to screen and printer + + + +\ *** Block No. 70, Hexblock 46 + +\ 2scr's nscr's thru ks 28jul85re) \ cas16aug06 + +Forth definitions + +| : 2scr's ( blk1 blk2 --) \ print two screen side by side + cr LF 17cpi +wide +dark $15 spaces \ screennumber in bold and 17cpi + over 3 .r $13 spaces dup 3 .r + -dark -wide cr b/blk 0 DO + cr I c/l / $15 .r 4 spaces \ formatted output of both Screens + over block I + C/L 1- type 5 spaces + dup block I + C/L 1- -trailing type + C/L +LOOP 2drop cr ; + +| : nscr's ( blk1 n -- blk2) 2dup \ will print screen this: 1 3 + bounds DO I over I + 2scr's LOOP + ; \ way 2 4 + +: pthru ( from to --) \ prints scrren from to + Prter lock Output push Printer 1/8" \ store Outputdevice and enable printer + 1+ over - 1+ -2 and 6 /mod \ calculate printposition for each + ?dup IF swap >r \ Screen and print according to layout + 0 DO 3 nscr's 2+ 1+ page LOOP r> THEN + ?dup IF 1+ 2/ nscr's page THEN drop + Prter unlock ; + + + +\ *** Block No. 71, Hexblock 47 + +\ Printing with shadows 28jul85re) \ cas16aug06 + +Forth definitions + +| : 2scr's ( blk1 blk2 --) \ like 2scr's (with Shadow) + cr LF 17cpi +wide +dark $15 spaces + dup 3 .r + -dark -wide cr b/blk 0 DO + cr I c/l / $15 .r 4 spaces + dup block I + C/L 1- type 5 spaces + over block I + C/L 1- -trailing type + C/L +LOOP 2drop cr ; + +| : nscr's ( blk1 n -- blk2) \ like nscr's (with Shadow) + 0 DO dup [ Editor ] shadow @ 2dup \ screen Shadow + u> IF negate THEN \ scr+1 Sh+1 + + over 2scr's 1+ LOOP ; + +: dokument ( from to --) \ like pthru (with Shadow) + Prter lock Output push Printer + 1/8" 1+ over - 3 /mod + ?dup IF swap >r + 0 DO 3 nscr's page LOOP r> THEN + ?dup IF nscr's page THEN drop + Prter unlock ; + +\ *** Block No. 72, Hexblock 48 + +\ 2scr's nscr's thru ks 28jul85re) \ cas16aug06 + +Forth definitions $40 | Constant C/L + +| : 2scr's ( blk1 blk2 --) \ same again for standard forth screens + pcr LF LF 10cpi +dark $12 spaces \ with 16 lines and 64 chars + over 3 .r $20 spaces dup 3 .r + cr 17cpi -dark + $10 C/L * 0 DO cr over block I + C/L + 6 spaces type 2 spaces + dup block I + C/L -trailing type + C/L +LOOP 2drop cr ; + +| : nscr's ( blk1 n -- blk2) under 0 \ see above + DO 2dup dup rot + 2scr's 1+ LOOP nip ; + +: 64pthru ( from to --) \ like pthru, but for standard screens + Prter lock >ascii push >ascii off + Output push Printer + 1/6" 1+ over - 1+ -2 and 6 /mod + ?dup IF swap >r + 0 DO 3 nscr's 2+ 1+ page LOOP r> THEN + ?dup IF 1+ 2/ nscr's page THEN drop + Prter unlock ; + + +\ *** Block No. 73, Hexblock 49 + +\ pfindex 02oct87re \ cas16aug06 + +Onlyforth Print also + +: pfindex ( from to --) \ print fast index on printer + Prter lock Printer &12 "long \ 12" Papiersize + +jump findex cr page -jump \ skip perforation + Prter unlock display ; + + + + + + + + + + + + + + + + + + +\ *** Block No. 74, Hexblock 4a + +\ Printspool 02oct87re \ Background print cas16aug06 + +\needs tasks .( Tasker?!) \\ \ Multitasker is needed + +$100 $100 Task Printspool \ Create workarea for task + +: spool ( from to --) \ enable backgroud printing + Printspool 2 pass \ from to will be passed to task + \ on next PAUSE the task will execute + pthru \ pthru and will go to sleep + stop ; + +: endspool ( --) \ abort background task + Printspool activate \ task will be activated to go to sleep + stop ; \ again immeditaly + + + + + + + + + + + +\ *** Block No. 75, Hexblock 4b + +\ Printer Routine C1526 cas16aug06 \ \\ Printer interface 1526 cas16aug06 + +( not useable for Printspool!! re) \ This driver also works with: + +Onlyforth Vocabulary Print \ C16 & CITIZEN-100DM \ see Handbook + +Print also Definitions + +: prinit 4 7 busout ; +\needs FF : FF noop ; +: CRET $d bus! ; \ FF : Formfeed is missing here + +: pspaces ( n -) + 0 ?DO BL bus! LOOP ; + +1 2 +thru + +Only Forth also Definitions + +( save ) + + + + + + +\ *** Block No. 76, Hexblock 4c + +\ Printer interface 1526 02oct87re \ clv14oct87 + +Variable Pcol Variable Prow + +| : pemit bus! 1 Pcol +! ; +| : pcr CRET 1 Prow +! 0 Pcol ! ; +| : pdel ; +| : ppage FF 0 Prow ! 0 Pcol ! ; +| : pat ( zeile spalte -- ) + over Prow @ < IF ppage THEN + 0 rot Prow @ - bounds ?DO pcr LOOP + dup Pcol @ - pspaces Pcol ! ; +| : pat? Prow @ Pcol @ ; +| : ptype ( adr count -) dup Pcol +! + bounds ?DO I c@ bus! LOOP ; + +| Output: >printer + pemit pcr ptype pdel ppage pat pat? ; + +Forth definitions + +: printer prinit >printer ; + +: display cr busoff display ; + + +\ *** Block No. 77, Hexblock 4d + +\ printer routinen 20oct87re + +Only Forth also definitions + +4 Constant B/scr + +: .line ( line# scr# --) + block swap c/l * + c/l 1- type ; + +: .=== + c/l 1- 0 DO Ascii = emit LOOP ; + +: prlist ( scr# --) + dup block drop printer + $E emit ." Screen Nr. " dup . $14 emit + cr .=== + l/s 0 DO I over .line cr LOOP drop + .=== cr cr cr display ; + + + + + + + + +\ *** Block No. 78, Hexblock 4e + +\ CP-80 Printer loadscreen clv14oct87 + +Onlyforth hex + +Vocabulary Print Print definitions also + +Create Prter 2 allot ( Semaphor) + +0 Prter ! \ Prter unlock /clv + +1 6 +thru + +Only Forth also definitions + +( clear ) + + + + + + + + + + + +\ *** Block No. 79, Hexblock 4f + +\ p! ctrl: ESC esc: 07may85mawe) + +Print definitions + +: p! ( 8b -) + BEGIN pause $DD0D c@ $10 and UNTIL + $DD01 c! ; + +| : ctrl: ( B -) Create c, + does> ( -) c@ p! ; + + 07 ctrl: BEL | $7F ctrl: DEL +| $0D ctrl: CRET | $1B ctrl: ESC + $0A ctrl: LF $0C ctrl: FF + +| : esc: ( B -) Create c, + does> ( -) ESC c@ p! ; + + $30 esc: 1/8" $31 esc: 1/10" + $32 esc: 1/6" $20 esc: gorlitz + +| : ESC2 ESC p! p! ; + + + + +\ *** Block No. 80, Hexblock 50 + +( printer controls 07may85mawe) + + $0e esc: +wide $14 esc: -wide + $45 esc: +dark $46 esc: -dark + $47 esc: +dub $48 esc: -dub + $0f esc: +comp $12 esc: -comp + +: +under 1 $2D esc2 ; +: -under 0 $2D esc2 ; + + + + + + + + + + + + + + + + + +\ *** Block No. 81, Hexblock 51 + +( printer controls 07may85mawe) + + $54 esc: suoff + +: super 0 $53 ESC2 ; + +: sub 1 $53 ESC2 ; + +: lines ( lines -) $43 ESC2 ; + +: "long ( inches -) 0 lines p! ; + +: american 0 $52 ESC2 ; + +: german 2 $52 ESC2 ; + +: pspaces ( n -) + 0 swap bounds ?DO BL p! LOOP ; + +| : initport 0 $DD01 c! $FF $DD03 c! ; + +: prinit initport + american suoff 1/6" + &12 "long CRET ; + + +\ *** Block No. 82, Hexblock 52 + +( CP80 printer interface 26mar85re) + +| Variable unchanged? unchanged? off + +| : c>a ( 8b0 - 8b1) + unchanged? @ ?exit + dup $41 $5B uwithin + IF $20 or exit THEN + dup $C1 $DB uwithin + IF $7F and exit THEN + dup $DC $E0 uwithin + IF $A0 xor THEN ; + + + + + + + + + + + + + + +\ *** Block No. 83, Hexblock 53 + +( print pl 06may85we) + +Variable Pcol Variable Prow + +| : pemit c>a p! 1 Pcol +! ; +| : pcr CRET 1 Prow +! 0 Pcol ! ; +| : pdel DEL -1 Pcol +! ; +| : ppage FF 0 Prow ! 0 Pcol ! ; +| : pat ( zeile spalte -- ) + over Prow @ < IF ppage THEN + 0 rot Prow @ - bounds ?DO pcr LOOP + dup Pcol @ - pspaces Pcol ! ; +| : pat? Prow @ Pcol @ ; +| : ptype ( adr count -) dup Pcol +! + bounds ?DO I c@ c>a p! LOOP ; + +| Output: >printer + pemit pcr ptype pdel ppage pat pat? ; + +Forth definitions + +: Printer prinit >printer ; + + + + +\ *** Block No. 84, Hexblock 54 + +( 3scr's nscr's thru ks07may85mawe) +Forth definitions + +| : 3scr's ( blk -) + cr -comp +dark + $B spaces dup 3 .r + $19 spaces dup 1+ 3 .r + $19 spaces dup 2+ 3 .r + cr +comp -dark L/S C/L * 0 DO + cr 5 spaces dup block I + C/L 1- type + 8 spaces dup 1+ block I + C/L 1- type + 8 spaces dup 2+ block I + C/L 1- type + C/L +LOOP drop cr LF ; + +| : nscr's ( blk1 n - blk2) under 0 + DO dup 3scr's over + LOOP nip ; + +: pthru ( from to -) + Output @ -rot Printer Prter lock 1/8" + 1+ over - 1+ 9 /mod + ?dup IF swap >r + 0 DO 3 nscr's page LOOP r> THEN + ?dup IF 1- 3 / 1+ 0 + DO dup 3scr's 3 + LOOP THEN drop + Prter unlock Output ! ; diff --git a/tools/ufscr2file.c b/tools/ufscr2file.c index c01d3f0..3d95c63 100644 --- a/tools/ufscr2file.c +++ b/tools/ufscr2file.c @@ -7,6 +7,7 @@ #include #include +#include #include "openfiles.h" #include "petscii.h" @@ -37,14 +38,19 @@ int nextchar(FILE *in) { } void buffered_putchar(FILE *out, char c) { - static char line[50], *p=line; - if (p - line > 45) { + static char line[100], *p=line; + if (p - line > 95) { fprintf(stderr, "!!! overlong line !!!\n"); exit(1); } if (c == '\n') { while (p > line && *(p - 1) == ' ') p--; - *p = '\0'; + *p-- = '\0'; + if (p > line + 40 && *p == '\\' && *(p-1) == ' ') { + p -= 2; + while (p > line && *(p - 1) == ' ') p--; + *p-- = '\0'; + } fprintf(out, "%s\n", line); p=line; return; @@ -52,7 +58,7 @@ void buffered_putchar(FILE *out, char c) { *p++ = c; } -int printblock(FILE *in, FILE *out, int n) { +int readwriteblock(FILE *in, FILE *out, int n) { int line, col, c; fprintf(out, "\n\\ *** Block No. %d, Hexblock %x\n\n", n, n); for (line = 0; line < 25; line++) { @@ -69,17 +75,122 @@ int printblock(FILE *in, FILE *out, int n) { return 0; } +#define BLOCKSIZE 1024 + +int readblock(FILE *in, short buf[], int n) { + int i, c; + for (i = 0; i < BLOCKSIZE; ++i) { + c = nextchar(in); + if (c == EOF) { + fprintf(stderr, "\n### premature end of input file ###\n"); + return 1; + } + buf[n * BLOCKSIZE + i] = c; + } + return 0; +} + +int writeblock(FILE *out, short buf[], int n) { + int line, col, i; + fprintf(out, "\n\\ *** Block No. %d, Hexblock %x\n\n", n, n); + for (line = 0, i = 0; line < 25; ++line) { + for (col = 0; col < (line == 24 ? 40 : 41); col++, ++i) { + buffered_putchar(out, (char) petscii2ascii(buf[n * BLOCKSIZE + i])); + } + buffered_putchar(out, '\n'); + } + return 0; +} + +int writeshadowedblock(FILE *out, short buf[], int block, int shadow) { + int line, col, i; + short *bp, *sp; + fprintf(out, "\n\\ *** Block No. %d, Hexblock %x\n\n", block, block); + bp = buf + block * BLOCKSIZE; + sp = buf + shadow * BLOCKSIZE; + for (line = 0, i = 0; line < 25; ++line) { + for (col = 0; col < (line == 24 ? 40 : 41); col++, ++bp) { + buffered_putchar(out, (char) petscii2ascii(*bp)); + } + if (24 == line) { + buffered_putchar(out, ' '); + } + buffered_putchar(out, ' '); + buffered_putchar(out, '\\'); + buffered_putchar(out, ' '); + for (col = 0; col < (line == 24 ? 40 : 41); col++, ++sp) { + buffered_putchar(out, (char) petscii2ascii(*sp)); + } + buffered_putchar(out, '\n'); + } + return 0; +} + +#define MAX_BLOCK 170 +#define HALF_MAX_BLOCK (MAX_BLOCK / 2) + +int readwritedisk(FILE *in, FILE *out) { + for (int block = 0; block < MAX_BLOCK; block++) + if (readwriteblock(in, out, block)) + return EXIT_FAILURE; + return 0; +} + +int readwritediskbuffered(FILE *in, FILE *out) { + short buffer[MAX_BLOCK * BLOCKSIZE]; + int block; + for (block = 0; block < MAX_BLOCK; block++) + if (readblock(in, buffer, block)) + return EXIT_FAILURE; + for (block = 0; block < MAX_BLOCK; block++) + if (writeblock(out, buffer, block)) + return EXIT_FAILURE; + return 0; +} + +int readwritediskshadowed(FILE *in, FILE *out) { + short buffer[MAX_BLOCK * BLOCKSIZE]; + int block; + for (block = 0; block < MAX_BLOCK; block++) + if (readblock(in, buffer, block)) + return EXIT_FAILURE; + for (block = 0; block < HALF_MAX_BLOCK; block++) + if (writeshadowedblock(out, buffer, block, block + HALF_MAX_BLOCK)) + return EXIT_FAILURE; + return 0; +} + +enum mode { unbufferd, buffered, shadowed }; + int main(int argc, char *argv[]) { FILE *in, *out; + enum mode m = unbufferd; + if (argc >= 2 && strcmp(argv[1], "-b") == 0) { + m = buffered; + --argc; ++argv; + } else if (argc >= 2 && strcmp(argv[1], "-s") == 0) { + m = shadowed; + --argc; ++argv; + } int error = openfiles(&in, &out, argc, argv, "usage: %s file.d64 [outfile]\n"); if (error) { return error; } - int block; - for (block = 0; block < 170; block++) - if (printblock(in, out, block)) - return EXIT_FAILURE; + switch(m) { + case unbufferd: + if (readwritedisk(in, out)) + return EXIT_FAILURE; + break; + case buffered: + if (readwritediskbuffered(in, out)) + return EXIT_FAILURE; + break; + case shadowed: + if (readwritediskshadowed(in, out)) + return EXIT_FAILURE; + break; + } return closefiles(in, out); } diff --git a/x16files/cc64 b/x16files/cc64 index 753799d..bbbb3b5 100644 Binary files a/x16files/cc64 and b/x16files/cc64 differ diff --git a/x16files/vf-build-base b/x16files/vf-build-base index 3efa28c..ee12471 100644 Binary files a/x16files/vf-build-base and b/x16files/vf-build-base differ