Descripción del contenido de la página

Tareas por hacer en Forth 5mx, un Forth para la computadora Psion 5mx, escrito en OPL+.


A pesar de que el desarrollo de Forth 5mx está detenido, de vez en cuando le hago algún retoque al programa.

Este fichero contiene la relación de tareas pendientes, funcionalidades por añadir o probar, y errores por depurar.

Código fuente


Copyright (C) 2005-2011 Marcos Cruz (

This file is part of Forth 5mx.

Forth 5mx is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <>.


Forth 5mx is already usable. I used it a lot to program
applications and tools in Forth. Nevertheless there are
many things yet to improve or fix. I worked on Forth 5mx
when I needed something to be fixed or improved for my Forth applications.
This way, Forth 5mx evolved week after week for years as I needed it.
My goal was Forth 5mx to be as reliable and ANS compliant as I could.
At the same time I planned to make it much faster using assembler extensions.

The development of Forth 5mx almost ended by the end of 2008.
Since then, I only fix bugs and do little changes, but maybe I will
code some simple new features in the future (e.g. a menu).

This file keeps all known things to be done, finished, fixed or imagined....

Next things to do:

Fix the error mentioned at the end of the proc unlimited_ioread:().

Debug when the TOS macro is not defined:
IF causes an error.

-Use COPX to make some things much faster.
Some ideas:
- Char comparations with ce32base functions.
- Char case changes with ce32base functions.
- String case change with cdescriptor functions: DesLowerCase, DesUpperCase, DesCopyStrLC, DesCopyStrUC, DesStr
- Circular text buffer with cdescriptor functions: DesMid,
- Source file load with descriptors:  LexGet, LexSkipCharacters, LexSkipSpace, LexNextTokenStr
- Dictionary searching with cdescriptor functions: LexSkipSpace, DesFindStr

- Fix the use of sbuffer_reserved&. Is it necessary?
- Adjust to sbuffer_reserved& the lenght of the string kept in the string buffer.
- Change _PLUS_SBUFFER? to use sbuffer_length&.

More things to do:

- Bug or not?: [IF] and [ELSE] do not obey \ and ( while searching for [ELSE] or [THEN] .
- Fix strange bug: When the macro _RESTORE_INPUT is called in the code of EVALUATE, the system crashes (and that code is not executed!).
- Finish the migration from the macro _PARSE?() to _ANSPARSE?() and then rename this to _PARSE?().
- Rewrite PARSE_WORD the same way.
- Internal toin& could be the real address, not the offset. That way manipulations would be faster, I think.
  Also, the limit should be the final address of the input buffer. That way some calculations would be easier and faster.
  Use new variable in& instead of toin&. in& will have the right address, not the offset. That will be faster. The word >IN will have to calculate the offset when called.
- Bug?: CD xxx crashes the system. I know, the right sintax is S" xxx" CD . That's Forth!


- Bug: the debug console does not show the current stack pointer at the start.
- Bug: the fetch command in the debug console uses one cell deeper.
- Bug: If an error happens while evaluating a string, the debug system can not be used, the keyboard gets frozen.
- I suspect the debug macros that call debug:() sometimes make the FVM crash.
- Adapt the string buffer to have no lenght limit... will it be much slower?
- Fix unsigned:()
- Fix ABS
- Is . already fixed?
- Bug: COLD should restore the file paths.
- NUMBERQ overflows with -2147483648
-  Implement from gforth:
  find-name       c-addr u -- nt | 0         gforth       ``find-name''
- In SVARIABLE , 256 should be calculated with ENVIRONMENT?


- the error sound may be personalized with the xt of a word.
- ini file with global options? The extend file can be used for that.
- add REDEFINED-MSG flag as in PFE Forth (= WARNING ?)

Core words:


Compilation, virtual machine, dictionary:

- DOES> should work in other word than that having CREATE inside. test it.
- create (CREATE) to make a distinction in WORDS between words created by VARIABLE and CREATE , though they can share the same code. (solved?)
- A bug?: POSTPONE and [COMPILE] finds the word in which they are compiled:
  : foo postpone foo ( no error!) ;
  Implement the smudge bit.
- Explore about SMUDGE and RECURSE in the Standard.
- Proc numberq: could fill a global variable with the number, to avoid recalculation by proc number: in interpret:: (?)
- numberq: and number: could be faster using peekb (?)
- Write SAVE-SYSTEM and LOAD-SYSTEM to work with the OPL heap used as memory.
- Out of memory control needed!
- Fix the ior calculation in ALLOCATE , RESIZE and FREE .

Stack manipulation:

- Write 2NIP 2TUCK


- Use imperative in OPL procedures and Forth words comments.


- PARSE-WORD some times causes a "string too long OPL error" (itwousd be fasser than WORD in [ELSE] ).
- counted_string:(string$,addr&) needed no more?
- Explore string:() versus poke$ in S"
- Should string:() leave the string in the stack any more?
- Explore S, versus string:()
- Find a better method for PAD and its address. (solved?)
- OPL strings vs. pokeb/peekb. Explore.
- Write SEARCH for no lenght limit.
- bug?: an S" in the command line can be finished by enter.
- finish and test the string buffer
- test the string buffer precision with a little buffer.
- explore the proc move:(), slow and used only by ACCEPT.
- PARSE shoud not copy the found string (look the Standard).

Double numbers:

- Fix the words <# # #S #> (they should use double numbers).
- Write all the double number words.

Unsigned numbers:

- write the definitive U<
- write U.

Files and paths:

- fix bug: when a source file is in a directory and it has:
    include ..\second_file.f
    then any OPEN-FILE on that directory causes a -33 error.
- fix path bug: SETPATH is reset after and INCLUDEd file.
- Solve the file path question. Change SOURCEPATH into a common word like CD . Explore gforth.
- bug: S" .." CD just adds "/../" to the path but ".." works in INCLUDE ../file.f
- Test DIRECTORY and rename it.
- ( should work across lines when parsing from a text file.
- fix SEEK-FILE to use double precision parameter, and the file words that use it.
- fix OPEN-FILE : it should create a non existant file (really? gforth does. Look the standard.)
- Fix INCLUDE : after the first 112 error with one file, it gives the same error with any file (already solved?).
- write new DIR version to return the file names on the stack.
- write sourceline# from gforth
- fix RENAME-FILE and DELETE-FILE to return ior.
- fix READ-FILE : OPL ioread() overflows when the byte count is larger than the file size. I think the real reason is the OPL 16 Kb IOREAD limit. I have to explore that.
- write a new word >FILE-SIZE based on the Sysram1 OPX function GetFileSize&:(file$).

Error trapping:

- Error "not found" is not shown whith ' and [']
- Fix a little bug: report_error ˆˆˆ signs with words like INCLUDE .

Terminal input:

- Fix little bug: carriage return code in pasted texts cause errors. Control chars must be deleted before pasting.
- Test EXPECT and ACCEPT .
- Implement command history in a file, like gforth.
- Implement Insert/Replace.
- Improve paste from keyboard: erase control chars before pasting.
- Fix bug: showline:() scrolls up when the line lenght is longer than the screen width.


- Explore the PFE way.

Unused PsiForth words to investigate:

- EXCHANGE (primitive)
- LOOKUP and family
- get rid of PsiForth tool words like EMITS ARRAY TABLE and others. they should be in an optional file.

Debug tools:

- Optional sounds.
- Turn debug off at the debug panel.
- Add commands to change the DUMP range in debug:().
- Add an EVALUATE option in the debug code.

Speed optimization:

- optimize the no TOS version of words like = and similar: use _DROP instead of _NIP and chage sp offsets in the calculation.
- make macro for string:()
- examine the remaining calls to packed$:()
- OPL constants KTrue&, KFalse& and KKey..& are integers in Const.oph. Test speed.
- improve find& for speed.
- Compare OPL speed between PsiForth code for (LOOP) and (+LOOP) :
        if x
            code 1
            goto y
        code 2
        goto y
    and the new one:
        if x
            code 1
            code 2
        goto y

Non-Standard words:

THIRD  (a b c -- a b c a)
UNDER+  (a b c -- a+c b)
RPICK   ( i -- x ; i'th item from return stack)


- Implement a menu. It's very easy. It must be done in the proc lineedit$:().


- .S could be primitive, using the DEBUG code.
- Optimize the DUMP speed
- why needed the word INDICATOR and the OPL variable indicator$ ?
- what is $? in gforth?
- the message "replace battery" apears also when externally powered.
- Bug: The prompt shows the stack content after a COLD before deleting it.
- Explore the actual state of BEEP and compare the parameters with those of the OPL original.
- The first prompt "ok" shows that there's one item on the stack. Why?


A high-level U< can be written:
: U<  \ ni n2 -- f
2DUP XOR 0< IF  \ signs differ?
DROP 0<······\ if n1 < 0 then n2 > 0

Notes about OPL speed:

* avoid procedures which do little work and are called
   from within a loop: use a macro instead
* local variables are faster