2. Errors (Bug's)/Inconsistencies in PowerBASIC Versions 3.0, 3.1, 3.2 and 3.5



2.0. PowerBASIC-Errorlibraries
2.1. The NUMERIC/OVERFLOW-Problem in PowerBASIC 3.0
2.2. The NUMERIC/OVERFLOW-Problem in PowerBASIC 3.1/3.2
2.3. No Overflow-Error with Doublewords
2.4. Crash of the PowerBASIC IDE and compiled EXE's while loading
2.5. EXEs of different size when compiling with PB/PBC
2.6. Different EXE-Files with same Compilation
2.7. Problems with the Mouse within the IDE
2.8. The Fixup Overflow Syndrome
2.9. The story with ASCII-154 after a Remark in the Inline-ASM
2.10. Error 454: END FUNCTION expected
2.11. Another REMARK-Problem with $ALIAS
2.12. The Mistake CDWRD in the german Online-Help
2.13. The Mistake CVDWRD in the german Online-Help
2.14. Crash when pressing CTRL-C
2.15. Error when producing Output with "CONS:" and CTRL-C
2.16. The Problem with Error 244 in a Stand Alone EXE
2.17. Problems with linking of multiple Lines of Source
2.18. Problems with the WATCH-Window and multidimensional Arrays
2.19. Buggy internal Function/Variable: pbvScrnCols
2.20. Incorrect internal Function/Variable: pbvHost
2.21. A little difference in the new Inline-Assembler of V3.1/3.2
2.22. The dd-Problem in PowerBASIC 3.1/3.2
2.23. Undocumented internal Variables in PowerBASIC 3.0/3.1/3.2
2.24. The PRINT-Bug in PowerBASIC 3.2
2.25. The "File not found"-Error after using NAME
2.26. Calculationerror when using Constants
2.27. Wrong "Bit Movement" with ROTATE
2.28. Overflow when using FOR/NEXT-Loops
2.29. Overflow when using STEP -1 in FOR/NEXT-Loops
2.30. The Bug in the VARPTR32 Command
2.31. Der "KEY ON" Bug
2.32. Crash of the PowerBASIC IDE in the Pick- Menu
2.33. Crash of the PowerBASIC IDE with faulty Syntax
2.34. Error when swapping variables using SWAP
2.35. The Multiplexer Interrupt Error in the REG-Command
2.36. Contents of a Directory will be deleted with KILL
2.37. The thing with the "USR" string
2.38. The GOTO DWORD Bug
2.39. The 'ON LOCAL ERROR' Bug
2.40. ... and again 'ON LOCAL ERROR'
2.41. Runtimeerror in the PowerBASIC Helpcompiler
2.42. The Bug "Truncating" in the PowerBASIC Helpcompiler
2.43. Crash of the PowerBASIC-IDE after calling its own Help

2.0. PowerBASIC-Errorlibraries

For better Security of your own programs I would recommend that you link all Errorlibraries. This is the only way to make sure that PowerBASIC shows a correct Error and not an unexplainable Error at:
            SELECT CASE pbvrevision
You can remove all Errorlibraries in the finished program, because they are only needed in development.
The $ERROR-Libraries can be linked within the IDE or directly in your Source. The Settings in the Source are used above the Settings in the IDE!

The $ERROR-Libraries are linked as follows:
            $ERROR NUMERIC ON
            $ERROR OVERFLOW ON
            $ERROR BOUNDS ON
            $ERROR STACK ON
Note: Some of the Bugs shown here can only be found with these Libraries linked!

2.1. The NUMERIC/OVERFLOW-Problem in PowerBASIC 3.0

Versions: 3.0
Known : partly removed in version 3.1

The problems shown here only apply to the use of unsigned variables and are shown with variables of type WORD:
    Example 1:
            Demo?? = &hA000
causes an Overflow, because PowerBASIC interprets this as a signed variable. This error can be solved by using a real number. Similar effects can occur with the $NUMERIC-System when using the REG()-Command:
    Example 2:
            Demo?? = REG(1)
can, under special circumstances, cause an Overflow, too, if the passed value would be negative as INTEGER. This error can be solved, if only using variables of type INTEGER with REG(), by removing the NUMERIC-Library when compiling.
It would be much better though to trash the old BASIC-Crap and do the whole thing in InLine-Assembler right away! :-)

It is also interesting to see the 'floating' of error with deactivated $ERROR NUMERIC library. The error occurs some later time in the program, strangely at variables of type WORD, too. Even stranger that you can at best see this at internal PowerBASIC variables of type WORD.

Another Overflow effect is hidden behind the PowerBASIC-Functions STRSEG/STRPTR, VARSEG/VARPTR, CODESEG/CODEPTR. Unlike REG(1) the variables MUST be of type WORD, else an Overflow can occur in bigger programs.

2.2. The NUMERIC/OVERFLOW-Problem in PowerBASIC 3.1/3.2

Versions: 3.1/3.2
Known : Correction recommended at PowerBASIC Inc.

One shouldn't think that a new version lets the old bugs be forgotten ;-).
    Example 1:
            Demo?? = &hA000
does not cause an Overflow anymore, as far as I know, but you can't be can still cause an Overflow. This can't be demonstrated in one line anymore, because it sometimes still occurs in very complex programs. This still has not changed with version 3.20. Unlike version 3.00 this bug can be passed by using definite unsigned variables:
            Demo?? = &h0A000
