Foren: Forum of Decimal BASIC (Thread #48109)

Paract Compiler and Interpreter Differ (2023-01-22 17:19 by toml12953 #93481)

When I run the following program to convert an Intel HEX file to a BIN file, the interpreter does it correctly and each byte in the output file is the binary representation of the data in the HEX file. When I compile and run the program with Paract, most of the bytes are OK but some are different. Below are the program and a sample data line

The resulting TEST.BIN file should have the 16 bytes
3E 03 D3 10 3E 11 D3 10 31 00 C0 21 08 F8 E5 CD
which is correct in the interpreter

but when the program is run in the compiler, the file has more bytes and some are incorrect
3E 03 C3 93 10 3E 11 C3 93 10 31 00 C3 80 21 08 C3 B8 C3 A5 C3 8D


Sample data file (test.hex)
:10F800003E03D3103E11D3103100C02108F8E5CDDE
:0000000000

Program:
DO
INPUT PROMPT "HEX file name (no extension): ":HexName$
WHEN EXCEPTION IN
OPEN #1: NAME HexName$ & ".HEX", ACCESS INPUT
LET FileFound = 1
USE
PRINT "No such HEX file. Try again."
LET FileFound = 0
END WHEN
LOOP UNTIL FileFound = 1

OPEN #2: NAME HexName$ & ".BIN"
ERASE #2

DO
LET OutLn$=""
LINE INPUT #1, IF MISSING THEN EXIT DO: record$
LET ByteCount = BVAL(record$(2:3),16)
IF ByteCount = 0 THEN EXIT DO
FOR I=1 TO ByteCount
LET OutLn$ = OutLn$ & CHR$(BVAL(record$(9+2*I-1:9+2*i),16))
NEXT I
PRINT #2: OutLn$;
LOOP

CLOSE #1
CLOSE #2

PRINT "File ";UCASE$(HexName$);".HEX converted."

END

Reply to #93481×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Anmelden

Re: Paract Compiler and Interpreter Differ (2023-01-22 17:59 by SHIRAISHI Kazuo #93482)

I wonder that was caused by the incompatibility between Decimal BASIC English version and BASICAcc in the default character.
Set Option-compatibility-behavior-"Unit of String Manipulation" to Byte
or white in each program unit
OPTION CHARACTER BYTE.


Reply to #93481

Reply to #93482×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Anmelden

Re: Paract Compiler and Interpreter Differ (2023-01-23 00:52 by toml12953 #93484)

Reply To Message #93482
> I wonder that was caused by the incompatibility between Decimal BASIC English version and BASICAcc in the default character.
> Set Option-compatibility-behavior-"Unit of String Manipulation" to Byte
> or white in each program unit
> OPTION CHARACTER BYTE.
>
>

Yes, that was it. When I changed to Byte rather than Character, it worked. Thanks!
Reply to #93482

Reply to #93484×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Anmelden