|
Post by md on Feb 20, 2024 19:29:09 GMT 1
DEFINT A-Z CLS LastKey$ = "1" PetCount = 3
IF VAL(LastKey$) < 1 OR VAL(LastKey$) > PetCount THEN PRINT "THIS SHOULD NOT HAVE DISPLAYED" 'this is incorrect END IF
TheVal = VAL(LastKey$) 'correction IF TheVal < 1 OR TheVal > PetCount THEN PRINT "THIS DOES NOT DISPLAY" END IF
|
|
|
Post by Jos on Feb 20, 2024 20:12:09 GMT 1
When I run that code in PowerBasic 3.5 (by F9), I get a blank window. Pressing a key returns to the PB editor.
Jos
|
|
|
Post by md on Feb 21, 2024 3:57:22 GMT 1
This dump might be of interest
Offset Data Source Line Microsoft (R) BASIC Compiler Version 7.10
0030 0006 DEFINT A-Z 0030 0006 CLS 0030 ** I00002: jmp I00003 0032 ** I00004: pop ax 0033 ** push di 0034 ** push si 0035 ** push cs 0036 ** push ax 0037 ** jmp B$SAS1 003C ** I00005: pop ax 003D ** push si 003E ** push di 003F ** push cs 0040 ** push ax 0041 ** jmp B$SCT1 0046 0006 LastKey$ = "1" 0046 0006 PetCount = 3 0046 0006 0046 0006 IF VAL(LastKey$) < 1 OR VAL(LastKey$) > PetCount THEN 0046 0006 PRINT "THIS SHOULD NOT HAVE DISPLAYED" 0046 0006 END IF 0046 ** I00003: push 0FFh 0048 ** call B$SCLS 004D ** mov di,offset <const> 0050 ** mov si,offset LASTKEY$ 0053 ** call I00004 0056 ** mov PETCOUNT%,0003h 005C ** int 39h 005E ** db 06h 005F ** dw <000000000000F03F> 0061 ** push si 0062 ** call B$FVAL 0067 ** mov di,ax 0069 ** int 39h 006B ** db 05h 006C ** int 3Dh 006E ** call B$FCMP 0073 ** jb I00007 0075 ** int 3Bh 0077 ** db 06h 0078 ** dw PETCOUNT% 007A ** push si 007B ** call B$FVAL 0080 ** mov si,ax 0082 ** int 39h 0084 ** db 04h 0085 ** int 3Dh 0087 ** call B$FCMP 008C ** jna I00006 008E ** I00007: push offset <const> 0091 ** call B$PESD 0096 000C 0096 000C TheVal = VAL(LastKey$) 0096 000C IF TheVal < 1 OR TheVal > PetCount THEN PAGE 2 20 Feb 24 20:52:40 Offset Data Source Line Microsoft (R) BASIC Compiler Version 7.10
0096 000C PRINT "THIS DOES NOT DISPLAY" 0096 000C END IF 0096 ** I00006: push offset LASTKEY$ 0099 ** call B$FVAL 009E ** mov si,ax 00A0 ** int 39h 00A2 ** db 04h 00A3 ** int 3Bh 00A5 ** db 1Eh 00A6 ** dw THEVAL% 00A8 ** int 3Dh 00AA ** cmp word ptr THEVAL%,01h 00AF ** jl I00009 00B1 ** mov ax,PETCOUNT% 00B4 ** cmp ax,THEVAL% 00B8 ** jnl I00008 00BA ** I00009: push offset <const> 00BD ** call B$PESD 00C2 000E 00C2 ** I00008: call B$CENP 00C7 000E
|
|
|
Post by Jos on Feb 21, 2024 8:05:35 GMT 1
It shows MS Basic compiled code seemingly uses its own floating point emulator unconditionally. That is it doesn’t for instance execute opcode DDh which is redirected to INT 39h if a FPU is missing. Instead INT 39h is executed directly. However, could be compiled code does this for simple loading and retrieving the top FPU register, while library functions like B$FCMP in contrast do use FPU instructions.
The first test uses floating point values, the second binary values. B$FCMP will return VAL("1") < 1? This mishap is with vDos 2023.05.01?
Jos
|
|
|
Post by Jos on Feb 21, 2024 15:01:05 GMT 1
Could you post this compiled sample?
Jos
|
|
|
Post by md on Feb 21, 2024 15:04:48 GMT 1
I don't know if executables can be posted. This is attempting to post "test2.exe". It worked! Attachments:test2.EXE (6.87 KB)
|
|
|
Post by Jos on Feb 21, 2024 15:10:04 GMT 1
The program requires (at least) one extra file, I get:
C:\>test2 Input path for run-time module brt71enr.exe:
Jos
|
|
|
Post by md on Feb 21, 2024 15:16:57 GMT 1
bc test2/o; link test2; As reference brt71enr.exe is 84,800 bytes 11/21/1992 09:30 AM Attachments:test2.EXE (24.5 KB)
|
|
|
Post by Jos on Feb 21, 2024 15:32:51 GMT 1
Could you post that brt71enr.exe file?
Jos
|
|
|
Post by md on Feb 21, 2024 15:34:29 GMT 1
|
|
|
Post by Jos on Feb 21, 2024 15:42:31 GMT 1
With brt71enr.exe in place I also get:
C:\>test2 LESS Will have a look at this...
Jos
|
|
|
Post by Jos on Feb 21, 2024 17:21:14 GMT 1
I don’t expect those switches effect VAL("1") < 1.
g2 would enable some 32-bit CPU functions and direct access of extended memory?
RTLINK probably was faster that MS LINK and have some extra options.
Jos
|
|
|
Post by Jos on Feb 28, 2024 21:50:17 GMT 1
I fixed this seemingly MS Basic specific issue, it didn’t directly relate to the involved test.
At startup MS Basic loads a predefined 80-bit floating point value into the FPU. The Windows MS runtime floating point libraries are however limited to 64-bit. Shouldn’t generally be a problem, but the loaded value exceeds the 64-bit precision in a specific way. Causing MS Basic to set a flag to do (unneeded) corrections later on. Exclusively(?) messing up that test.
Jos
|
|