Should you be Toolbox-Developer and want to make sure that your sources work under PowerBASIC 3.0 then enter the following lines:
            ! mov ax, &hA000
            ! mov Demo??, ax

    Example 2:
            Demo?? = REG(1)
sure about that. But you should still use variables of type INTEGER when using REG. Many PowerBASIC-Functions work better now, others still cause trouble. this affects some special routines which are only set for INTEGER variables, but still work with variables of type WORD.

The Overflow problem with STRSEG/STRPTR, VARSEG/VAROTR and CODESEG/ CODEPTR still exists.

2.3. No OVERFLOW-Error with Doublewords

Versions: 3.0/3.1/3.2/3.5
Known : Yes

There is no internal Overflow test for Variables of type Doubleword. You can test this with a little example.
            i??? = -1
            PRINT i???
The cause for this problem lies within the Intel CPU itsself, because there is no Overflow created that the Compiler could test for.

2.4. Crash of the PowerBASIC IDE and compiled EXE's while loading

Versions: 3.0/3.1 (3.2 not tested)
Known : No (partly)

A Crash of the IDE while loading occurs rather rarely and can usually be traced back to one of the following: In most cases the IDE will return to the Commandline with a graphical Error (Cursor within the IDE) while loading.
Also struck with this effect are all compiled PowerBASIC-EXE Files. If you want to get around this effect at any cost, you will have to compress the PowerBASIC-EXE with an EXE-Packer like PKLITE.

2.5. EXEs of different size when compiling with PB/PBC

This isn't really a Bug, because there is only a small difference in the cause of the IDE-Compiler and the Commandlinecompiler, which explains the differently sized EXE-Files.
The IDE always compiles the EXE-File with the Settings in the IDE, meaning that if you don't want to compile the VGA-Lib into it, you set it in the IDE. The PBC always compiles the VGA-Lib into it, IF you haven't declared it differently with a Metastatement. The Metastatements are always taken before the IDE-Settings!

2.6. Different EXE-Files with same Compilation

Versions: 3.0/3.1
Known : Seems so

A nice effect can be reported, when you compile Sources more than once and then compare them with a Filecompare-Utility. If your free Memory has changed, the created EXE-Files will be different.
As far as I see it, the two PowerBASIC Compilers save some Information about the system they were compiled on, which are of Integer/Word type and are at the Offset's &h9C/&hA0. (PB3.1) This effect can be shown as well in the PB-IDE as with PBC.

Some say that PB-EXE-Files which were compiled under a PowerBASIC- Shell with PBC seem to crash more often.

But even since I have been compiling all of my projects like this for two years, I can not approve to this effect. Version 3.0 of the PowerBASIC-Compiler SHELL seemed to cause other effects with big EXE- Files. The problems were solved back then by using an alternativ PBSHELL-Command.

2.7. Problems with the Mouse within the IDE

Versions: 3.0
Known : Seems corrected in Version 3.1

Should you work with a Mouse in the IDE, so that you can insert and cut Sorucecode easily, this could cause a partial crash when marking long texts which go past the right screen border. Furthermore the Mouse cursor does not mark the text correctly.
There also seem to be some problems when using the Mouse in the 80*43/50 Mode.

2.8. The Fixup Overflow Syndrome

Versions: 3.0/3.1/3.2
Known : Correction demanded at PowerBASIC Inc.

This is my favorite Bug, since it is actually caused by a real error in the programming of a PowerBASIC- User. The description in the Manual, as well as in the Online-Help is slightly irritating, but principally correct.

Personally I would decribe the Bug like this:

< new Bug description >
PowerBASIC could not find the named Jumpaddress. A possible cause for this is a SHORT-Jump to a Label not in the valid Area for a SHORT- Jump. Please check all Jumpcommands for validity.
< End >

There is a small Bug in this Errormessage in both PowerBASIC Versions. But since the human mind will not really believe what is written there, the Source is compiled again (without change). The IDE crashes for doing that immediately.

I will save myself a closer description of the working of the different Assemblercommands, especially the different ways of addressing in relation to the CPU. There are many Assemblerbooks out there, and they are something really needed for good programming with the Inline-Assembler anyways.

2.9. The thing with ASCII-154 after a REMARK in the Inline-Assembler

Versions: 3.0/3.1/3.2
Known : Error corrected in Version 3.50

There is a nice little thing that can drive you crazy when doing good commenting in the Inline-Assembler Source. It's the story with the ASCII-154 after a REMARK (REM or ; ):
            PRINT "1"
            ! nop                ; Ue   <- (ASCII-154)
            PRINT "2"
PowerBASIC will in this case continue to run the program to the line with the ASCII-154 (after the REM) and then stop. The hard guys can trace the whole thing with the Debugger. They'll notice that in this case PowerBASIC will simply add seven ASCII-Zeros to the Code and then stops compiling.

Errors (Bug's)/Inconsistencies in PowerBASIC Versions 3.0, 3.1, 3.2 and 3.5 (Part 2)
Errors (Bug's)/Inconsistencies in PowerBASIC Versions 3.0, 3.1, 3.2 and 3.5 (Part 3)

(c) 1996/2007 by Thomas Gohel, All rights and bugs reserved
(c) 1996/1998 by Thomas Geiger, english version